walt/tables/tickets

tickets

one ticket per trade. the address comes from the trade's signature, so a trade can only pay once.

definition

ticket_address = find_program_address(
  ["ticket", coin_mint, sha256(trade_signature)],
  walt_program
)

what it is

a ticket is a small account that follows one trade from the moment it lands to the moment its thought is paid for. it holds the hash of the trade's signature, the wallet that traded, the class, the budget, and later the hashes of the receipt and the thought.

because the address is derived from the signature, opening a second ticket for the same trade fails. the account already exists. no counter and no list is needed to stop a trade from being used twice.

a ticket moves through four states and never goes back. open: the account exists and has no budget yet. paid: the fee has been converted and the payment for the thought has settled. settled: both hashes are written and the leftover has been burned. void: the trade could not be confirmed and the budget went straight to the burn.

seeds of the loaded trades

signaturesha256(signature)size usdclass

notes

the seed column is the real hash of each real signature. the full ticket address also needs the program id, so it is not shown here.

a ticket is 178 bytes. the byte layout is drawn on the accounts page.

figure

a ticket only moves forward.

columns

columntypemeaning
trade_sig_hash[u8; 32]sha256 of the trade signature
payerpubkeywallet that made the trade
size_usd_microsu64trade size in millionths of a dollar
classu80 to 3, from the size
budget_usdcu64usdc set aside for this thought
statusu80 open, 1 paid, 2 settled, 3 void
receipt_hash[u8; 32]hash of the payment receipt
thought_hash[u8; 32]hash of the thought text
read_costu64usdc spent on chain reads
opened_slotu64slot the ticket was opened
settled_slotu64slot the ticket was settled
walt/tables/tickets: one address per trade, derived from its signature.