BlockChain區塊鏈
  • 本書簡介
  • 區塊鏈運作原理
  • Bitcoin介紹
    • 簡介
    • Bitcoin其他知識
  • Bitcoin原理與實作
  • BitcoinJS
    • BTC 地址格式種類
    • 從 Mnemonic 轉為地址
  • Serverless 架構實作
  • Docker常用指令
  • ethereum初探
    • ethereum歷史
    • EVM
  • ethereum PoS 節點架設
  • ethereum(Docker)
  • ethereum(Geth)
    • Parity
  • ethereum(智能合約)
    • 合約測試 Unit Test
    • DAO
    • 可升級合約
    • 使用合約進行 multiswap
    • 合約安全
    • 開發工具
    • Hardhat 教學
      • Hardhat 寫測試
    • ERC-721 範例
      • 白名單機制
    • OpenZeppelin 合約 library
    • Truffle
    • 合約部屬
    • solidity 教學
  • ethereum(Dapp)
    • 相關 SDK
    • Multicall
    • Ethers.js 使用
    • Remix IDE
    • web3.js 使用
    • 在網頁上使用 web3 並操作區塊鏈
      • solidity筆記
  • Hyperledger Fabric
  • blockchainDB
  • 挖礦程式使用教學
    • 門羅幣/Monero (XMR)
  • Bitfinex API 使用
  • FTX API
  • CCXT 通用交易所 API
  • Solana 教學
  • Ethereum BigQuery
  • The Graph
    • yaml 定義
    • mapping 語法
    • Schema 定義
    • Query 範例
    • Unit test
  • DeFi 筆記
    • MEV 相關
    • Dex 聚合
    • Yearn
    • Curve
    • Uniswap
      • Swap 互動
    • AAVE、Compound
      • Compound 原理
      • AAVE 合約開發
Powered by GitBook
On this page
  • 實際上有第三種節點
  • 實際架設範例
  • 執行節點
  • Validator lifecycle
  • PoS deposit 合約

Was this helpful?

ethereum PoS 節點架設

PreviousEVMNextethereum(Docker)

Last updated 1 year ago

Was this helpful?

[2024 更新]

The merge (POS) 之後必須要架設兩個 client 才能正常執行節點。

分別為 execution layer(例如 Geth ) 以及 consensus layer (例如 Prysm, Loadstar)

consensus client (layer) 也稱為 Beacon Node、CL Client

實際上有第三種節點

叫做 validator node,可使用 consensus layer 的 client 架設,validator node 用來 stake 32 ETH, 並且存放錢包私鑰、產生區塊等。

validator node 只與 beacon node 連接

實際架設範例

以下使用 Prysm

1.需要先安裝 bazel (專案建構工具)

brew install bazelisk

2.安裝 Prysm 並編譯可執行節點檔案

bazel build //cmd/beacon-chain:beacon-chain --config=release
bazel build //cmd/validator:validator --config=release

執行節點

1.執行 execution node

./geth --mainnet --http --http.api eth,net,engine,admin --authrpc.jwtsecret=<PATH_TO_JWT_FILE> 

--execution-endpoint 為 Geth 的 RPC endpoint

bazel run //cmd/beacon-chain --config=release --execution-endpoint=<YOUR_ETH_EXECUTION_NODE_ENDPOINT> --mainnet

執行 beacon node 後要等個幾分鐘,開始 sync 後才不會有類似如下的 error

ERROR execution: Beacon node is not respecting the follow distance. EL client is syncing. lastBlockNumber=0

其他參考:

Validator lifecycle

每個 slot 為 12 秒,一個 epoch 為 32 個 slot:6.4 分鐘。

文件描述特定 epoch 後 beacon chain 會執行特定事項 (beacon state transition)。

PoS deposit 合約

此合約讓大家可以呼叫 deposit(),支付 32eth 同時,並且放入參數,為成為 PoS validator 必要條件,在此合約成功 deposit 後會 emit 事件,ETH beacon chain 監聽到後會把此申請人加入 queue。

bytes calldata pubkey,
bytes calldata withdrawal_credentials,
bytes calldata signature,
bytes32 deposit_data_root

之後 deposit function 用 merkle tree 的方式去做 verify。

deposit_date_root 在 cli tool 產生的deposit.json 內,其使用如下參數:validator's public key, withdrawal credentials, the amount of ETH being staked, and the validator's signature.

從以下網站可以查看目前哪些節點較多人用:

完整教學:

https://clientdiversity.org/#distribution
https://docs.prylabs.network/docs/advanced/proof-of-stake-devnet#manual-setup-built-from-source
https://notes.ethereum.org/7CFxjwMgQSWOHIxLgJP2Bw#A-note-on-Ethereum-20-phase-0-validator-lifecycle
https://github.com/ethereum/staking-deposit-cli
Nodes and clients | ethereum.orgethereum.org
Nodes and networks | Prysm
Logo
Build Prysm from source | Prysm
Logo
GitHub - rzmahmood/ethereum-pos-testnet: 💻⛓️ A Quick and Easy Way to Bootstrap your own Local Ethereum PoS Testnet. Great for testing consensus ⛓️💻GitHub
Logo
Logo