Build parachain
# Build parachain
The developer can build your own parachain on the exsiting node of parent blockchain and develop kinds of onchain applications, e.g. Token launch.
# Get parachain installation package
Download the package from github. ([https://github.com/33cn/plugin/releases]) we offer Mac version, Windows version and Linux version.
Unzip parachain installation package
- bin file: chain33-linux-amd64
- cli command file: chain33-cli-linux-amd64
- parachain configuration file: chain33.para.toml
# Revise configuration file
Revise the following parameter in chain33.para.toml based on the situation.
- Revise title, format is "user.p.{name}.", in which only name can be modified.
Title="user.p.para."
- Revise parachain genesis token which should be in uppercase.
CoinSymbol="PARA"
- Revise rpc monitoring port
[rpc]
jrpcBindAddr="localhost:8901"
grpcBindAddr="localhost:8902"
2
3
Notice: The monitoring port should differ from the port for parent blockchain, to avoid configuration collision.
- Ensure the IP and port sync trading data from parachain. By default, the grpc port of parent blockchain is 8802. Please revise the grpc port of parent blockchain based on your situation.
ParaRemoteGrpcClient="localhost:8802"
grpc server ip of parent blockchain nodes can support multi-ip loading balance. It should be divide by ",". The example is as follows:
ParaRemoteGrpcClient="118.31.177.1:8802,39.97.2.127:8802"
- Confirm the start height of parent blockchain. Parachain start syncing from the specific height of parent blockchain, which is also the first block of parachain.
[consensus.sub.para]
startHeight=345850
2
If startHeight is set as "1", it means that the parachain should sync from first height of parent blockchain. Thus, the parameter should not be set higher than the height of parent blockchain.
# Start nodes
- To start nodes, under the path of chain33 program and configuration file, run the following command.
nohup ./chain33-linux-amd64 -f chain33.para.toml >/dev/null 2>&1 &
- Run the following command, and check the process.
ps -ef | grep -v grep | grep chain33-linux-amd64
- If process starts, run the following command to inquire network information of parachain.
./chain33-cli-linux-amd64 --rpc_laddr="http://localhost:8901" block last_header
--parameter[rpc_laddr] is jsonrpc port address of parachain, which is marked as jrpcBindAddr in configuration file.
If creation succeeds, the following information should be returned:
{
"version": 0,
"parentHash": "0x37a43cd8531b383b29bd3748bc71****c4d6819528cfa7db1b96864896a8",
"txHash": "0xeeea856a89820b01626b5f31ed8e86e4****a975766c0a9dc215024c5391fc3",
"stateHash": "0x85e3f2786da5d0c476b5668b77df4****56b0f84c2705056eeedbb4f47e8cf3",
"height": 1083,
"blockTime": 1638776745,
"txCount": 1,
"hash": "0x4e05a79fd434d0e3c5daa3daf1bee8a49****6dc283e2605393899057fd6955",
"difficulty": 520159231
}
2
3
4
5
6
7
8
9
10
11