以太坊·Rinkeby 测试网络

时间:2022-04-28
本文章向大家介绍以太坊·Rinkeby 测试网络,主要内容包括本文节选自电子书《Netkiller Blockchain 手札》、Netkiller Blockchain 手札、9.2. Rinkeby 测试网络、基本概念、基础应用、原理机制和需要注意的事项等,并结合实例形式分析了其使用技巧,希望通过本文能帮助到大家理解应用这部分内容。

本文节选自电子书《Netkiller Blockchain 手札》

Netkiller Blockchain 手札

本文作者最近在找工作,有意向致电 13113668890

Mr. Neo Chan, 陈景峯(BG7NYT)

中国广东省深圳市龙华新区民治街道溪山美地 518131 +86 13113668890 <netkiller@msn.com>

文档始创于2018-02-10

版权 © 2018 Netkiller(Neo Chan). All rights reserved.

版权声明

转载请与作者联系,转载时请务必标明文章原始出处和作者信息及本声明。

http://www.netkiller.cnhttp://netkiller.github.iohttp://netkiller.sourceforge.net

http://www.netkiller.cn

http://netkiller.github.io

http://netkiller.sourceforge.net

微信订阅号 netkiller-ebook (微信扫描二维码)QQ:13721218 请注明“读者”QQ群:128659835 请注明“读者”

微信订阅号 netkiller-ebook (微信扫描二维码)

QQ:13721218 请注明“读者”

QQ群:128659835 请注明“读者”

http://www.netkiller.cn

http://netkiller.github.io

http://netkiller.sourceforge.net

微信订阅号 netkiller-ebook (微信扫描二维码)

QQ:13721218 请注明“读者”

QQ群:128659835 请注明“读者”

9.2. Rinkeby 测试网络

https://www.rinkeby.io/

9.2.1. 测试网络

连接测试网络,启动 "Ethereum Wallet",主菜单-Develop-Network,选择 "Rinkeby - Test network"。

如果这个菜单是灰色的,可以你在本地运行过 geth,解决方法如下:

mkdir ~/ethereum/rinkeby			
geth --datadir ~/ethereum/rinkeby --rinkeby --rpc console

在另一个终端窗口执行

neo@MacBook-Pro ~/ethereum/rinkeby % "/Applications/Ethereum Wallet.app/Contents/MacOS/Ethereum Wallet" ~/ethereum/rinkeby/geth.ipc

或者使用TCP方式连接

"/Applications/Ethereum Wallet.app/Contents/MacOS/Ethereum Wallet" --rpc http://localhost:8545

启动过程比较缓慢,启动后会同步区块信息

弹出第一个界面,让你选择网络,这里选择 Rinkeby 测试网络

输入密码,要求八位字母和数字组合

提示你备份钱包

生成账号 0x36ccB50B007D3D409E69841905DEf1D77D114Ddc

这时你会看到右下角的数字不断地变化,表示正在同步区块信息。同步过程比较漫长,请耐心等待。

9.2.2. 获取测试网络上的以太币

想获取Rinkeby测试网络中的以太币,需要去申请,地址:

https://faucet.rinkeby.io

输入你的钱包地址,并点击“Give me Ether”,有三种选项,前面是获得的以太币数量,后面是冷却时间,在冷却时间过后才能进行下一次以太币申请。例如第一项是生成3个以太币,8小时后才能再次申请。

如果一切顺利,你会看到你的钱包地址已经多出了申请数量的以太币。

注意:如果申请的人数很多,需要排队等待

9.2.3. 连接节点(Light node)

下载创世区块

mkdir ~/.rinkeby
cd ~/.rinkeby
wget https://www.rinkeby.io/rinkeby.json

初始化区块

geth --datadir=$HOME/.rinkeby init rinkeby.json

启动以太坊,这里采用Light node模式,仅仅下载区块信息,不会运行交易,速度比较快。

geth --networkid=4 --datadir=$HOME/.rinkeby --syncmode=light --ethstats='yournode:Respect my authoritah!@stats.rinkeby.io' --bootnodes=enode://a24ac7c5484ef4ed0c5eb2d36620ba4e4aa13b8c84684e1b4aab0cebea2ae45cb4d375b77eab56516d34bfbd3c1a833fc51296ff084b770b94fb9028c4d25ccf@52.169.42.101:30303

9.2.4. 区块链浏览器

https://rinkeby.etherscan.io