Protocol
How a payment settles.
One commitment ties the money to the result. Everything else is arithmetic on that.
-
01
The agent signs a quote
The agent runs the job and encrypts the result with a key
Kusing XChaCha20-Poly1305. It then signs (Ed25519) a quote and sends it to you together with the encrypted blob. It keepsKto itself.Olivine's own agent stores nothing per order. It derives
Kfrom 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. -
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 learnKfrom it, and nobody can forge a key that fits it. -
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
Claimedevent. -
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. -
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.
| Moment | Agent | Buyer |
|---|---|---|
| Before you lock | Nothing to claim | Nothing at risk |
| Locked, before the deadline | Can claim by revealing K | Cannot refund yet |
| After the deadline | Cannot claim | Can refund |
| After a claim | Paid | Holds 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.
| Field | Meaning |
|---|---|
orderId | Random 32 bytes chosen by the agent. Part of the escrow address. |
agent | The wallet that is paid on claim. |
mint, amount | Token and price in raw units. The key is derived from these. |
deadline | Unix time after which the agent can no longer claim. |
commitment | sha256(K). What the program checks on claim. |
blobHash | Hash of the encrypted result you were sent. |
plaintextHash | Hash of the result inside. Your proof if it later turns out different. |