From Compile To Private-Net

Compile Section

Get the main chain source. Make sure that goopen in new window is ready.

git clone https://github.com/user00000001/TesraMainChain.git
cd TesraMainChain
make tesramain                     # for chain execution file.
make all                           # for all execution files.
make clean                         # clean all compiled results.

Prepare For Using It

Put binary files path into env path or move them into some env paths.

echo "export PATH=$PATH:`pwd`/build/bin" >> ~/.bashrc && source ~/.bashrc

Usage

Tesra Main Chain bases on go-ethereumopen in new window, for more common usage details, you might need to visit gethopen in new window documents. Before using tesramain you need prepare some accounts. See Generate Accounts, and prepare 7 or more accounts to add some accounts into source code, compile again to gain final tesramain, Modify Code. Use tesramain's console bases on web3open in new window, include pos modification could read this, API.

  1. Boot first node.

    **********************!!!PROTECTION POLICY!!!**********************
    Waiting For The Next Deployment, Maybe It Will Be Displayed After That.
    
  2. Under the tesramain console, set the miner to work.

    **********************!!!PROTECTION POLICY!!!**********************
    Waiting For The Next Deployment, Maybe It Will Be Displayed After That.
    
  3. Check pow2pos block and mine status, whether mine blocked.

    eth.blockNumber
    
  4. When the block number was not increased for a long while. Exit this console.

    exit
    
  5. Start tesramain with the generated data and mine block.

    index=0 ;tesramain --etherbase $index --ethash.dagdir ~/tesramainchain/dag/$index --nodiscover --ipcpath ~/tesramainchain/ipc/$index --datadir ~/tesramainchain/data/$index --keystore ~/tesramainchain/keystore --port $((20000+$index)) --unlock $index --password ~/tesramainchain/password --verbosity 100 --firstPos 10 --mine console
    
  6. Watch terminal logs, miner will block again then record slot leader public key. check all accounts infomation. record the matched public key's index FirstPosSlotLeaderIndex.

    **********************!!!PROTECTION POLICY!!!**********************
    Waiting For The Next Deployment, Maybe It Will Be Displayed After That.
    
  7. Show the enode address FirstBootEnode of the node just booted.

    tesramain --etherbase 0 --ethash.dagdir ~/tesramainchain/dag/0 --nodiscover --ipcpath ~/tesramainchain/ipc/0 --keystore ~/tesramainchain/keystore --unlock 0 --password ~/tesramainchain/password console --exec "admin.nodeInfo.enode"
    
  8. Boot the FirstPosSlotLeader node.

    **********************!!!PROTECTION POLICY!!!**********************
    Waiting For The Next Deployment, Maybe It Will Be Displayed After That.
    
  9. Then add FirstBootEnode as a peer, and set miner to work.

    admin.addPeer(FirstBootEnode)
    miner.start(1)
    
  10. Check the block number whether increased.

    **********************!!!PROTECTION POLICY!!!**********************
    Waiting For The Next Deployment, Maybe It Will Be Displayed After That.
    

After these operations, the private net with two nodes has been set up, and the consensus protocol has been upgraded from pow to (d)pos.