1

I have a private network setup with geth and a few machines (2 full nodes for mining and a light node). The three devices have the following IPs:

  • MINER1 - 10.42.0.40
  • MINER2 - 10.42.0.250
  • LIGHT-NODE - 10.42.0.150

I followed the suggested setup as follows:

  1. Setup account from a new directory e.g. ~/miner1

    geth --datadir="./" account new

  2. Create a common genesis.json block file for all participating devices (I can confirm this is the same file used on all devices)

    {
    "config": {
        "chainID"       : 10,
        "homesteadBlock": 0,
        "eip155Block":    0,
        "eip158Block":    0
    },
    "nonce": "0x01",
    "difficulty": "0x20000",
    "mixhash": "0x00000000000000000000000000000000000000647572616c65787365646c6578",
    "coinbase": "0x0000000000000000000000000000000000000000",
    "timestamp": "0x00",
    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "extraData": "0x00",
    "gasLimit": "0x2FEFD8",
    "alloc": {
    }
    

    }

  3. Initiate the genesis block with

    geth --datadir="./" init genesisblock.json

  4. Startup the node

Full Node MINER1

geth --datadir="./" --identity "MINER1" --networkid 2008 --rpc --rpcaddr 0.0.0.0 --rpcport 8501 --nodiscover --minerthreads="1" --mine --unlock 0 console

Full Node MINER2

geth --datadir="./" --identity "MINER2" --networkid 2008 --rpc --rpcaddr 0.0.0.0 --rpcport 8502 --nodiscover --minerthreads="1" --mine --unlock 0 console

Light Node (Raspberry Pi)

geth --verbosity 6 --datadir="./" --cache=32 --syncmode=light --networkid 2008 --rpc --rpccorsdomain 0.0.0.0 --rpcport="8503" --nodiscover --unlock 0 console
  1. Perform manual discovery using admin.addPeer("enodeURL")

Run from MINER1 to add MINER2

admin.addPeer("enode://a90cdb6f0c48b60052fc995fb3a2ae45de28baec009ba526418d46ff0a1e9005f6a79883f6b821b964accdadc5017481409e8494e5ad39f22453c3ecff3b8228@10.42.0.250:30303")

This works perfectly and can be seen using admin.peers that the two miner nodes are able to synchronize

  1. Perform the same manual discovery on the light node to add MINER1 and MINER2

admin.addPeer("enode://a902f3231e561546896f4619bb7129e67f3b46ee4bc6a86e35ca1f575444e9f25dcb65bf0e09b02fd2714ce59bbb496a7783486d39eca4a17327ae1bacb3c699@10.42.0.40:30303")

admin.addPeer("enode://a90cdb6f0c48b60052fc995fb3a2ae45de28baec009ba526418d46ff0a1e9005f6a79883f6b821b964accdadc5017481409e8494e5ad39f22453c3ecff3b8228@10.42.0.250:30303")

This results in a true response from the console but waiting and running admin.peers returns no peers - []

Using the --verbosity 6 command line argument I receive the following information after running the admin.addPeer("enodeURL") command:

DEBUG[02-10|16:30:21] Adding static node                       node=enode://a902f3231e561546896f4619bb7129e67f3b46ee4bc6a86e35ca1f575444e9f25dcb65bf0e09b02fd2714ce59bbb496a7783486d39eca4a17327ae1bacb3c699@10.42.0.40:30303
TRACE[02-10|16:30:21] New dial task                            task="staticdial a902f3231e561546 10.42.0.40:30303"
TRACE[02-10|16:30:21] Rejected peer                            id=a902f3231e561546 addr=10.42.0.40:30303 conn=staticdial err="useless peer"
TRACE[02-10|16:30:21] Dial task done                           task="staticdial a902f3231e561546 10.42.0.40:30303"
TRACE[02-10|16:30:21] New dial task                            task="wait for dial hist expire (29.999612993s)"
DEBUG[02-10|16:30:40] Recalculated downloader QoS values       rtt=20s confidence=1.000 ttl=1m0s
TRACE[02-10|16:30:51] Dial task done                           task="wait for dial hist expire (29.999612993s)"
TRACE[02-10|16:30:52] New dial task                            task="staticdial a902f3231e561546 10.42.0.40:30303"
TRACE[02-10|16:30:52] Rejected peer                            id=a902f3231e561546 addr=10.42.0.40:30303 conn=staticdial err="useless peer"
TRACE[02-10|16:30:52] Dial task done                           task="staticdial a902f3231e561546 10.42.0.40:30303"
TRACE[02-10|16:30:52] New dial task                            task="wait for dial hist expire (29.999654995s)"
DEBUG[02-10|16:31:00] Recalculated downloader QoS values       rtt=20s confidence=1.000 ttl=1m0s
DEBUG[02-10|16:31:20] Recalculated downloader QoS values       rtt=20s confidence=1.000 ttl=1m0s

As you can see I get a Rejected peer with err="useless peer" in the trace.

Running net.listeningreturns true and I am able to ping the MINER1 and MINER2 hosts from the light node.

Upon running the geth commands I am warned about no UPNP enabled on the network:

DEBUG[02-10|16:28:42] Couldn't add port mapping                proto=tcp extport=30303 intport=30303 interface="UPnP or NAT-PMP" err="no UPnP or NAT-PMP router discovered"

but this shouldn't affect the private network on the LAN when I do not plan on my network communicating over the internet/WAN should it?

Is anyone able to shed any light on why I am unable to attach my light node to the full nodes on my private network?

Thanks in advance for any help you guys can provide, it's much appreciated!

0

First a create the any location this genesisblock file saved : /genesisblock.json

{
    "nonce"     : "0x0000000000000055",
    "mixHash"   : "0x0000000000000000000000000000000000000000000000000000000000000000",
    "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
    "difficulty": "0x20000",
    "gasLimit"  : "0x800000",
    "timestamp" : "0x0",
    "extraData" : "",
    "coinbase"  : "0x0000000000000000000000000000000000000000",
    "alloc"     : {},
    "config"    : {
        "chainId": 100,
        "homesteadBlock": 0,
        "eip155Block": 0,
        "eip158Block": 0
    }
}

Then Initiate the genesis file this commend run:

geth --datadir "D:\bolckchain\chaindata" init "c\genesisblock.json"

Then Private network create : this code run :

geth --networkid 13 --port 30303 --datadir "D:\bolckchain\chaindata" console

Private network create then mist or walled open

Then anther node add the private network this private network is 13

Then anther node add this network then addPeer : Example :

 admin.addPeer("enode://a902f3231e561546896f4619bb7129e67f3b46ee4bc6a86e35ca1f575444e9f25dcb65bf0e09b02fd2714ce59bbb496a7783486d39eca4a17327ae1bacb3c699@10.42.0.40:30303")

IP configuration (enode creation with ip address) IP-192.168.1.114

10.42.0.40 this miens anther computer ip: example 192.168.0.101

Then peer check this commend run :

$ admin 

New Account crate commend :

->personal.newAccount()

Then password provided and re-password then new account create .

and all account list this commend :

 ->personal.listAccounts 

and miner ether add this commend run :

-> miner.start(1)

sometime wait and account ether add:

and miner stop commend :

 -> miner.stop()

and block number information this commend :

-> eth.getBlock(10)

10 miens 10 number block .

Remove Peer command :

-> admin.removePeer()
  • Thanks for the reply Alomgir Hossen but my question is related to trouble adding the light node to my network. The full nodes recognise each other without issue but I am unable to get the light node to sync with them – Malapeno Feb 10 '18 at 19:04
  • oh yes this link help link try it ethereum.stackexchange.com/questions/11297/… – ALOMGIR HOSSEN Feb 11 '18 at 5:05
0

The problem is that the light client is still in development and by default a node will not connect to light peers.

Set this parameter start of geth :

--lightserv value                 Maximum percentage of time allowed for serving LES requests (0-90) (default: 0)

For example :

geth --lightserv 20

For more details, sees the official documentation here, or this question How to run a "server" for light clients?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.