@lijiang

Sculpting in time

Do one thing and do it well.
Every story has a beginning and an end.

3 分钟

回顾

ETH2.0 Phase0 BeaconChain Blog

2020年的12月份,ETH上线了2.0-0阶段的信标链,ETH2.0 Proof of Stacking(pos)的底层应用,它不像现在在运行的ETH1.0主链,Beacon Chain上面没有智能合约也没有账户管理,它的主要功能就是2.0的共识机制,用户通过质押ETH(我们称之为validator)来保护整个2.0主网的安全性,更多的人运行validator节点,能够更好的去中心化以及抵御外部攻击。0阶段,用户是只能质押ETH代币,无法运行合约以及转账操作。

合并

在2022年的三月份ETH开发者上线了kiln ETH2.0合并测试网,当前的1.0主网将合并到2.0的Beacon Chain,这样做是为了结束1.0上面的pow共识机制,并全面的过渡到pos,用ethereum.org官方的表述意思就是像宇宙飞船的对接,1.0已经无法再进行较远距离的星际航行,于是开发者们设计2.0的新引擎,1.0将与2.0飞船进行对接合并,然后驶向宇宙的更深处。当合并完成之后,ETH1.0主网将与Beacon Chain进行合并,成为ETH分片链,并且将转向Pos权益证明而非Pow工作量证明。主网将智能合约带入到Proof-of-stack系统中,并且导入ETH1.0中的所有历史数据和现状,确保ETH的持有者和用户能够平滑的过度到2.0。当合并发生时,validator节点将接管主网,miner将不再需要。

操作指引

我选择的是lighthouse beacon chain做为自己的验证节点,以下是具体在kubernetes中进行操作的yaml文件,还可以参考相关网站用于部署节点。

帮助文档

ETH Kiln TestNet

kiln testnet on arm

How to run a node on Kiln

Join the kiln testnet - lighthouse

我的节点

kubernetes kiln testnet node and validator

geth-kiln-net.yaml

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: geth-merge-devnets
  namespace: eth
  labels:
    app: geth-merge-devnets
spec:
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: geth-merge-devnets
  template:
    metadata:
      labels:
        app: geth-merge-devnets
    spec:
      nodeSelector:
        kubernetes.io/hostname: deep-dream
      initContainers:
      - name: geth-init
        image: 192.168.1.114:5000/geth-merge-devnets:4c57d09-20220316
        args:
          - geth
          - --datadir=/execution_data
          - init
          - /custom_config_data/genesis.json
        volumeMounts:
          - name: geth-merge-devnets-data
            mountPath: /execution_data
          - name: merge-devnets-genesis-json
            mountPath: /custom_config_data
      containers:
      - name: geth-merge-devnets
        resources:
          limits:
            memory: 5Gi
            cpu: 4
          requests:
            memory: 2Gi
            cpu: 1

        image: 192.168.1.114:5000/geth-merge-devnets:4c57d09-20220316
        args:
          - geth
          - --datadir=/execution_data
          - --syncmode=full
          - --http
          - --metrics
          - --http.api
          - "engine,eth,web3,net,debug"
          - --authrpc.jwtsecret=/execution_data/jwtsecret
          - --metrics.expensive
          - --networkid=1337802
          - --http.corsdomain
          - "*"
          - --authrpc.addr
          - "0.0.0.0"
          - --authrpc.vhosts=*
          - --http.addr
          - "0.0.0.0"
          - --http.vhosts=*
          - --bootnodes
          - "enode://c354db99124f0faf677ff0e75c3cbbd568b2febc186af664e0c51ac435609bade[email protected]164.92.130.5:30303"
        ports:
          - containerPort: 8545
            name: port
          - containerPort: 8551
            name: secure
        volumeMounts:
          - name: geth-merge-devnets-data
            mountPath: /execution_data
      volumes:
        - name: geth-merge-devnets-data
          persistentVolumeClaim:
            claimName: geth-merge-devnets-data
        - name: merge-devnets-genesis-json
          configMap:
            name: kiln-genesis-json

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: geth-merge-devnets-data
  namespace: eth
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: openebs-hostpath
  resources:
    requests:
      storage: 500Gi
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: geth-merge-devnets-service
    project: geth-merge-devnets-service
  name: geth-merge-devnets-service
  namespace: eth
spec:
  ports:
    - protocol: TCP
      port: 8545
      targetPort: 8545
      name: port
    - protocol: TCP
      port: 8551
      targetPort: 8551
      name: secure
  selector:
    app: geth-merge-devnets

lighthouse-beacon-chain-kiln-net.yaml

---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: lighthouse-beacon-merge-devnets
  namespace: eth
  labels:
    app: lighthouse-beacon-merge-devnets
spec:
  serviceName: "lighthouse-beacon-merge-devnets"
  selector:
    matchLabels:
      app: lighthouse-beacon-merge-devnets
  template:
    metadata:
      labels:
        app: lighthouse-beacon-merge-devnets
    spec:
      nodeSelector:
        kubernetes.io/hostname: deep-tesla
      containers:
      - name: lighthouse-beacon-merge-devnets
        resources:
          limits:
            memory: 7Gi
            cpu: 4
          requests:
            memory: 4Gi
            cpu: 250m
        image: 192.168.1.114:5000/lighthouse-workflow:v2.1.4
        args:
          - lighthouse
          - bn
          - --network
          - kiln
          - --staking
          - --http-allow-sync-stalled
          - --merge
          - --eth1-endpoints
          - http://geth-merge-devnets-service:8545
          - --execution-endpoints
          - http://geth-merge-devnets-service:8551
          - --datadir
          - /data
          - --metrics
          - --jwt-secrets
          - /data/jwtsecret
          - --validator-monitor-auto
          - --http
          - --http-address
          - 0.0.0.0
          - --boot-nodes
          - "enr:-Iq4QMCTfIMXnow27baRUb35Q8iiFHSIDBJh6hQM5Axohhf4b6Kr_cOCu0htQ5WvVqKvFgY28893DHAg8gnBAXsAVqmGAX53x8JggmlkgnY0gmlwhLKAlv6Jc2VjcDI1NmsxoQK6S-Cii_KmfFdUJL2TANL3ksaKUnNXvTCv1tLwXs0QgIN1ZHCCIyk"
        ports:
          - containerPort: 5052
        volumeMounts:
          - name: lighthouse-beacon-merge-devnets-data
            mountPath: /data
      volumes:
        - name: lighthouse-beacon-merge-devnets-data
          persistentVolumeClaim:
            claimName: lighthouse-beacon-merge-devnets-data

  volumeClaimTemplates:
    - metadata:
        name: lighthouse-beacon-merge-devnets-data
      spec:
        accessModes:
          - ReadWriteOnce
        storageClassName: openebs-hostpath
        resources:
          requests:
            storage: 300Gi
---
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: lighthouse-beacon-chain-kiln-service
    project: lighthouse-beacon-chain-kiln-service
  name: lighthouse-beacon-chain-kiln-service
  namespace: eth
spec:
  ports:
    - protocol: TCP
      port: 5052
      targetPort: 5052
      name: port
    - protocol: TCP
      port: 9000
      targetPort: 9000
      name: upnp-tcp
    - protocol: UDP
      port: 9000
      targetPort: 9000
      name: upnp-udp

  selector:
    app: lighthouse-beacon-merge-devnets

lighthouse-validator-kiln-net.yaml

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: lighthouse-validator-kiln
  namespace: eth
  labels:
    app: lighthouse-validator-kiln
spec:
  serviceName: "lighthouse-validator-kiln"
  selector:
    matchLabels:
      app: lighthouse-validator-kiln
  template:
    metadata:
      labels:
        app: lighthouse-validator-kiln
    spec:
      initContainers:
        - name: lighthouse-validator-kiln-import-keys
          image: 192.168.1.114:5000/lighthouse-workflow:v2.1.4
          args:
            - /bin/bash
            - -c
            - |
              mkdir -pv /keys-copy;
              cp -v /keys/*.json /keys-copy/;
              lighthouse account validator \
              --network kiln \
              import \
              --password-file /pass/account_pass \
              --directory /keys-copy \
              --reuse-password \
              --datadir /data              
          volumeMounts:
            - name: lighthouse-validator-kiln-keys
              mountPath: /keys
            - name: lighthouse-validator-kiln-pass
              mountPath: /pass
            - name: lighthouse-validator-kiln-data
              mountPath: /data
      containers:
      - name: lighthouse-validator-kiln
        image:  192.168.1.114:5000/lighthouse-workflow:v2.1.4
        livenessProbe:
          exec:
            command:
              - sh
              - -c
              - touch /data/disk_health_fine && ls /data/validators
          initialDelaySeconds: 30
          periodSeconds: 10
          timeoutSeconds: 10
        args:
          - lighthouse
          - vc
          - --network
          - kiln
          - --datadir
          - /data
          - --beacon-nodes
          - http://lighthouse-beacon-chain-kiln-service:5052
          - --suggested-fee-recipient
          - "0x0000000000000000000000000000000000000000"

        volumeMounts:
          - name: lighthouse-validator-kiln-pass
            mountPath: /pass
          - name: lighthouse-validator-kiln-data
            mountPath: /data
      volumes:

        - name: lighthouse-validator-kiln-pass
          configMap:
            name: lighthouse-validator-kiln-pass

        - name: lighthouse-validator-kiln-data
          persistentVolumeClaim:
            claimName: lighthouse-validator-kiln-data

        - name: lighthouse-validator-kiln-keys
          configMap:
            name: lighthouse-validator-kiln-keys

  volumeClaimTemplates:
    - metadata:
        name: lighthouse-validator-kiln-data
      spec:
        accessModes:
          - ReadWriteOnce
        storageClassName: cineneural-git-zfs
        resources:
          requests:
            storage: 6Gi

最新文章

分类

关于

Keep thinking, Stay curious
Always be sensitive to new things