OBJECTION to duplicate problem: The supposed duplicate answer DOES NOT work. The problem wording is similar but the problem itself requires a different solution.
I created a local private chain like below
geth --genesis ...CustomGenesis.json --verbosity 6 --datadir ...customchain1\chain --identity SomeChain --blockchainversion 12 --networkid 123 --rpcport 8101 --maxpeers 15 console
Launching the wallet, I have to skip peer search because it never finishes. After opening I can see I'm in PRIVATE-NET but with 0 peers.
I noticed I needed 12 peers for validation of contracts so I tried creating 1-2 nodes to see if this would work. I used below tutorial and some others I forgot.
https://github.com/ethereum/go-ethereum/wiki/Connecting-to-the-network
Initially, I created another folder with geth.exe in it. then used the below command on a seperate console while the main geth.exe was already running.
geth --datadir="...\customchain1\node1\chain" --verbosity 6 --networkid 123 --ipcdisable --port 30302 --rpcport 8102 console
I used admin.nodeInfo.enode
on the node geth console to get enode value. Then used below command on the primary geth console to add as peer.
admin.addPeer("enode://7a68ad5995ed4fa02a20f582e0c41bd6afad609102edda3fe3b443b618e56b11282d78cbeddfd2b8fb846a36ed6230d446fb41dc5fd77ff97bf20502e7ce0568@[::]:30302")
EDIT Adding " before and after enode returns true
but admin.peers returns nothing still.
This returns (anonymous): Line 1:20 Unexpected token :
I then copied the genesis file I used to create the blockchain, deleted everything else and ran the exact same command within the node folder. I retrieved the enode line and tried again. The error was the same.
Am I misunderstanding how this should work or is there something else I'm missing?
Thank you.
EDIT Almost There Some logs I captured. Seems that they do almost connect then drop due to mismatched networkID but where the hell does it get that number from? I have nothing with networkID 1602902873 and I explicitly state the networkID differently in all commands.
10:42:11.869273 p2p/server.go:428] new task: static dial 07837c0f7f31ad77 127.0.0.1:30301
10:42:11.869273 p2p/server.go:428] new task: static dial b708f0574d3b88af 127.0.0.1:30302
10:42:11.869273 p2p/server.go:428] new task: static dial 38754ca3bd38f3b7 127.0.0.1:30303
10:42:11.869273 p2p/server.go:428] new task: discovery lookup
10:42:11.869273 p2p/dial.go:263] dial tcp 127.0.0.1:30301 (07837c0f7f31)
10:42:11.870275 p2p/dial.go:263] dial tcp 127.0.0.1:30302 (b708f0574d3b)
10:42:11.870275 p2p/dial.go:263] dial tcp 127.0.0.1:30303 (38754ca3bd38)
10:42:11.876277 p2p/server.go:477] <-posthandshake: static dial conn 07837c0f7f31ad77 127.0.0.1:30301
10:42:11.877278 p2p/server.go:477] <-posthandshake: static dial conn b708f0574d3b88af 127.0.0.1:30302
10:42:11.878279 p2p/server.go:483] <-addpeer: static dial conn 07837c0f7f31ad77 127.0.0.1:30301
10:42:11.878279 p2p/server.go:672] Added Peer 07837c0f7f31ad77 127.0.0.1:30301
10:42:11.878279 p2p/server.go:467] <-taskdone: static dial 07837c0f7f31ad77 127.0.0.1:30301
10:42:11.878279 p2p/peer.go:301] Peer 07837c0f7f31ad77 127.0.0.1:30301: Starting protocol eth/63
10:42:11.879280 eth/handler.go:231] Peer 07837c0f7f31ad77 [eth/63]: peer connected [Geth/v1.4.4-stable/windows/go1.5.1/CustomChainPOCNode2]
10:42:11.879280 p2p/server.go:483] <-addpeer: static dial conn b708f0574d3b88af 127.0.0.1:30302
10:42:11.879280 p2p/server.go:672] Added Peer b708f0574d3b88af 127.0.0.1:30302
10:42:11.879280 eth/handler.go:236] Peer 07837c0f7f31ad77 [eth/63]: handshake failed: NetworkId mismatch - 1602902873 (!= 123)
10:42:11.879280 p2p/peer.go:308] Peer 07837c0f7f31ad77 127.0.0.1:30301: Protocol eth/63 error: NetworkId mismatch - 1602902873 (!= 123)
10:42:11.879280 p2p/peer.go:177] Peer 07837c0f7f31ad77 127.0.0.1:30301: protocol error: NetworkId mismatch - 1602902873 (!= 123) (Subprotocol error)
10:42:11.879280 p2p/server.go:477] <-posthandshake: static dial conn 38754ca3bd38f3b7 127.0.0.1:30303
10:42:11.880280 p2p/server.go:467] <-taskdone: static dial b708f0574d3b88af 127.0.0.1:30302
10:42:11.882281 p2p/peer.go:301] Peer b708f0574d3b88af 127.0.0.1:30302: Starting protocol eth/63
10:42:11.882281 eth/handler.go:231] Peer b708f0574d3b88af [eth/63]: peer connected [Geth/v1.4.4-stable/windows/go1.5.1/CustomChainPOCNode1]
10:42:11.882281 eth/handler.go:236] Peer b708f0574d3b88af [eth/63]: handshake failed: NetworkId mismatch - 1602902873 (!= 123)
10:42:11.884283 p2p/peer.go:308] Peer b708f0574d3b88af 127.0.0.1:30302: Protocol eth/63 error: NetworkId mismatch - 1602902873 (!= 123)
10:42:11.884283 p2p/peer.go:177] Peer b708f0574d3b88af 127.0.0.1:30302: protocol error: NetworkId mismatch - 1602902873 (!= 123) (Subprotocol error)
10:42:11.881281 p2p/server.go:626] static dial conn 38754ca3bd38f3b7 127.0.0.1:30303 failed checkpoint posthandshake: Connected to self
10:42:11.882281 p2p/server.go:499] <-delpeer: Peer 07837c0f7f31ad77 127.0.0.1:30301
10:42:11.888287 p2p/server.go:467] <-taskdone: static dial 38754ca3bd38f3b7 127.0.0.1:30303
10:42:11.888287 p2p/server.go:499] <-delpeer: Peer b708f0574d3b88af 127.0.0.1:30302
10:42:11.882281 p2p/server.go:688] Removed Peer 07837c0f7f31ad77 127.0.0.1:30301 (Subprotocol error)
10:42:11.890288 p2p/server.go:688] Removed Peer b708f0574d3b88af 127.0.0.1:30302 (Subprotocol error)
SHAME...SHAME...SHAME...bell rings So while trying to understand how a random magical networkID appears instead of the one I gave. I noticed it was an Integer if written without quotes. I had a number beyond the max int value. When I fixed it to something acceptable it worked immediately.