Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

What you cannot do privately

Nobody can make a private actor act

A private handler runs only inside a proof made by a holder of the account’s keys. A stored message that the owner never collects never runs.

Consequence: You cannot build “anyone can trigger this” on private state. A liquidation, a timeout or a penalty cannot reach into a private account.

Way around: Put what must be enforceable in a public actor, where a private participant posts a bond and the public actor acts on a deadline: answer in time, or lose the bond. See the public referee pattern in The pattern language.

One owner’s private accounts per transaction

A transaction can run private handlers only for accounts whose keys the submitter holds, so two people’s private accounts cannot both act in one transaction.

Consequence: No atomic private-to-private exchange between two parties.

Way around: A public escrow actor in the middle, with a timeout. Or a group-owned private account, when the parties trust each other with visibility.

A SyncMessage cannot reach a stranger’s private actor

Only an AsyncMessage can, and an AsyncMessage waits.

Consequence: You cannot ask “does Bob’s private account hold a badge?” and get an answer in the same transaction.

Way around: Bob proves it himself, in his own transaction, to a public actor.

Private state belongs to one key holder

There is no private state that two mutually distrusting parties can both update.

Way around: A group secret gives shared private accounts, with three costs: every member sees everything, membership cannot shrink without moving to a new secret, and any member can stall the others, since each update replaces the account’s commitment, so a member who keeps updating it makes everyone else’s pending transactions stale.

Whatever crosses to public is public

A private actor’s message to a public actor is published in full. See What a private transaction reveals.

Consequence: A private bidder’s bid to a public auction is visible, unless the message carries only a commitment to it.

Way around: Commit now, reveal later. Hide the sender behind a blinded address.

A public sender’s stored message is in the clear

A public actor that sends an async message to a private address publishes it.

Way around: Route value through a private actor first, so the async message is sealed.

A reply from public to private is fixed at proving time

The prover never reads public state. When a public actor replies to a private one inside a private transaction, the wallet predicts the reply from the public state it reads while building, the proof commits to that prediction, and settlement checks the live reply against it (The boundary). If the state the reply depends on changes before the transaction lands, the reply differs and the transaction fails.

Consequence: A private actor cannot reliably read fast-changing public state, such as the clock read at a fine granularity or a busy pool’s reserves.

Way around: Read coarse or slow-moving values. Or do not read: assert a range and let the transaction fail if the range no longer holds.

Collecting costs a proof

The protocol lets one transaction collect several stored messages: one as its root, the others as claims queued ahead of it, within the zone’s cap of eight private actions per transaction (MAX_PRIVATE_ACTIONS, lez/programs/fee/core/src/market.rs). The reference wallet claims only native credits this way, up to four into a private transaction it builds for the receiving account (Collecting), and collects any other message as the root of its own transaction. So with the reference wallet, draining N native credits takes about N/5 proofs, and N other messages take N.

Consequence: Designs that send many small non-credit messages to a private actor are expensive for the receiver.

Way around: Accumulate on the public side and send one message. Or let the sender batch.

A stored message is never returned

A stored message is not delivered in the transaction that sent it, so nothing that happens to it later can change that transaction. If the recipient never collects it, or its handler refuses it, the protocol returns nothing to the sender.

Way around: Receiving handlers for value must accept every legitimate message, or offer the owner a repair path. A sender who may want value back needs a return path in the program: a deadline after which they may reclaim, enforced by a public actor.

Events are dropped privately

A private handler’s events are not published.

Way around: If an indexer must see something, send it to a public actor that emits the event.

No randomness, no oracles

A handler is deterministic and sees only its input (the message, its own state on the receiving account, the sender and its grants) and the replies it gets. There is no randomness beacon and no price feed. Built-in programs answer two questions: the clock gives the block id and timestamp (ReadBlockId, ReadTimestamp), and the native token gives an account’s balance (ReadState). Neither brings in anything from outside the chain.

Way around: Commit-reveal between participants for randomness. A public actor fed by a trusted signer for external data.

Linkability is the user’s job

  • A blinded address reused is linkable to itself.
  • A signature links its account to the whole transaction.
  • Timing links transactions that look related.

Things that are fine

  • Paying a private account from its keys or an address it gave you, while it is offline.
  • A private actor acting on a public program under a pseudonym.
  • A public program trusting a statement about private state, when the statement comes from its own code.
  • Mixing public and private actors of the same program in one transaction, when you own the private ones.
  • Keeping a whole application’s state in a group-owned private account.