Side Chain -> Side Chain
Quickstart on how to integrate the flow of porting a token from a ChainPort generated sidechain token to another ChainPort generated side chain token.
Port from Side chain to Side chain
This section describes how to bridge from a ChainPort minted token on one chain to a ChainPort minted token on a different chain.
To bridge from side chain to side chain, simply call the crossChainTransfer
function on the ChainportSideBridge
contract on the source network.
This function required to add Value to the transaction in order to success. There is a getter for that amount:
Value is required in order to cover the gas cost of minting and receiving the ported tokens on the target chain.
Copy
First make sure to approve spend on the ERC20 token you would like to bridge
Copy
Parameter | Name | Description |
---|---|---|
bridgeToken |
| The address of the token you wish to bridge. |
amount |
| The amount of tokens you wish to bridge, in wei. |
networkId |
| The destination chain network Id. The following endpoint will fetch the list of network ids: |
affiliate |
| Your affiliate address. If you dont have an affiliate address, pass in the zero address. To get an affiliate address and participate in our revenue sharing program please reach out to us on telegram. |
Calling crossChainTransfer
on the ChainportSideBridge
smart contract on Polygon Mumbai Testnet, which after 18 block confirmations, triggers a bridge transaction on Binance Smart Chain Testnet:
PythonCopy
Once the crossChainTransfer
transaction has been mined and reaches the minimum block confirmation threshold (check the GET/api/meta
endpoint for the min block confirmations for a given chain), the ChainPort bridge will initiate a mint transaction on the target chain. Usually this process takes up to 5 minutes.
You can keep track of your bridge transaction via the following endpoint:
Check the status of your bridge transaction
GET
https://api.chainport.io/api/port
Returns a port transaction
Query Parameters
Name | Type | Description |
---|---|---|
base_tx_hash* | String | The transaction hash of the |
base_network_id* | String | The source chain Chainport network id. |
200 Port transaction successfully fetchedCopy
Before the bridge transaction reaches the minimum confirmation threshold, this request will return an empty object
Note that a target_tx_status
of 1 indicates the bridge has processed your transaction on the target network. When target_tx_status
is 1 you should be able to see the properly reflected balance of the requestor address on the target chain for the ported token whose token address is listed in the target_token_address
field. A target_tx_status
of null indicates that the bridge is still working on processing the transaction on the target chain.
Last updated