Introducing Bitmatrix

Burak
Burak
May 12 · 3 min read

Bitmatrix is a constant product market maker built on Liquid Network. We’re utilizing the power of bitcoin opcodes to enable automated liquidity provision across L-BTC and other Liquid-based assets. Bitmatrix comes with a maximally Uniswap-like UX and is effectively powered by Liquid’s powerful scripting capabilities.

How Does It Work?

From a technical standpoint, we designed a pool covenant that holds some amount of L-BTC and some amount of token pair like USDT. The multiplication between the two assets is a constant of which the covenant enforces over introspection.

Bitmatrix utilizes the x * y = k formula, where x is the amount of L-BTC pool holds, y is the amount of token pool holds, and k is the fixed constant indicating the pool’s total liquidity always remains the same.

Covenant Architecture

A Bitmatrix pool is made of 4 recurring covenants which interoperate and apply constrains one another.

The first and the foremost covenant is the “Flag Covenant”. This covenant holds a unique token called ‘flag asset’ which has a total supply of one unit. Flag asset is identical to pool and is issued prior to pool setup. All three other covenants are constrained to this asset ID.

The second covenant is called “L-BTC covenant” which holds L-BTC liquidity. This covenant is constrained to Flag Covenant and is therefore subject to its spending rules.

The third covenant is called “Pair token covenant’ which holds token liquidity as a pair to L-BTC. Just like L-BTC covenant, this covenant is also constrained to Flag Covenant.

The fourth covenant is called “LP token covenant’ which holds LP tokens with a pre-determined supply. When people add/remove liquidity, the pool’s constant value changes. The division between a liquidity provider’s provided liquidity constant value and the initial constant value represents a liquidity provider’s stake in percentage and is denominated in LP tokens. The pool is enforced to give liquidity providers LP tokens when they add liquidity and redeem their LP tokens when they remove liquidity.

The pool inherits the previous state from itself, updates and constructs a new state, and continues to operate in an anyone-can-spend fashion with respective to unconfirmed transaction chain limit. All four covenants are enforced to validate their new state by introspecting their sighash preimage.

In order to make sure people are not cheating the pool, Flag Covenant enforces x*y=k constrain over L-BTC covenant new states and Pair token covenant new states’ asset ID and asset amount.

Please note that Bitmatrix is not available for testing yet. Our team is working to roll out the initial version around Q4 2021.

https://bitmatrix.app/

Join the community: https://t.me/bitmatrix_community

Bitmatrix

Bitmatrix