Skip to main content

7. Query and Test Interface

Query and Test Interface


Query and Test Interface

POST chain_queryTransaction (Test transaction execution)

Interface Purpose:

  • Test transactions are executed in a single machine trial to decide whether to actually submit the transaction to the network based on the returned results.
  • Query result operations are uniformly executed through the trial interface, which can return results immediately without gas fees.
Parameters
nametypedata typedescription
fromrequiredstringSender address
torequiredstringReceiver address
valuerequiredstring (hex)Transaction value
slicenorequiredstring (hex)Metaspace number
Responses
http codecontent-typeresponse
0application/json{"ret_data":"...","err":"..."}

Response Fields:

  • ret_data - Transaction execution return value (hex encoded)
  • err - Transaction execution return error
Example cURL
{
"jsonrpc": "3.0",
"method": "chain_queryTransaction",
"params": [{
"from": "0xc3b6472d6370eaf4eb58fff19ce1724c9d61892c",
"to": "0x6268af5542c4b0ccbb650a0aaccbfcdfbabf6b52",
"value": "0x2E90EDD00",
"sliceno": "0x2"
}, "", "encryp=none"],
"id": "d2c8fe196f9f8d8ace952e9e"
}
Response Example
{
"jsonrpc": "3.0",
"id": "055169b80c4e2ef96c2b2cbb",
"result": {
"ret": "0",
"err": "",
"content": {
"ret_data": "",
"err": ""
}
}
}