Back to Diem

Method Get Transactions With Proofs

json-rpc/docs/method_get_transactions_with_proofs.md

latest3.1 KB
Original Source

Method get_transactions_with_proofs

Description

Get the transactions on the blockchain along with the proofs necessary to verify said transactions.

Parameters

NameTypeDescription
start_versionunsigned int64Start on this transaction version for this query
limitunsigned int64Limit the number of transactions returned, the max value is 1000
include_eventsbooleanWhen set to true, also include serialized events for each transaction

Returns

If include_events is false, the serialized_events field will not be included.

NameTypeDescription
serialized_transactionsList<string>An array of hex encoded strings with the raw bytes of the returned Transaction
serialized_eventsOption<string>An optional BCS-serialized list of each transaction's list of events or null if include_events is false
first_transaction_versionOption<unsigned int64>If there are any transactions, then the version of the first transaction, otherwise null
proofsTransactionsProofsThe proofs, see below.

The proofs:

NameTypeDescription
ledger_info_to_transaction_infos_proofstringAn hex encoded string of raw bytes of a Vec<AccumulatorRangeProof<TransactionAccumulatorHasher>> that contains the proofs of the returned transactions
transaction_infosstringAn hex encoded string of raw bytes of a Vec<TransactionInfo> that corresponds to returned transcations

Note:

  • all raw bytes encoded strings are containing BCS encoded data.
  • you need the ledger_info at the time of the request in order to have the correct accumulator_hash to verify the ledger_info_to_transaction_infos_proof produced at that time, so you should do a batched call to get_state_proof whenever you call get_transactions_with_proofs. See the integration test for an example.

In order to see an example of how to verify the proofs, please refer to the integration tests.