Geth + mist+私有链部署智能合约-5.2

genesis.json文件

{
    "config":{
        "chainId":13,
        "homesteadBlock":0,
        "eip155Block":0,
        "eip158Block":0
    },
    "nonce":"0x0000000000000033",
    "mixhash":"0x0000000000000000000000000000000000000000000000000000000000000000",
    "difficulty": "0x0300",
    "alloc": {},
    "coinbase":"0x0000000000000000000000000000000000000000",
    "timestamp": "0x00",
    "parentHash":"0x0000000000000000000000000000000000000000000000000000000000000000",
    "extraData": "",
    "gasLimit":"0xffffffff"
}

据此创建创世块,并开始挖矿miner.start(1) ,再停止挖矿后,eth.coinbase主账户中就有了ether,这次得到以太的挖矿到底打包了什么交易?

参考https://www.cnblogs.com/sumingk/articles/9030469.html的配置新节点出现错误提示

配置如下命令

geth --identity "TestNode2" --datadir "data1" --rpc --rpcapi "db,eth,net,web3" --rpcaddr "127.0.0.1" --ipcpath "data1\geth\geth.ipc" --rpcport "8487" --port "30305" --networkid "29382" console
UDP listener up                          self=enode://c00f076d0bee45cbfbc5d301ce90c31f1cc55bbbfe5b85619e46804570013ddd18937d08550a322e087469439dc3cff39c1ce139de6535bf7cd1c16542eb32e2@[::]:30303
Fatal: Error starting protocol stack: listen tcp :30303: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted.

每允许使用一个socket地址。

然鹅,使用参考链接给出的命令就可以成功启动节点,dont know why...

geth --identity "TestNode2" --datadir "data1" --rpc --rpcapi "db,eth,net,web3" --rpcaddr "127.0.0.1" --ipcpath "data1\geth\geth.ipc" --rpcport "8487" --port "30305" --networkid "29382" console

JS控制台已经启动

instance: Geth/TestNode2/v1.8.11-stable-dea1ce05/windows-amd64/go1.10.2
 modules: admin:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

在主节点上添加新节点失败

> admin.addpeer("enode://5de4cb1aa4aaa9f2e1feb40c0a6745e1ec729313497489466509e7ed2058550c76292e630ed0e2a283a992ff7bed4b9f1f30b06e952b30e973909cdd5df7ea7d@[::]:30305")





TypeError: 'addpeer' is not a function
    at <anonymous>:1:1

> web3.admin.addpeer("enode://5de4cb1aa4aaa9f2e1feb40c0a6745e1ec729313497489466509e7ed2058550c76292e630ed0e2a283a992ff7b
ed4b9f1f30b06e952b30e973909cdd5df7ea7d@[::]:30305")
TypeError: 'addpeer' is not a function
    at <anonymous>:1:1

这个是因为admin.addpeer应该是admin.addPeer 

与参考链接不同的地方在于主节点,重新启动一个主节点

geth --identity "TestNode1" --datadir "
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值