What is Komodo DeFi Engine?

Komodo DeFi Engine (KDE) previously known as Market Maker 2 (MM2) is the primary protocol that powers the atomic swap process. It allows Atomic DEX to be a market leader in the world of Decentralized exchanges. KDE is a complete suite of open-source blockchain development tools, which includes an atomic swap engine (backend/core), APIs and other set of programs and rules.

Before the Defi engine, the previous protocols used by AtomicDEX were not compatible and outdated to modern threats and user volume. There were two problems faced by the previous market makers.

Komodo uses the UTXO model as it is a Z-cash fork. There are a few blockchains in the world that use UTXO (Unspent Transaction Output model). These chains are usually Bitcoin or ZEC-related/forked blockchains. UTOX model is a very effective ledger management technique for a blockchain. They begin and end each transaction.

The internet is also not a seamless data connection all of the time. The previous market makers worked on open ports and specific firewalls. This was the second biggest problem faced by previous market makers. To work with a client-side p2p exchange, the internet connection is really important. This makes sure that the app is completely in sync with the blockchain so there won't be any hurdles while having an exchange.

KDE uses libtorrent which implements BitTorrent protocol. This helps KDE operate without any connectivity gaps and network anomalies. In this protocol, the swap works in a torrent type of way. This shows the level of dedication and creativity the atomic DE‌‌X team has towards this technology.

Break down of the Trading Process

Here is a step by step breakdown on how Atomic DEX  allows peer to peer atomic swaps from both a maker and taker perspective. 

(Steps you’ll see when swapping coins)

If a Maker posts a trade on AtomicDEX it is registered as Step 0. This is not a part of the trading process but it is important as it is initiating the trade. This can be called STEP 0.

(Click on the Trade button to initiate a trade (STEP 0))

Step 1: <DEXfee> payment

The Taker which will usually see an order to fill trades on a Maker’s offer and accepts it. In order to verify the trade taker will pay a fee of 0.15% of the total trade amount. The purpose of the swap fee is to get rid of spam requests. Note that Makers do not pay any trading fees on AtomicDEX.

After the taker has paid the exchange fee the maker will verify and move on to step 2 which will be sending the maker payment. Please note all of this is possible due to Market Maker 2 and automated. You don’t have to literally verify it yourself.

Step 2: <MakerPayment> Is Sent

Maker sends his payment, known as the Maker Payment, which is sent to a P2SH address (for Bitcoin-protocol coins) or to a smart contract address (for ETH and ERC-20 tokens).This commits senders funds to a hash.

Step 3: <TakerPayment> Is Sent

Once the Maker payment is sent to a hash locked or time locked address the taker payment is sent using the same algorithm in a hash locked address which will be transferred later on to the wallet address. 

Step 4: <TakerPayment> Is Spent

Once the taker payment is hash locked the maker payment is released from the time lock into the personal wallet address of the taker. This is possible once a secret 32 byte hash code is revealed.

Step 5: <MakerPayment> Is Spent

Similarly, the taker payment is unlocked in the same mechanism and sent to the maker's personal address. The secret byte code is public once the time lock is complete upon successful transaction.

This long and technical process is automated and only possible due to the komodo defi engine. The engine runs automated and secure while keeping the network secure, seamless, and quick. Developers can refer to docs if they want to use the public APIs.

Introduction

AtomicDEX is one of the most innovative projects developed by the komodo team for blockchain interoperability. It is a multi-chain wallet and a decentralized exchange making it a groundbreaking innovation in the cryptocurrency world.

The name comprises “atomic” and “DEX” (Decentralized exchange). AtomicDEX is in beta version and is available on Android, iOS, and desktop platforms. AtomicDEX is one of the few DEX that is truly decentralized and cross-chain. It works not only on the ethereum chain but connects ethereum and bitcoin blockchain together,

Exigency?

In current times most of the DEX (Decentralized exchanges) is ethereum centric. This is mainly because of the wallets and storage options for ethereum and ERC-20 stakeholders. 

Ethereum based wallets are designed trustless/client side and due to so many ethereum sub-projects it is always easy to exchange tokens. However, when trading bitcoins and other UTOX assets usually centralized exchanges come handy. 

AtomicDEX has solved this basic problem by implementing the AtomicSwaps technology. It supports almost every asset including bitcoin and other UTOX assets as well as ETH and ERC-20 tokens. This exchange phenomenon is completely trustless, versatile, easy and cheaper.

Why AtomicDEX?

A wallet and a fully fledged functioning exchange. The cryptocurrency world is all about security and decentralized interchange of data. However, today the world's largest exchanges are centralized and dependent. AtomicDEX aims to solve these issues by providing.

AtomicDEX is developed as client side software. The private keys are stored offline on a user’s device. The DEX works in lite mode (You don’t have to download block chain data in order to exchange your tokens).

The Interface?

Let’s walk through AtomicDEX Beta v-0.31 for desktop and work with the wallet and the exchange. The first screen after opening is the signup screen as displayed in the image below. A user can recover their wallet or create a new one.

When Komodo developed the Antara framework, it was based on the agnostic open standard smart contract work from Ripple. Cryptoconditions is a portable multi level, multi algorithm & multi signature capable smart contract format.

The original set of Antara modules are based on the early work of jl777. The vision was to modernize and democratize smart chain building blocks for future product development in the blockchain space. These modules are coded in C++ and leverage the cryptoconditions open standard to enable portability between languages.

New Smart Contract Language Support

In Q1 2020, the Komodo team had already started looking into using other languages for cryptoconditions support (Antara support). These included python and javascript. Some integration tests in the komodo codebase have been in use since 2018. These were originally written in python - so it's an easy bridge to cross using existing implementations of the open standard.

Electrum Lite Wallet Smart Contract Bounty

Although the Antara framework is the most powerful UTXO smart contract implementation in existence, it currently has a high barrier to entry for users. Version 1 was for power users and developers to become familiar with in product development. For wider adoption of the technology one this is necessary. Lite wallets developers need to have access to these powerful functions without requiring the full node operating. This is a limitation for mobile apps, however it is being overcome in two ways. Electrum decoding (python) with a bounty currently available for skilled python protocol developers, and with nSPV technology.

nSPV Super Lightweight Full Node Blockchain

Notarized Simple Payment Verifications allow for a low power computing device to be able to verify & create transactions. Just like a full node, these clients can do it without the need of downloading all the blockchain data. This solution was inspired by the flyclient whitepaper. More details from lead developer jl777 discovery & implementation. The notarization process of dPoW makes this solution possible.

Antara V2 Refactor & Optimization

In 2019 & 2020, through the use of the Antara framework, some early limitations were discovered. The CDP developer from the Komodo team, Mihailo was first to mention the refactor process in discord. The platform sync feature of Komodo to enable cross-chain tokenized asset transfer was first being tested in Q3 2018.

Return Of A Champion + WASM

One of the most impressive developers in Komodo's history has returned to collaborate yet again. Scott Sadler or libscott worked with jl777 in 2017 & 2018 to bring cryptoconditions (& Antara) to the UTXO blockchain world. He has returned and give some clues as to what is coming for Komodo in the mid-term future.

We have cryptoconditions in Rust now also, can be compiled to wasm:

Source of the comment can be found in this issue

Transaction Deconstruction

Many valuable lessons have been learned from the first 18 months of experimenting with what power Antara brings to the UTXO blockchain world. By creating powerful tokenized versions of more valuable and liquid cryptocurrencies, like bitcoin, and exploring the current limitations to advance the science of computing with cryptography the developers previously in jl777's shadow are forging a bright future for sovereign community based projects.

The Antara framework beginning to look like network protocol by encapsulating it's structure in a more elegant and developer friendly envelope.

Portable Smart Contracts

With the introduction of cleaner more standardized internals, and the ability to run wasm cryptoconditions in web apps and many other target computing platforms, integration with other platforms like the wavelets from Perlin (written in rust) or Cosmos' wasm projects becomes more of a picture within the scope of integration rather than a pipe dream. One must not forget that Polkadot is also a Rust implementation of multi-chains, with many DeFi projects already in late stages of development.

Using the python electrum wallet sources, Komodo developer pbca26 was able to demonstrate to discord user zrtx goal on how to sign a raw transaction. The conversation included zCash protocol expert dukeleto, atomicDEX API & marketmaker developer artem.pikulin.

Electrum wallet is fully capable of signing correct kmd/kmd smartchain transactions and worked so far w/o any major issues. 99% of it's core code is inherited from zcash electrum wallet version. Here is the resulting gist (embedded below) from pbca26 to achieve the goal below:

komodo-cli createrawtransaction -> unsigned tx hash -> transaction lib of electrum-komodo -> signed tx hash

Most multicoin lite wallets can be used to enter a seed phrase (list of words) or a private key for a coin and be used for different coins. Sometimes, a new wallet will come out and offer features that you may want to try out. The wallet supports a private key for one type of coin for example, like bitcoin.

In the discord mining channel, it was asked:

is there a tool to get out of a komodo private key a BTC private key?

Here is the question.

Komodo team member Poly suggested to extract the key from a lite wallet, like what Verus Desktop & Chameleon Pay can do. Proof-of-Stake expert and LABS maintainer Alright from the Komodo team offered a python script for doing the task. It is included in the following gist below.

The requirements are to install base58 python package with pip install base58. Duke Leto from the HUSH private communications project and ZEC expert offered another private key conversion script with a useful tidbit of information:

ZEC/HUSH/etc have 2 prefix bytes, BTC/KMD only have 1

User CHMEX from the dexstats site has an online address converter to verify outputs of scripts, but it is for public addresses only - aka do not enter in private key or WIFs!

AtomicDEX marketmaker developer artem.pikulin has made a CD pipeline for testers and developers. This follows the official docker image for the komodo daemon being available for testers & developers.

AtomicDEX API Docker Image

Orderbook.Live Docker Container To Be Updated

The container for the orderbook.live atomicDEX api project will test this in the coming week!

atomicDEX orderbook live project

Komodo has released docker images of their work for wider developer appreciation and uptake. These are uploaded directly from the CI/CD developer pipeline.

Komodo Official Docker Images

From the discord chat, QA Manager TonyL made the announcement. A further example to create an assetchain, docker run -p 127.0.0.1:`ac_rpc_port`:`ac_rpc_port` -d --mount src=$HOME/.zcash-params,target=$HOME/.zcash-params,type=bind testblockchain

The Komodo team has some alpha testing consensus rules that were initially researched in 2019 to support collateralized stablecoin issuance, synthetic prices, and debt positions. This story comes from Forbes who extracted some great Antara Composer material. Background info on the tech supporting these solutions follows.

Antara Composer view of creating a stablecoin

Price Feed Oracles

The first step in producing a suitable oracle for DeFi is building an oracle that is decentralized, not simply a trusted feed. The decentralized oracle enables all participants to enter into the oracle feed publishing portion of the system. Technical information about the price feed oracles used in a Komodo solution can be found in 2019 week 14 blockchain development update article, Komodo also produced another piece about the oracle problem and smart contracts.

Blockchain Financial Products

Once the decentralized oracle is available to the smart chain network, making use of the price data to make blockchain enforced positions becomes possible. Using pegs to form a collateralized debt position and synthetic prices is then available as new decentralized fintech products. This article from 2019 week 16 blockchain development update describes how any price feed data whether it is forex, crypto or stocks can be used with DeFi.

An example from Komodo team @gcharang in discord says:

Basically, any asset(could be an index/basket) whose price can be calculated is available as a stable coin. It just needs a separate chain. The peg on each chain can also be collateralized by multiple assets.

Examples of what is possible:

Synthetix & Chainlink for DeFi on Ethereum

This podcast comes from the Ethereum DeFi space where synthetix & chainlink collaborate on creating their building blocks. We have written about synthetix on this website.

Experience Crypto
© 2021 komodefi.com. Powered by Komodefi
chevron-down