Connecting To Your Ethereum Node And Adding a Genesis Block

Follow

To connect to your *Ethereum private node* and start the Genesis block only takes a few steps.

 

Step 1: Select a node

From the drop-down list in your connect dashboard

 

Step 2: Create your genesis block file

If you do not already have your genesis block saved as a json file, copy it from the Settings tab and save it as a file named, “genesis.json”.  Below is an example of a default genesis block:

{

   "config": {

       "chainId": 1994,

       "homesteadBlock": 0,

       "eip155Block": 0,

       "eip158Block": 0,

       "byzantiumBlock": 0

   },

   "difficulty": "400",

   "gasLimit": "2000000",

   "alloc": {}

}

 

Step 3: Create your static nodes file

Enode URL: Get this from the Dashboard overview, connect menu

 

Be sure to add ?discport=0 to the end of each enode URL.

 

Copy your enode URL and save as a json file named “static-nodes.json”, as in the example below:

[

"enode://5d2a0e4c3ffc0e958c445c8f480601179501c9eb05e1fc9976569886726dbd8822fd6106019b91ee4e6b11cf997b740be582eee478e98d62c24aaa41aaa50c53@18.215.182.179:30303?discport=0"

]

 

If your network has multiple nodes you would like to connect to, add the additional enode URLs to the static-nodes.json file. Example below:

[

"enode://5d2a0e4c3ffc0e958c445c8f480601179501c9eb05e1fc9976569886726dbd8822fd6106019b91ee4e6b11cf997b740be582eee478e98d62c24aaa41aaa50c53@18.215.182.179:30303?discport=0",

"enode://f4642fa65af50cfdea8fa7414a5def7bb7991478b768e296f5e4a54e8b995de102e0ceae2e826f293c481b5325f89be6d207b003382e18a8ecba66fbaf6416c0@33.4.2.1:30303?discport=0",

"enode://5d2a0e4c31fc0e958c445c8f480601179501c9eb05e1fc9976569886726dbd8822fd6106019b91ee4e6b11cf997b740be582eee478e98d62c24aaa41aaa50c53@18.125.128.179:30303?discport=0",

...

"enode://pubkey@ip:port?discport=0"

]

 

Step 4: Run scripts

 

Run the initnode script:

 

#!/bin/bash

#

geth --datadir ./eth init ./genesis.json

 

cp ./static-nodes.json ./eth/geth/

inninode.gif


Run the startnode script:

 

#!/bin/bash

#

geth --datadir=./eth --nodiscover --syncmode "full" --networkid your network id

 

Your Network ID for the startnode script is the same as your chainid in your genesis block.

Add parameters as needed for the start node script.

script1.gif

 

Attach to your network with geth:

script2.gif


 Additional resources

 

For additional articles, see our knowledge base

Additional things you can do with an Ethereum private node

 What is Geth?

Packages to install Geth

0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.