To build a private chain, it is necessary to deploy at least one fullnode running by SR to produces blocks, and any number of fullnodes to synchronize blocks and broadcast transactions. Only one SR node and one fullnode are set up in this example.
# Preparation
Oracle JDK 1.8
Create at least two TRON network address and save the address and private key. You can use [tronweb](🔗) or [wallet-cli](🔗) or [Tronlink](🔗) to create address.
# Deployment Guide
The process of building a node on private chain is the same as that on mainnet. The difference is the content of the node configuration file. The most important step to build a private chain is to modify the configuration items in the configuration file, so that the nodes can form a private network for node discovery, block synchronization and broadcast transactions.
Create deployment directory Create deployment directory, it is recommended to put the two fullnodes in different directories. `
$ mkdir SR $ mkdir FullNode
`Obtain [FullNode.jar](🔗), then put it into the SR and FullNode directories respectively.
Obtain the node's config file [private_net_config.conf](🔗), and put it into the SR and FullNode directories respectively, and modify the file names respectively to supernode.conf, fullnode.conf.
Modify the configuration file of each node
Config Item | SR Fullnode | FullNode | Description |
localwitness | The private key of witness address | Please do not fill in data | Generating blocks requires signing with a private key |
genesis.block.witnesses | Witness address | The same as SR node's | Genesis block related configuration |
genesis.block.Assets | Preset TRX for specific accounts. Write the pre-prepared address and specify its TRX balance as needed | The same as SR node's | Genesis block related configuration |
p2p.version | any positive integer except for 11111 | the same as SR node's | Only nodes of the same p2p version can shake hands successfully |
seed.node | Please do not fill in data | Change the seed.node ip.list in the configuration file to the IP address and the port (`listen.port `) of the SR | Enables fullnode to establish connection with SR node and synchronize data |
needSyncCheck | false | true | Set the first SR’s needSyncCheck to false, other SRs true |
node.discovery.enable | true | true | If it is false, the current node will not be discovered by other nodes |
block.proposalExpireTime | 600000 | The same as SR node's | The default proposal effective time is 3 days: 259200000 (ms), if you want to quickly pass the proposal, you can set this item to a smaller value, such as 10 minutes, that is, 600000ms |
block.maintenanceTimeInterval | 300000 | The same as SR node's | The defaul maintenance time interval is 6 hours: 21600000 (ms), if you want to pass the proposal quickly, you can set this item to a smaller value, such as five minutes, that is, 300000ms. |
committee.allowSameTokenName | 1 | 1 | Allow same token name |
committee.allowTvmTransferTrc10 | 1 | 1 | Allow tvm transfer TRC10 |
Modify the port in the configuration file, and configure the SR and FullNode with different port numbers. **Note** that this step is required if SR and FullNode are running on the same machine, otherwise, this step can be skipped.
`
listen.port
` : p2p listen port`
http
` port: Http listen port`
rpc
` port: rpc listen port
Startup the node
Fullnode that produces blocks
Fullnode
Modify the dynamic parameters of the private chain
In order to be the same as the main network environment, the dynamic parameters of the private chain need to be modified to be consistent with those of the main network. The modification of dynamic parameters can be done through proposals. The SR account can use [tronweb](🔗) or [wallet-cli](🔗) or fullnode http API [`
wallet/proposalcreate
`](🔗)to create proposals, [`wallet/proposalapprove
`](🔗) to approve proposals.The following are the dynamic parameters and values sorted out according to the proposals passed by the mainnet successively. SR can directly use the following commands to create a proposal to complete the modification of all the dynamic parameters of the private chain at one time.