back to methods summary

The getTransactions method returns an array of block and transaction hashes.

A transaction consists of transfers. Transfer is an amount-address pair. There could be several transfers in a single transaction.

Input:

ArgumentMandatoryDescriptionFormatExample
addresses No Array of (string) addressarray
blockHashOnly one of these parameters : blockHash or firstBlockIndex.Hash of the starting blockstring4306a17026cc3156d8dd316efe827af7ee5b64c6849a900717f13967833517f5
firstBlockIndexOnly of these parameters : blockHash or firstBlockIndex.Starting heightuint321000
blockCount Yes Number of blocks to return transaction hashes fromuint3210
paymentId No Valid string372209c11ea6f6563ff319285fb2625dfbcde2573d1c32a585b1898639072912

Note: if paymentId parameter is set, getTransactions method returns transactions that contain specified payment_id. (in the set block range)

Note: if addresses parameter is set, getTransactions method returns transactions that contain transfer from at least one of specified addresses.

Note: if 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.

Output:

Array that contains:

  • block_hash - string - hash of the block which contains a transaction
  • transactions - array - contains
    • transactionHash - string - hash of the transaction
    • blockIndex - uint32 - number of the block that contains a transaction
    • timestamp - uint64 - timestamp of the transaction
    • isBase - boolean - shows if the transaction is a coinbase transaction or not
    • unlockTime - uint64 - height of the block when transaction is going to be available for spending
    • amount - int64 - amount of the transaction
    • fee - uint64- transaction fee
    • extra - string
    • paymentId - string - payment_id of the transaction (optional)
    • transfers - array - contains
      • address - string
      • amount - int64

Input example:

{  
  "params":{  
     "blockCount":5,
     "firstBlockIndex":1000,
     "addresses":[  
        "ir48V76oJqAhYpGmsJgn79Yk6vvwYhU2cDc7azm3UW8C4EyzhhEDUUQjXtrbwzwpJ6Kp2ebwHErWD9VxBVnmXBk41oDB3Lt4j"
     ],
     "paymentId":"372209c11ea6f6563ff319285fb2625dfbcde2573d1c32a585b1898639072912"
  },
  "jsonrpc":"2.0",
  "id":"test",
  "method":"getTransactions"
}

$ curl -s -X POST -d '{"params":{"blockCount":5,"firstBlockIndex":1000,"addresses":["ir48V76oJqAhYpGmsJgn79Yk6vvwYhU2cDc7azm3UW8C4EyzhhEDUUQjXtrbwzwpJ6Kp2ebwHErWD9VxBVnmXBk41oDB3Lt4j"]},"jsonrpc":"2.0","id":"test","method":"getTransactions"}' localhost:14101/json_rpc | jq

Output example:

{
  "id": "test",
  "jsonrpc": "2.0",
  "result": {
    "items": [
      {
        "blockHash": "8bee40d72c4280d4c78aea25c929eaf7a33e91d1437e03549eb1dde6c4a7d17e",
        "transactions": [
          {
            "amount": 9500432607,
            "blockIndex": 1000,
            "extra": "0122c9d74f14f6a721329a48c0344c8f6674bccaa8ef216ff2849b9e59442c2b33",
            "fee": 0,
            "isBase": true,
            "paymentId": "",
            "state": 0,
            "timestamp": 1622597634,
            "transactionHash": "2079ed98eefdb73b8897352e832307b1a9f2211f066083483869dc6fb808b418",
            "transfers": [
              {
                "address": "ir48V76oJqAhYpGmsJgn79Yk6vvwYhU2cDc7azm3UW8C4EyzhhEDUUQjXtrbwzwpJ6Kp2ebwHErWD9VxBVnmXBk41oDB3Lt4j",
                "amount": 9500432607,
                "type": 0
              }
            ],
            "unlockTime": 1020
          }
        ]
      },
      {
        "blockHash": "5adf22137d4f57e610f05a8b06bd8cbb8c8a5588174f94a73804d9bb11cb27ea",
        "transactions": [
          {
            "amount": 9500360125,
            "blockIndex": 1002,
            "extra": "014aefe3be47743af612f7d84dc1e3f36c476b20ce67f525ccce20391847ca6681",
            "fee": 0,
            "isBase": true,
            "paymentId": "",
            "state": 0,
            "timestamp": 1622597897,
            "transactionHash": "6bf8241be99ea1360916f24b9fb75c6008d28da852b76eb638ca809c0778dfbc",
            "transfers": [
              {
                "address": "ir48V76oJqAhYpGmsJgn79Yk6vvwYhU2cDc7azm3UW8C4EyzhhEDUUQjXtrbwzwpJ6Kp2ebwHErWD9VxBVnmXBk41oDB3Lt4j",
                "amount": 9500360125,
                "type": 0
              }
            ],
            "unlockTime": 1022
          }
        ]
      }
    ]
  }
}