How to setup Geth Full Ethereum Test Node in Windows Details

How to setup Geth Full Ethereum Test Node in Windows

How to setup Geth Full Ethereum Test Node in Windows

What you will require to Install Geth on Window:

  •   -  You will require a fairly good server
  •   -  At least 32 Gb of RAM
  •   -  2 Tb SSD Hard Drive (hard drive will take very long to sync)
  •   -  Good bandwidth which is co-located as close as possible to other nodes 
  •   -  Cloud-hosted dedicated machines on OVH, Hetzner Europe, Alibaba, AWS, etc.

Installing you private test Ethereum test node


You get a few different Ethereum clients to work with, this article will focus on installing Geth on Windows 10 as it is one of the most popular and well-tested and are always up to date due to its development protocol. 

First we will download and install geth. You can do this by typing https://geth.ethereum.org/downloads into your browser. Then download Geth for Windows.
Now install Geth by clicking on the link you downloaded. You can leave options as selected and entered by default.



Now we will navigate to Window PowerShell. You can do this by right clicking on the windows icon and then selecting Windows PowerShell (Admin) with administrator privileges. 



You should by default be in the windows user directory that is currently logged into windows. If not you can change the directory by typing: cd C:\Users\{Username}\. 
Then we create a directory for our full node and our mining software, for my example I will call this directory Blockchain/EtherNode. You can do this by typing mkdir Blockchain/EtherNode. 

Then navigate to this directory by typing  cd Blockchain/EtherNode.




Now we need to create our Genesis block, this is the first block in our node that will define the initial behavior of our blockchain instance.
Creating this block from scratch can be quite difficult and using an existing one can be very problematic especially if the versions of your Geth software is different than the initial one the existing Genisis block was created in. To ensure we do not run into these problems and our genesis block is compliant with our version of Geth we will create a new genesis block using a tool called puppeth,  this is an inline command-line tool that is installed with Geth that provides features to create and monitor your own Ethereum network.
To start make sure that you are in the directory that you created for your node eg: C:\Users\{Username}\Blockchain\EtherNode in my case. 
Type puppeth 
  -  You will be presented with a query for the network name - this is the name you want to give to your private Ethereum Node. In our case we chose "iqtechmain". Make sure the name does not contain any spaces, special characters or capital letters.
  -  Now you have to choose what you want to do. We want to create a new genesis file so we will opt for Option 2.
  -  We want to create a new genesis block from scratch, so we chose Option 1 unless you have created one already then you can import it. 
  -  We want to use the Etash - proof of work algorithm so we chose Option 1, you would use Option 2 for your test platform as proof of authority is much faster and less resource hungry than proof of work.
  -  If you have an account that you will be prefunding for payouts, then you enter this address in the option, we will not be prefunding any accounts so we will just leave it as is and press enter, it is however advisable to have at least one
  -  Once again we will not be prefunding so we will press enter again.
  -  Next we must specify our explicit chain/network ID. If you leave this empty a random Id will be created. This id must be different from anyone that already exist if we do not want to join any of the already existing ones. 
        --  1 is for the Main net
        --  2 is for Morden test net (this is obsolete)
        --  3 is for the Ropten test net
        --  4 is for the Rinkeby test net
        --  42 is for the Kovan test net
     We will be using the Rinkeby test net so we will choose 4
     Now you have configured your new genesis block but we still need to export it to a Json File
  -  Now we will choose Option 2 - Manage existing genesis and option 2 again for Exporting genesis configuration
  -  Now you can enter the path of the folder the genesis specs should be saved into. If you leave this empty the default location will be the current directory you are in. Press Enter
Now you have successfully created a new Genisis block and exported it to the current directory. If you now type ls you should see a list of the genesis configuration files you just exported




The iqtechmain.json file is the one we will use to initialize our private test node. You can use notepad to open it if you want to see what it looks like.

Now that we have our genesis block created and exported we can use it to initialize our Ethereum Test Node. We will do this with the following command
geth --datadir . init iqtechmain.json

After you ran this command you should see the diredctory where the node data will be saved in our case this is C:\Users\Administrator\Blockchain\EtherNode\geth\chaindata. If you now type ls you will see the additions to the private folder you created.



The geth folder keeps all the data for the chain and the keystore will store all our accounts. The keystore will still be empty at this point. Next we will create 3 accounts, at this point the keystore folder will be populated with data. The first of these accounts will be used to receive all the mining rewards.
geth --datadir . account new 

You will now be asked for your passphrase, this is very important and also very private. Anybody that has this passphrase can transfer funds from this account. Choose carefully and remember. After typing this passphrase twice you will be presented with the address for this account. It is a autogenerated number. You can follow these steps two more time or however many times you feel to create as many accounts(wallets) as you feel.
geth --datadir . account list

This will give you a list of all the accounts, their respective index, address and the file where they are stored on your network.
Now the only left to do is to start our node. In order for us to start our node and start mining blocks we need to create a script that will define all the required parameters to let us interact with our private test node.
Navigate to C:\Users\{Username}\Blockchain\EtherNode in your windows explorer. Create a file called startnode.cmd, and enter the following:
geth --networkid 4 --mine --miner.threads 6 --datadir "." --http --http.api personal,eth,web3,net --miner.etherbase 0x9e1B854B1dFecB5A6E5DB875bC8a6b1fc5511306 --http.port 8545 --miner.notify http://127.0.0.1:8545 --cache=21000 --maxpeers=250 --syncmode full --snapshot=false --txpool.globalslots=1000

After you have created this file you can navigate to this folder if you are not there already, now just type ./startnode.cmd. Your node should now be running, now you just have to wait for you node to finish synchronizing. If you setup a full node like we did here it can take quite a while for the blockchain to synchronize on the Main net due to its size. It all depends on your servers processing power and the memory made available to geth in the startnode.