Intents
This page explains how intents and solving works within the Anoma protocol.
Intents, which are unbalanced transactions, can be become balanced transactions through composition with matching intents by other counterparties.
Anoma users submit their intents to an intent pool in the form of unbalanced transactions, which are received and processed by solvers that output balanced transactions. These transactions are then ordered and finally sent to the executor node, which verifies and executes the transactions in the determined order, updating the state.
Below, we show examples of a balanced transaction that can directly be executed and two flavors of intents (unbalanced transactions) requiring counterparty discovery.
Alice and Bob own apple 🍏 and banana 🍌 resources. Both want to swap their fruits and know exactly what they want. Both don't need to know each other.
Alice's intent
"I want to give 3🍏 for 2🍌."
3🍏 Alice
2🍌 Alice
Bob's intent
"I want to give 2🍌 for 3🍏."
2🍌 Bob
3🍏 Bob
Balanced txn (composition of Alice's and Bob's unbalanced txns)
Anyone seeing the two transactions (including Alice and Bob themselves) can compose the unbalanced transactions to obtain a balanced transaction containing two actions.
3🍏 Alice
2🍌 Alice
// Action Separator2🍌 Bob
3🍏 Bob
After execution,
Alice has swapped her 3🍏 Alice resource for a 2🍌 Alice resource,
Bob has swapped his 2🍌 Bob for a 3🍏 Bob resource.
This outcome is equivalent to two balanced transactions (see the previous tab) where both, Alice and Bob, transfer resources to one another.
Alice and Bob own apple 🍏 and banana 🍌 resources. Both want to swap some of their fruits within specific constraints. Both don't know each other.
Both, Alice and Bob express their desired outcomes in ephemeral, constraint-carrying resources 💬 to solver Sally.
Alice's Intent
"Sally, I want to give exactly 4🍏 for at least 4🍌."
4🍏 Alice
1💬 Sally, give = 4🍏 Alice, want ≥ 4🍌 Alice
Bob's Intent
"Sally, I want to give at most 7🍌 for exactly 3🍏."
7🍌 Bob
1💬 Sally, give ≤ 7🍌 Bob, want = 3🍏 Bob
Sally's Solving Intent
Seeing both intents in the intent pool, Sally comes up with a solution.
"I'll give 3🍏 to Bob and take 1🍏 for myself as a fee. Furthermore, I'll give 5🍌 to Alice, return 1🍌 to Bob, and take 1🍌 for myself as a fee."
1💬 Sally, give = 4🍏 Alice, want ≥ 4🍌 Alice
3🍏 Bob
1💬 Sally, give ≤ 7🍌 Bob, want = 3🍏 Bob
1🍏 Sally
5🍌 Alice
1🍌 Bob
1🍌 Sally
Balanced Transaction (composition of Alice's, Bob's, and Sally's intents)
Sally composes her solution intent with Alice's and Bob's intents and obtains a balanced transaction containing three actions.
4🍏 Alice
1💬 Sally, give = 4🍏 Alice, want ≥ 4🍌 Alice
// Action Separator7🍌 Bob
1💬 Sally, give ≤ 7🍌 Bob, want = 3🍏 Bob
// Action Separator1💬 Sally, give = 4🍏 Alice, want ≥ 4🍌 Alice
3🍏 Bob
1💬 Sally, give ≤ 7🍌 Bob, want = 3🍏 Bob
1🍏 Sally
5🍌 Alice
1🍌 Bob
1🍌 Sally
After execution,
Alice gave her 4🍏 and got 5🍌 , more than the least amount she specified,
Bob gave 6🍌 and has 1🍌 left, less than the maximal amount he specified, and got the 3🍏 apples he wanted,
Sally took 1🍏 and 1🍌 for her services. If she is taking too much for herself, users might decide to not let her settle their intents anymore (see the Slow Games ART).
Last updated