Skip to main content

TransactionHash

Type Alias TransactionHash 

Source
pub type TransactionHash = SHA256Hash;
Expand description

Hash of a transaction body, the identifier users, events and indexers know a transaction by.

This is the SHA-256 hash of the XDR-encoded Transaction – the same encoding the signatures cover (see SignedTransaction). It deliberately covers neither the signatures wrapped around it by SignedTransaction nor the nondeterministic data attached to it by ProposedTransaction:

  • Excluding the signatures keeps the identifier fixed however the body is signed, so a submitter can look up its transaction without knowing which signing a block carried.
  • Excluding the proposal data keeps the identifier computable by the submitter at signing time. Nondeterministic proposal data does not exist until a proposer has executed the transaction, so an identifier covering it could not be used to look up one’s own transaction.

Proposals do not name transactions by this hash: they commit to each transaction’s exact signed encoding by SignedTransactionHash.

Uniqueness across blocks rests on replay protection – the Uniquifier every Transaction carries – rather than on anything in the preimage: two distinct commits can never share a hash, because the same Transaction cannot commit twice.

Aliased Type§

pub struct TransactionHash { /* private fields */ }