Spectrum: Scaling ErgoDEX beyond Layer 1
1. State of DeFi
Classical DeFi applications such as Uniswap, Compound, etc. have shown promising results in regard to features and decentralization, but also revealed essential limitations of the approach which most present dApps are built upon. These limitations fall into two categories:
- Poor user experience;
- Poor capital efficiency.
Some examples of the features that fall into the “Poor user experience” would be long confirmation times and sometimes extremely high fees. And as for “Poor capital efficiency” this would be non-optimal prices, arbitrage, and Miner extractable value (MEV). All the things that slowly siphon users profits.
These issues are being addressed by developers of existing or classic Layer-1-based dApps to some extent, but the old approaches are limited in what can be done.
The most popular type of DeFi applications that are similar to Uniswap and ErgoDEX are built directly on a Layer 1 blockchain:
Classical DeFi protocol:
- Ties the performance of the dApp to the performance of a Layer 1 blockchain (e.g. Ethereum, Cardano or Ergo). Let’s not forget that decentralized blockchains are maintained by thousands of nodes which all have to run the same computations in order to confirm that a transaction is correct. This leads to the fact that the execution of complex smart contracts takes a long time, especially if the network is congested;
- Limited by the liquidity of the parent blockchain. At the moment, this problem is partially solved with the help of synthetic assets. But such a solution does not allow direct access to the liquidity of other networks;
- Does not allow you to swap native currency in decentralized and native manner. For example, to transfer your liquidity from ETH to ADA you have to use CEXs to reach your goal.
2. State of cross-chain DeFi
Cross-chain decentralized finance is a novel approach aiming to solve the above issues.
Rather than committing to a concrete single Layer 1 blockchain, cross-chain solutions abstract across several Layer 1 networks with a focus on interoperability and cross-chain liquidity aggregation.
True cross-chain DeFi is impossible without a solid Layer 2 solution that allows us to:
- Offload the burden of expensive transactions validation from Layer-1s;
- Validate cross-chain transactions faster and cheaper than other designs.
In order to implement a cross-chain solution, an interoperability layer is required. The problem of cross-chain interoperability can be reduced by transferring data among multiple blockchains. There are already a few existing solutions in the field. Let’s look at them and see why they are not satisfactory for cross-chain DeFi.
2.1 Custodial solution: Trusted Oracle
Cross-chain interoperability could be achieved with a “trusted oracle” that registers some event on one blockchain and performs the required action on the other. For instance, below is an illustration of a simple cross-chain swap:
Centralized oracles provide fast and cheap transactions but lack a key feature , decentralization. The liquidity of a protocol built on this approach is custodial, which is a centralized approach similar to CeFi when users deposit their funds to an exchange’s wallet:
- A system is not sustainable when it depends on a single party;
- If the oracle goes down unfinished swaps can appear frozen halfway;
- A centralized oracle can censor transactions;
- A malicious oracle can perform a man-in-the-middle attack by sending inaccurate data.
2.2 Semi-centralized oracle network
Another approach involves some sort of intermediate network of oracles facilitating the transfer of data among multiple blockchains.
Often, all funds transferred between blockchains are stored and distributed on special threshold wallets, which are generated by the participants of the intermediate network, thus they are controlled by a group of oracle operators.
This method is inherently similar to the first one, it is more decentralized, but less reliable, due to the fact that PoA or PoS is used with high collateral and a small (less than a hundred) number of nodes. This makes it impossible to achieve high decentralization and system security. But, at the same time, the system becomes inflexible. xDeFi protocols built on such networks turn into a distributed custodial repository of funds managed by a small group of people.
Spectrum moves beyond the idea of cross-chain data bridges and implements a decentralized protocol for cross-chain computations. This assumes not only the transfer of data (assets, events, etc) among heterogeneous blockchains but also computations on this data, just like smart-contracts on regular Layer 1 blockchains but with access to multiple blockchains at once. This also allows us to shift validation of complex DeFi smart-contracts from Layer 1 blockchains.
Data from connected blockchains (transactions, assets, events) is aggregated along with Spectrum transactions into blocks which form a higher-order chain. Spectrum transactions are allowed to execute smart-contracts that operate on data from the connected blockchain and can trigger on-chain finalization.
Spectrum.Network operates under an optimized Roll-dPoS consensus protocol, which was used in IoT-oriented blockchains such as where nodes are IoT devices, so the protocol is designed to support a large number of participants.
Our contribution to the existing evaluation of Roll-dPoS introduces CoSi — an efficient protocol for collective signing. Replacing the old signature protocol from Roll-dPoS with CoSi we get faster block negotiations (from O(n) in old Roll-dPoS to O(log n), where n is the number of validators).
The following properties allow the consensus to achieve a high degree of decentralization and security:
- Decentralized operation of the protocol with a large number of participants (thousands of nodes), protected from compromise by collusion of a narrow circle of people;
- Low cost of entering the protocol and high cost of compromise;
- Tolerance to high network churn.
Roles in the Spectrum Network are randomly assigned to participants via a lottery until the end of the epoch. The honesty of the chosen participants is achieved by economic incentives built on the prisoner’s dilemma from game theory, which states that it is more profitable for each participant to betray the attacker and receive a reward, rather than join the attacker and incur punishment.
A technical paper on Spectrum protocol will be published shortly.
Putting it all together
Spectrum reveals the true potential of ErgoDEX. First of all it will allow quicker and cheaper transactions. Secondly, it will have cross-chain liquidity and interoperability out of the box. Not only bridges for cross-chain transfers of assets, but truly cross-chain pools for native assets, where on one side is native ADA and on the other is native ERG. And finally, Spectrum opens the door for more sophisticated DeFi protocols such as Decentralized Lending or Option Vaults, which are impractical to build on top of many Layer 1 blockchains due to current design limitations.
In the near future we will reveal our full roadmap, where we will detail the steps for the further implementation of Spectrum. We also welcome your feedback on our solutions. ErgoDex is our common future and we are happy to build it together with you!