The CENNZX Guide
By: Cathy Breed
Tags: Centrality English, Decentralized Exchange, Blockchain, Cennznet, Decentralization

Translations can be found here:

Runtime modules are the core of what makes our protocol so accessible and unique, so it’s super exciting that yet another one of our core modules is live on our mainnet!

Let’s dive into the CENNZX module and explore what it is, why it’s useful and how it works.

What is CENNZX?

CENNZX is an automated decentralised spot exchange. It will allow users to:

Trade generic asset tokens instantly on the CENNZnet blockchain

Send exchanged tokens directly to a 3rd party account within a single exchange transaction

Initially, users will be able to use CENNZX to trade CPAY for CENNZ and vice versa, but eventually, the exchange will support all generic asset tokens active on CENNZnet. This will include Sylo and Plug tokens along with any generic assets created by new DApps on the network.

Why is CENNZX important for CENNZnet?

CENNZX provides an exceptionally secure, fast and transparent way for CENNZnet users to exchange their tokens. By having a reliable automated on-chain exchange, tokens can be traded in full confidence that the transaction is secure and fully recorded on the decentralised ledger. This prevents common issues with centralised exchanges, which are often hacked.

CENNZnet’s dual token economy structure also means that users need to have ready access to both CENNZ (our staking token) and CPAY (our gas token). As a spot exchange, CENNZX will provide instant access to both tokens, and users will also be able to see a projection of how much their tokens are worth in relation to each other before trading.

The other really cool thing about CENNZX is that new DApps will be able to add their generic asset tokens into the mix. By creating a new liquidity pool (term explained below) brand new tokens can be bought and traded using CPAY, creating a market that will enable new DApps to thrive.

How does CENNZX work?

CENNZX is a decentralised automated exchange built on the CENNZnet blockchain. Our exchange uses Automated Market Maker (AMM) technology to replace the traditional exchange order book with a system of on-chain pre-stoked token stores, known as liquidity pools. The liquidity (available tokens for trade stored in the liquidity pools) is provided by other users. These liquidity providers can earn a passive income on their deposit as a result of the transaction fees paid by traders.

Liquidity pools

Liquidity pools are essentially a pot of tokens locked into a smart contract which users can then trade against. They are known as liquidity pools because they allow the overall decentralised system to have liquidity, or the ability to quickly convert one asset into another without losing its value.

Separate liquidity pools are required for every exchange pair. For example, on CENNZX all our liquidity pools contain our gas token CPAY and then the specific generic asset you can trade in CPAY for. So our pools will look something like this:

CPAY + CENNZ CPAY + Plug CPAY + Sylo

To exchange your CPAY tokens for CENNZ you would use the first liquidity pool above. You would pay in your CPAY token to the CPAY side of the pool and then receive CENNZ from the CENNZ part of the pool in return.

Liquidity pools are constantly supplied with tokens by network users hoping to earn interest on their tokens (see Adding Liquidity section for more details). This way there are always available tokens of all types ready for exchanges to be made.

The rates of token exchange are determined by the initial ratio of tokens entered into the liquidity pool. E.g 10 CPAY to 20 CENNZ. This is then kept fixed by the constant product market maker formula.

Direct exchanges can be made between two liquidity pools. For example, if a user wanted to exchange Plug tokens for CENNZ, the module would first convert the traded Plug into CPAY in one liquidity pool and then this CPAY can be converted to CENNZ within the CPAY + Plug pool.

The constant product formula

The constant product formula is a mathematical formula that enables the AMM technology to function. In essence, it preserves the original token ratio of the liquidity pools and ensures that there is a relative balance between overall token reserves. This is also aided by the process of arbitrage, which exists as a result of market inefficiencies and will ensure CENNZX does not stray too far from external market values.

Constant product formula as used in CENNZX is: X * Y = K

For example:

X (CPAY tokens) x Y (CENNZ tokens) = K (a constant product)

Let’s look at an example of the formula in action:

CENNZX has both CPAY and CENNZ tokens in a liquidity pool. Every time CPAY is bought the following happens:

The price of CPAY goes up as there is less CPAY in the pool than before the purchase. Simultaneously, the price of CENNZ goes down as there is more CENNZ in the pool.

In accordance with the formula (x*y=k) despite the change in token amounts, the pool stays in constant overall balance: where the product of multiplying both token amounts together will always = the same value (constant product). This means that the value of CPAY tokens in the pool will always equal the total value of CENNZ tokens available in the pool.

In this constant state of balance, the relative prices of CENNZ and CPAY will fluctuate as people sell and deposit both tokens. However, no matter how volatile the price gets, there will eventually be a return to a state of balance that reflects a relatively accurate market price. This is because if the CENNZX price deviates too far from the market price on other external exchanges (ie. the value of CPAY becomes very low compared to CENNZ), traders will be incentivised to come to CENNZX and take advantage of this price difference. By doing this they will trade the price up or down by buying or selling tokens until the pool matches the value on other exchanges.

Adding liquidity

Anyone with an internet connection and in possession of any type of CENNZnet token can become a liquidity provider. Liquidity providers supply tokens to liquidity pools in exchange for the possibility of a return on their investment.

How do providers earn interest? When people use the CENNZX exchange they pay a transaction fee. This transaction fee boosts the overall number of tokens held in the pools over time. When providers deposit their tokens, the exchange notes what proportion of the tokens in the pool belong to them. The provider can then withdraw their tokens at any time and receive the same proportion of the token pool that they put in. If the number of tokens in the pool at that time is much higher than when the provider made their deposit, they will earn a significant investment on their tokens.

Providers can add liquidity to the pools at any time using the exchange UI. It’s important to note that, in order to preserve the token ratio providers must deposit an even balance of both tokens for their chosen liquidity pool. E.g if you wish to deposit CENNZ you must also deposit the proportional ratio of CPAY. This ensures the liquidity pool balance is preserved.