8

7个主流ETH2客户端【以太坊2.0】

 3 years ago
source link: http://blog.hubwiz.com/2021/01/26/eth2-clients/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

ETH2是下一代的以太坊区块链,可以达到更高的交易容量。ETH1到ETH2的迁移是 分阶段的,目前处于信标链阶段。本文编辑整理了七个主流的ETH2客户端实现, 以帮助开发者了解并进行ETH2相关开发与部署。

用自己熟悉的语言学习 以太坊DApp开发Java | Php | Python | .Net / C# | Golang | Node.JS | Flutter / Dart

1、Prysm - Golang ETH2客户端

Prysm项目是采用Go语言实现的全功能的以太坊2.0网络客户端,由Prysmatic Labs开发。

prysm-setup.png

安装Prysm最简单的方法就是运行Prysm仓库 中的prysm.sh脚本,该脚本将自动识别当前操作系统并下载最新的Prysm程序:

mkdir prysm && cd prysm
curl https://raw.githubusercontent.com/prysmaticlabs/prysm/master/prysm.sh --output prysm.sh && chmod +x prysm.sh

使用prysm.sh即可运行ETH2的信标节点,你需要能够访问ETH1节点:

./prysm.sh beacon-chain --http-web3provider=<YOUR_ETH1_NODE_ENDPOINT>

运行结果如下:

prysm-run.png

  • 开发语言:GO
  • 官方网址:https://prylabs.net/
  • 源码:https://github.com/prysmaticlabs/prysm
  • 文档:https://docs.prylabs.network/docs/getting-started/

2、Lighthouse - Rust ETH2客户端

Lighthouse是开源的以太坊2.0客户端,可以连接到其他ETH2客户端以构成一个 弹性、去中心化的POS区块链。Lighthouse采用Rust开发,由Sigma Prime维护。

lighthouse.jpg

安装Lighthouse最简单的方式是从这里 下载预编译的程序,然后解压即可。

  • 开发语言:Rust
  • 官方网址:https://lighthouse-book.sigmaprime.io/
  • 源码:https://github.com/sigp/lighthouse
  • 文档:https://lighthouse-book.sigmaprime.io/

3、Teku - Java ETH2客户端

Teku是ETH2信标链的Java实现,由以太坊生态中的大佬CondenSys开发。

teku.png

安装Teku最简单的方法是从这里 下载预编译程序。官方推荐将客户端和Validator在单一进程内运行,例如:

teku --network=pyrmont --eth1-endpoint=http://localhost:8545 \
--validator-keys=validator/keys/validator_888eef.json:validator/passwords/validator_888eef.txt \
--rest-api-enabled=true --rest-api-docs-enabled=true \
--metrics-enabled
  • 开发语言:Java
  • 官方网址:https://pegasys.tech/teku
  • 源码:https://github.com/ConsenSys/teku
  • 文档:https://docs.teku.consensys.net/en/latest/

4、Cortex - C# ETH2客户端

Cortex是一个采用C#开发的ETH2客户端,基于.NET core 3.0运行环境, 由Nethermind提供。

nethermind.png

运行Cortext客户端最简单的方法是使用Docker。例如采用默认的配置:

dotnet run --project src/Cortex.BeaconNode.Host \
--QuickStart:GenesisTime ([DateTimeOffset]::Now.ToUnixTimeSeconds()) \
--QuickStart:ValidatorCount 3
  • 开发语言:.NET/C#
  • 官方网址:https://nethermind.io
  • 源码:https://github.com/NethermindEth/cortex

5、Lodestar - TypeScript ETH2客户端

Lodestar是ETH2协议的TypeScript实现,由ChainSafe Systems开发。

lodestar.png

安装Lodstar最简单的方法是使用npm或yarn,例如:

yarn global add @chainsafe/lodestar-cli

使用lodester命令启动信标节点:

./lodestar beacon --network $NETWORK_NAME

输出结果如下:

2020-12-15 15:45:21 [DB]               info: Connected to LevelDB database name=/home/yourNameHere/.local/share/lodestar/pyrmont/chain-db
2020-12-15 15:45:25 [] info: Initializing beacon state from db slot=0, epoch=0, stateRoot=0x2bb257ca66d05a047a65fe43a5f457b674de445d917cca029efb09b3ba4758c4
2020-12-15 15:45:25 [DB] info: Connected to LevelDB database name=/home/yourNameHere/.local/share/lodestar/pyrmont/chain-db
2020-12-15 15:45:29 [API] warn: Server listening at http://127.0.0.1:9596
2020-12-15 15:45:29 [API] info: Started rest api server address=http://127.0.0.1:9596
2020-12-15 15:45:29 [METRICS] info: Starting metrics HTTP server port=8008
2020-12-15 15:45:30 [NETWORK] info: PeerId 16Uiu2HAmTfyqcJ8Ym8oUXGtsSLoDZUeScGASkPBmSskUVrGWGWPW, Multiaddrs /ip4/127.0.0.1/tcp/9000,/ip4/192.168.1.70/tcp/9000,/ip4/172.18.0.1/tcp/9000
2020-12-15 15:45:30 [SYNC] info: Waiting for peers...
2020-12-15 15:45:30 [SYNC] warn: Current peerCount=0, required = 3

如果你要启动validator,可以使用如下命令:

./lodestar validator --network $NETWORK_NAME

可以看到如下输出结果:

2020-08-07 14:14:24  []                 info: Decrypted 2 validator keystores 
2020-08-07 14:14:24 [VALIDATOR 0X8BAC4815] info: Setting up validator client...
2020-08-07 14:14:24 [VALIDATOR 0X8BAC4815] info: Setting up RPC connection...
2020-08-07 14:14:24 [] info: Checking genesis time and beacon node connection
2020-08-07 14:14:24 [VALIDATOR 0X8E44237B] info: Setting up validator client...
2020-08-07 14:14:24 [VALIDATOR 0X8E44237B] info: Setting up RPC connection...
  • 开发语言:TypeScript
  • 官方网址:https://chainsafe.io/
  • 源码:https://github.com/ChainSafe/lodestar
  • 文档:https://chainsafe.github.io/lodestar/

6、Nimbus - Nim ETH2客户端

Nimbus是一个由Status.im network资助的ETH项目,致力于为资源受限的设备提供 最佳的以太坊体验。Numbus Eth2客户端是ETH2协议的Nim版本实现。

使用Nimbus启动一个仿真的本地ETH2信标链非常简单:

git clone https://github.com/status-im/nim-beacon-chain
cd nim-beacon-chain

make
make test

运行仿真:

make eth2_network_simulation

结果如下:

nimbus.png

  • 开发语言:Nim
  • 官方网址:https://nimbus.team/
  • 源码:https://github.com/status-im/nimbus-eth2
  • 文档:https://nimbus.team/docs/

7、Trinity - Python ETH2客户端

Trinity是Python实现的ETH2客户端:

trinity.png

安装Trinity很简单:

pip install -U trinity

Trinity安装后使用trinity命令即可启动节点。

  • 开发语言:Python
  • 官方网址:https://trinity.ethereum.org/
  • 源码:https://github.com/ethereum/trinity-eth2
  • 文档:https://trinity-client.readthedocs.io/en/latest/

汇智网原创,转载请标明出处


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK