Test and Launch
1. Testing the Project
There are two steps to test the interaction between your chain and Poly Chain.
1.1 Debugging on DevNet
DevNet for developers provides debugging and testing for your code. The access steps are as follows:
- Propose a request to submit code developed for Poly Chain to GitHub and wait for code review.
- Propose a request to submit code developed for the register tool to Github and wait for code review.
- Propose a request to submit code developed for the new chain to Github and wait for code review.
- Submit the Cross-chain contracts hash you have deployed and the RPC that can connect your chain, then wait for
Poly team
to allocate chain ID and router number. Register to Poly Chain and sync genesis block header. The details are as follows:
- Register to Poly Chain
- Call entry function
RegisterSideChain
- Call entry function
ApproveRegisterSideChain
- Call entry function
- Sync genesis block header
- Call entry function
SyncSideChainGenesisHeader
- Call entry function
- Register to Poly Chain
[!Note|style:flat|label:Notice] Registration is currently completed by
Poly team
with the trusted account.
Launch your relayer.
If you choose to develop based on Poly-Relayer, please request to submit code to Github and execute the subcommands below:
- Generate a Poly Chain wallet, and contact
Poly team
via to add whitelist. - Compile the branch you developed.
./build.sh devnet/testnet/mainnet
- Execute
settxblock
to set the initial scan height../relayer_main settxblock --height <the height> --chain <chainid>
- Execute
setheaderblock
to set the header sync height (This command is optional. If it fails,header sync
will start from the registered height)../relayer_main setheaderblock --height <the height> --chain <chainid>
- Start the server.
./server --config ./config.json --roles ./roles.json
- Execute
status
to show how relayer works../relayer_main status
- Generate a Poly Chain wallet, and contact
[!Note|style:flat|label:Notice] Complete the corresponding actions if you develop a relayer independent from Poly-Relayer.
- Notes on debugging:
- Check your wallet balance regularly to avoid problems caused by insufficient balance.
- Create multiple wallet accounts, which can speed up the cross-chain transaction.
- Make sure the chain has been registered before launching the relayer.
- Ensure the relayer can work correctly, and check whether the block header can be accurately and continuously synchronized in both Poly Chain and your chain. Synchronization is the prerequisite of processing cross-chain information.
- Check whether the cross-chain transaction can be verified correctly. We suggest that you deploy a simple business logic contract logic to call the cross-chain function and test if the three parts (Poly Chain, your contract, and relayer) work well together.
[!Note|style:flat|label:Notice] Here you are recommended to interact with your chain on DevNet, which means when you call the cross-chain function, the
toChainId
(the input parameter of cross-chain function) is your chain ID registered in Poly Chain.
1.2 Testing on TestNet
Here is TestNet provided for developers to test the interaction between chains. The access to TestNet is almost the same as that of DevNet:
- Propose a request to submit code developed for Poly Chain to Github and wait for code review.
- Propose a request to submit code developed for the register tool to Github and wait for code review.
- Propose a request to submit code developed for the new chain to Github and wait for code review.
- Submit the cross-chain contract hash, RPC, and chain name to Poly Network.
- Register to Poly Chain and
sync genesis block header
on Poly TestNet. The detail is consistent with DevNet and is also completed by Poly Network. - Deploy a business contract on the chain you want to interact with and provide the function called by the target chain to Poly Network.
- Launch your relayer, which is the same as what is on DevNet.
Notes on the test:
- The transaction has been completed on the source chain but not completed on Poly:
- Is the block header synchronization normal?
- Does the relayer catch the transaction?
- Is the input parameter
toChainId
(the input parameter of cross-chain function, i.e., the target chain ID) correct?
- The transaction hasn't been completed on the target chain:
- Is the "method" (the function of your contract called by target chain) allowed to be called by CCM contract on the target chain?
- Can
txData
(the input parameter of cross-chain function) be parsed correctly by the "method" on the target chain?
- The transaction has been completed on the source chain but not completed on Poly:
2. Launching on MainNet
Now you can follow the processes to launch your project on MainNet:
- Notify
Poly team
via to merge the final code (including contracts and Poly code) into the MainNet, which should be taken about one week ahead of your launch schedule. - Submit the cross-chain contract hash deployed on MainNet, MainNet RPC, and chain name to Poly Network. Please verify your contract code.
- Register to Poly Chain and
sync genesis block header
on Poly MainNet. The information on the TestNet and DevNet is consistent, and has also been completed by Poly Network. - Launch your relayer.
Congratulations! You have integrated your chain in Poly Network. If you want to deploy products, please refer to the other guides we provide: