发起以太坊交易时需要消耗以太币,开发智能合约做测试时如果在主网做测试成本会很高,并且主网的速度也比较慢,以太坊官方考虑到大家的这个需求提供了几条测试链供大家使用,比较知名的有以下这几个
以太坊的主测试网,环境最接近主网环境,有实际的雷锋矿工在挖矿,只不过难度会比主网低很多,不过由于 Ropsten 采用与主网完全一样的 PoW 共识,有时也就会和主网一样拥堵,在这条链上做测试更容易测试出智能合约或者dapp里潜在的问题
用的是 PoA 机制,无需挖矿,所以出块很快而且很稳定
和Rinkeby同样使用的是 PoA 机制
下面介绍下如果获取这几条链的测试币
Ropsten
打开这个网址https://faucet.metamask.io/

点击request 1 ether from faucet按钮会通过web3连接钱包,获取到钱包当前账户的以太坊地址,这个我使用的钱包是MetaMask,如果你没有装支持web3访问的钱包,可以参考这篇文章安装
https://www.jianshu.com/p/a84fe16f1af7

点击连接

连接成功后底部会生成一笔交易,hash值0x183bf40870a4df15af9809056748f138ae2aef1355aa03689ca9d95671c0b770

等交易确认后一个以太坊就到账了

Rinkeby
Rinkeby获取测试币相对麻烦些,需要注册twitter账号(需要翻墙)

把推文中0x0000000000000000000000000000000000000000替换成你的地址点击TWEET,发送成功后点击分享图标选择Copy link to Tweet,把推文的链接复制下来


然后打开Rinkeby测试币水龙头网页 https://www.rinkeby.io/#faucet

把刚才那个推文链接复制进输入框,点击Give me Ether

根据你的需要选择要多少个代币,要的越多到账越慢😓,到账时间相对其它的测试链很慢,如果着急就用别的链做测试
kovan
打开这个网址https://faucet.kovan.network/,需要使用github账号登陆

登陆成功后输入以太坊地址,点击发送就好了,转账交易就提交到链上了


同样的等待交易确认就能收到一个以太币了

网友评论