DeFi on Bitcoin
Level up your open finance game five times a week. Subscribe to the Bankless program below.
Dear Bankless Nation,
Can we build DeFi on Bitcoin?
It’s surprisingly hard to get a real answer to that question. Everyone has an agenda.
But what you’re about to read is the most honest answer to DeFi on Bitcoin that I’ve ever seen.
Probably because it’s written by real builders working to actually make it happen. It’s written by Bitcoiners who’ve kept the core vision—crypto is about building a bankless money system for the world. Not a duplicate of the banking system we already have.
Maybe we could use a bit more bankless maximalism in crypto.
You’re really going to enjoy this one.
Let’s learn about DeFi on Bitcoin.
DeFi on Bitcoin: Our Experience
E-cash. Cheap p2p payments. Censorship resistant digital gold.
Whichever narrative you ascribe to, Bitcoin was designed as an alternative to the incumbent financial system. Designed to create a bankless system that displaces the old system, and thus removing dependencies on institutions and intermediaries.
However, financial tools on Bitcoin have gone down a completely different path. To this day, most activities around BTC are dependent on large "crypto banks" like centralized exchanges and centralized lending platforms that largely dominate their respective verticals.
These crypto banks require you to deposit your BTC with them and typically, little is known about what exactly happens to those funds after they are deposited. As some have keenly inferred and noted with the centralized lending platforms, in particular, they are free to rehypothecate, trade, and conduct other profit-making activities with the Bitcoin collateral users provide them.
Users of these products are subject to custodial risk as well as the risk of failures in their opaque internal risk management systems. Centralized platforms are also restrictive in terms of who can access them due to jurisdiction requirements and they often require an “application” process to obtain a loan.
The rise of DeFi
While Bitcoiners were left using centralized crypto banks for their financial needs, projects like MakerDAO, Compound, etc. were busy building transparent, open, and non-custodial solutions for Ethereum folks, creating everything from a censorship-resistant stablecoin to a transparent money-market.
Source: DeFi Pulse July 21, 2020
But why weren't these type of applications being built on Bitcoin?
Part of this may stem from the challenges of building on Bitcoin. Bitcoin script is a simple, primitive, and secure stack-based language. It is not Turing complete and has no concept of state. This makes it very easy to securely lock your Bitcoin, without any worry of a "smart contract hack" as we so often see in Ethereum. But it also makes it considerably more difficult to build with.
Another challenge stems from the lack of ecosystem for building financial applications on top of Bitcoin. Without a MetaMask or Web3 ecosystem, the gateway to building on Bitcoin and DeFi is much more difficult.
The earliest attempts at Bitcoin DeFi were mostly focused on exchanging, specifically Atomic Swaps. Teams such as Summa, Liquality, SparkSwap, and Swap Online, all began building experimenting with ways to enable cross-chain exchange in 2017/2018.
Some of these atomic swap solutions reached main net and got traction. However, most of them faded away or pivoted.
Building for Bitcoin is hard, and building cross-chain is even harder. You need to know the participants' Bitcoin address before entering into an agreement. You also can't create a liquidity pool on Bitcoin. That means no AMM's, and liquidity providers need to be online 24/7 to allow for participants to interact with any type of Bitcoin DeFi.
Despite this, Liquality has been working hard to overcome many of these UI/UX challenges (thanks to their new Liquality wallet) and has recently received an increasing amount of traction for swapping BTC, ETH, DAI, and USDC.
Liquality Swap Volume 2020
Alternate types of exchange
One of the more unique projects came from Summa with their cross-chain auctions. They achieved this by using SPV Proofs to prove that a BTC transaction occurred on Ethereum.
This allowed users to download a desktop application, and use Bitcoin to buy Ethereum assets in an auction.
Although this was a very elegant and unique solution, it didn't get a lot of volume or use. This may be related to the fact that it required users to download a desktop app, or that liquidity for the auctions never gained a significant amount of traction.
Wouldn't it be great if you could just have an ERC20 representation of BTC that could be used with all of the existing DeFi protocols?
No need for custom Bitcoin wallets, and no need for liquidity providers to be constantly online.
At the surface, this sounds like the perfect solution. However, every version of tokenized Bitcoin has trade-offs.
First came WBTC or "Wrapped Bitcoin". This solution allowed users to deposit BTC with a custodian, and in return get an ERC20 BTC. This of course is much more similar to CeFi than DeFi since users need to go through a KYC process, and trust a third-party custodian.
On the bright side, each WBTC is backed 1:1 with BTC, so it is very easy to scale.
Source: btconethereum.com (BTC locked in WBTC)
Next was tBTC, or "Trustless BTC", which allowed users to deposit BTC, held by custodians with ETH stake, and receive an ERC20 BTC. The ETH stake held by custodians is greater than the value of the BTC locked (1.5x initially). If the custodians misbehave, then their ETH stake can be slashed.
The trustless nature of this token makes it a much more censorship-resistant, and a better option for DeFi. However, the significant amount of ETH collateral makes it very difficult to scale, as every person who wishes to lock 1 BTC and mint 1 tBTC, must be accompanied with a custodian/staker with 1.5x the value of that BTC in ETH.
🧠 Note: tBTC briefly launched back in April, but ended up pausing a few days after launch due to a vulnerability in SPV Proof verification on legacy Bitcoin transactions.
They have plans to relaunch.
Lastly, renBTC, a protocol similar to tBTC, allows users to deposit BTC, once again held by a trustless custodian (the RenVM), however, this time REN is used as collateral (instead of ETH).
Once again, the trustless nature makes it censorship-resistant, and it is designed with the assumption that as more assets are locked up in the system, the value of REN will grow, which makes it more scalable than tBTC.
However, with REN being a newer asset, using it as collateral increases the concern of insolvency in the case of users losing confidence in the protocol.
Source: btconethereum.com (BTC locked in renBTC)
Bitcoin sidechains such as RSK offer an underlying platform to build DeFi on Bitcoin. In fact, Money on Chain has been working on building a stablecoin solution on this very platform.
RSK works by enabling users to lock their BTC in a federated sidechain, which runs the EVM and receive RBTC. This means applications on RSK can create smart contracts with BTC.
However, this requires users to trust the federation and a proper bridge into RSK. So far there has been limited traction with this approach. Most likely due to the lack of a proper bridge, and the lack of applications built on top.
Our Experience building Atomic Loans V1
After being frustrated with only being able to get a BTC-backed loan from "crypto banks" pre-2018, our team set out to build a protocol that would allow Bitcoin holders to get access to liquidity without liquidating their Bitcoin in a trust-minimized way.
Our goal was to allow users to lock BTC as collateral, and receive a loan in an Ethereum stablecoin.
Why not use tokenized BTC?
At the time of building, tokenized Bitcoin did not exist on Ethereum. We contemplated going this route but realized that it would either not be scalable, due to the high collateralization requirements for custodians/stakers or would require taking custody in order to mint an ERC20 BTC.
We opted for a P2P loan model (easiest to build for V1), which allowed users to lock BTC in a custom Bitcoin contract, that could be unlocked in the case of repayment or liquidation of a position.
For repayment, this was achieved using a similar mechanism used in atomic swaps (revealing a secret after repayment to allow the borrower to unlock their BTC). For liquidation, a 2-of-3 multi sig was used (with borrower, lender, and arbiter) which allows lender and arbiter to liquidate the collateral in the case that a debt position went below the minimum-collateralization ratio.
Using an arbiter has different trust properties to an oracle. In a typical DeFi protocol, if an oracle misbehaves then all the debt positions in the protocol can be liquidated. With an arbiter, it's easy to collude with a particular lender or borrower, but difficult to take the entire system down.
However, using a model like this meant that the lenders needed to be online 24/7 to be able to reveal secrets and help liquidate. To solve this, we built agents to allows lenders to set and forget their funds. But even with these agents, compared to protocols like Compound, this process was quite cumbersome.
Additionally, we quickly learned that the P2P loan model was very capital inefficient. Pooling is difficult in Bitcoin (unless you tokenize it). Our V1 model meant that you could have lenders lend to multiple borrowers, but not the other way around.
This naturally led to the need for larger lenders and smaller lenders with unutilized funds.
On top of this, using a custom Bitcoin contract (P2SH) meant that most Bitcoin wallets didn't support unlocking the BTC.
We opted for using Ledger Nano initially to allow borrowers to unlock their BTC since Ledger supported the particular unlocking capabilities we needed (signP2SHTransaction). Surprisingly, many early customers didn't have Ledgers, and even those that did have one didn't necessarily feel comfortable connecting their device to a web interface, for fear of the web interface scanning their transaction history.
Despite all these constraints, we managed to reach ~500k TVL before pausing on June 21st, 2020 after a vulnerability disclosure by samczsun. Building and launching V1 was a great learning experience and taught us a lot about what users really care about.
- Building for Bitcoin is hard
- Users prefer non-custodial only if it's a simple experience
- Requiring users to set up infrastructure reduces likelihood of liquidity provision
- Pooling is a lot more capital efficient
Future of DeFi on Bitcoin
So far most of the solutions mentioned so far, have involved the EVM in one sense or another. It's hard to say whether this will continue to be the case, although there are some projects in the work that enables "DeFi" using the native functionality of Bitcoin.
Blockstream has been working on a blockchain smart contract programming language called Simplicity, which is designed to enable code execution to be easily formally verifiable.
It is currently a work in progress and is expected to be completed by the end of the year. At that point, it will most likely be deployed to Liquid sidechain. There are currently no plans or intentions to have this incorporated into Bitcoin Core any time soon.
DLC's (Discrete Log Contracts)
Discrete Log Contracts are basically Bitcoin oracle contracts. They enable users to enter into an agreement that is enforced by "real life" events and settled in BTC.
This is achieved by having participants lock their funds into a 2-of-2 multi sig and follow similar exit methods to the lightning network (i.e. cooperative close and uncooperative close with oracle signature).
These contracts enable financial derivatives and prediction markets to be created on top of Bitcoin.
DLC's are also transferable on-chain and over the lightning network, allowing for users to enter and exit position off-chain. However, DLC's over the lightning network run into the same capital inefficiency problems as routed payments.
If you're interested in learning more about DLC's, the Suredbits blog is probably the best resource out there.
RGB is a smart contract system that allows for assets to be issued on top of the Lightning Network.
This is achieved by anchoring assets to specific Bitcoin UTXOs and addresses and preventing double-spending by using single-use-seals (cryptographic primitive that ensures that a particular message can only be sent once).
Tether is planning to issue USDT on RGB by the end of the year.
Combining the capabilities of RGB with the work being done on DLC's enables even more financial derivatives and prediction markets use cases.
RGB is also planning to integrate Simplicity to enable more advanced smart contract capabilities once it is finalized at the end of the year.
To learn more about RGB, be sure to join the telegram community!
Bitcoin is digital gold. But that doesn't mean it needs to act as a shiny rock.
From DLC's to tokenized BTC, more and more infrastructure is being built to allow Bitcoin hodlers to use their BTC for new financial applications.
Whether these applications are built on Ethereum using cross-chain bridges, on sidechains like Liquid, or on Lightning Network—only time will tell.
- Try out Bitcoin DeFi using tokenized ERC20 BTC
- Participate in Atomic Loans “Sats for Science” customer research
- Read: Is tokenized BTC bullish for ETH?
🙏Thanks to our sponsor
Aave is an open source and non-custodial protocol for money market creation. Originally launched with the Aave Market, it now supports Uniswap and TokenSet markets and enables users and developers to earn interest and leverage their assets. Aave also pioneered Flash Loans, an innovative DeFi building block for developers to build self-liquidations, collateral swaps, and more. Check it out here.
Not financial or tax advice. This newsletter is strictly educational and is not investment advice or a solicitation to buy or sell any assets or to make any financial decisions. This newsletter is not tax advice. Talk to your accountant. Do your own research.
Disclosure. From time-to-time I may add links in this newsletter to products I use. I may receive commission if you make a purchase through one of these links. I’ll always disclose when this is the case.