1

I am new to ethereum private blockchain

System information: geth version:1.8.2 os&version:linux

synopsis: when i tried to connect peers to my private blockchain it showing like

WARN [03-20|11:41:32] Node data write error err="state node c56d5a…f2fb4a failed with all peers (1 tries, 1 peers)"

node is not at all syncing . i am running this since from a week please help me out

Steps to reproduce the behaviour:

         1.created two nodes using the geth 
         2.join them using admin.addPeer()
         3.peer is connected.                                                   Same error getting in node system and getting also  peer system.          I got this problem since last week.
  • In the future you should format your post. All the lines you posted were duplicates of each other, and without formatting it is near impossible to read. How are your two nodes connected? Are they on a LAN, WAN? – hextet Mar 29 '18 at 7:49
  • connected to LAN only – Raji Mar 29 '18 at 10:40
  • I connected using this command geth --port 30302 --networkid 58342 --rpc --rpcport 8745 --rpcaddr 10.0.0.5 --rpccorsdomain "*" console – Raji Mar 29 '18 at 11:49
  • when I use eth.syncing command it showing like this eth.syncing { currentBlock: 498287, highestBlock: 1459478, knownStates: 248675, pulledStates: 248675, startingBlock: 498287 } – Raji Mar 31 '18 at 5:44
0

In order to start mining on a private blockchain you need to do a few things:

  • create a genesis block
  • init a geth node with genesis block
  • start nodes to use the genesis block info
  • start mining

Create a genesis block

Create a genesis.json file like this one

{
    "config": {
        "chainId": 1234,
        "homesteadBlock": 0,
        "eip155Block": 0,
        "eip158Block": 0
    },
    "difficulty": "1",
    "gasLimit": "1000000",
    "alloc": {}
}

And save it to /tmp/genesis.json

Init a geth node with genesis block

Create a directory for your node data for example

mkdir /tmp/node1

Enter that directory and init the chain status using the genesis.json you created above

$ geth --datadir=./ init /tmp/genesis.json

You should see Successfully wrote genesis state

Start nodes to use the genesis block info

Now you can start your server and start mining. In the same /tmp/node1 directory run

$ geth --datadir=./ --networkid 1234 console

It will start your geth server and open a console for you. Make sure to match the networkid with the one in the genesis.json file and that you initialized the /tmp/node1/ with the genesis block.


Start mining

Next you need to create an account, set it to be the account that receives the mined ether, and start mining.

Type these commands in the geth console

> personal.newAccount()
> miner.setEtherbase(eth.accounts[0])
> miner.start(1)

And it should start mining

  • The commands you wrote in Start mining, where do I execute them? – Al Bundy Apr 1 '18 at 20:32
  • When you start geth with the console parameter there's a console where you can enter commands. You need to execute them there – cleanunicorn Apr 1 '18 at 21:29

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.