区块链不同机器的节点相互连接

1节点所在的机器,相互之间可以互联互通
2它们有相同的创世纪文件
3 有相同的networkid

一 第一个节点创建

root@i-67u87x1c:/home/ubuntu# mkdir private-geth
root@i-67u87x1c:/home/ubuntu# cd private-geth/
root@i-67u87x1c:/home/ubuntu/private-geth# vim genesis.json

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

初始化创始块
root@i-67u87x1c:/home/ubuntu/private-geth# geth --datadir ./data/00 init genesis.json
WARN [07-06|14:38:34] No etherbase set and no accounts found as default 
INFO [07-06|14:38:34] Allocated cache and file handles         database=/home/ubuntu/private-geth/data/00/geth/chaindata cache=16 handles=16
INFO [07-06|14:38:34] Writing custom genesis block 
INFO [07-06|14:38:34] Successfully wrote genesis state         database=chaindata                                        hash=a0e580鈥5e82e
INFO [07-06|14:38:34] Allocated cache and file handles         database=/home/ubuntu/private-geth/data/00/geth/lightchaindata cache=16 handles=16
INFO [07-06|14:38:34] Writing custom genesis block 
INFO [07-06|14:38:34] Successfully wrote genesis state         database=lightchaindata    

进入geth后面连接节点


root@i-67u87x1c:/home/ubuntu/private-geth# geth --datadir ./data/00 --networkid 314590 --ipcdisable --port 632 --rpcport 8156 --bootnodes "enode://96f7a95a8c5e7a1f911142d87ce53ae882568be0435016e4803a6d410a9ecc7a69322cee8efbe8499ec7c737c377793182cab8869a076389c6b47626df00450b@192.168.0.4:61910" console
WARN [07-06|14:43:54] No etherbase set and no accounts found as default 
INFO [07-06|14:43:54] Starting peer-to-peer node               instance=Geth/v1.6.6-stable-10a45cb5/linux-amd64/go1.8.1
INFO [07-06|14:43:54] Allocated cache and file handles         database=/home/ubuntu/private-geth/data/00/geth/chaindata cache=128 handles=1024
INFO [07-06|14:43:54] Initialised chain configuration          config="{ChainID: 15 Homestead: 0 DAO: <nil> DAOSupport: false EIP150: <nil> EIP155: 0 EIP158: 0 Metropolis: <nil> Engine: unknown}"
INFO [07-06|14:43:54] Disk storage enabled for ethash caches   dir=/home/ubuntu/private-geth/data/00/geth/ethash count=3
INFO [07-06|14:43:54] Disk storage enabled for ethash DAGs     dir=/root/.ethash                                 count=2
INFO [07-06|14:
  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值