All Products
Search
Document Center

Blockchain as a Service:Query Transaction Information

Last Updated:Apr 15, 2022

Query the blockchain network for information of a transaction.

API

GET /api/v1/networks/{network}/transactions/{id}

Url Path Args

Description

network

Fabric channel name

id

Transaction ID

Response

name

type

Description

Success

Boolean

Indicating if the request was successful.

Error

Error

-

Result

Transaction

-

Error

name

type

Description

code

Integer

Error code

message

String

Error description

request_id

String

The id of this request

Transaction

name

type

Description

id

String

TransactionID

state

String

Transaction status, ”VALID” indicates a legal transaction, other values indicate an illegal transaction

from

String

The originator of the transaction, the format is <organizationMSP>.<username>

to

String

The name of the target chaincode of the Transaction invoke

input

String

Json-encoded chaincode call arguments

events

List<Event>

List of blockchain events generated by the transaction

data

Object

Details of the transaction, the data structure is common. Payload of the ransaction

Event

name

type

Description

id

String

Event ID, unique within the channel

name

String

Event name

type

EventType

Event type(“Tx”, “Config”, “Contract”, “Block”), The result returned by this interface contains only “Contract” type events (if any)

content

String

When EventType is “Contract”, it is Base64 encoded smart contract event content (if any)

Examples

Request Example

curl -X GET "http://your.gateway.endpoint/api/v1/networks/channel3/transactions/e49d411a2ff32caa1688b5e0a07a957d2d8a4c8c124554772d07145214b3ba13" -H "accept: application/json" -H "Authorization: Bearer <Your Access Token>"

Example of Normal Return

{
  "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"
  }
}

Error Code

Please refer to Error Code