On my desktop and my laptop, I downloaded geth&tools 1.8.2. On the desktop I created a local node using:
geth --datadir "D:\EthereumLocalNode" init "D:\EthereumLocalNode\genesis.json"
In the genesis.json file:
{
"config": {
"chainId": 1114,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"difficulty": "400",
"gasLimit": "2100000",
"alloc": {
"1f8b3201b54d73daac3c9437289102c7f11f9ff0": {
"balance": "100000000000000000000000"
},
"968859556c516ccf00269a69795d08b5e899e2d2": {
"balance": "120000000000000000000000"
}
}
}
Then using bootnode tool , I have created nodekey in order to be used later for bootnodes command as such:
bootnode -genkey boot.key
Then I start my first node using the following flags:
geth --datadir "D:\EthereumLocalNode" --networkid 1114 console 2>> "D:\EthereumLocalNode\myLog.log" --rpc --rpccorsdomain "*" --nodiscover --nodekey boot.key
Flags as my intention are for :
--networkid 1114 // random id (same as chainId in genesis.json, I'm not sure if this equivalance is required, please comment if not)
--rpc
--rpccorsdomain "*" // To be able to reach this local node using remix and deploy contracts through there
--nodiscover // To manually add the nodes I want, no other random nodes allowed.
--nodekey boot.key // To use same constant key I created previously in the boot.key file
When I run
admin.nodeInfo.enode
I get :
"enode://1998f24ae4cb9f685633e679286d613a3752ed03d460308c21e3c5efc28d080c608f351c379bdc4f77f4f036e3ce86e1786ec7256c8e467c1dee8c99aafc0629@[::]:30303?discport=0"
Please note the ?discport=0 part at the end (due to --nodiscover option)
My desktop ip is assigned as 192.168.1.20 for my local wifi network.
Then I created an empty folder in my laptop as "E:\EthereumLocalNode2" which I later will use to create a node that will be connected to the node in my desktop.
I intentionally leave it empty now and not use geth init for that node, since I want my network to have a single blockchain that will originate from the node in my desktop. If I run geth init in this node, genesis nodes and therefore blockchains would differ. (Please warn me, if this assumption is wrong)
I run the following command in the laptop as :
geth --datadir "E:\EthereumLocalNode2" console 2>> "E:\EthereumLocalNode2\myLog2.log" --bootnodes "enode://1998f24ae4cb9f685633e679286d613a3752ed03d460308c21e3c5efc28d080c608f351c379bdc4f77f4f036e3ce86e1786ec7256c8e467c1dee8c99aafc0629@192.168.1.20:30303" --nodiscover
Note that enode address is the same as boot.key I previously created. What happens next is, some default blockchain is generated, admin.peers returns empty for both nodes.
I have tried using the following geth calls also , with each difference:
No "enode://" string:
geth --datadir "E:\EthereumLocalNode2" console 2>> E:\EthereumLocalNode2\myLog2.log" --bootnodes "1998f24ae4cb9f685633e679286d613a3752ed03d460308c21e3c5efc28d080c608f351c379bdc4f77f4f036e3ce86e1786ec7256c8e467c1dee8c99aafc0629@192.168.1.20:30303" --nodiscover
No quotation marks around enode address:
geth --datadir "E:\EthereumLocalNode2" console 2>> E:\EthereumLocalNode2\myLog2.log" --bootnodes 1998f24ae4cb9f685633e679286d613a3752ed03d460308c21e3c5efc28d080c608f351c379bdc4f77f4f036e3ce86e1786ec7256c8e467c1dee8c99aafc0629@192.168.1.20:30303 --nodiscover
With bracelets around ip address
geth --datadir "E:\EthereumLocalNode2" console 2>> "E:\EthereumLocalNode2\myLog2.log" --bootnodes "1998f24ae4cb9f685633e679286d613a3752ed03d460308c21e3c5efc28d080c608f351c379bdc4f77f4f036e3ce86e1786ec7256c8e467c1dee8c99aafc0629@[192.168.1.20]:30303" --nodiscover
All of which fail to successfully connect to node on my desktop.
I also tried using admin.addPeer with no sucess.
Then I was suspicous about whether firewall was getting in the way, so in my desktop I started another cmd instance and create another node in an again empty folder pointing to my first node using --bootnodes but this time with
--ipcdisable // To be able to connect from the same computer.
--port 30304 // Not to have conflicting ports
Full command is :
geth --datadir "D:\EthereumLocalNode2" console 2>> "D:\EthereumLocalNode2\myLog2.log" --bootnodes 1998f24ae4cb9f685633e679286d613a3752ed03d460308c21e3c5efc28d080c608f351c379bdc4f77f4f036e3ce86e1786ec7256c8e467c1dee8c99aafc0629@127.0.0.1:30303 --port 30304 --networkid 1114 --ipcdisable --nodiscover
Again neither this nor admin.addPeer work. I'm not able to connect to my first node either through my local home wifi network or through the same computer.
Please help, I've already lost 2 nights hopeless to find a solution. Probably something is wrong with the way I'm using flags.
Sorry for the long explanation.
Hash
field of the output eth.getBlock(0) the same on both nodes?