Search

[INDEXER] Search for Transactions

Changed on

/search/transactions allows the caller to search for transactions that meet certain conditions. Some conditions include matching a transaction hash, containing an operation with a certain status, or containing an operation that affects a certain account.

/search/transactions is considered an "indexer" endpoint and Rosetta implementations are not required to complete it to adhere to the Rosetta spec. However, any Rosetta "indexer" MUST support this endpoint.

post/search/transactions

Request

  • The document declares no server URL.
  • Auth
    none declared

Request body

SearchTransactionsRequest required

SearchTransactionsRequest is used to search for transactions matching a set of provided conditions in canonical blocks.

network_identifier, NetworkIdentifier required

The network_identifier specifies which network a particular object is associated with.

operator, 'or' | 'and'

Operator is used by query-related endpoints to determine how to apply conditions.

If this field is not populated, the default and value will be used.

max_block, integer

max_block is the largest block index to consider when searching for transactions. If this field is not populated, the current block is considered the max_block.

If you do not specify a max_block, it is possible a newly synced block will interfere with paginated transaction queries (as the offset could become invalid with newly added rows).

offset, integer

offset is the offset into the query result to start returning transactions.

If any search conditions are changed, the query offset will change and you must restart your search iteration.

limit, integer

limit is the maximum number of transactions to return in one call. The implementation may return <= limit transactions.

transaction_identifier, TransactionIdentifier

The transaction_identifier uniquely identifies a transaction in a particular network and block or in the mempool.

account_identifier, AccountIdentifier

The account_identifier uniquely identifies an account within a network. All fields in the account_identifier are utilized to determine this uniqueness (including the metadata field, if populated).

coin_identifier, CoinIdentifier

CoinIdentifier uniquely identifies a Coin.

currency, Currency

Currency is composed of a canonical Symbol and Decimals. This Decimals value is used to convert an Amount.Value from atomic units (Satoshis) to standard units (Bitcoins).

status, string

status is the network-specific operation type.

type, string

type is the network-specific operation type.

address, string

address is AccountIdentifier.Address. This is used to get all transactions related to an AccountIdentifier.Address, regardless of SubAccountIdentifier.

success, boolean

success is a synthetic condition populated by parsing network-specific operation statuses (using the mapping provided in /network/options).

Example request

{
  "network_identifier": {
    "blockchain": "bitcoin",
    "network": "mainnet",
    "sub_network_identifier": {
      "network": "shard 1",
      "metadata": {
        "producer": "0x52bc44d5378309ee2abf1539bf71de1b7d7be3b5"
      }
    }
  },
  "max_block": 5,
  "offset": 5,
  "limit": 5,
  "transaction_identifier": {
    "hash": "0x2f23fd8cca835af21f3ac375bac601f97ead75f2e79143bdf71fe2c4be043e8f"
  },
  "account_identifier": {
    "address": "0x3a065000ab4183c6bf581dc1e55a605455fc6d61",
    "sub_account": {
      "address": "0x6b175474e89094c44da98b954eedeac495271d0f"
    }
  },
  "coin_identifier": {
    "identifier": "0x2f23fd8cca835af21f3ac375bac601f97ead75f2e79143bdf71fe2c4be043e8f:1"
  },
  "currency": {
    "symbol": "BTC",
    "decimals": 8,
    "metadata": {
      "Issuer": "Satoshi"
    }
  },
  "status": "reverted",
  "type": "transfer",
  "address": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
}

Response

Expected response to a valid request

SearchTransactionsResponse required

SearchTransactionsResponse contains an ordered collection of BlockTransactions that match the query in SearchTransactionsRequest. These BlockTransactions are sorted from most recent block to oldest block.

transactions, BlockTransaction[] required

transactions is an array of BlockTransactions sorted by most recent BlockIdentifier (meaning that transactions in recent blocks appear first).

If there are many transactions for a particular search, transactions may not contain all matching transactions. It is up to the caller to paginate these transactions using the max_block field.

total_count, integer required

total_count is the number of results for a given search. Callers typically use this value to concurrently fetch results by offset or to display a virtual page number associated with results.

next_offset, integer

next_offset is the next offset to use when paginating through transaction results. If this field is not populated, there are no more transactions to query.

Example response

{
  "transactions": [
    {
      "block_identifier": {
        "index": 1123941,
        "hash": "0x1f2cc6c5027d2f201a5453ad1119574d2aed23a392654742ac3c78783c071f85"
      },
      "transaction": {
        "transaction_identifier": {
          "hash": "0x2f23fd8cca835af21f3ac375bac601f97ead75f2e79143bdf71fe2c4be043e8f"
        },
        "operations": [
          {
            "operation_identifier": {
              "index": 5
            },
            "related_operations": [
              {
                "index": 1
              },
              {
                "index": 2
              }
            ],
            "type": "Transfer",
            "status": "Reverted",
            "account": {
              "address": "0x3a065000ab4183c6bf581dc1e55a605455fc6d61",
              "sub_account": {
                "address": "0x6b175474e89094c44da98b954eedeac495271d0f"
              }
            },
            "amount": {
              "value": "1238089899992",
              "currency": {
                "symbol": "BTC",
                "decimals": 8,
                "metadata": {
                  "Issuer": "Satoshi"
                }
              }
            },
            "coin_change": {
              "coin_identifier": {
                "identifier": "0x2f23fd8cca835af21f3ac375bac601f97ead75f2e79143bdf71fe2c4be043e8f:1"
              }
            },
            "metadata": {
              "asm": "304502201fd8abb11443f8b1b9a04e0495e0543d05611473a790c8939f089d073f90509a022100f4677825136605d732e2126d09a2d38c20c75946cd9fc239c0497e84c634e3dd01 03301a8259a12e35694cc22ebc45fee635f4993064190f6ce96e7fb19a03bb6be2",
              "hex": "48304502201fd8abb11443f8b1b9a04e0495e0543d05611473a790c8939f089d073f90509a022100f4677825136605d732e2126d09a2d38c20c75946cd9fc239c0497e84c634e3dd012103301a8259a12e35694cc22ebc45fee635f4993064190f6ce96e7fb19a03bb6be2"
            }
          }
        ],
        "related_transactions": [
          {
            "network_identifier": {
              "blockchain": "bitcoin",
              "network": "mainnet",
              "sub_network_identifier": {
                "network": "shard 1",
                "metadata": {
                  "producer": "0x52bc44d5378309ee2abf1539bf71de1b7d7be3b5"
                }
              }
            },
            "transaction_identifier": {
              "hash": "0x2f23fd8cca835af21f3ac375bac601f97ead75f2e79143bdf71fe2c4be043e8f"
            }
          }
        ],
        "metadata": {
          "size": 12378,
          "lockTime": 1582272577
        }
      }
    }
  ],
  "total_count": 5,
  "next_offset": 5
}

Changes

    • breaking

      added the new required request property account_identifier/address

    • breaking

      added the new required request property network_identifier/blockchain

    • breaking

      added the new required request property network_identifier/network

    14 more changes in this revision