以太坊centos6.5搭建私有链创建账户、挖矿、转账
1.系统配置 cat /etc/redhat-release
2.安装golang
Golang官网下载地址:https://golang.org/dl/
将安装包下载到任意目录下(/app/ETH/golang)
a.wget https://dl.google.com/go/go1.10.3.linux-amd64.tar.gz
b.tar -zxvf go1.10.3.linux-amd64.tar.gz
c.添加/app/ETH/golang/go/bin目录到PATH变量中。添加到/etc/profile
d.source /etc/profile
e.go version
3.下载以太坊代码
https://github.com/ethereum/go-ethereum/releases
我下的是go-ethereum-1.8.1.tar.gz
tar -zxvf go-ethereum-1.8.1.tar.gz
4.编译以太坊代码
进入/home/ETH/go-ethereum-1.8.1
make
生成build/bin文件夹 geth文件
5.创世区块文件init.json
{
"config": {
"chainId": 10,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"coinbase" : "0x0000000000000000000000000000000000000000",
"difficulty" : "0x20000",
"extraData" : "",
"gasLimit" : "0xffffffff",
"nonce" : "0x0000000000000042",
"mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp" : "0x00",
"alloc" : {}
}
6.创世区块初始化
./geth --datadir "/app/chain" init init.json
7.启动以太坊
./geth --rpc --rpccorsdomain "*" --datadir "/app/chain" --port "30303" --rpcapi "db,eth,net,web3" --networkid 100000 console
8.账户查看 eth.accounts
9.创建账户personal.newAccount() 输入两遍密码“123456”
10.获取账户资产eth.getBalance(eth.accounts[0])
11.开始挖矿miner.start()
12.转账
eth.sendTransaction({from: '0x0bb81ec0920fed869f6b5f1bf46d4b923058af18', to: '0xa695bc0b0500834a627f07ad4e364105802cb5d2', value: web3.toWei(1, "ether")})
需要先解锁转出账户
personal.unlockAccount("0x0bb81ec0920fed869f6b5f1bf46d4b923058af18","123456")//账号,密码
挖矿成功,转账才能成功
1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。