At Liquid protocol, we are creating an instant liquidity framework that utilizes smart contracts along with crypto exchanges to exchange any blockchain token for fiat under 30 seconds. This means that customers will now be able to liquidate their token based wealth conveniently and safely without any of the hassles described earlier.
Liquid is on a mission to:
- Provide support for crypto tokens issued on Ethereum and other platforms.
- Allow for instant exchange of such tokens into fiat currencies.
- Connect seamlessly to existing cryptocurrency card solutions, using an API based system.
- Partner with new ICOs to ensure that their tokens are easily liquid-able using the liquid platform.
How it works
Liquid Protocol connects with existing exchanges and service providers to offer a seamless mechanism of instant interconversion between crypto tokens and fiat currencies. It consists of two frameworks: an exchange mechanism and a conversion mechanism.
The first framework within Liquid protocol consists of a mechanism that manages communication with centralised and decentralised exchanges. This includes accepting API inputs containing information regarding the token the user wishes to liquidate, searching for the best price on exchanges, calculating any intermittent fees, predicting price fluctuations and delivering a JSON response with a quote. It must be kept in mind that all these steps take place in a fraction of second.
Procedure of working:
- The crypto prepaid card provider uses Liquid APIs to send Liquid information regarding the transaction value, token in use, and desired return currency (USD, EUR, GBP etc.)
- Liquid in turn uses exchange ticker APIs to find the cheapest exchange rate for the particular token to ETH. In addition to looking for the cheapest price, the framework also has a preference order of exchanges, from most trusted to least trusted. Liquid compiles a composite score for each exchange (comprising of trust and price) and in turn identifies the exchange with the highest score.
- The mechanism then uses prediction technologies (AI/ML) to analyse price fluctuation and compute the ‘maximum risk’ for the token over the next 30 minutes. ‘Maximum risk’ is in essence the greatest predictable price drop of the token over the next 30 minutes. The relevance of this step will be discussed later in this section.
- Factoring in potential costs and risks, the protocol replies to the API request with a JSON response containing the quote. This quote consists of:
- Price per token (value of 1 token in fiat)
- Total number of tokens needed to fulfil the transaction
- A smart contract address to which the tokens must be sent
- An optimal fee setting to ensure quick transfer
Time Sensitivity: How Liquid Evades Slow Blockchain Transfer Times
The biggest challenge faced by cryptocurrencies is their slow transfer times. As a result, even the quickest exchange of tokens would require a minimum of 2-3 minutes, which makes the entire system unusable for credit card transactions. Therefore, for an instant conversion, Liquid must dispense the fiat amount before the actual exchange takes place. This means that the framework must take into account any price fluctuations that can take place between funds being dispensed and the actual conversion.
How much of a delay can be expected? The chart below shows statistics for a transaction that used 21,000 gas at 4 Gwei (cost per gas). Currently, such a transfer would take around 28 seconds to confirm, as explained by the table below:
|% of last 200 blocks accepting this gas price||96|
|Transactions at or above in current Tx pool||128|
|Mean Time to Confirm (Blocks)||2|
|Mean Time to Confirm (Seconds)||28|
|Transaction fee (ETH)||0.000084|
|Transaction fee (Fiat)||$0.04183|
For a token to be converted to fiat form (USDt), a minimum of 3 transactions would be needed:
- From the user’s wallet to the Liquid Smart Contract
- From the Liquid Smart Contract to the Exchange’s token wallet
- From the Exchange’s USDt wallet back to the card issuer
Therefore, a minimum time of 1 minute 24 seconds is needed, which excludes the time taken for an exchange to process the conversion (this ranges from a few seconds for a centralised exchange to several minutes for a decentralised one). Taking into account various factors, we have concluded that a 30 minute window would be reasonable for the slowest token exchange. Considering the volatility of crypto tokens, it is necessary to account for the potential risk of a delayed conversion.
We are currently exploring options to develop our own deep learning based crypto price prediction algorithm or modifying an existing solution to suit our use case.
Instant Conversion Mechanism
The second component of Liquid Protocol is the instant conversion mechanism, which allows the crypto card issuer to receive fiat funds in exchange for tokens within a few seconds. This mechanism builds on the exchange framework discussed earlier, managing the actual transfer of funds between the user’s wallet, Liquid, exchanges, and the card issuing company. While this works in a fairly straight forward manner for crypto currencies with smart contract support (like Ethereum and NEO), the process is slightly more complicated for Bitcoin, which currently has a market share of 40% by market capitalisation but does not support smart contracts the way Ethereum or NEO do.
Protocol for standard smart contract platforms
For Ethereum or NEO tokens, Liquid API returns a smart contract address and the number of tokens to be transferred to that address, along with an optimal fee setting (e.g. Gwei in Ethereum). Upon receipt of this API response, the card issuer must initiate the transfer of tokens from the user’s wallet to the smart contract address specified. This transfer must take place immediately. The issuer must then make another API call, specifying the transaction ID.
Liquid will wait for the transaction to appear in the mempool (usually within 4-5 seconds), verify the value of crypto tokens and then dispense the required amount of fiat. Fiat, in this case, will be transferred as USD-Tether (USDt) or TrueUSD (TUSD), both of which are pegged to USD 1:1. There is also an option to transfer EUR and GBP, as requested by the issuer in their first API call.
Once the transaction has been confirmed, the smart contract will automatically transfer funds to the exchange with the best composite price/trust score (described earlier). The tokens will be swapped for USDt or TUSD and returned to the fiat pool of the contract.
Protocol for Bitcoin
Liquid is designed to work primarily with tokens issued on smart contract platforms. Nevertheless, considering the large market share and widespread popularity of Bitcoin, we have added support for Bitcoin as well. Since Bitcoin wallets cannot be operated by smart contracts, we have developed an innovative mechanism to manage Bitcoin on the Ethereum blockchain.
This involves the creation of a new Ethereum token, Liquid Bitcoin (LBTC) which is backed by Bitcoin 1:1. Liquid Protocol will issue 1 LBTC for every BTC deposited in its wallets. Therefore, we will essentially make Bitcoin an ERC20 compliant Ethereum asset.
The initial exchange between BTC and LBTC will take place as follows:
- The card issuer will use Liquid API to send the user’s Ethereum address in which the LBTC should be deposited after conversion.
- Liquid will return a newly created Bitcoin address in which the user’s Bitcoin should be deposited.
- The card issuer proceeds to deposit Bitcoin in the address.
- Liquid uses BTC Relay or a similar service to send details about the transfer to a smart contract address once the transaction has been confirmed.
- The smart contract automatically sends an equivalent amount of LBTC to the user’s Ethereum address.
Bitcoin has now been converted to an ERC20 asset, which means that it can be transferred across the Ethereum blockchain as any other smart contract token. For every transaction, an equivalent value of LBTC must be sent to the smart contract returned by Liquid API, in much the same way as described earlier.
When the user wishes the withdraw his/her Bitcoin from the wallet, the following process will take place:
- The card issuer makes an API call to Liquid with the Bitcoin withdrawal amount, and withdrawal wallet address.
- Liquid returns a smart contract address to which the LBTC must be sent.
- The card issuer transfers the LBTC equivalent to smart contract address.
- Liquid transfers Bitcoin from its BTC wallet to the user’s wallet as soon as the transaction is confirmed.