Baklava

Swap

One pair, one pool

Pools on baklava-testnet-5, what is in each one, and what a trade against it would come to. There is no order book and nobody to match with: a price here is the ratio of two reserves, and a trade is what moving that ratio costs.

Every number here was true at a height that has passed. The chain prices a trade again at the height it actually lands in, and somebody else's trade can land first — so the amount a quote names is not what the transaction promises. The floor it carries is. That is why every command below is composed with -min-out filled in rather than left for somebody to remember, the same way a purchase on the market names the price it expects.

What can be traded

Every pool the index knows about, as of height — nothing here has to be looked up by id. The index says which pools exist and proves nothing; every reserve, ratio and share count below comes from the node.


One the list did not have

The pool for a pair is derived from the pair, so a token id is enough to reach it whether or not any index mentioned it.


Make a market

Three transactions, none of them signed here. This page never asks for a key or a recovery phrase, and you should not give one to a page that does — it composes the commands and you run them.

1 — create the pool

baklava pool -a BKLV -b <token id>

The id comes from the pair, in canonical order, so there is exactly one pool for it and nobody chose the name. BKLV is twenty zero bytes and not a token record at all; the ticker is a convenience the command understands and the chain has never heard of. Ten BKLV to the treasury, for the reason a token costs ten: a pool is a permanent row every node carries.

2 — fill it

baklava deposit -pool <pool id> -a <bklv> -max-b <token>

The first deposit sets the price: both amounts go in exactly as named and the shares are the square root of their product. Every one after it is measured against the ratio at the height it lands in and rounded up, which is why the second amount is a maximum rather than a number.

3 — give the liquidity up, if you mean it

baklava burn -pool <pool id> -all

The shares move to an address nobody has a key for and the pool's total is left alone — subtracting them would raise every remaining holder's fraction, which would make a burn a gift to the providers who stayed rather than a lock. Every card above shows the two numbers so anybody can compare them.


The chart is the one thing here nothing can check, and that is why it is at the bottom of every pool rather than the top. A price is not a leaf. There is no history on the chain — users carry their own receipts — and no query for what a pool held at a height that has passed, so a series exists only because something was standing there writing it down. That something is the index, which takes a sample whenever a block moves a pool and keeps it only when the node says the answer was true at that block. Each point was exact when it was taken; none of them can be proved afterwards, and a rebuilt index starts the series over. Everything above a chart on this page is a leaf or arithmetic over leaves, and the ordering is the claim.

The trades and the holders are not unproved in the same way. Every column of a trade row is in a signed transaction and the row carries its id, so a reader who doubts one fetches the receipt and settles it — what is missing there is what the trade got back, because the chain computes that and nobody signed it. And a holders table takes only the list of addresses from the index: every balance beside a name is fetched from the chain with its own Merkle path, so a wrong index can leave somebody out of that table and can never put a wrong number into it. Three panels, three different things to believe.

What is proved here and what is not. A pool record proves the pair and how many shares exist. The value is not in it: the reserves are ordinary balances at an address nobody holds a key for, so each one is an account or token-balance answer with a Merkle path to a signed header. The list of which pools exist comes from an index, which proves nothing and can hide a row — it can never invent one, because every row is then asked of the chain. The quote is this page's own arithmetic over those reserves, in exactly the integers statemachine.applyTrade uses, and a wrong one costs a refused transaction rather than a bad fill. The paths themselves are folded by baklava rather than by this page.