I am trying to setup a private ethereum chain and connect two peers to it. I followed this tutorial on github. One of the two peers ran from a windows 10 geth client. The other ran from a Ubuntu geth client (Ubuntu itself ran on Virtual Box).
I started off by creating a genesis block (genesis.json) on the windows client:
{
"config": {
"chainId": 19,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"difficulty": "15",
"gasLimit": "2100000",
"alloc": {}
}
Then I ran in cmd :
geth –datadir path/to/data init genesis.json
After that, I created the bootnode:
bootnode –genkey = boot.key
and
bootnode –nodekey = node.key
I then received
self=enode://6b2700c843fb78732706a2b687ce751a2fbaf7d9034f455f5037af68f1ca0c1a52824cd178f17bc994af9c489d9e3ed0795900ae0efe4eacafb1e8653dc3eb6e@[myip]:30301
My understanding is that this enode will point the future peers to the genesis block and other peers.
Here is the problem. I am able to ping myip,yet
telnet myip 30301
is unsuccessful. I suspect that i did not use the correct Ip address. I tried using the ipv4 address found from ipconfig, as well as my ipv4 address that I looked up online (probably given by the service proider) with no avail.
Best Answer
If you can't telnet then there is something wrong with your networking. Either your virtual network connection between hosts is the problem or there is a firewall blocking connections.
If you are just getting started then I'd keep things really simple first of all and:
e.g. initialise your geth nodes like this:
Then launch your first geth node like this
And then start up your second node. In my case I needed to use
ethuser@host01:~/test1$ geth --datadir nodeB --port 30304 --networkid 1234567 --bootnodes enode://9ce583f7e1905b23217cd2a92894291c6d8f5ce7a29e85fdeaf48b3ab065c6d5b6cce4f064fdaf26f41d2354bf0a203438563f6ffdba73cec3b8692f6f850817@127.0.0.1:30303
Wait a few moments to give the nodes a chance to connect and then double check in your console that
admin.peers
returns some more info, e.g.I've left out creating accounts etc as you don't specifically ask it but if you're interested here are some more of my own newbie experiences: https://alanbuxton.wordpress.com/2017/07/19/first-steps-with-ethereum-private-networks-and-smart-contracts-on-ubuntu-16-04/