get_transaction - Nervos

Returns the information about a transaction requested by transaction hash.

Parameters

  • tx_hash - Hash of a transaction.
  • verbosity - Result format which allows 0, 1 and 2. (Optional, the defaults to 2.)

Returns

This RPC returns null if the transaction is not committed in the canonical chain nor the transaction memory pool.

If the transaction is in the chain, the block hash is also returned.

When verbosity=0, it’s response value is as same as verbosity=2, but it return a 0x-prefixed hex encoded molecule packed::Transaction on transaction field.

When verbosity is 1: The RPC does not return the transaction content and the field transaction must be null.

When verbosity is 2: if tx_status.status is pending, proposed, or committed, the RPC returns the transaction content as field transaction, otherwise the field is null.

Example

Request

curl --location --request POST 'https://ckb-mirana.unifra.io/v1/4fb36720a57340d39aee4cf68511064a' \
--header 'Content-Type: application/json' \
--data-raw '{
  "id": 42,
  "jsonrpc": "2.0",
  "method": "get_transaction",
  "params": [
    "0x037dafd7f9c6f742e8c9f225191b441b0b5c4e8b3c1e87c29a2f2ec2fbbf6934"
  ]
}'

Result

{
    "jsonrpc": "2.0",
    "result": {
        "transaction": {
            "cell_deps": [
                {
                    "dep_type": "dep_group",
                    "out_point": {
                        "index": "0x0",
                        "tx_hash": "0x71a7ba8fc96349fea0ed3a5c47992e3b4084b031a42264a018e0072e8172e46c"
                    }
                }
            ],
            "hash": "0x037dafd7f9c6f742e8c9f225191b441b0b5c4e8b3c1e87c29a2f2ec2fbbf6934",
            "header_deps": [],
            "inputs": [
                {
                    "previous_output": {
                        "index": "0x1",
                        "tx_hash": "0xcfa0a39cea905ebe56bbf7ea7eb0d6e7fafe8423ae0de6c56cea21a1a74123f3"
                    },
                    "since": "0x0"
                },
                {
                    "previous_output": {
                        "index": "0x0",
                        "tx_hash": "0xd08a4c845030c4d1683ffc23eb58bc681ca8074f8768d4451aadb124c87fdf30"
                    },
                    "since": "0x0"
                }
            ],
            "outputs": [
                {
                    "capacity": "0x2647c0b2a7",
                    "lock": {
                        "args": "0x217b919129ac2b238ee7ab467e1416ec2d09fc19",
                        "code_hash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
                        "hash_type": "type"
                    },
                    "type": null
                },
                {
                    "capacity": "0x1718c7a8d",
                    "lock": {
                        "args": "0x49ce8dd6f1a500189d8268d6a469829d786e1122",
                        "code_hash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
                        "hash_type": "type"
                    },
                    "type": null
                }
            ],
            "outputs_data": [
                "0x",
                "0x"
            ],
            "version": "0x0",
            "witnesses": [
                "0x5500000010000000550000005500000041000000e9e34740644108b93b52dc4c1b00756c30b5e87cf4ea55e319ac32a9fbde7e206fd1e50ba83cbc5bf43ee0408ec25a17506133da9fc6e4232459f70c3f1c446c01",
                "0x"
            ]
        },
        "tx_status": {
            "block_hash": "0xb3c5b9789dff3821e298a62e6cc4060accb19ed2558f988a8826573252b9ae20",
            "reason": null,
            "status": "committed"
        }
    },
    "id": 42
}
Language
Click Try It! to start a request and see the response here!