Skip to content

Deploy private chain

cross-chain edited this page Nov 7, 2019 · 5 revisions
  1. clone efsn source code
git clone https://github.com/FUSIONFoundation/efsn.git
cd efsn
  1. modify efsn source code (to get ticket and balance in genesis block)
core/genesis.go  : line 400
core/genesis_alloc.go : line 23
replace address `0x0122bf3930c1201a21133937ad5c83eb4ded1b08` to your address
  1. build the source code
make efsn bootnode

binaries will be in generated in `./build/bin` directory
  1. generate bootnode key
./build/bin/bootnode -genkey bootnode.key
  1. start bootnode
# bootnode.key is the file generated in the above step (step 4).
# you can change port number 40407 to others if conflict with other program
./build/bin/bootnode -nodekey bootnode.key -addr :40407 > bootnode.address 2>&1 &
  1. get the running bootnode's address
# bootnode.address is the file generated in the above step (step 5)
cat bootnode.address

bootnode.address content is something like this:

INFO [11-07|17:05:37.719] UDP listener up self=enode://9237f5d9144f170817dc01a236fc31340e9b793fe62760aae89c9b1d91cb4033988dfca75642453399ed751f3dec2accff489540b26486e2633019b0cbdd5593@[::]:40407

the bootnode's address is enode://...@[::]:40407, you should replace [::] with 127.0.0.1.
for the above example, the final bootnode's address is
enode://9237f5d9144f170817dc01a236fc31340e9b793fe62760aae89c9b1d91cb4033988dfca75642453399ed751f3dec2accff489540b26486e2633019b0cbdd5593@127.0.0.1:40407

bootnode's address is required for multiple nodes to communicate with each other through bootnode.

  1. start fusion node
  • start mining node
./build/bin/efsn --devnet --datadir node1 --port 12341 --bootnodes enode://9237f5d9144f170817dc01a236fc31340e9b793fe62760aae89c9b1d91cb4033988dfca75642453399ed751f3dec2accff489540b26486e2633019b0cbdd5593@127.0.0.1:40407 --rpc --rpcport 12001 --rpcapi web3,eth,net,db,personal,fsn,fsntx --rpcaddr 0.0.0.0 --rpccorsdomain \* --ws --wsport 13001 --wsapi web3,eth,net,db,personal,fsn,fsntx --wsaddr 0.0.0.0 --wsorigins \* --unlock 0x0122bf3930c1201a21133937ad5c83eb4ded1b08 --password passwd --networkid 55555 --mine --autobt 2>&1 |tee -a node1.log
  • start syncing node
./build/bin/efsn --devnet --datadir node2 --port 12342 --bootnodes enode://9237f5d9144f170817dc01a236fc31340e9b793fe62760aae89c9b1d91cb4033988dfca75642453399ed751f3dec2accff489540b26486e2633019b0cbdd5593@127.0.0.1:40407 --rpc --rpcport 12002 --rpcapi web3,eth,net,db,personal,fsn,fsntx --rpcaddr 0.0.0.0 --rpccorsdomain \* --ws --wsport 13002 --wsapi web3,eth,net,db,personal,fsn,fsntx --wsaddr 0.0.0.0 --wsorigins \* --networkid 55555 2>&1 |tee -a node2.log

Note for options:

  1. you should use your own bootnode address in option --bootnodes <YOUR-BOOTNODE-ADDRESS>
  2. you can change --port --rpcport --wsport these port numbers if it conflicts with other program.
  3. you can also change your datadir name in option --datadir <YOUR-DATA-DIR>, block chain data will store in this directory.
  4. you should specify your own account address to unlock option --unlock <YOUR-ACCOUNT-ADDRSS>
  5. you should specify you own password file path to password option --password <YOUR_PASSWORD-FILE>
  6. if you want to mining, you should specify --mine option
  7. if you want to auto buy ticket, you should specify --autobt option

  1. check your node state you can attach to any running node, and execute commands in the concole
./build/bin/efsn attach node1/efsn.ipc

then input commads in the console,
(double press tab keyboard to completes command)
eg., 

eth.blockNumber
admin.nodeInfo
fsn.getStakeInfo()
fsn.getAllBalances(eth.coinbase)
personal.unlockAccount(eth.coinbase, null, 0)
miner.start()

additinal:

  • generate new account
./efsn account new --datadir node2

it will generate a new keystore file in your specified datadir (node2 in the above example)