DocsEvents

DocsReference25 of 33 · 2 min read

Events

Every event the Liora program emits, byte by byte, and how to read one from a transaction.

The program emits four events. Each is recorded as an inner instruction of the transaction, which keeps it out of the log and its size limit.

EventEmitted bySays
PaymentAnnouncementpayWhat a payment publishes
WhitelistChangedadmit, removeA leaf written or cleared, and the new root
DepositRecordeddepositA wallet's deposit into a balance key
WithdrawalRecordedwithdrawA payout to a public wallet

#Reading an event

An event is an inner instruction that the Liora program sends to itself, signed by its event authority (seed __event_authority). Its data is:

OffsetBytesContent
08The event tag e445a52e51cb9a1d, the same for every Anchor event
88The event's discriminator
16The fields, in Borsh

The offsets in the tables below count from the start of the fields. Integers are little-endian. Packed points and field elements are 32 bytes as Announcements describes them.

Rings transactions are version 1 messages. Ask the RPC for them with maxSupportedTransactionVersion: 1, and read the events of successful transactions only: a failed transaction emits nothing that counts.

#PaymentAnnouncement

Discriminator e6bee1d441e8ef6c. Every field has a fixed size.

OffsetBytesFieldTypeWhat it holds
032stealth_address[u8; 32]P, packed.
3232ephemeral_key[u8; 32]R, packed.
641view_tagu8The low byte of Poseidon(1, Q.x, Q.y).
6532audit_c1[u8; 32]c1 = kG, packed.
9732audit_c2[u8; 32]c2 = S + kA, packed.
12932whitelist_root[u8; 32]The root the proof was made against, big-endian.

The program emits it after the payment's proof has verified and the transfer has gone through. The API serves the same fields as hex, with audit_c1 and audit_c2 together as auditCiphertext.

#WhitelistChanged

Discriminator 12b6f720d9644f7a.

OffsetBytesFieldTypeWhat it holds
08revisionu64The revision after the change.
84indexu32The leaf index that changed.
1232leaf[u8; 32]The leaf admitted or removed.
4432root[u8; 32]The root after the change.
761admittedboolTrue for an admission, false for a removal.

Replaying these events in order rebuilds the whole tree: write leaf at index when admitted is true, clear it when false, and compare the root you compute with root.

#DepositRecorded

Discriminator 00df5aebb7f84f43.

OffsetBytesFieldTypeWhat it holds
032walletpubkeyThe depositing wallet.
3232owner_point[u8; 32]The packed balance key that owns the new note.
648amountu64Lamports deposited.

A holder's scan uses it to find the deposits made to their balance keys.

#WithdrawalRecorded

Discriminator 2478c2086f24accf.

OffsetBytesFieldTypeWhat it holds
032destinationpubkeyThe wallet paid.
328amountu64Lamports paid to it, fees excluded.