13. Cross-chain Metaspace
Cross-chain Metaspace Interface
Login VoidChain to Get Transaction Voucher
POST chain_logonSwap (Get transaction voucher)
Parameters
name type data type description account required string Account pass required string Password
Responses
http code content-type response 0application/json{"mark":"..."}
Response Fields:
- mark - Transaction voucher returned after successful login
Example cURL
{"jsonrpc": "3.0","method": "chain_logonSwap","params": ["opcode=Account&subcode=Logon&account=wxl_test&pass=12345678", "encryp=none"],"id": "aa80aa0c6bb0c7d81ac7e5b3"}
Response Example
{"jsonrpc": "3.0","id": "cfc6f40fc054a50518da3a54","result": {"ret": "0","err": "","content": {"mark": "0b2c7458f88bdbb586884bb9"}}}
Login Third-party Decentralized Exchange with Transaction Voucher
Interface provided by third-party exchanges.
Create Public Chain Private Address
POST chain_dexSwap (Create local address for public chain)
Description:
Executed by the exchange, the exchange will automatically allocate a corresponding local address for each user on the public chain, which serves as the cross-chain address for importing assets from VoidChain. The creation and maintenance of the transfer-in and transfer-out of the corresponding public chain are completed within the edge trust machine.
The locally managed addresses of other public chains automatically generated by TC accounts are all encrypted and saved locally using the TC user's private key HASH as the password.
Since each public chain will only retain a unique address for the same TC user on the same edge trust machine, if a public chain address already exists when creating it, it will be automatically skipped to avoid overwriting the earlier address and causing asset loss.
Parameters
name type data type description chain required string Chain name
Responses
http code content-type response 0application/json{"chain":"...","address":"..."}
Response Fields:
- address - Corresponding public chain address returned
Example cURL
{"jsonrpc": "3.0","method": "chain_dexSwap","params": ["opcode=Account&subcode=Create&chain=ETH", "encryp=none"],"id": "aa80aa0c6bb0c7d81ac7e5b3"}
Response Example
{"jsonrpc": "3.0","id": "0b2c7458f88bdbb586884bb9","result": {"ret": "0","err": "","content": {"chain": "ETH","address": "0x8303466791b6fc5443f3c4e099fd9cd2a702755a"}}}
Query Public Chain Private Address
POST chain_dexSwap (Query local chain addresses)
Description:
Displays all private key public chain addresses corresponding to the current account on the current trading platform.
Parameters
None
Responses
http code content-type response 0application/jsonAddress list
Example cURL
{"jsonrpc": "3.0","method": "chain_dexSwap","params": ["opcode=ActiveRobot&subcode=ChainLocalAddr", "encryp=none"],"id": "aa80aa0c6bb0c7d81ac7e5b3"}
Response Example
{"jsonrpc": "3.0","id": "43c7b6b132fa54407caca3e9","result": {"ret": "0","err": "","content": {"info": [{"Name": "ETH","Addr": "0xcfcb6f2c878e7613a76d304fd2043a5733308387"}]}}}
Import Public Chain Mnemonic
POST chain_dexSwap (Import public chain mnemonic)
Description:
When importing the local address of the corresponding public chain, if the local address exists, it will be overwritten. So when importing, you need to confirm whether the current public chain address exists. If it exists, the exchange should do a secondary confirmation with the user whether to overwrite the import.
Parameters
name type data type description chain required string Chain name content required string Base64 encoded private key
Responses
http code content-type response 0application/jsonImport result
Example cURL
{"jsonrpc": "3.0","method": "chain_dexSwap","params": ["opcode=Key&subcode=Import&chain=ETH&content=", "encryp=none"],"id": "ae47754298cdd62834b33af8"}
Export Public Chain Mnemonic
POST chain_dexSwap (Export public chain mnemonic)
Description:
In principle, local public chain addresses should not store assets for a long time, but only serve as a bridge for transferring in and out of the corresponding public chain. If you wish to directly manage the corresponding public chain assets at this address, then the mnemonic of this address needs to be exported and saved to avoid asset loss if the edge trust machine is damaged one day.
Parameters
name type data type description chain required string Chain name
Responses
http code content-type response 0application/json{"info":"..."}
Response Fields:
- info - Mnemonic phrase
Example cURL
{"jsonrpc": "3.0","method": "chain_dexSwap","params": ["opcode=Key&subcode=Export&chain=ETH", "encryp=none"],"id": "aa80aa0c6bb0c7d81ac7e5b3"}
Response Example
{"jsonrpc": "3.0","id": "bd899d795214c7e749ad7fe7","result": {"ret": "0","err": "","content": {"info": "expand knee lonely click super machine still safe adapt actor learn matrix"}}}
Deploy Public Chain Contract
POST chain_dexSwap (Deploy public chain contract)
Description:
Each public chain can only have one legitimate contract address (confirmed by community voting) in the cross-chain metaspace, so it cannot be deployed repeatedly.
Parameters
name type data type description content required string Public chain information (base64 encoded JSON)
Content Format (before base64 encoding):
{
"robotaddr": "",
"initdecimals": "",
"chainName": "",
"chainSymbol": ""
}
Responses
http code content-type response 0application/json{"info":"..."}
Response Fields:
- info - Transaction hash
Example cURL
{"jsonrpc": "3.0","method": "chain_dexSwap","params": ["opcode=ActiveRobot&subcode=ContractInitChain&content=", "encryp=none"],"id": "aa80aa0c6bb0c7d81ac7e5b3"}
Response Example
{"jsonrpc": "3.0","id": "1bd17d7ec7f2fdca6d738531","result": {"ret": "0","err": "","content": {"info": "0xe8e9799e16b515c56f1b3e5fd808f34bffb1fbd5753c3781d738b4f240f3f0f8"}}}
Deploy Public Chain Token
POST chain_dexSwap (Deploy public chain token)
Parameters
name type data type description content required string Public chain information (base64 encoded JSON)
Content Format (before base64 encoding):
{
"chainaddr": "",
"remoteaddr": "",
"initdecimals": "9",
"tokenName": "USDT",
"tokenSymbol": "USDT"
}
Responses
http code content-type response 0application/json{"info":"..."}
Response Fields:
- info - Transaction hash
Example cURL
{"jsonrpc": "3.0","method": "chain_dexSwap","params": ["opcode=ActiveRobot&subcode=ContractUpCoin&content=", "encryp=none"],"id": "aa80aa0c6bb0c7d81ac7e5b3"}
Response Example
{"jsonrpc": "3.0","id": "1bd17d7ec7f2fdca6d738531","result": {"ret": "0","err": "","content": {"info": "0xe8e9799e16b515c56f1b3e5fd808f34bffb1fbd5753c3781d738b4f240f3f0f8"}}}
Public Chain Information Query
POST chain_dexSwap (Query public chain token list)
Description:
Display the token list of each public chain mapped to the cross-chain metaspace.
Parameters
name type data type description address required string Public chain address begin required int Starting number len required int Fetch length
Responses
http code content-type response 0application/jsonToken list
Example cURL
{"jsonrpc": "3.0","method": "chain_dexSwap","params": ["opcode=ActiveRobot&subcode=ContractQueryCoins&address=&begin=0&len=100", "encryp=none"],"id": "aa80aa0c6bb0c7d81ac7e5b3"}
Public Chain Token Details Query
POST chain_dexSwap (Query public chain token details)
Description:
Display token details of each public chain mapped to the cross-chain metaspace.
Parameters
name type data type description address required string Public chain address conaddr required string Token address findaddr optional string Account address to query (if empty, query current account address)
Responses
http code content-type response 0application/jsonToken details
Example cURL
{"jsonrpc": "3.0","method": "chain_dexSwap","params": ["opcode=ActiveRobot&subcode=ContractGetCoin&address=&conaddr=&findaddr=", "encryp=none"],"id": "aa80aa0c6bb0c7d81ac7e5b3"}
Response Example
{"jsonrpc": "3.0","id": "1bd17d7ec7f2fdca6d738531","result": {"ret": "0","err": "","content": {"info": {"RemoteAddr": "0x0000000000000000000000000000000000000000","Conaddr": "0x8a8dae6216f5fddbcb8f8a44e1fca2f35ce0728a","Tokenname": "USDT","TokenSymbol": "USDT","Amount": 0,"Total": 0,"Decimals": 9}}}}
Launch Public Chain
VoidChain community voting operation required, no public operation interface.
Activate Public Chain
POST chain_dexSwap (Activate public chain)
Description:
Only public chains that have completed the launch operation can be activated and enter normal operational status.
Parameters
name type data type description chainsymbol required string Public chain code
Responses
http code content-type response 0application/jsonActivation result
Example cURL
{"jsonrpc": "3.0","method": "chain_dexSwap","params": ["opcode=ActiveRobot&subcode=Activechain&chainsymbol=TC", "encryp=none"],"id": "aa80aa0c6bb0c7d81ac7e5b3"}
Query All Chain Information
POST chain_dexSwap (Query all introduced public chains)
Description:
Display all currently introduced public chains.
Parameters
name type data type description begin required int Starting number len required int Fetch length
Responses
http code content-type response 0application/jsonChain list
Example cURL
{"jsonrpc": "3.0","method": "chain_dexSwap","params": ["opcode=ActiveRobot&subcode=ContractQueryChain&begin=0&len=100", "encryp=none"],"id": "8ea8f7248e93f4c3087ab78a"}
Response Example
{"jsonrpc": "3.0","id": "8ea8f7248e93f4c3087ab78a","result": {"ret": "0","err": "","content": {"info": {"Addrs": ["0xcd8ae719d79026fb94c4732736840f71b1e78818","0x3725ad4a821347dfb6cf5c7f655722e907576e98"],"Names": ["TC","ETH"],"Symbols": ["TC","ETH"]}}}}
Robot Address Query
POST chain_dexSwap (Query robot addresses)
Description:
Each introduced public chain will automatically generate one and only one robot account corresponding to that public chain, not subject to any human interference, managing all assets of that public chain.
Parameters
None
Responses
http code content-type response 0application/jsonRobot address list
Example cURL
{"jsonrpc": "3.0","method": "chain_dexSwap","params": ["opcode=ActiveRobot&subcode=Robotaddr", "encryp=none"],"id": "aa80aa0c6bb0c7d81ac7e5b3"}
Response Example
{"jsonrpc": "3.0","id": "8ea8f7248e93f4c3087ab78a","result": {"ret": "0","err": "","content": {"info": [{"Name": "TC","Addr": "0xe725e10cb00fdd08fe439f68b1c10b947ec8ab6e"},{"Name": "ETH","Addr": "0x1cc37bda9dfc0b6915f2e6d1190e64e90310623e"}]}}}
Import Public Chain Assets
POST chain_dexSwap (Import assets from public chain)
Description:
The process of importing public chain assets refers to transferring from the local public chain account address to the VoidChain public chain robot account address, while mapping the corresponding public chain assets in the cross-chain metaspace. Importing public chain assets uses a unified interface parameter.
Importing public chain assets for a single user is designed as a serial operation, meaning only one import process can occur at the same time. If the previous import is not completed, you need to wait.
Parameters
name type data type description content required string Import content (base64 encoded JSON)
Content Format (before base64 encoding):
{
"chain_symbol": "ETH",
"coin_symbol": "ETH",
"coin_name": "USDT",
"coin_address": "",
"amount": "0x333",
"remote_rpc": "https://holesky.gateway.tenderly.co"
}
Note: If address is empty, it means importing platform coin.
Responses
http code content-type response 0application/jsonImport initiated
Import is an asynchronous task. You need to periodically execute import status query to confirm the import result.
Example cURL
{"jsonrpc": "3.0","method": "chain_dexSwap","params": ["opcode=Assets&subcode=Import&content=", "encryp=none"],"id": "aa80aa0c6bb0c7d81ac7e5b3"}
Import Public Chain Asset Status Query
POST chain_dexSwap (Query import asset status)
Parameters
name type data type description op required string Import - Import asset query, Export - Export asset query
Responses
http code content-type response 0application/jsonImport status details
Example cURL
{"jsonrpc": "3.0","method": "chain_dexSwap","params": ["opcode=Assets&subcode=Show&op=Import", "encryp=none"],"id": "aa80aa0c6bb0c7d81ac7e5b3"}
Response Example
{"jsonrpc": "3.0","id": "7b66498181f29306a67c9c48","result": {"ret": "0","err": "","content": {"chain_symbol": "ETH","coin_symbol": "ETH","coin_name": "ethereum","coin_address": "","amount": 819,"local_address": "0xcfcb6f2c878e7613a76d304fd2043a5733308387","robot_address": "0x0037b8c3fb4a51f169790172aeda81073b0d315a","remote_rpc": "https://holesky.gateway.tenderly.co","tc_address": "0x60c63b7c85d26538e708ab53c93c2ecbbd8a931e","tcrobot_address": "0xbbb74f97ebf42e11ec94b62cfa93678b197fb78e","txhash_local": "0xf004d67b86307f38fa59f134160fa875859bca657800a03497c415af235b5bfb","txhash_tc": "","status": 102,"status_detail": "2 blocks confirmed","active_time": 0,"process": false}}}
Status Codes:
100- Import_chain_robot: chain asset to chain robot stage106- Import_chain_End: cross chain successful200- Import_TC: chain robot mapping voidChain stage201- Import_MAPGETHASH: voidChain map stage203- Import_TC_End: map end, if fail return to 106999- Import_successful: successful1000- Import_fail: fail
Export Public Chain Assets
POST chain_dexSwap (Export assets to public chain)
Description:
The process of exporting public chain assets refers to transferring from the VoidChain public chain robot account address to the local public chain account address, while eliminating the mapped public chain assets in the cross-chain metaspace. Exporting public chain assets uses a unified interface parameter.
Exporting public chain assets for a single user is designed as a serial operation, meaning only one export process can occur at the same time. If the previous export is not completed, you need to wait.
Parameters
name type data type description content required string Export content (base64 encoded JSON)
Content Format (before base64 encoding):
{
"chain_symbol": "ETH",
"coin_symbol": "ETH",
"coin_name": "USDT",
"coin_address": "",
"amount": "0x333",
"remote_rpc": "https://holesky.gateway.tenderly.co"
}
Note: If address is empty, it means exporting platform coin.
Responses
http code content-type response 0application/jsonExport initiated
Export is an asynchronous task. You need to periodically execute export status query to confirm the export result.
Example cURL
{"jsonrpc": "3.0","method": "chain_dexSwap","params": ["opcode=Assets&subcode=Export&content=", "encryp=none"],"id": "aa80aa0c6bb0c7d81ac7e5b3"}
Export Public Chain Asset Status Query
POST chain_dexSwap (Query export asset status)
Parameters
name type data type description op required string Export - Export asset query
Responses
http code content-type response 0application/jsonExport status details
Example cURL
{"jsonrpc": "3.0","method": "chain_dexSwap","params": ["opcode=Assets&subcode=Show&op=Export", "encryp=none"],"id": "aa80aa0c6bb0c7d81ac7e5b3"}
Response Example
{"jsonrpc": "3.0","id": "7b66498181f29306a67c9c48","result": {"ret": "0","err": "","content": {"chain_symbol": "ETH","coin_symbol": "ETH","coin_name": "ethereum","coin_address": "","amount": 819,"local_address": "0xcfcb6f2c878e7613a76d304fd2043a5733308387","robot_address": "0x0037b8c3fb4a51f169790172aeda81073b0d315a","remote_rpc": "https://holesky.gateway.tenderly.co","tc_address": "0x60c63b7c85d26538e708ab53c93c2ecbbd8a931e","tcrobot_address": "0xbbb74f97ebf42e11ec94b62cfa93678b197fb78e","txhash_local": "0xf004d67b86307f38fa59f134160fa875859bca657800a03497c415af235b5bfb","txhash_tc": "","status": 102,"status_detail": "2 blocks confirmed","active_time": 0,"process": false}}}
Status Codes:
100- Export_Map_Start101- Export_MAPGETHASH: voidChain map stage102- Export_Map_End200- Export_Robot_chain201- Export_Robot_GetHash210- Export_Robot_End999- Export_successful: successful1000- Export_fail: fail
Broker Transaction
POST chain_dexSwap (Execute broker transaction)
Parameters
name type data type description content required string Broker transaction content (base64 encoded JSON array)
Content Format (before base64 encoding):
[{
"chain_symbol": "TC",
"coin_symbol": "TC",
"sender": "0x36355226f5463ead232e9ed40d512a25aaba7e08",
"recv": "0xd9bbfded452336bb9a71986742ca6e2e78967e86",
"amount": "0x300"
}, {
"chain_symbol": "ETH",
"coin_symbol": "USDT",
"sender": "0xd9bbfded452336bb9a71986742ca6e2e78967e86",
"recv": "0x36355226f5463ead232e9ed40d512a25aaba7e08",
"amount": "0x80000"
}]
Responses
http code content-type response 0application/jsonTransaction result
Example cURL
{"jsonrpc": "3.0","method": "chain_dexSwap","params": ["opcode=ActiveRobot&subcode=BrokerTrans&content=", "encryp=none"],"id": "aa80aa0c6bb0c7d81ac7e5b3"}
Query Cross-chain Metaspace Assets
POST chain_dexSwap (Query mapped assets in cross-chain metaspace)
Parameters
name type data type description chain required string Chain ID coinsymbol required string Token ID findaddr optional string Target address (if empty, query current account)
Responses
http code content-type response 0application/json{"info":"..."}
Example cURL
{"jsonrpc": "3.0","method": "chain_dexSwap","params": ["opcode=ActiveRobot&subcode=QuerySpaceCoin&chain=ETH&coinsymbol=USDT&findaddr=", "encryp=none"],"id": "aa80aa0c6bb0c7d81ac7e5b3"}
Response Example
{"jsonrpc": "3.0","id": "3c0f5890ca10580b4c5b3cab","result": {"ret": "0","err": "","content": {"info": "0000000000000000000000000000000000000000000000000000000000000fff"}}}
Query Other Chain Assets
POST chain_dexSwap (Query assets on other public chains)
Description:
For public chains other than VoidChain, you need to configure the corresponding RPC host in the configuration file data/rpc.host to access normally.
Parameters
name type data type description chain required string Chain ID address required string Token address findaddr optional string Target address (if empty, query current account)
Responses
http code content-type response 0application/json{"info":"..."}
Example cURL
{"jsonrpc": "3.0","method": "chain_dexSwap","params": ["opcode=ActiveRobot&subcode=QueryOtherCoin&chain=&address=&findaddr=", "encryp=none"],"id": "aa80aa0c6bb0c7d81ac7e5b3"}
Response Example
{"jsonrpc": "3.0","id": "3c0f5890ca10580b4c5b3cab","result": {"ret": "0","err": "","content": {"info": "0000000000000000000000000000000000000000000000000000000000000fff"}}}