Module transaction_union_payload

Module transaction_union_payload 

Source
Expand description

Unified transaction representation for SNARK circuits

This module provides a single, unified structure (TransactionUnion) that can represent all transaction types (payments, stake delegations, fee transfers, coinbase) for SNARK circuit processing. This enables efficient proof generation by using a single circuit design regardless of the specific transaction type.

§Transaction Union

The TransactionUnion type encodes all transaction variants using a tagged union approach:

  • Common: Fields present in all transactions (fee, nonce, memo, etc.)
  • Body: Transaction-specific fields with interpretation based on Tag
  • Tag: Discriminates between Payment, StakeDelegation, FeeTransfer, and Coinbase

§Field Interpretation

Fields in Body are interpreted differently based on the Tag value:

  • Payment: source_pk and receiver_pk are sender and recipient
  • Stake Delegation: receiver_pk is the new delegate
  • Fee Transfer: receiver_pk is the fee recipient, amount is the fee
  • Coinbase: receiver_pk is the block producer, amount is the reward

§Receipt Chain Hash

This module also provides functions for computing receipt chain hashes, which commit to the sequence of transactions applied to an account:

§Timing and Vesting

The module implements timing validation for timed (vested) accounts:

Timed accounts have a minimum balance that decreases over time according to a vesting schedule. When the minimum balance reaches zero, the account automatically becomes untimed.

§Account Helpers

Utility functions for account operations:

Structs§

Body
Common
MinBalance 🔒
TransactionUnion
TransactionUnionPayload

Enums§

ExistingOrNew
Tag
TimingValidation

Functions§

account_check_timing
add_amount
checked_cons_signed_command_payload
Returns the new receipt_chain_hash
cons_signed_command_payload
Returns the new receipt_chain_hash
cons_zkapp_command_commitment
prepend account_update index computed by Zkapp_command_logic.apply
get_account
get_with_location
set_account
sub_amount
timing_error_to_user_command_status
validate_nonces
validate_timing
validate_timing_with_min_balance 🔒
validate_timing_with_min_balance_impl 🔒