5.4.4.9 Get Transaction information API
Corresponding block information can be queried according to block number or the block hash. The block number and block hash cannot simultaneously be blank. When neither is blank, the block number will be invoked in priority.
1. Interface address:
https://PCNGatewayAddress/api/fiscobcos/v1/node/getBlockInfo
2. Call Method: POST
3. Signature algorithm: required and refer to Section 5.4.4.1
4. Call parameters
No. | Field name | Field | Type | Required | Remarks |
---|---|---|---|---|---|
1 | Header | header | Map | Y | |
2 | Body | body | Map | Y | |
3 | Signature Value | mac | String | Y | |
header | |||||
1 | user unique ID | userCode | String | Y | |
2 | DApp unique ID | appCode | String | Y | |
Body | |||||
1 | Block Height | blockNumber | string | N | When null, blockHash can not be null |
2 | Block Hash | blockHash | String | N | When null, blockNumber can not be null |
Example:
{
"header":{"appCode":"CL1881038873220190902114314","userCode":"newuser"},
"body":
{
"blockNumber":22,
"blockHash":"0xf27ff42d4be65329a1e7b11365e190086d92f9836168d0379e92642786db7ade"
},
"mac":"MEQCIBRhaM2szckWl9N9qcqnaYXOXGQw7SfII9DlRvxcI3YVAiBt4XeNs+EUjhBNSr3IjLRPZucsuGHxfjt9RiaNIQS8cA=="}
5. Response parameters
No. | Field name | Field | Type | Required | Remarks |
---|---|---|---|---|---|
1 | Header | header | Map | Y | |
2 | Body | body | Map | Y | |
3 | Signature Value | mac | String | Y | |
header | |||||
1 | Response ID | code | int | Y | 0: authentication successful -1: authentication failed |
2 | Response Message | msg | String | N | if code=0 then can be null |
Body | |||||
Block HASH | blockHash | String | Y | ||
Block Number | blockNumber | Int | Y | ||
Parent Block HASH | parentBlockHash | String | Y | ||
Block Size | blockSize | Int | Y | ||
Block Time | blockTime | Int | Y | Timestamp in millisecond format | |
author | String | Y | |||
Transaction Information | transactions | TransactionData | Y | ||
TransactionData | |||||
Transaction Id | txId | String | Y | ||
Block HASH | blockHash | String | Y | ||
Block Number | blockNumber | Int | Y | ||
Gas Used | gasUsed | Int | Y | ||
from | String | Y | |||
to | String | Y | |||
value | Int | Y | |||
input | String | Y |
Example:
{
"header": {
"code": 0,
"msg": "Transaction successful"
},
"mac": "MEQCIHX8SuEn/sDiPscd5li3X1GdseyggAyC2o9L92FjhzrfAiBLyFW/rguLkqz/Lz62VtX3m7Y1nHqcFqcNdM7Wq0wGLQ==",
"body": {
"blockHash": "0x199eca276b60473dd65f8b36641684456694b419d89ef41b4953a9cdac848305",
"blockNumber": 1,
"parentBlockHash": "0xa6886f12ee91470e35546432413ed372615f8d4c23fa82e8381b3e5b31219d4c",
"blockSize": 0,
"blockTime": 1587125168039,
"transactions": [
{
"txId": "0x8ee0c68e222742b5b70878265d3fdbd3a8e0d549da42a298a4ae872ca4fbfd89",
"blockHash": "0x199eca276b60473dd65f8b36641684456694b419d89ef41b4953a9cdac848305",
"blockNumber": 1,
"gasUsed": 100000000,
"from": "0x08ac3132a6c7e6ca5a7fbaf0521bb8b6f370ed35",
"to": "",
"value": 0,
"input": "0x60806040523480156200001157600080fd5b506110016000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c92a78016040805190810160405280600681526020017f745f6261736500000000000000000000000000000000000000000000000000008152506040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016200010191906200024a565b602060405180830381600087803b1580156200011c57600080fd5b505af115801562000131573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525062000157919081019062000174565b50620002f4565b60006200016c8251620002a3565b905092915050565b6000602082840312156200018757600080fd5b600062000197848285016200015e565b91505092915050565b6000620001ad8262000298565b808452620001c3816020860160208601620002ad565b620001ce81620002e3565b602085010191505092915050565b6000601382527f626173655f6b65792c626173655f76616c7565000000000000000000000000006020830152604082019050919050565b6000600782527f626173655f6964000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006060820190508181036000830152620002668184620001a0565b905081810360208301526200027b8162000213565b90508181036040830152000000"
}
]
}
}