For the complete documentation index, see llms.txt. This page is also available as Markdown.

get_transactions - Nervos

Example code for the get_transactions JSON-RPC method. Complete guide on how to use get_transactions JSON-RPC in GetBlock Web3 documentation.

Returns transactions matching a lock or type script filter. Used to build transaction history for an address. Paginated; supports two response formats (grouped vs ungrouped).

Parameters

Parameter
Type
Required
Description

search_key

SearchKey

Yes

Search criteria — script, script_type, optional filter, group_by_transaction

order

string

Yes

asc or desc

limit

Uint32

Yes

Maximum results per page

after

string

No

Cursor from previous response

Request Example

curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "get_transactions",
    "params": [
        {
            "script": {
                "code_hash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
                "hash_type": "type",
                "args": "0xb39d53656421a3895eb35a627d4a6e76dd4afba6"
            },
            "script_type": "lock"
        },
        "desc",
        "0x32"
    ],
    "id": "getblock.io"
}'
import axios from 'axios';

const data = JSON.stringify({
    "jsonrpc": "2.0",
    "method": "get_transactions",
    "params": [
        {
            "script": {
                "code_hash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
                "hash_type": "type",
                "args": "0xb39d53656421a3895eb35a627d4a6e76dd4afba6"
            },
            "script_type": "lock"
        },
        "desc",
        "0x32"
    ],
    "id": "getblock.io"
});

const config = {
    method: 'post',
    url: 'https://go.getblock.io/<ACCESS-TOKEN>/',
    headers: {
        'Content-Type': 'application/json'
    },
    data: data
};

axios(config)
    .then(response => console.log(JSON.stringify(response.data, null, 2)))
    .catch(error => console.log(error));

Response Example

Response Parameters

Field
Type
Description

result.objects

array of TxRecord or TxGroupRecord

Matching transactions

result.objects[].tx_hash

H256

Transaction hash

result.objects[].block_number

Uint64

Block number containing the transaction

result.objects[].io_type

string

input or output — whether the script appeared in inputs or outputs

result.objects[].io_index

Uint32

Index of the input/output in the transaction

result.last_cursor

string

Cursor for pagination

Use Cases

  • Wallet transaction history for an address

  • Building activity feeds for accounts

  • Backfill of historical activity for indexers

Error Handling

Status Code
Error Message
Cause

403

Forbidden

Missing or invalid <ACCESS-TOKEN>

-32602

Invalid params

Request parameters are missing or malformed

-32601

Method not found

Method does not exist or is not enabled on this node

-32603

Internal error

Server-side error while processing the request

429

Too Many Requests

Rate limit exceeded for your plan

SDK Integration

Was this helpful?