-
Notifications
You must be signed in to change notification settings - Fork 33
Deploy private chain
- clone efsn source code
git clone https://github.com/FUSIONFoundation/efsn.git
cd efsn
- 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
- build the source code
make efsn bootnode
binaries will be in generated in `./build/bin` directory
- generate bootnode key
./build/bin/bootnode -genkey bootnode.key
- start bootnode
# bootnode.key is the file generated in the above step (step 4).
# we can change port number 40407 to others if conflict with other program
./build/bin/bootnode -nodekey bootnode.key -addr :40407 > bootnode.address 2>&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, we 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.
- 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:
- we should use your own bootnode address in option
--bootnodes <YOUR-BOOTNODE-ADDRESS>
- we can change
--port --rpcport --wsport
these port numbers if it conflicts with other program. - we can also change your datadir name in option
--datadir <YOUR-DATA-DIR>
, block chain data will store in this directory. - we should specify your own account address to unlock option
--unlock <YOUR-ACCOUNT-ADDRSS>
- we should specify you own password file path to password option
--password <YOUR_PASSWORD-FILE>
- if we want to mining, we should specify
--mine
option - if we want to auto buy ticket, we should specify
--autobt
option
- check your node state we 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()
9 connect nodes manually
sometimes nodes can not connect with each other (even though bootnode is running)
for this situation, we can connect them manually use the following way,
for example, we'll connect node1 with node2 manually.
- firstly, we should know the node info of node2.
we can do like this:
./build/bin/efsn attach node2/efsn.ipc
admin.nodeInfo.enode
we will get result like the following format: "enode://90629a1c849c22249562f7c15f156e6a821fb4db6822c3c62c79f56f77edcfd8bbf7d8eedb9bd66c2c2314ea74684e8d0353ecbb3a592b97a4c2e6e9af248ed9@[::]:12342"
we should replace [::]
with 127.0.0.1
, so the final node info of node2 is:
"enode://90629a1c849c22249562f7c15f156e6a821fb4db6822c3c62c79f56f77edcfd8bbf7d8eedb9bd66c2c2314ea74684e8d0353ecbb3a592b97a4c2e6e9af248ed9@127.0.0.1:12342"
- then we can add peer of node2
we can do like this:
./build/bin/efsn attach node1/efsn.ipc
admin.addPeer("enode://90629a1c849c22249562f7c15f156e6a821fb4db6822c3c62c79f56f77edcfd8bbf7d8eedb9bd66c2c2314ea74684e8d0353ecbb3a592b97a4c2e6e9af248ed9@127.0.0.1:12342")
- check peers of my node
we can do like this:
./build/bin/efsn attach node1/efsn.ipc
admin.peers
if connect succsessfuly, the peers would contain node2 now. that means node1 and node2 is connected now. they can communicate through p2p protocol now.
additional:
- generate new account
./efsn account new --datadir node2
it will generate a new keystore file in your specified datadir
(node2 in the above example)