Docs/Reference
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.
| Event | Emitted by | Says |
|---|---|---|
PaymentAnnouncement | pay | What a payment publishes |
WhitelistChanged | admit, remove | A leaf written or cleared, and the new root |
DepositRecorded | deposit | A wallet's deposit into a balance key |
WithdrawalRecorded | withdraw | A 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:
| Offset | Bytes | Content |
|---|---|---|
| 0 | 8 | The event tag e445a52e51cb9a1d, the same for every Anchor event |
| 8 | 8 | The event's discriminator |
| 16 | The 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.
| Offset | Bytes | Field | Type | What it holds |
|---|---|---|---|---|
| 0 | 32 | stealth_address | [u8; 32] | P, packed. |
| 32 | 32 | ephemeral_key | [u8; 32] | R, packed. |
| 64 | 1 | view_tag | u8 | The low byte of Poseidon(1, Q.x, Q.y). |
| 65 | 32 | audit_c1 | [u8; 32] | c1 = kG, packed. |
| 97 | 32 | audit_c2 | [u8; 32] | c2 = S + kA, packed. |
| 129 | 32 | whitelist_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.
| Offset | Bytes | Field | Type | What it holds |
|---|---|---|---|---|
| 0 | 8 | revision | u64 | The revision after the change. |
| 8 | 4 | index | u32 | The leaf index that changed. |
| 12 | 32 | leaf | [u8; 32] | The leaf admitted or removed. |
| 44 | 32 | root | [u8; 32] | The root after the change. |
| 76 | 1 | admitted | bool | True 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.
| Offset | Bytes | Field | Type | What it holds |
|---|---|---|---|---|
| 0 | 32 | wallet | pubkey | The depositing wallet. |
| 32 | 32 | owner_point | [u8; 32] | The packed balance key that owns the new note. |
| 64 | 8 | amount | u64 | Lamports deposited. |
A holder's scan uses it to find the deposits made to their balance keys.
#WithdrawalRecorded
Discriminator 2478c2086f24accf.
| Offset | Bytes | Field | Type | What it holds |
|---|---|---|---|---|
| 0 | 32 | destination | pubkey | The wallet paid. |
| 32 | 8 | amount | u64 | Lamports paid to it, fees excluded. |