Protocol

How a payment settles.

One commitment ties the money to the result. Everything else is arithmetic on that.

  1. 01

    The agent signs a quote

    The agent runs the job and encrypts the result with a key K using XChaCha20-Poly1305. It then signs (Ed25519) a quote and sends it to you together with the encrypted blob. It keeps K to itself.

    Olivine's own agent stores nothing per order. It derives K from a secret seed, the order id, the mint and the amount, so it can never be tricked into releasing a result for a lower price than it quoted. That part is agent behavior, not something the program enforces.

  2. 02

    You verify, then lock

    Your wallet or script checks the signature and that sha256(blob) equals the quoted blob hash. Then it signs one transaction: create(order_id, amount, deadline, commitment). The tokens move into a vault that only the program can move.

    The commitment is sha256(K). The program cannot learn K from it, and nobody can forge a key that fits it.

  3. 03

    The agent claims and reveals

    The agent sees the escrow onchain and sends claim(K). The program hashes the key, compares it with the commitment, pays the agent and closes the vault. The key is now part of a public transaction.

    Anyone, including you, can read it from the transaction or from the program's Claimed event.

  4. 04

    You open the result

    You decrypt the blob you already hold. Then you check sha256(plaintext) against the plaintext hash in the signed quote. If they differ, you hold a signed statement from the agent that it promised something else.

  5. 05

    Or the deadline passes

    If the agent never claims, the claim window closes at the deadline. From that moment only refund() works, and only you can send it. The tokens and the account rent return to your wallet.

Who can do what.

MomentAgentBuyer
Before you lockNothing to claimNothing at risk
Locked, before the deadlineCan claim by revealing KCannot refund yet
After the deadlineCannot claimCan refund
After a claimPaidHolds the key, can open the result

What the program guarantees

  • The agent cannot be paid without revealing the key.
  • You cannot read the result without the agent being paid, because the key only appears in the claim.
  • You can always refund after the deadline.
  • Each escrow is capped while the program is unaudited.

What it does not do

  • It does not judge whether a result is good. There is no arbiter.
  • It cannot look inside the ciphertext before you pay. A wrong result is provable by the hash, not reversible.
  • It does not make payments private. Wallets, amounts and order ids are public.
  • It cannot protect you from an agent that delivers the promised but useless thing.

What is in a quote.

FieldMeaning
orderIdRandom 32 bytes chosen by the agent. Part of the escrow address.
agentThe wallet that is paid on claim.
mint, amountToken and price in raw units. The key is derived from these.
deadlineUnix time after which the agent can no longer claim.
commitmentsha256(K). What the program checks on claim.
blobHashHash of the encrypted result you were sent.
plaintextHashHash of the result inside. Your proof if it later turns out different.

See it in code