Blockchain Traversal InterfaceTry API
POST
chain_queryInfo
(Blockchain Traversal Interface)
Parameters
begin: starting block height. Returns up to 100 blocks at a time.
Sliceno: metaspace number
Example Code
{
"jsonrpc": "3.0",
"method": "chain_queryInfo",
"params": [
"pubChainQuery",
"op=scanBlock&begin=&sliceno=0",
"encryp=none"
],
"id": "1"
}{
"jsonrpc": "3.0",
"id": "1",
"result": {
"ret": "0",
"err": "",
"content": [
{
"parentHash": "0xcfee308a28697bafef2f635c2c67272a65eab1996c93aebac2bcb29155d5bc77",
"miner": "0x6d3da5167929a4b297df09325389d72f35327fa4",
"stateRoot": "0x670a4e6f9262854a889e36dd766c6942780a6a9c74840fcbe2a9fde1e4f2c36b",
"transactionsRoot": "0xb0ef76de17cce27b75554325e7cba7f22eb3238fb642f35b174c885ae86f1987",
"receiptsRoot": "0xbc86b068c10758ec5e644d81b530038b31e6da3450892c7a3dcb6e9a0488c1e8",
"Recno": 2,
"number": 1,
"timestamp": 1742515456744655700,
"Txns": [//Transaction hash
"0xd56f8fd299e309598752d54576395f15d403f2eb274d163e4eaf9e103cf64828"
],
"Senders": [//Transaction sender
"0x35f4646842fc5fe208b7d3fab125c8542be88324"
],
"Data": "" //Transaction content, base64-encoded
}
]
}
}Notes
After expanding the transaction content, parse each transaction as follows:
From: get it from the corresponding index in the "Senders" array
Value: if present, it is a platform-coin transfer
Input: if value is empty and input has content, it is a contract transaction
Three important ERC20 contract token functions:
Transfer:
function transfer(address _to, uint256 _value) external returns (bool success)
Function code: 0xa9059cbb
Parameter format: two 64-character strings
Example:
000000000000000000000000fa363a25864e3557c62b25cc41ccff4b41c6d762
0000000000000000000000000000000000000000000000000000000000000030
Complete content: 0xa9059cbb000000000000000000000000fa363a25864e3557c62b25cc41ccff4b41c6d7620000000000000000000000000000000000000000000000000000000000000030
Delegated transfer:
function transferFrom(address _from, address _to, uint256 _value) external returns (bool success)
Function code: 0x23b872dd
Parameter format: three 64-character strings
Example:
000000000000000000000000fa363a25864e3557c62b25cc41ccff4b41c6d762
000000000000000000000000ca363a25864e3557c62b25cc41ccff4b41c6d768
0000000000000000000000000000000000000000000000000000000000000030
Complete content: same format as above
Delegated amount:
function approve(address _spender, uint256 _value) external returns (bool success)
Function code: 0x095ea7b3
Parameter format: two 64-character strings
Example: 000000000000000000000000fa363a25864e3557c62b25cc41ccff4b41c6d762
0000000000000000000000000000000000000000000000000000000000000030
Complete content: same format as above