ErgoDEX is a decentralized, non-custodial exchange, which enables a fast and secure transfer of liquidity between the Ergo and Cardano blockchains.
It allows users to exchange assets and provide liquidity, through the execution of smart contracts, without the need for intermediaries.
ErgoDEX is a DApp of the Ergo ecosystem, which will offer interoperability and liquidity between Ergo and Cardano.
The Ergo blockchain includes several technical and economic improvements to existing blockchain solutions.
First thing’s first.
What is Ergo?
The main objective of the Ergo blockchain is to provide financial contracts in an efficient and secure way.
Ergo’s PoW (Proof of Work) consensus uses the eUTXO (extended Unspent Transaction Output) model when conducting transactions. With their use of Σ-protocols (a type of zero-knowledge proof), Ergo smart contracts are highly efficient and secure with features like ring signatures, multi-signatures, multi-currencies, advanced privacy, and self-replicating scripts.
The Ergo – Autolykos – consensus protocol is based on the well-known Proof of Work (PoW) consensus algorithm. Its native token is ERG.
PoW was chosen for a number of reasons, including that PoW protocols have high security guarantees and are friendly to thin clients. However, Autolykos has several significant differences from Bitcoin’s PoW. One of them is that Ergo blocks support Non-Interactive Proofs of Proof of Work (NIPoPoW), allowing thin clients to synchronize with the network by downloading less than a megabyte of data.
Each coin in Ergo is protected by a program in ErgoScript, which is a powerful scripting language, which specifies the conditions under which a coin can be used: who can spend it, when, under what external conditions, with whom, etc.
Furthermore Ergo uses authenticated status, and for any transaction a customer can download proof of its correctness. Thus, regardless of the size of the blockchain, a normal user with a smartphone can join the network and start using Ergo with the same security guarantees as a full node.
What Will Ergo Bring to Cardano?
Ergo is the first blockchain to adopt the smart contract language in the same eUTxO model as Cardano, allowing compatibility with Proof of Work.
The bigger a DApp is, if it is making DeFi collateralized, the bigger the stake it has at its disposal, and Ergo brings the proven PoW security for all the more complex DApps implementations on top of the common UTxO model.
The cryptography used by the Ergo protocol is more advanced than others used in other PoW blockchains. It runs on sigma protocols where cryptographic signatures are highly flexible and composable.
Oracles are a crucial element of DeFi infrastructure. They are the bridge between the siloed world of the blockchain and data from the real world, and so are vital for DeFi to reach its full potential. The integrity of major use cases, including stablecoins and lending platforms, rely on oracles that are fit for purpose.
Ergo’s UTXO model offers benefits for oracle systems that were not previously available. The Oracle Pools act to decentralize the provision of data, ensuring that both the process and the data itself are more reliable.
Two Oracle Pools are active in Ergo: Erg-USD and Eth-USD.
At their simplest, oracle pools break up time into fixed epochs (e.g. 6 hours), which are subdivided into blocks (e.g. 180 two-minute blocks). The group of oracles within the pool agree on the data sources and each post their data points to the blockchain in their own UTXO.
At the end of an epoch these data points are averaged, after removing outliers, in a final transaction which reads each data point UTXO. This results in the oracle pool producing a new finalized datapoint, and moving forward towards the next epoch.
This is not particularly complicated to understand, but lays a solid foundation. One critical factor to note is that the whole process occurs on-chain. Moreover, the use of UTXOs enables the addition of incentives and governance mechanisms, allowing far greater sophistication and flexibility of oracle pools and data provision than was previously possible.
Ergo also implements a local exchange system with the new stablecoin called ageUSD, the first UTxO-based stablecoin.
With these complementary features in the consensus protocol with PoW, and cryptographic with Sigma, Ergo will be a competitive advantage for Cardano, as developers will have a complete solution to build their DApps.
The ErgoDEX logic is based on nodes and off-chain bot design, allowing all participants to run an ErgoDEX node and earn protocol fees. Decentralized off-chain bots ensure the decentralized nature of ErgoDEX, and will incentivize participants to host their own node.
In DeFi, there are two types of decentralized exchanges (DEX): order book, similar to traditional financial exchanges, and Automated Market Maker (AMM).
Swap order contracts allow DEX based on order books, and these follow traditional financial models. They are well established and work best in highly liquid markets.
AMM uses mathematical models to set the price and match buyers and sellers, rather than simply matching buy and sell orders, as in traditional order books.
AMM is best in markets with low liquidity. One of the characteristics of AMM is that liquidity providers add assets to the exchange for a fee, and the market benefits from increased liquidity, lower latency, limited price slippage, and lower market volatility when this additional liquidity is used.
Thanks to the eUTXO ledger model used by Ergo and Cardano, AMM’s liquidity pool contracts for DEXs can be combined with order contracts used on DEXs in the order book. This ability enables shared liquidity between different types of exchanges on the Ergo and Cardano blockchains, which was not possible before.
ErgoDEX on the Cardano Blockchain
As of this writing, ErgoDEX is not yet operational on Cardano.
The ErgoDEX developers raised the treatment that they will give to the audience and the eUTxOs. In an interview on the YouTube channel Cardano With Paul They said they will work on a code off-chain solution with SPOs, particularly with small pools to encourage decentralization. The protocol will run an off-chain bot to choose the validating SPO. An execution fee will be added to the transaction fee on the ErgoDEX platform, before the order is signed. Then each block validated with multiple transactions will be moved to the ledger, and the pool executed by the winning bot will be rewarded with the execution fee.
Stage 4. OrderBook DEX: Frontend development
- Order Book UI design
- Order Book UI development (Ergo Network)
- Public Order Book DEX testing (Ergo Network) )
Stage 5. ErgoDEX for Cardano
- AMM DEX contracts (Plutus) ✔
- AMM DEX Bots (Cardano Network) ✔
- Order Book DEX contracts (Plutus)
- Order Book DEX Matcher (Cardano Network)
- ErgoDEX UI update for Cardano network
Stage 6: Grand testing
- Public AMM testing (Cardano network)
- Public Order Book testing (Cardano network)
- Bug fixes and improvements
- Stable ErgoDEX release
In the ErgoDEX each actor is incentivized to fulfill his role as well as possible.
There are five types of economic agents in the ErgoDEX ecosystem:
Each type of agents benefits from using DEX in his own way:
- Miners are earning miner fees paid in native tokens
- UI providers are earning fees paid in native tokens charged for each operation done via UI
- Off-chain executors are earning fees paid in native tokens from both OrderBook and AMM services
- In AMM: fees are charged for every operation on a liquidity pool
- An amount of native tokens defined by a user for deposit | redeem operations
- An amount of native tokens defined by a user for each unit of quote asset exchanged
- In OrderBook: fees are charged in native tokens for each unit of quote asset exchanged
- In AMM: fees are charged for every operation on a liquidity pool
- LPs benefit from protocol fees paid in tokens and accumulated in liquidity pools
- Traders benefit from DEX services they use
The team is formed by Ilya Oskin and Dmitry Usov, active developers in the Ergo space, and Yasha Black, as Product Manager, Timofey Gusev and Alexander Romanovskiy, as Core Developers, Vadim Safonov, as Frontend Developer, Kostya Russkih, as Product Designer and Gary Waugh as Community Manager.
Oskin was one of the main developers of the Ergo reference node and has worked on ErgoWallet, Ergo Blockchain Explorer, etc.
The ErgoDEX team has presented the proposal at Catalyst FUND5, obtaining funding. You can read it here: ErgoDex Plutus Port
I will explain in a second part how DEX works.