This information will guide individuals in setting up XDC private blockchain. The steps mentioned in this writeup are executed and tested on Ubuntu Linux 20.04 LTS version.
XDC Private Blockchain setup steps
1. Server Requirement
OS version: Ubuntu 20.04
RAM : Minimum 16Gb, Better 32Gb
STORAGE : 50Gb
2. Install golang
Please refer to the install page. Go Version used in setting up XDC private blockchain is go1.20.2
.
Remember to set environment variables:
GOPATH=/home/ubuntu/go
GOROOT=/usr/local/go
3. Prepare XinFin client
Untill "pr 238" is merged in XinFinOrg github, you can use this Repo.
cd ${HOME}
git clone https://github.com/GoPlugin/PLI_XDC_Private_Blockchain.git
cd ${HOME}/PLI_XDC_Private_Blockchain/XDPoSChain
make all
4. Create genesis
cd ${HOME}/PLI_XDC_Private_Blockchain/XDPoSChain/build/bin
./puppeth
4.1 Input XDPoS as network name
Please specify a network name to administer (no spaces or hyphens, please)
> XDPoS
4.2 Input 2 to configure new genesis
What would you like to do? (default = stats)
1. Show network stats
2. Configure new genesis
3. Track new remote server
4. Deploy network components
> 2
4.3 Input 3 to select XDPoS
Which consensus engine to use? (default = XDPoS)
1. Ethash - proof-of-work
2. Clique - proof-of-authority
3. XDPoS - delegated-proof-of-stake
> 3
4.4 Input 2 as block time
How many seconds should blocks take? (default = 2)
> 2
4.5 Input 2000 as reward
How many Ethers should be rewarded to masternode? (default = 10)
> 2000
4.6 Input an address for first masternode
Who own the first masternodes? (mandatory)
> xdc85f33E1242d87a875301312BD4EbaEe8876517BZ
4.7 Input three addresses for signers
Which accounts are allowed to seal (signers)? (mandatory at least one)
> xdc757f225273eba574196ef04f6c22bcc3ec623adc
> xdc09c1a2b3c620665ebda5aefcf51b775073b3be60
> xdccfb27876e117bcee77085c984f9042f4d43ada13
> xdc
Mention 3 addresses: (These addresses should be from your XDCPay Wallet Account, without xdc prefix.)
- 757f225273eba574196ef04f6c22bcc3ec623adc
- 09c1a2b3c620665ebda5aefcf51b775073b3be60
- cfb27876e117bcee77085c984f9042f4d43ada13
4.8 Input 900 as blocks per epoch
How many blocks per epoch? (default = 900)
> 900
4.9 Input 5 as gap
How many blocks before checkpoint need to prepare new set of masternodes? (default = 450)
> 5
4.10 Input foundation address
What is foundation wallet address? (default = xdc0000000000000000000000000000000000000068)
> xdc50a1c6bc2156499cfda614a0e9855ba1758bf321
Mention an address: 50a1c6bc2156499cfda614a0e9855ba1758bf321 without xdc prefix. (This address is from your XDCPay Wallet Account)
4.11 Input three addresses for foudation MultiSignWallet
Which accounts are allowed to confirm in Foundation MultiSignWallet?
> xdcd9ac740163cc633c05b00c589eb7c9997925511b
> xdc4fe0fb8578841584a3693c010c455fd8a056b7d2
> xdc90597dbfdef58819fae19af21d40c03e4315bb9d
> xdc
4.12 Input 2 as require number
How many require for confirm tx in Foundation MultiSignWallet? (default = 2)
> 2
4.13 Input addresses for Team MultiSignWallet
Which accounts are allowed to confirm in Team MultiSignWallet?
> xdcd9ac740163cc633c05b00c589eb7c9997925511b
> xdc4fe0fb8578841584a3693c010c455fd8a056b7d2
> xdc90597dbfdef58819fae19af21d40c03e4315bb9d
> xdc
Mention 3 addresses: (These addresses are from your XDCPay Wallet Account, without xdc prefix.) NOTE: These are the same addresses used in step 4.11
- d9ac740163cc633c05b00c589eb7c9997925511c
- 4fe0fb8578841584a3693c010c455fd8a056b7d3
- 90597dbfdef58819fae19af21d40c03e4315bb9e
4.14 Input 2 as require number
How many require for confirm tx in Team MultiSignWallet? (default = 2)
> 2
4.15 Input address for swap wallet
What is swap wallet address for fund 55m XDC?
> xdc90597dbfdef58819fae19af21d40c03e4315bb9e
Mention an address: 90597dbfdef58819fae19af21d40c03e4315bb9e without xdc prefix.(This address is from your XDCPay Wallet Account)
4.16 Input some addresses to prefund
Which accounts should be pre-funded? (advisable at least one)
> xdcd756f8cd4083c86497622c0c6193bdfe860f04ez
> xdc0801590680024aa5b4499226947276f5e327b72a
> xdc
Mention some addresses: (These addresses are from your XDCPay Wallet Account, without xdc prefix)
- d756f8cd4083c86497622c0c6193bdfe860f04ez
- 0801590680024aa5b4499226947276f5e327b72a
4.17 Input network ID
Specify your chain/network ID if you want an explicit one (default = random)
> 111
4.18 Export the genesis file
What would you like to do? (default = stats)
1. Show network stats
2. Manage existing genesis
3. Track new remote server
4. Deploy network components
> 2
1. Modify existing fork rules
2. Export genesis configuration
3. Remove genesis configuration
> 2
Which file to save the genesis into? (default = XDPoS.json)
> XDPoS.json
- Select 2 to manage existing genesis.
- Select 2 to export genesis configuration
- Enter genesis filename: XDPOS.json
- Press CtrL + C to exit
The gensis file is saved to: ${HOME}/XDPoSChain/build/bin/XDPoS.json
.
4.19 Modify the genesis file
Edit the genesis file ${HOME}/XDPoSChain/build/bin/XDPoS.json
, add the below line:
"constantinopleBlock": 4,
under the line which has "eip155Block": 3
5. Setup bootnode
cd ${HOME}/XDPoSChain/build/bin
./bootnode -genkey bootnode.key
./bootnode -nodekey ./bootnode.key
Copy bootnode information from the output of above mentioned command.
enode://enode://fa88a0faf3f57a5911e287c12326f5a50adf960f4e8e0cc8ce2287ac04b49873c6bb7c144113d9fcae15f40be9c281a3404ea3cc72c29fd4556fe2e3e4ebfa8f@[127.0.0.1]:30301
Then press Ctrl+C to stop bootnode program.
6. Start the masternodes
6.1 Setup Local_DPoS_Setup
cd ${HOME}/Local_DPoS_Setup
6.2 Copy genesis and bootkey files
cp ${HOME}/XDPoSChain/build/bin/XDPoS.json ${HOME}/Local_DPoS_Setup/genesis/
cp ${HOME}/XDPoSChain/build/bin/bootnode.key ${HOME}/Local_DPoS_Setup
6.3 Setup ENODE and private keys
Edit file ${HOME}/Local_DPoS_Setup/.env
, add 4 private keys(of 1 master node, 3signer nodes as given in step 4.6, 4.7) without 0x prefix:
ENODE=<ENODE_VALUE>
PRIVATE_KEY_0=<KEY_0>
PRIVATE_KEY_1=<KEY_1>
PRIVATE_KEY_2=<KEY_2>
PRIVATE_KEY_3=<KEY_3>
6.4 Start private networks
Edit file ${HOME}/Local_DPoS_Setup/start-3-signers-networks.sh
, edit line number 21 to include your XDPoS.json file
./start-3-signers-networks.sh
6.5 Verify private networks
Once the node starts, wait for the block number * 4 times the blocks per epoch as given under the topic 4.8.
If, the node persists beyond this threshold then the private blockchain is ready for performing transactions.
7. Configure XDCPay
7.1 Configure the RPC, chain ID
- Add a new Network under "Network Settings"
- Network Name => Private Blockchain
- New RPC URL => http://:
- Chain ID => As given in topic 4.17
IMPORTANT: XDC Private Blockchain need to have 3 or 5 signer as mentioned under "4.7" topic. If we try to set it up using 2 or 4 signer node then we will have brain split as mentioned in this link.
Discussion (0)