Pollux Private Chain
To construct a private chain, it is imperative to deploy at least one full node operating under Pollux to generate blocks, and any quantity of full nodes to synchronize blocks and broadcast transactions. In this instance, only one Pollux node and one full node are arranged.
Preparation
Poxchain JDK 1.8
Generate a minimum of two Pollux network addresses and securely store both the address and private key. You can utilize pox chain web, wallet-cli, or Poxc hain to initiate the address creation process.
Deployment Guide
The process of establishing a node on a private chain mirrors that on the mainnet. The distinction lies in the content of the node configuration file. A pivotal aspect of constructing a private chain involves adjusting the configuration parameters within the file. This ensures that the nodes can collectively create a private network for tasks such as node discovery, block synchronization, and broadcasting transactions.
Create deployment directory Create deployment directory, it is recommended to put the two full nodes in different directories.
Obtain Full Node.jar, then put it into the SR and Full Node directories respectively.
Obtain the node's config file private_net_config.conf, and put it into the SR and Full Node directories respectively, and modify the file names respectively to super node.conf, full node.conf.
Modify the configuration file of each node
Certainly! Here's the rewritten content in table form with the specified replacements:
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 PRC node's
Genesis block related configuration
genesis.block.Assets
Preset PRC for specific accounts. Add the pre-prepared address to the end and specify its PRC balance as needed
The same as PRC node's
Genesis block related configuration
p2p.version
any positive integer except for 11111
the same as PRC 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 PRC
Enables fullnode to establish connection with PRC node and synchronize data
needSyncCheck
false
true
Set the first PRC’s needSyncCheck to false, other PRCs 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 PRC 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 PRC node's
The default 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 PRC10
Modify the port in the configuration file, and configure the SR and Full Node with different port numbers. Note that this step is required if SR and Full Node are running on the same machine, otherwise, this step can be skipped.
listen.port
: p2p listen porthttp
port: Http listen portrpc
port: rpc listen port
Startup the node
Full node that produces blocks
Full node
Modify the dynamic parameters of the private chain
In order to align with the main network environment, the dynamic parameters of the private chain need to be adjusted to match those of the main network. The adjustment of dynamic parameters can be accomplished through proposals. The PRC account can utilize pox chain or wallet-cli or full node http API wallet/proposal create to generate proposals, wallet/proposal approve to endorse proposals.
Here are the dynamic parameters and values organized based on the proposals approved by the mainnet consecutively. PRC can directly employ the following commands to initiate proposals and complete the modification of all dynamic parameters for the private chain. Considering the dependencies among some parameters, and in accordance with the current parameter values on the main network, the modification of all private chain parameters can be split into two proposals. In the initial step, PRC creates and casts votes for the first proposal using the code provided below:
After generating the proposal through the above code, you can inquire about the proposal's effective time: "expiration_time" via the http://127.0.0.1:xxxx/wallet/listproposals interface. The timestamp is in milliseconds. Once the effective time has elapsed, if the "state" in the return value of the interface is "APPROVED," it indicates that the proposal has been approved. You can then proceed to the next stage and create the second proposal. The sample code is as follows:
After the proposal takes effect, the dynamic parameters of the private chain will be consistent with the main network. You can query the chain parameters through the /wallet/getchainparameters API.
Last updated