Skip to main content

From Compile To Private-Net

Compile Section

Get the main chain source. Make sure that go is ready.

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

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-ethereum, for more common usage details, you might need to visit geth 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 web3, 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.

    miner.start(1)
  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.

    tesramain --etherbase 0 --ethash.dagdir ~/tesramainchain/dag/0 --nodiscover --ipcpath ~/tesramainchain/ipc/0 --keystore ~/tesramainchain/keystore --unlock 0 --password ~/tesramainchain/password console --exec "eth.accounts.forEach(function(v, i, a){var result=personal.showPublicKey(v, '1qaz'); console.log(i, a[i], JSON.stringify(result))}"
  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.

    eth.blockNumber

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.