From Compile To Private-Net
Compile Section
Get the main chain source. Make sure that go 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-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.
Boot first node.
**********************!!!PROTECTION POLICY!!!********************** Waiting For The Next Deployment, Maybe It Will Be Displayed After That.
Under the tesramain console, set the miner to work.
**********************!!!PROTECTION POLICY!!!********************** Waiting For The Next Deployment, Maybe It Will Be Displayed After That.
Check pow2pos block and mine status, whether mine blocked.
eth.blockNumber
When the block number was not increased for a long while. Exit this console.
exit
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
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.
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"
Boot the FirstPosSlotLeader node.
**********************!!!PROTECTION POLICY!!!********************** Waiting For The Next Deployment, Maybe It Will Be Displayed After That.
Then add FirstBootEnode as a peer, and set miner to work.
admin.addPeer(FirstBootEnode) miner.start(1)
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.