Note: For the latest on the future of Chainflip and the next evolution of the Loki Project, read our project update.
The next chapter in private cross-chain asset swaps
Since getting started in 2018, Loki has been constantly exploring and pushing the boundaries of what a staked node network can do.
So far, our incentivised Service Node network is being used to power an encrypted messaging app — Session — and a low-latency onion router — Lokinet. Session and Lokinet are both in active development, and they’re both going from strength to strength. Session is gaining traction in the privacy community thanks to its anonymous account system and decentralised back-end, while Lokinet is hurtling towards the biggest new feature in its history — exit nodes. We’re more excited than ever about these projects, and we’re in full support of their ongoing development.
To us, the success of Session and Lokinet is a sign that the idea we had three years ago was spot on — off-chain technology backed by blockchain-staked nodes is a world of untapped potential.
Just as Session corrects an overreliance on centralised messaging services, there’s another space which is highly centralised: finance. Even in the world of crypto, trading and exchanging assets often means relying on centralised services — exchanges, brokers, and other middlemen.
That’s why it’s time to unveil a new project launching on Loki — a project close to the heart of cryptocurrency, trade, and finance. Today, we’re announcing that Loki will be supporting a new entrant to the world of decentralised finance, or DeFi.
Of course, we’re not the first ones to notice the centralisation problem in finance. The DeFi world has been growing and maturing for some time now — if you’re an active crypto enthusiast, you’ve probably heard of DeFi projects like Uniswap.
So far, DeFi initiatives have been largely centred around ERC-20 tokens, which don’t quite live up to the standards of privacy that we expect here at Loki.
That’s one reason why Loki hasn’t really been a part of the DeFi space — until now.
TL;DR: Loki is entering the world of decentralised finance, and will be supporting the development of a cross-chain decentralised asset swapping service called Chainflip. Skip to FAQ.
So what is Chainflip? Simply put, Chainflip is a DeFi asset swapping service which will allow you to exchange cryptocurrencies cross-chain.
Uniswap, the decentralised ERC-20 token trading system that allows for swapping of any pooled ERC-20 token into any other pooled ERC-20 token, uses ETH itself as a trade medium. It was created to solve the liquidity drought seen on many decentralised exchanges. By incentivising people to stake into liquidity pools for each ERC-20 token, Uniswap encourages liquidity for all supported tokens, providing users with a trustless, decentralised token swapping service that will reliably have the liquidity necessary to support large swaps.
We think Loki is uniquely positioned to help a new entrant improve on the Uniswap vision — and that’s where Chainflip comes in. Chainflip is a cross-chain liquidity pool system that allows users to swap any crypto asset for which Chainflip has a liquidity pool into any other supported asset — BTC to ETH, XMR to LOKI, USDT to BTC, if there is a Chainflip pool, users can make the swap.
We’re excited to be announcing our support for Chainflip today, and we think it has the potential to be the next big thing in DeFi — keep reading to get a glimpse of how Chainflip will work and the timeline for rolling it out.
How it works
Chainflip relies on combining some concepts that DeFi users will be familiar with — liquidity pools and arbitrage-based price regulation — with some new elements, including decentralised vault nodes and quoters, and a web front end that can be accessed both via the clearnet and anonymously through a Lokinet SNApp. In this section, you’ll get a high-level conceptual explanation of how these parts work together to enable Chainflip. A low-level technical rundown, including a look at the underlying maths and economics, will be released by the Chainflip team once the finer details have been hashed out.
The first hurdle for any decentralised asset trading system is how to supply liquidity. Traditional centralised exchanges provide liquidity by relying on an order book-based system to pair sellers and buyers. Liquidity pools provide an alternative trading system that can be decentralised much more easily. Rather than individual traders placing asks and bids on an asset, liquidity providers stake assets into a pool, providing liquidity for users of the swapping service. A percentage of the value of each swap is programmatically taken as a fee and left behind in the pool, funding liquidity provision over time and effectively earning stakers a return on their initial capital input. Liquidity providers can withdraw their assets from a liquidity pool at any time, receiving a percentage of the pool’s current value proportional to their starting contribution.
A second challenge for decentralised swapping systems is ensuring that the price ratio between each asset pair remains (relatively) consistent with the rest of the market. Each swap conducted using a given liquidity pool will result in a shift in the balance of the pool’s asset pair; the larger the swap, the bigger the resulting imbalance. Such an imbalance will give rise to an arbitrage opportunity: sharp-eyed traders with readily accessible stores of the relevant asset will be able to swoop in and swap the overvalued asset against the undervalued asset then sell the undervalued asset on other exchanges, turning a tidy profit. This process will repeat until the liquidity pool is once again balanced with the wider market. After a series of relatively large swaps and a return to fair market price, the total value in a given pool should always increase due to the fees collected on each swap.
Under a liquidity pool system, market makers and liquidity providers alike are exposed to losses that people simply buying and holding the same assets would not be exposed to. This type of loss, which is a topic of significant discussion in DeFi, is known as impermanent loss — even though there’s often nothing impermanent about it.
There are some situations where it would make more sense to simply hold assets outside of a pool, because liquidity providers can come out worse off if there are significant price changes that aren’t offset by trading fees. In order to encourage trading on liquidity pools, the liquidity pools will be seeded to make trading on them in the early days more attractive, which will also make liquidity provision more attractive.
Chainflip’s real potential comes from its ability to provide direct cross-chain asset-to-asset swapping. Chainflip doesn’t rely on ‘wrapped’ ERC-20 tokens or other synthetic assets to achieve cross-chain swaps. It doesn’t take 5 or more steps to swap assets. Users don’t need any special wallets or other software. All a user needs is a browser, an asset, and a wallet address for the asset they’re swapping into.
All of Chainflip’s liquidity pools are staked against $LOKI. Using a universal quoting and state machine mechanism, swappers are able to swap their assets — swapping BTC into ETH, for example — without even needing to have a Loki wallet, with the swap occurring as rapidly as the origin and destination chains allow.
Additionally, Chainflip’s PrivateSwap mode allows users to leverage the privacy afforded by the Loki blockchain. In this mode, funds are temporarily stored on the Loki blockchain before being swapped out again in chunks, effectively ensuring privacy of the participants is preserved — regardless of the properties of the origin and destination chains. The feasibility of this mode is currently being investigated.
So, how will Chainflip actually work? Well, the system itself involves a few moving parts:
- Vault Node(s)
- Front-end interface
- Liquidity providers (stakers)
- Swappers (users)
Let’s run through each component and break down how they contribute to Chainflip’s swapping system.
Vault Nodes are special types of staked Loki nodes that store and send the assets which form Chainflip’s liquidity pools. Using multi-signature signing and Threshold Signature Schemes (TSS), these Vault Nodes trustlessly provide destination addresses on the chains of each liquidity pool. Whenever users swap assets from one chain to another, or deregister their stake in a given liquidity pool, Vault Nodes construct and send those transactions on the relevant chain(s).
The Quoter communicates with Chainflip’s Vault Nodes in order to provide users with ‘quotes’. Quotes give users an indication of the rate they will get on a given swap (based on the size of the desired trade). Quoters will register quotes with Chainflip’s Vault Nodes, so Vault Nodes can watch for user transactions and distribute counter-assets when that transaction enters their multisig vault.
An accessible and intuitive front-end interface is the cornerstone of any service hoping to reach mass adoption. Rather than requiring complex client and node software on users’ devices, Chainflip will offer a simple web-based frontend accessible from any browser. This primary frontend will be designed and maintained by the Chainflip team to provide a straightforward and intuitive user experience. In the spirit of true decentralisation, however, the option to interact directly with Vault Nodes, quotes, and Chainflip’s state chain itself will also exist, ensuring that users need not rely on a centralised frontend provider to use Chainflip.
Liquidity providers — or ‘stakers’ — ask the Quoter to generate stake requests. Stakers will have the option of providing either symmetrical or (in the case of pools with deep liquidity) asymmetrical stakes. Asymmetrical staking allows a staker to inject an asset into only one side of a given liquidity pool (e.g. only BTC rather than both BTC and Loki) and end up with a balanced stake in the pool. Stakers are effectively market makers — they earn a share of swap fees in return for providing liquidity. Stakers sacrifice some upside potential on their assets (relative to simply holding unstaked assets) in return for exposure to the trading fees the pool collects along the way.
Chainflip’s actual users, the swappers, might be crypto investors, day-to-day users of supported chains’ platforms, arbitrage traders, or anyone else seeking fast, easy cross-chain asset exchange without needing to register and verify accounts, place orders, set up arduous 2FA security, or trust a centralised exchange. Instead, users can simply swap any supported assets as fast as the relevant blockchains allow.
How Chainflip will become a reality
At Loki, our goal is to utilize staked nodes to provide private decentralised services, and we think Chainflip is exactly the kind of project we should support, as well as being a huge boon for the Loki ecosystem. The more people there are using Loki-based projects, the stronger the network is, and that means the infrastructure supporting Session and Lokinet gets even stronger. Even though the Loki crypto’s function within Chainflip will be transparent to swappers, Chainflip will be a huge value-add for both the crypto itself and the Loki Project as a whole.
We want to help build a future where asset trading is less reliant on centralised exchanges, but first things first: we need to know if that goal is something the Loki community supports.
With that in mind, here’s a look at the staged rollout planned for Chainflip.
Keep in mind, these are early days, so some of the finer details may change.
Developing a minimum viable product as a proof of concept: the Chainflip alpha
Chainflip’s alpha build will be simpler than the vision for its final implementation — this will be in order to expedite development time and help gauge community interest. We will be supporting another organisation which will:
- Develop the frontend interface for Chainflip
- Run vaults and quoter as centralised services
- Provide incentives for users to stake into the liquidity pool
Obviously this alpha is far from full realisation of the decentralised vision for Chainflip. However, if this version of Chainflip proves to be popular with the community, more resources will be devoted to it to make sure it delivers on its full potential. This stage will allow Chainflip to generate liquidity, build community interest, develop a user interface, and iterate on the vision for the concept.
The Chainflip interface will also be available as a Lokinet SNApp, allowing users to access the service anonymously.
On the other hand, if community interest in the Chainflip alpha isn’t at hoped-for levels, plans for supporting the concept will be re-evaluated.
In the event that step one is successful, the next major step in decentralising Chainflip will be changing the trust model of the vaults. During the alpha, the alpha program operator will be running the vaults, but in the second stage, we’ll support the development of a suite of software daemons to set up a multisig vault for each chain that is integrated into Chainflip.
This will make sure Vault Node operators are set up for success when permissionless participation is launched at a later stage. Step two will also involve implementation of the Chainflip state machine, which will make the transition to fully decentralised vaults much simpler.
Vault Nodes on the Loki Network
This step is much more involved, and represents the bulk of the work that must be done. An entirely new class of nodes on the Loki Network will need to be created. However, step two will have laid the groundwork for vaults and decentralised use of the state machine, which will smooth out the work required in step three.
Vault Nodes will likely be paid a fee from the block reward, which could be offset by burning Loki every time swaps occur between vaults. This design is a work in progress, but the model is fundamentally similar to the ideas behind LNS and Blink fees, which are already enabled on the Loki Network.
A fully decentralised system
The final step in the quest to decentralise Chainflip is to remove the centralised quoter. This comes last because so long as the contents of the state machine can be verified by the user externally, centralised quoters don’t pose a large trust risk to users. But centralisation still leaves this part of the service vulnerable to censorship, leaving users unable to access the system if the centralised quoter were to be taken down.
As such, a method of permissionless injection of quotes into the state machine is being discussed.
Progressing through the stages
Using the knowledge we’ve gained from developing the Service Node quorum systems, and technologies such as LokiMQ, we’re extremely well placed to support this decentralised technology and enable the release of a cross-chain swapping service to the world. But at the end of the day, we’re relying on your support and belief to drive the usage of this tool in the wider crypto community.
What is Chainflip?
Chainflip is a new DeFi asset swapping service being developed on the Loki Network. Chainflip is intended to allow for quick and easy cross-chain asset swapping.
Why are you supporting this?
We believe Loki is uniquely positioned to support a new entrant to the DeFi space. With the existing foundation of the Loki blockchain and related infrastructure supporting it, we think Chainflip will be able to solve a lot of the challenges facing current DeFi projects.
How long will this take?
The exact development timeline depends on Chainflip’s reception by the community. We’re focused on supporting tools that you — our community — actually want to use. If Chainflip receives strong community support, we will devote greater support to the development of the project.
We hope the Chainflip alpha will be available very soon. From there, Chainflip’s popularity and viability will be assessed to decide how much we will support Chainflip’s ongoing development. It is quite possible that Chainflip will receive ongoing support over time, similar to the Loki Wallet.
Will this slow down the development of Session, Lokinet, or Loki Core?
No. One Session developer will be re-tasked to monitor the Chainflip project, but we are currently seeking a new Android Session developer to fill the resulting gap.
All of the Loki Foundation’s existing projects and initiatives will continue to be actively developed, with the same level of resources and support which they have had up until this point.
How is Chainflip different to Uniswap or other existing liquidity pool services?
Chainflip is built to interact with potentially any blockchain, so it could facilitate swaps between any cryptocurrencies which have been integrated.
This means swapping with Chainflip is not limited to ERC-20 tokens — or any other single type of token. Chainflip can be used to swap any two assets for which there are liquidity pools.
Chainflip does share some design features with existing liquidity pool and cross-chain projects, but there are fundamental differences. Chainflip uses Loki — a CryptoNote blockchain — as a trade medium, and Loki’s intrinsic privacy features mean it can be used as both a swapping agent and a privacy tool.
Additionally, Chainflip does not use any ‘wrapped’ or ‘synthetic’ tokens, or complex multi-step processes involving specialised wallets. ‘Chain-agnostic’ approaches are not believed to be a viable way to solve the cross-chain swapping problem; instead, Chainflip considers all of the features and limitations of each integrated chain, as they are integrated. There are already solutions written up for most major blockchain types.
This is a very competitive space — how will Chainflip succeed?
Any team designing a cross-chain swapping tool where nodes have wallet custody will need an understanding of how to design, maintain, upgrade, and architect node incentives, software, and consensus rules, and the Loki team has the experience and expertise in each of these areas necessary to support the development of Chainflip.
Where’s the whitepaper, or a more in-depth explanation of the technology?
Today, we wanted to share the vision for the Chainflip project with you so we can start canvassing for thoughts and feedback. While there’s obviously a lot of information still to come, including technical details, cryptoeconomics, and the mathematics behind Chainflip, that information will be released as it is finalised.
Come and talk about Chainflip!
If you’d like to jump in and brainstorm, an open discussion will be held with all of you. Some more formal designs are currently being worked on, which will be shared at a later stage, but we wanted to share this announcement of support to get the ball rolling with you, the Loki community. We’re hugely excited to share our vision of the future of decentralised asset exchange — and we hope you’re excited too.
We can’t wait to hear from you!
Note: The Blockswap project was rebranded to Chainflip on 25/09/2020.