Tether-efill your lightning channels
TLDR; Boltz adds support for Tether, enabling users to atomically swap USDT for lightning Bitcoin and vice versa.
TLDR; Boltz adds support for Tether, enabling users to atomically swap USDT for lightning Bitcoin and vice versa.
Rewind
Boltz started as a simple submarine swap service that allowed users to refill and withdraw from their Bitcoin lightning channels across layers in a self custodial manner. This naturally attracted lots of early lightning adopters to use our service. We slowly added API support, which enabled apps like Breez to integrate Boltz reverse swap service, and also launched Channel Creation swaps, which made it easy for new users of lightning to get a fully balanced ready-to-transact lightning channel with inbound liquidity. Over time Boltz had evolved into a full fledged lightning service provider (LSP for short). While we will continue to work on other LSP features and integrations with various lightning apps that are currently in the pipeline, we felt it was time to give the “exchange” side of the Boltz offering some attention. We are starting this today by adding Tether (USDT).
The Tether conundrum
Tether has been a controversial topic of debate in the Bitcoin community. Many are apprehensive of it, and rightly so. After all, how could an inherently pro privacy and economically libertarian community endorse Tether? The entity behind the Tether cryptocurrency is accused of freezing assets and issuing tokens on a whim, which according to many is an antithesis of what the community stands for. But for the better or worse, Tether has proven to be quite successful and resilient to regulations. In this ongoing crypto bull run, Tether’s commutative transaction volume went above $600B. With first mover advantage, Tether has benefited from building a network effect around its stablecoin before anyone else even got started. The rationale behind us deciding to add it is that Boltz is an exchange service and it cannot function as one without offering popular asset pairs. The popularity and adoption of the BTC/USDT pair has been able to garner in the past few years is evident by the success of companies like Binance. As a privacy first and lightning first project, we enabled the LN-BTC/USDT
pair only with one particular use case in mind: providing our users an option to refill their lightning channels with USDT.
Technology
Since inception, we at Boltz have worked towards building a cross chain and cross layer atomic swap solution using native assets. It is not only practical but also adheres with the core principals of privacy and self-custodianship. Tether offering adds another feather to the cap. BTC-LN to USDT and USDT to BTC-LN swaps on Boltz uses the same HTLC powered concept prevalent in other cross layer swaps already offered by Boltz. HTLCs, or hashed timelocked contracts, are integral to the architecture of the lightning network, and are standardized on the Bitcoin blockchain. This doesn’t hold true for account-based blockchains like the Ethereum network — which means to add support for ERC20 tokens like Tether, you guessed it — we needed to write a smart contract.
Building a smart contract for Boltz swaps required us to focus on two main aspects: security and transaction costs. Security of the user’s funds is of utmost importance to us. We were obsessed about making sure that the smart contract is written with industry grade best practices. We also undertook rounds of in-house penetration testing. These steps were important for making sure that the smart contract is production ready before deployment. With all these frequent DeFi hack news, we are proud to say that we don’t test in prod.
The second important aspect of our focus was the transaction cost. With heavily fluctuating gas prices on the Ethereum network, it’s important for us to optimize our smart contract for gas use, so that our users can save on transaction fee. There’s a simple rule when it comes to gas costs on the account based blockchains: computation is cheap, storage is expensive. We were able to considerably bring down the transaction fees by storing as little data in the global state of the Ethereum network as possible.
The novelty of the Ethereum smart contract allowed us to eradicate the need for users to download the refund files for USDT to LN-BTC swaps — which is a necessity for swaps UTXO based chains. All the data needed to refund the locked coins from the contract can be queried via an Ethereum node. This resulted in a smart contract that not only offers great user experience on Boltz but is also secure, cheap, and easily auditable with rudimentary understanding of the Solidity language.
In the spirit of open source and complete transparency, here is the Boltz contract for the swap that is verified on Etherscan. The code is publicly available in the Boltz Github repo.
Demo
The following is the video demonstration of how users can use their USDT to refill their lightning channels using Boltz
Summary
USDT integration was in the works for quite a while now and we couldn’t be more stoked to finally ship this. We hope that our users would be as excited as we are for this new asset that can be used to refill and rebalance lightning channels. Like always, hit us up on Discord if you have any feedback or just want to say Hi. Stay healthy and Boltz on ⚡