Starting the node:
-
Comment the second line of startTestNet.sh (by default it is commented here anyway)
-
cd to this directory root and run ./startTestNet.sh in console (cut and paste the commented accounts inside "alloc" to somewhere. having it there throws error at this point). 2.1 Make sure the data directory path in startTestNet.sh and the data folder (devChain) are same
-
If the genesis block is created successfully, it will say " successfully wrote genesis block"
-
Now comment Line 1 and uncomment Line 2 in startTestNet.sh
-
Run: ./startTestNet.sh
-
In another terminal, attach to the running geth process using IPC Interprocess communication):
-
Run: sudo geth attach ipc:///devChain/geth.ipc
-
Once you are in the geth console, use web3 to create some accounts using :
web3.personal.newAccount()
copy the account number and password in safe place. You will need to unlock the account using the password everytime you want to make a transaction.
-
-
Now copy all these accounts to the itmo-genesis.json file. The format in which accounts are to be placed is commented. Uncomment and replace the accounts. The balances are all in Wei (1 ETHER = 10^18 Wei)
-
Stop the running node. Comment line 2 and uncomment Line 1 and run ./startTestNet.sh. Now the new accounts are initialized with the balance
-
Comment line 1 in startTestNet.sh. Uncomment line 2
-
run ./startTestNet.sh , the output should be similar like step 3
-
Repeat steps 3.1 and 3.2 . (OPtional: Repeat step 3.4 and run: web3.personal . It will show the new accounts)
-
Now your private node is running. You can make RPC to this node using the ipaddress of this server and the port number defined in startTestNet.sh file. (If your node is inside a LAN then RPC could not be possible. Router should have port forwarding enabled to do so)
-
Note that mining is not started yet. If you create some transactions, then they will stay in pending status. (Run web3 in geth console to see them) To start mining you have to run: web3.miner.start() or you can add "--mine" (without quotes) in the second line of startTestNet.sh . For this, the coin_base and default accounts are to be set. The default account is normally the first account that is created. You can check all those via the geth console by running: web3 . The default account is the one where all the mining rewards are send.
Setup to run private node as a start-up process:
- startTestNet.sh should be executable
- Best way to run the node is to run it as a startup process (at least that's how I am doing it)
- add the full executable path of startTestNet.sh in /etc/rc.local 3.1 startTestNet.sh should be owned by root to be executable during start-up