具有私有区块链以太坊的2个节点之间的连接

时间:2018-02-06 23:09:11

标签: linux ubuntu blockchain ethereum

大家好> , 三天我一直试图让2个节点以太坊相互连接但没有成功。我忘了,对不起,如果你觉得很难理解我,但我不会说英语................................ .................................................. ..............

我重新开始......所以也许我可以让自己更好地理解......

我初始化节点1:

帐户已创建, CustomGenesis.json:

    {     "config": {       "chainId": 150,       "homesteadBlock": 0,       
    "eip155Block": 0,       "eip158Block": 0     },     "difficulty": "2000",     
    "gasLimit": "2100000",     "alloc": {       
   "ff61ed39188497df4b48ae61284e2c76f29adbb4": { "balance": "1000000000000" }     
   },   "coinbase": "0xfad2cc813e3de65335444f88a80c267fbb33b7b5",   "nonce": 
    "0x0000000000000042",   "mixhash": 
    "0x0000000000000000000000000000000000000000000000000000000000000000",   
   "parentHash": 
    "0x0000000000000000000000000000000000000000000000000000000000000000",   
   "timestamp": "0x00" }

我初始化区块链

    $ geth --datadir ~/data/.ethereum_private init ~/data/CustomGenesis.json

    INFO [02-09|00:36:52] Allocated cache and file handles         
    database=/home/max/data/.ethereum_private/geth/chaindata cache=16 
   handles=16
    INFO [02-09|00:36:52] Writing custom genesis block
   INFO [02-09|00:36:52] Successfully wrote genesis state         
   database=chaindata                                       hash=8f09d5…
   b82b6f
   INFO [02-09|00:36:52] Allocated cache and file handles         
   database=/home/max/data/.ethereum_private/geth/lightchaindata cache=16 
   handles=16
   INFO [02-09|00:36:52] Writing custom genesis block
   INFO [02-09|00:36:52] Successfully wrote genesis state         
   database=lightchaindata                                       
   hash=8f09d5…b82b6f


    $ geth --datadir ~/data/.ethereum_private --nodiscover --maxpeers 1 --
    networkid 150 --rpc --rpccorsdomain "*" console 2>>eth2.log

    INFO [02-09|00:42:30] Starting peer-to-peer node               
    instance=Geth/v1.7.3-stable-4bb3c89d/linux-amd64/go1.9
    INFO [02-09|00:42:30] Allocated cache and file handles         
   database=/home/max/data/.ethereum_private/geth/chaindata cache=128 
   handles=1024
   INFO [02-09|00:42:30] Initialised chain configuration          config="
  {ChainID: 150 Homestead: 0 DAO: <nil> DAOSupport: false EIP150: <nil> 
  EIP155: 0 EIP158: 0 Byzantium: <nil> Engine: unknown}"
 INFO [02-09|00:42:30] Disk storage enabled for ethash caches   
 dir=/home/max/data/.ethereum_private/geth/ethash count=3
INFO [02-09|00:42:30] Disk storage enabled for ethash DAGs     
 dir=/home/max/.ethash                            count=2
 INFO [02-09|00:42:30] Initialising Ethereum protocol           versions="
[63 62]" network=150
 INFO [02-09|00:42:30] Loaded most recent local header          number=0 
 hash=8f09d5…b82b6f td=2000
 INFO [02-09|00:42:30] Loaded most recent local full block      number=0 
  hash=8f09d5…b82b6f td=2000
 INFO [02-09|00:42:30] Loaded most recent local fast block      number=0 
 hash=8f09d5…b82b6f td=2000
 INFO [02-09|00:42:30] Loaded local transaction journal         
 transactions=0 dropped=0
 INFO [02-09|00:42:30] Regenerated local transaction journal    
 transactions=0 accounts=0
 INFO [02-09|00:42:30] Starting P2P networking
 INFO [02-09|00:42:30] HTTP endpoint opened: http://127.0.0.1:8545
 INFO [02-09|00:42:30] RLPx listener up 
    self="enode://e88391e5f801132c12912f52f
   a27e22231d782a883138e7219a9c16c8bed7212b
      d03a45580400cbc019997d2365b090246deb
  216e4b35d80be332fa3ef39ff38@[::]:30303?
   discport=0"
   INFO [02-09|00:42:30] IPC endpoint opened: 
  /home/max/data/.ethereum_private/geth.ipc
   INFO [02-09|00:42:34] Mapped network port                      proto=tcp 
           extport=30303 intport=30303 interface="UPNP IGDv1-IP1"

我初始化节点2: 帐户创建, CustomGenesis.json idem(我只更改帐户的地址)

   $ geth --datadir ~/data/.ethereum_private init ~/data/CustomGenesis.json

    INFO [02-09|00:50:10] Allocated cache and file handles         
   database=/home/max/data/.ethereum_private/geth/chaindata cache=16 
   handles=16
    INFO [02-09|00:50:10] Writing custom genesis block
   INFO [02-09|00:50:10] Successfully wrote genesis state         
  database=chaindata                                       hash=822931…
 c3a730
    INFO [02-09|00:50:10] Allocated cache and file handles         
   database=/home/max/data/.ethereum_private/geth/lightchaindata cache=16 
  handles=16
   INFO [02-09|00:50:10] Writing custom genesis block
  INFO [02-09|00:50:10] Successfully wrote genesis state         
     database=lightchaindata                                       
    hash=822931…c3a730

    $ $ geth --datadir ~/data/.ethereum_private --nodiscover --maxpeers 1 --
    networkid 150 --rpc --rpccorsdomain "*" console 2>>eth2.log

 INFO [02-09|00:56:40] Starting peer-to-peer node               
  instance=Geth/v1.7.3-stable-4bb3c89d/linux-amd64/go1.9
 INFO [02-09|00:56:40] Allocated cache and file handles         
 database=/home/max/data/.ethereum_private/geth/chaindata cache=128 
 handles=1024
WARN [02-09|00:56:40] Upgrading database to use lookup entries
   INFO [02-09|00:56:40] Initialised chain configuration          config="
    {ChainID: 150 Homestead: 0 DAO: <nil> DAOSupport: false EIP150: <nil> 
     EIP155: 0 EIP158: 0 Byzantium: <nil> Engine: unknown}"
  INFO [02-09|00:56:40] Disk storage enabled for ethash caches   
     dir=/home/max/data/.ethereum_private/geth/ethash count=3
  INFO [02-09|00:56:40] Disk storage enabled for ethash DAGs     
      dir=/home/max/.ethash                            count=2
     INFO [02-09|00:56:40] Initialising Ethereum protocol           
   versions="[63 62]" network=150
    INFO [02-09|00:56:40] Loaded most recent local header          number=0 
    hash=822931…c3a730 td=2000
      INFO [02-09|00:56:40] Loaded most recent local full block      
      number=0 hash=822931…c3a730 td=2000
    INFO [02-09|00:56:40] Loaded most recent local fast block      number=0 
       hash=822931…c3a730 td=2000
      INFO [02-09|00:56:40] Regenerated local transaction journal    
      transactions=0 accounts=0
       INFO [02-09|00:56:40] Starting P2P networking
         INFO [02-09|00:56:40] HTTP endpoint opened: http://127.0.0.1:8545
       INFO [02-09|00:56:40] Database deduplication successful        
       deduped=0
         INFO [02-09|00:56:40] RLPx listener up                         
       self="enode://0e1055c31a7108698693
       4bd8ba8add3a13721a81f061a657c61d109eaf
        0a75faa4d56309bdd699cdba0fac9abd18a92fa
         05285a7c4cdded73489c41aaaf2ee17@[::]:30303?discport=0"
       INFO [02-09|00:56:40] IPC endpoint opened: 
         /home/max/data/.ethereum_private/geth.ipc
        INFO [02-09|00:56:44] Mapped network port                      
        proto=tcp extport=30303 intport=30303 interface="UPNP IGDv1-IP1"

继续在节点2中插入节点1的enode

NODE 2

  

admin.addPeer( “e节点://e88391e5f801132c12912f52fa27e22231d782a883138e7219a9c16c8bed7212bd03a45580400cbc019997d2365b090246deb216e4b35d80be332fa3ef39ff38@10.0.0.61:30303”)

真 &GT;

此时日志中没有任何内容,一切都保持不变。进入节点的节点1后,在节点2中,节点2不应连接到节点1?

很明显我错了,但我不明白!

你能帮助我吗?

0 个答案:

没有答案