Liquidity baking in Tezos Granada proposal — how it works

by Nicolas Ochem

Liquidity Baking has been submitted to Tezos on-chain governance. Several publications explain what it is (Agora post, TZIP, Nomadic Blog Post), in this blog post we attempt to show the concept under a different light, by explaining what will actually happen when/if it goes live on-chain.

TLDR: the Granada proposal adds a new Decentralized Exchange contract to the Tezos protocol between tez and tzBTC. This contract is “special” because the protocol itself creates tez at every block and adds them to the contract. This incentivizes users to provide liquidity to the contract in order to capture a portion of the subsidy. Liquidity is a desirable attribute of any currency.

The CPMM contract

In a traditional order book exchange, you place limit orders (essentially posting how much you want to buy/sell and at which price). In a CPMM, you trade tokens by simply submitting how much you want to buy or sell. The contract will ensure that you get a good deal. To achieve that, it stores both tokens in a liquidity pool inside the contract itself.

The liquidity pool is filled by liquidity providers. Anyone can be a liquidity provider by acquiring both tokens and submitting them to the contract at once. In exchange, they get redeemable tokens representing their contribution to the pool. They can withdraw their contribution at any time by returning these redeemable tokens. When they do, they do not get exactly what they contributed: if the proportion of tokens in the pool has changed, they will get back a larger quantity of one token, and one lesser quantity of the other one, than they initially put in. They also receive fees paid by traders in proportion of their contribution.

Uniswap is the most popular of such contracts. In Tezos, the Dexter 2.0 contract is a well-known CPMM contract. It was written by Camlcase and later rewritten and formally verified by Nomadic Labs. This is the contract used in the Granada proposal.

An important property of such contracts is that any trade “moves the needle”. Each time someone trades, they add to one side of the pool and remove from the other. To counteract that, the contract makes it more interesting to do the opposite trade by moving the price a little. This is by design: if you multiply both quantities, you get the same number (hence the name: Constant Product Market Maker). This simple formula creates the right incentive.

See also: A Graphical Guide for Understanding Uniswap.

Decentralized Exchanges work well when there is liquidity in them, meaning, a lot of people have contributed a lot of funds to the contract. When there is a lot of liquidity, most trades are of small value compared to the total amount of liquidity available in the pool, and therefore do not move the price much.

Liquidity is important. As the CFO of Tesla, Zach Kirkhorn, said:

We’ve been quite pleased with how much liquidity there is in the bitcoin market.

Just creating a Decentralized Exchange contract does not automatically guarantee liquidity, because you need people to add funds. It has proven difficult to encourage people to add funds due a lack of rewards. The Granada proposal attempts to solve this problem.

Wrapped Bitcoin

From Tezos perspective, it is just another FA1.2 token (the Tezos equivalent of ERC20). A reputable Swiss association issues these tokens, and commits to keep one Bitcoin in custody for each tzBTC token that is emitted.

Such a construct is useful because it allows you to exchange Bitcoin and Tezos in a decentralized fashion. When you swap Tezos for tzBTC, you know that the tzBTC token that you receive is ultimately redeemable for a Bitcoin. There are ways to do that without a custodian (algorithmic stablecoins) but it is more experimental.

Granada proposal

We will attempt to explain what happens when/if the Granada protocol activates.

As part of the Liquidity Baking proposal, the migration logic for Granada will add a new contract to the chain storage, at address KT1TxqZ8QtKvLu3V3JH7Gx58n7Co8pgtpQU5.

This contract is a Constant Product Market Maker between tez (the native token) and tzBTC, as described above. It is similar to Dexter 2.0, but with a few differences. The trading fee is 0.1% instead of 0.3% for Dexter contracts.

Initially, the CPMM contract is almost empty. It contains a tiny amount of tez and tzBTC to set the initial rate. It is very similar to what you would get by initiating a new Dexter pair with no special help from the protocol.

Anyone could have pushed such a contract to the chain. But then, at next block, something magical happens. The protocol is amended in such a way that the tez balance in the pool will increase by 2.5 tez at every block.

Wait, what?

Protocol-funded CPMM

At next block, the pair contains 12.5 tez and 10 tez worth of tzBTC. From the contract’s point of view, Alice provided 100% of the liquidity and therefore 100% of the trading fees go to her. And if she withdraws from the pool at this stage, she would earn 25% returns in the 10 tez she added as liquidity (thanks to the 2.5 tez given by the protocol). Sweet!

5 tez per minute? Sign me up

Enter Bob the trader

Few blocks later

Meanwhile, more Alices provide liquidity by providing a combination of tez and tzBTC. Shall Alice remove the liquidity, she will get more Tez back than what she put, because the protocol selflessly added extra without changing her stake in the pool!

This makes it interesting for Alice to be a liquidity provider: she would get more rewards than if she was baking or delegating her tez. This also brings the system to an equilibrium: when 1/16th of total tez are providing liquidity, the liquidity provider rewards are comparable to baking rewards. Past this point, the 2.5 tez per block will be shared between so many liquidity providers that it will become less interesting.

A combination of liquidity-adding Alices and arbitraging Bobs cause the tzBTC/tez price to move closer to the BTC/tez price on centralized exchanges, and stabilize at this value.

It also causes a lot of tez and tzBTC to be added in the liquidity pool over time. By extension, a lot of BTC will have been deposited at the Bitcoin Association Switzerland, with their representation minted on the Tezos network as tzBTC tokens, increasing the amount of value circulating in the Tezos network.

The tez/tzBTC pair will also be extremely liquid: since the CPMM contract has so much value in it, it increases the amount of tez someone can buy or sell without paying a large premium (slippage).

Absent this protocol update, achieving such a result is hard.

Inflation

To counteract this increase in supply a little, 0.1% of every trade through this contract is burned by transferring it to the null implicit account, instead of being passed as a fee.

No one stands to benefit or lose from this increase in supply in particular: it affects everyone. The assumption is that the effect of this will be counterbalanced by the benefits of introducing the Liquidity Baking mechanism.

Phase out

A later protocol upgrade may switch to a different pair, or a different contract. For this first experiment, the choice has been made to favor tzBTC and this specific contract code, because it is seen by the proposers as the safest and most obvious choice to prove the usefulness of the mechanism.

Vote for liquidity baking

For Tezos to win, it needs liquidity. Liquidity will naturally happen when the world realizes the power of Tezos, but the world may never see the power of Tezos until it is more liquid. We can force this to happen by giving a nudge at the protocol level.

This is the true force of Tezos: using the governance model to a good outcome. It is tempting to limit this governance model to changes in the base layer but this is missing the point that Tezos is competing in a crowded ecosystem of interesting ideas, and blockchain is winner-take-all.

Thanks to Sophia Gold for proof-reading.

We are MIDL.dev: we provide Tezos baking as a service as well as other services for proof-of-stake blockchains. We provide recommendations on on-chain governance proposals for the benefits of our customers and the community.

--

--

Staking-as-a-service provider.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store