Skip to content

getTransactions

AxVultis edited this page Nov 12, 2022 · 2 revisions

The getTransactions method returns an array of block and transaction hashes. Transaction consists of transfers. Transfer is an amount-address pair. There could be several transfers in a single transaction.

Note: if paymentId parameter is set, getTransactions method returns transactions that contain specified payment_id. (in the set block range). Also, if addresses parameter is set, getTransactions method returns transactions that contain transfer from at least one of specified addresses. When both above-mentioned parameters are set, getTransactions method returns transactions that contain both specified payment_id and transfer from at least one of specified addresses.

Request Format

JSON-RPC

 {
  "jsonrpc": "2.0",
  "id": 13,
  "method": "getTransactions",
  "params": {
    "blockCount": 100,
    "firstBlockIndex": 0,
    "addresses": [
      "ccx7dehAGh837bfSfo18wJ1WzeCUWnzv3D23hvR8npyhHxoa6E3WXqNgTfHaWbAYRPdUhEXXEeKeEG7okKGHA8CZ3onHHofFDJ",
      "ccx7Sh1w3q9jmrzw3XkKPRBa4ZB8mxp5rH4Rm4cWJgDYNNahMKoEuYxgTfHaWbAYRPdUhEXXEeKeEG7okKGHA8CZ3onHF7W6gc"
    ]
  }
}

Request Details:

Argument Mandatory Description Format
addresses No Addresses to include array of strings
blockCount Yes The number of blocks to return int
blockHash No The hash of the first block to include. This field is mandatory if firstBlockIndex is not set string
firstBlockIndex No The height of the first block to include. This field is mandatory if blockHash is not set int
paymentId No A paymentId that must be used in the returned transaction hashes string

Response Format

JSON-RPC

 {
  "jsonrpc": "2.0",
  "id": 13,
  "result": {
    "items": [
      {
        "blockHash": "01bd06ca731914f27e143bbb902ce0bc05bff13d76faa027ea817e68f217488c",
        "transactions": [
          {
            "fee": 1000,
            "extra": "0127cea59bfadc49aa02ed4a225936671e55607b5241621abca2a5e14405906dbb",
            "timestamp": 1446029698,
            "blockIndex": 1,
            "state": 0,
            "transactionHash": "06ec210a8359f253f8b2160a0d6040cf89f2a05a553aaa577b7f508ee5d831f9",
            "amount": 6000000,
            "unlockTime": 11,
            "transfers": [
              {
                "amount": 6000000,
                "type": 0,
                "address": "ccx7dehAGh837bfSfo18wJ1WzeCUWnzv3D23hvR8npyhHxoa6E3WXqNgTfHaWbAYRPdUhEXXEeKeEG7okKGHA8CZ3onHHofFDJ"
              }
            ],
            "paymentId": "",
            "isBase": true
          }
        ]
      },
      {
        "blockHash": "28aa7d32f4274f6387969d7671bd4db98fd871bf0dd510a1df5e2ef4b1d41a35",
        "transactions": [
          {
            "fee": 1000,
            "extra": "01a8e6e408282b2ddf343e20d5e9aab283723ba10ab7ab7b3131f6981b02a84431",
            "timestamp": 1446029698,
            "blockIndex": 2,
            "state": 0,
            "transactionHash": "922d00d2e6eaed63f62d8e3b968cb08b6ea5c555fe0e6af948ab06efe6eb213a",
            "amount": 1001000,
            "unlockTime": 12,
            "transfers": [
              {
                "amount": 1000000,
                "type": 0,
                "address": "ccx7dehAGh837bfSfo18wJ1WzeCUWnzv3D23hvR8npyhHxoa6E3WXqNgTfHaWbAYRPdUhEXXEeKeEG7okKGHA8CZ3onHHofFDJ"
              }
            ],
            "paymentId": "",
            "isBase": false
          }
        ]
      }
    ]
  }
}

Response Details:

Argument Description Format
items Contains (see table below) array

Item Details:

Argument Description Format
blockHash The hash of the block string
transactions Contains (see table below) array

Transaction Details:

Argument Description Format
transactionHash hash of the transaction string
amount amount of the transaction int
blockIndex number of the block that contains a transaction int
confirmations number of confirmations int
depositCount number of deposits in the transaction int
extra string
fee transaction fee int
firstDepositId depositId of the first deposit in the transaction int
isBase shows if the transaction is a coinbase transaction boolean
paymentId paymentId of the transaction string
state state of the transaction int
timestamp timestamp of the transaction int
unlockTime height of the block when transaction is going to be available for spending int
transfers Contains (see table below) array

Transfer Details:

Argument Description Format
address address string
amount amount transferred int
message string
type The type of transfer int
Clone this wiki locally