LQDEX
LQDEX
Published in
5 min readSep 6, 2018

--

As we mentioned on August 23, we are working on launching LQDEX Bridge this month. Today we will dive deeper into the tech that runs LQDEX Bridge.

Major tech components driving the Bridge:

  1. Collators
  2. Staking
  3. Internals of Collator Backend
  4. Publicly Auditable Balances (During LQDEX acting as Solo Collator Phase of the Bridge)

Collators:

In the current implementation, Collators are economically bonded entities on the Bridge. LQDEX will act as the sole Collator in the initial release, but addresses and balances will be publicly auditable. Please refer to section 4 for an explanation on how it is publicly auditable.

Collators are implemented with centralized DB and we choose this because it is easier to test other parts of the Collator implementation. If we had set out to just work on PoS blockchain as the first step it would have taken us a lot more time to test other pieces of implementation. Collator backend is polling with multiple threads on all the addresses from all kinds of different assets for deposits/withdrawals. So we started building the Collator component as the first step and we found this can be independently used with Ethereum smart contract to behave as a bridge to trade BTC (and other non-ERC20 assets) on already existing and established Ethereum decentralized exchanges.

User/Collator Flow:

  1. Ideally selects a Collator with high collateral ratios (this option will be disabled in the first release). Collateral ratio is defined as an amount of stake the chosen Collator has against the total deposits the Collator has currently taken. For example, any new Collator that joins the LQDEX network that has taken zero deposits will have an infinite collateral ratio, which means the Collator is likely to be among the highest priority to be selected for accepting next incoming deposits from the user.

Collateral Ratio = Amount of Stake (/ Collateral ) / Value amount of Total Deposits .

We want to strictly maintain a 2:1 ratio for eligible Collators.

  1. Command ‘Generate new Bitcoin address’ is sent to Collator backend.
  2. Collator backend starts polling the newly generated Bitcoin address since we are not capturing other forms of user information except the generated Bitcoin address.
  3. If there is a deposit of Bitcoin to the newly generated address, Collator polling the backend will mint proxy ERC20 called LQ-BTC with the exact amount deposited.
  4. The newly minted LQ-BTC token is automatically assigned to an initial Ethereum address specified by the user on the LQ-BTC token contract.

Staking:

In the alpha test release, LQDEX will be the only Collator and this feature will be not used. Once we are confident with the system’s stability and absence of major bugs to release Collator libraries to the public, we will enable this feature for Bridge specifically on Ethereum smart contract. Technically, Collator libraries were designed to work with the LQDEX PoS blockchain. Building secure PoS blockchains are a challenge at scale as the economic finality of the blocks are less probabilistic in PoS design — refer to comprehensive research done by the Ethereum team here.

What value are we using to stake with? We have evaluated the following options:

  1. LQDEX tokens
  2. Ether
  3. Dai

LQDEX tokens would be ideal because it is designed to maintain its token value by a collateral management system and by controlling reward generation on each block on PoS blockchain, as described in the whitepaper. If we were to mint ERC20 LQDEX tokens on Ethereum and force Collators to use it for staking on the contract, then there is no stability mechanism designed for it — this is not the ideal choice for Bridge at the moment.

Staking with Ether would have similar volatility and stability issues as Ether, hence we will not use ETH as collateral. If Ether were to drop below 50%, 1.5 ETH would have to be staked for every 1 ETH worth of the external asset deposit. For example, if 1 ETH is worth $100 USD and 1 BTC is worth is $100 USD, the Collator would have to stake 1.5 ETH as collateral on the contract before being able to accept 1 BTC.

Collators could stake Dai as collateral because of its inherently well-designed stability mechanism. Additional details on the mechanics of this will be released in the coming weeks through this Medium space.

In summary, LQDEX Bridge will start using Ethereum smart contracts for staking/collateral (future release) as well as ERC20 minting and destroying LQ-BTC, LQ-LTC, LQ-ZEC, LQ-BCASH in the initial version of its evolution.

Once LQDEX PoS blockchain is ready, we will move the staking/collateral function of Bridge on the LQDEX chain to make use of inbuilt stability and collateral management mechanism.

Internals of Collator Backend :

In the system architecture, the Collator backend consists of 3 parts:

  1. Blockchain node such as Geth, Bitcoind, Litecoind, and Zcashd.
  2. API — deposit and withdraw APIs (sequence explained below).
  3. Polling engine — constantly polling the different asset generated addresses when there have been deposits made to those address, or there has been a command to destroy existing proxy token.

Deposit and Withdraw API:

Deposit API

1. User calls ‘deposit’ API with his Ethereum address to receive the proxy token (PT).

2. Backend creates a new asset address and returns it.

3. The user sends an X amount of the external asset, such as BTC, LTC, ZEC, etc.

4. Backend detects the sent transaction

5. Backend mints same amount of corresponding proxy token to the PT address

Withdraw API

1. User calls ‘withdraw’ API with his asset address (BTC, LTC, ZEC, etc.)

2. Backend creates new PT address and returns it.

3. User transfers X amount of the proxy token (LQ-BTC, LQ-LTC, LQ-ZEC, etc.)

4. Backend detects the transfer event.

5. Backend destroys the amount of the proxy token.

6. Backend sends the same amount of the corresponding asset to the asset address.

Public Auditable Balances (PAD):

Since the first version of LQDEX Bridge is solely managed by a LQDEX Collator, all the balances/addresses for each of the different supported assets will be publicly auditable.

Some of the PAD’s uses:

  1. Users can audit a specific Collator for their specific addresses and balances they hold.
  2. To understand which Collators have higher or lower collateral ratios to assess the selection of Collators for deposits and withdrawals.
  3. Risk assessment of total deposits, withdrawals and volume along with collateral ratios going through a specific Collator will serve as a metric for users to understand which Collator is safe and reliable.

We believe this product will be useful from day one for people to start trading BTC, LTC, ZEC, etc. with ERC20 tokens on existing Ethereum decentralized exchanges without any changes on their side of the code. LQDEX Bridge will have UI connections talking to EtherDelta’s smart contracts directly for putting an order and filling an order for anything that has ERC20 vs Non- ERC20 combination. Future articles will elaborate on how you can trade directly from LQDEX Bridge on EtherDelta.

Connect with LQDEX:
Telegram | Twitter | Reddit | Email

--

--

LQDEX
LQDEX
Editor for

LQDEX (pronounced "liquid-ex") is a decentralized, trustless, cross-chain digital asset exchange. LQDEX.com