以太坊智能合约教程(一)搭建以太坊私有链搭建

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u011439012/article/details/76168364

环境说明:win10 64位  geth1.6.5

1.安装geth  

安装完成以后,先创建2个账号:

geth account new

 

然后建立: mygenesis.json

{

   "nonce": "0x0000000000000042",

   "difficulty": "0x1",

   "alloc": {

       "44b9589cff8890d82053f8fc453c51eb7e1f615e": {

           "balance": "20000009800000000000000000000"

       },

       "4cbbef71f941a09f3f026d8063fae518ffaf999c": {

           "balance": "20000009800000000000000000000"

        }

    },

"config": {

"chainId": 15,

"homesteadBlock": 0,

"eip155Block": 0,

"eip158Block": 0

},

"mixhash":"0x0000000000000000000000000000000000000000000000000000000000000000","coinbase": "0x0000000000000000000000000000000000000000",

 

"timestamp": "0x00",

 

"parentHash":"0x0000000000000000000000000000000000000000000000000000000000000000",

 

"extraData":"0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",

 

"gasLimit": "0xb2d05e00"

}

启动私有链:

geth --identity "PICCetherum"--rpc --rpccorsdomain "*" --datadir "%cd%\chain" --port"30303"  --rpcapi"db,eth,net,web3" --networkid 95518 console


当看到Listening on[::]:30303Welcome to the GethJavaScript console!的提示,说明已经启动成功

identity 名称

datadir 区块链地址

节点信息:

admin.nodeInfo        Info 首字母一定要大写

admin.peers 查看peer节点

添加peer节点:

Enode对应admin.nodeInfo里面的enode信息,里面的IP要更改一下

admin.addPeer("enode://4b3aee02d139345d7651aa07c7e5d486984834000171c700b6bbe7d5c56070f069efdb103f7d9e2dd0cd4078af53c2d9a59df918366891cc142212dd1da18d19@[127.0.0.1]:30303")

创建account

personal.newAccount()

开启挖矿:

miner.start()

 

挖个5分钟,账号里面就会用很多币

 

结束挖矿命令:

miner.stop()


然后下载以太坊钱包

官网下载地址: https://github.com/ethereum/mist/releases

打开钱包主页面,已经有705个币了




猜你喜欢

转载自blog.csdn.net/u011439012/article/details/76168364