HomeGuidesAPI ReferenceChangelog
GuidesAPI ReferenceCommunityDiscordBlogFAQBug BountyAnnouncementsChange Log
Guides

Tron Private Chain

Building a TRON private chain

Test environment:

Operating system: macOs Mojave 10.14.2 8G 256G SSD
JDK 1.8 (Only Oracle jdk version is supported)

Before you start:

  1. JDK 1.8 (The Oracle jdk version is mandatory)
  2. Create at least two pairs of private keys and addresses (create the address via wallet-cli or tronweb)
  • address_A, private_A;
  • address_B, private_B;
  • address_C, private_C;
  1. Deploy at least one SuperNode for block production;
  2. Deploy any number of FullNode nodes to synchronize blocks and broadcast transactions;

Note: Only one SR node and one fullnode node are set up in this example

Deployment guide

1. Get FullNode.jar, Soliditynode.jar by compiling or release.

a. Compile by downloading the source code

1). Create the code directory

mkdir -p  /project/tron/

2). Download java tron ​​source code

cd  /project/tron/
git clone -b master https://github.com/tronprotocol/java-tron.git

3). Compile the java-tron project

cd ./java-tron
./gradlew build -x test

b. Get the latest version of the jar package directly through release
https://github.com/tronprotocol/java-tron/releases

2. Configuration file

a. Get the Super Node Configuration File

1). Download the private_net_config.conf file
https://github.com/tronprotocol/tron-deployment/blob/master/private_net_config.conf

2). Modify the localwitness in the configuration file.

3). Change genesis.block.witnesses in the configuration file to the address corresponding to the private key in localwitness

4). Change p2p.version to any positive integer except for 11111

5). Set the first SR’s needSyncCheck to false, others true

6). Change node.discovery.enable to true.

7). Write the account address that needs to be generated to genesis.block.assets as needed

7). Name the configuration file as supernode.conf

8). Please ensure TCP and UDP are enabled on listen.port(Pay attention to this item if you are using AWS or Alibaba Cloud)

b. Get the full node configuration file

1). Download the private_net_config.conf file, https://github.com/tronprotocol/tron-deployment/blob/master/private_net_config.conf

2). Change the seed.node ip.list in the configuration file to the IP address and the port of the SR. (127.0.0.1:16666 in this case)

3). Set p2p.version to be the same as p2p.version of the super node.

4). Set genesis.block to be consistent with genesis.block configuration in the super node.

5). Set needSyncCheck to true

6). Set node.discovery.enable to true

7). Name the configuration file fullnode.conf

3. Node Deployment

a. Deploying super nodes

nohup java -Xmx6g -XX:+HeapDumpOnOutOfMemoryError -jar  FullNode.jar --witness -c supernode.conf

b. Deploying full node

nohup java -Xmx6g -XX:+HeapDumpOnOutOfMemoryError -jar FullNode.jar -c fullnode.conf

After the node is enabled, logs and output-directory will be generated on the sibling directory of java-tron.jar
logs: node log files
output-directory: node data storage directory

Command line parameter description:
--witness: enable the witness function, i.e .: --witness.
--log-config: Specify the log configuration file path, i.e .: --log-config logback.xml.
-c: Specify the configuration file path, i.e .: -c config.conf.

The use of log file:
You can modify the level of the module to control the output of the log. The default level of each module is INFO. For example, to only print the information above the warn level of the network module, you can modify it as follows.

Note:
1). If SR and fullnode are on the same host, it is recommended to create separate folders for SR and fullnode to facilitate troubleshooting based on logs.

2). It is not possible to exclude super nodes other than myself from joining, and specific operations such as network isolation can be performed according to their own needs.

4. Proposal

In order to be consistent with the mainnet environment, it is necessary to keep the proposal in the private chain the same with the mainnet proposal. Please note: some proposals have a sequential order, and it is recommended to make a proposal according to the proposal_id of the main network.
a. Use the wallet / proposalcreate interface to create proposals, sign and broadcast
b. Use the wallet / proposalapprove interface to approve proposals, sign and broadcast
Please refer to the documentation for specific interface usage: [HTTP documentation] (https://tronprotocol.github.io/documentation-zh/api/http/)

Note:
If you need to quickly pass the proposal, you need to modify it as follows

  1. Modify the proposal effective time parameter, proposalExpireTime = 259200000 // 3 day: 259200000(ms) (modify block.proposalExpireTime in the configuration file)
  2. Modify the time interval of super representative adjustment, the current default is 6 hours. Can be modified by proposal
{
    "key": 0,
    "value": 300000 // 5 minutes in ms
}

All the current mainnet proposals and related information:
https://api.trongrid.io/wallet/listproposals
https://tronprotocol.github.io/documentation-zh/mechanism&algorithm/sr/

The proposals passed by the mainnet are organized as follows:

1."proposal_id": 1
 {
   "key": 9,
   "value": 1
 }
2."proposal_id": 3
 {
   "key": 10,
   "value": 1
 }

3."proposal_id": 4
 {
   "key": 11,
   "value": 20
 }

4."proposal_id": 7
 {
   "key": 17,
   "value": 250000000000
 }

5."proposal_id": 9
 {
   "key": 11,
   "value": 10
 }

6."proposal_id": 13
 {
   "key": 19,
   "value": 100000000000
 }

7."proposal_id": 14 
{
   "key": 15,
   "value": 1
 }

8."proposal_id": 15 
{
   "key": 18,
   "value": 1
 }

9."proposal_id": 16
{
   "key": 16,
   "value": 1
 }

10."proposal_id": 17
{
   "key": 20,
   "value": 1
 }

11."proposal_id": 18
{
   "key": 26,
   "value": 1
 }

12."proposal_id": 22
{
   "key": 30,
   "value": 1
 }

13."proposal_id": 27
{
   "key": 5,
   "value": 16000000
 },
{
   "key": 31,
   "value": 160000000
 }


14."proposal_id": 29
{
   "key": 32,
   "value": 1
 }