向区块链网络查询某一交易的信息。
API
GET /api/v1/networks/{network}/transactions/{id}
Url Path 参数 | 描述 |
---|---|
network | 通道名称 |
id | 交易ID |
返回结果
名称 | 类型 | 描述 |
---|---|---|
Success | Boolean | 请求是否成功 |
Error | Error | - |
Result | Transaction | - |
Error
名称 | 类型 | 描述 |
---|---|---|
code | Integer | 错误码 |
message | String | 错误描述信息 |
request_id | String | 请求ID |
Transaction
名称 | 类型 | 描述 |
---|---|---|
id | String | 交易ID |
state | String | 交易状态,”VALID” 表示合法交易,其它值表示非法交易 |
from | String | 交易的发起者,格式为 <组织MSP>.<用户名> |
to | String | 交易调用的目标链码名称 |
input | String | 经过 JSON 编码的链码调用参数 |
events | List<Event> | 交易所产生的区块链事件列表 |
data | Object | 交易的详细内容,数据结构为交易中的 common.Payload |
Event
名称 | 类型 | 描述 |
---|---|---|
id | String | 事件ID,通道内唯一 |
name | String | 事件名称 |
type | EventType | 事件类型(“Tx”, “Config”, “Contract”, “Block”),该接口返回的结果只包含“Contract”类型事件(如有) |
content | String | 当EventType为“Contract”时,为经过Base64编码的智能合约事件内容(如有) |
示例
请求示例
curl -X GET "http://your.gateway.endpoint/api/v1/networks/channel3/transactions/e49d411a2ff32caa1688b5e0a07a957d2d8a4c8c124554772d07145214b3ba13" -H "accept: application/json" -H "Authorization: Bearer <Your Access Token>"
正常返回示例
{
"Success": true,
"Result": {
"id": "e49d411a2ff32caa1688b5e0a07a957d2d8a4c8c124554772d07145214b3ba13",
"state": "VALID",
"from": "e2ehmfqasthMSP.octopus_26842_12345678901234",
"to": "sacc",
"input": "[\"set\",\"provider\",\"aliyun3\"]",
"events": null,
"data": {
"data": {
"actions": [
{
"header": {
"creator": {
"id_bytes": "LS0tLS1CR...SUZJQ0FURS0tLS0tCg==",
"mspid": "e2ehmfqasthMSP"
},
"nonce": "HdQ823siiR5yzRq/sGkrD0y6jTMOVkuG"
},
"payload": {
"action": {
"endorsements": [
{
"endorser": "Cg5lMmVobW...S0tLS0tCg==",
"signature": "MEQCIHm9YG6PbIUpqa3DF6l6h5vRTQxbGVyWkiYqOAIX5pa2AiBFQNvTfzlf951oj/ki0eGbB0AV9fGwBA8TpXMhyoGdgg=="
}
],
"proposal_response_payload": {
"extension": {
"chaincode_id": {
"name": "sacc",
"path": "",
"version": "3.0"
},
"events": null,
"response": {
"message": "",
"payload": "YWxpeXVuMw==",
"status": 200
},
"results": {
"data_model": "KV",
"ns_rwset": [
{
"collection_hashed_rwset": [],
"namespace": "lscc",
"rwset": {
"metadata_writes": [],
"range_queries_info": [],
"reads": [
{
"key": "sacc",
"version": {
"block_num": "16",
"tx_num": "0"
}
}
],
"writes": []
}
},
{
"collection_hashed_rwset": [],
"namespace": "sacc",
"rwset": {
"metadata_writes": [],
"range_queries_info": [],
"reads": [],
"writes": [
{
"is_delete": false,
"key": "provider",
"value": "YWxpeXVuMw=="
}
]
}
}
]
}
},
"proposal_hash": "dEy87BXYByKTxVjk2A0XMViX402pbHQOjAq/Y6i0XG0="
}
},
"chaincode_proposal_payload": {
"TransientMap": {},
"input": {
"chaincode_spec": {
"chaincode_id": {
"name": "sacc",
"path": "",
"version": ""
},
"input": {
"args": [
"c2V0",
"cHJvdmlkZXI=",
"YWxpeXVuMw=="
],
"decorations": {},
"is_init": false
},
"timeout": 0,
"type": "GOLANG"
}
}
}
}
}
]
},
"header": {
"channel_header": {
"channel_id": "channel3",
"epoch": "0",
"extension": "EgYSBHNhY2M=",
"timestamp": "2020-02-13T08:09:31.588293471Z",
"tls_cert_hash": null,
"tx_id": "e49d411a2ff32caa1688b5e0a07a957d2d8a4c8c124554772d07145214b3ba13",
"type": 3,
"version": 0
},
"signature_header": {
"creator": {
"id_bytes": "LS0tLS1CR...0FURS0tLS0tCg==",
"mspid": "e2ehmfqasthMSP"
},
"nonce": "HdQ823siiR5yzRq/sGkrD0y6jTMOVkuG"
}
}
}
},
"Error": {
"code": 200,
"message": "Success",
"request_id": "759fb8ee-9763-4355-b742-becc81cb7bf5"
}
}
错误码
请参考错误码
文档内容是否对您有帮助?