以太坊系列 - 以太坊的测试网
程序员文章站
2022-07-15 09:37:44
...
测试网简介
目前Ethereum存在三个测试网,分别是Ropsten(PoW算法,支持Parity和Geth),Kovan(PoA算法,Parity专用)和Rinkeby(Clique PoA共识算法,Geth专用)。
Ropsten
- PoW
- Supported by geth and parity
- Best reproduces the current production environment
- Chaindata size 15 GB - Apr 2018
Kovan
- PoA (Immune to spam attacks)
- Supported by parity only
- Chaindata size 13 GB - Apr 2018
Rinkeby
- PoA (Immune to spam attacks)
- Supported by geth only
- Chaindata size 6 GB - Apr 2018
Rinkeby
使用Geth加入Rinkeby测试网的操作非常简单,因为Geth内置了Rinkeby的配置参数。
首先我们创建一个目录,用于存储Geth的相关数据,示例:
mkdir ~/eth/rinkeby
cd ~/eth/rinkeby
#然后启动Geth:
geth --datadir ~/eth/rinkeby/ --rinkeby
可以通过网站 https://rinkeby.etherscan.io/ 来查看目前测试网的最新区块,确认Geth已经同步到了最新的区块。
参考资料:
https://rinkeby.etherscan.io/
https://ethereum.stackexchange.com/questions/27048/comparison-of-the-different-testnets
https://www.rinkeby.io/
Parity 两个节点形成集群网络
我们使用此地址,让node1与node0形成集群网络,命令如***意用node0的enode
值替换enode://后的部分):
linux使用这段
curl --data '{"jsonrpc":"2.0","method":"parity_addReservedPeer","params":["enode://e7e8e2f38f7cd485f69ffdf1a60e14fb4f45ba5c7cbb1e9b4d034a1913d65cfd9[email protected]127.0.0.1:30300"],"id":0}' -H "Content-Type: application/json" -X POST localhost:8541
windows使用这段
curl.exe --data '{\"jsonrpc\":\"2.0\",\"method\":\"parity_addReservedPeer\",\"params\":[\"enode://e7e8e2f38f7cd485f69ffdf1a60e14fb4f45ba5c7cbb1e9b4d034a1913d65cfd9[email protected]127.0.0.1:30300\"],\"id\":0}' -H "Content-Type: application/json" -X POST localhost:8541
上面的命令如果执行成功,会返回:
{"jsonrpc":"2.0","result":true,"id":0}
然后在node0和node1的终端中,就可以看到 1/25 peers 的输出。