DLCs on Lightning and Bitcoin Smart Contracts – Bitcoin Magazine
Below is a direct excerpt from Marty’s Bent Issue #1286: “The first mainnet DLC on Lightning has been done.” Sign up for the newsletter here.
It’s been exactly 11 months and two days since we wrote about discrete log contracts (DLCs) in this thread. For those of you who are a little rusty or completely ignorant of what a discrete log contract is, it is a special type of bitcoin transaction that executes a smart contract with information provided by an oracle.
For example, if two people want to bet on the outcome of Saturday’s NBA contest between the 76ers and the Grizzlies, they can create a DLC by unlocking funds in a multisig address, pre-constructing outcome transactions – if the 76ers win, send the bet to this address, if the Grizzlies win send the bets to this address – and choose an oracle, a company that publishes final results, e.g. Statmuse. The oracle provides a hash of the outcome of the game. Once the game is over on Saturday, the DLC can be locked out by the winner of the bet by signing the transaction that moves the bet in the smart contract to their address using the hash of the outcome provided by Statmuse.
A sports bet is just one example. Individuals can decide to bet on the price of bitcoin, the hash rate at a certain block height, the temperature on a certain day, or even create peer-to-peer derivatives like the ItchySats team has done. If you freaks have followed our coverage of DLCs over the years, you probably know that Uncle Marty is pretty bullish about the potential for DLCs to disrupt a number of industries. But to date, one of the things limiting DLCs from hitting a critical tipping point is the fact that they’ve only been done on chain. Considering how many potential applications could leverage DLCs and how many end users they could potentially touch, the thought of scaling this use case on-chain seems untenable, especially considering the possibility of periods of elevated transaction fees that make certain DLCs uneconomical . To me, it makes sense for DLCs to operate on Layer 2 protocols, such as Lightning Network or Fedimint, which have relatively cheap fees.
Well, the Crypto Garage team announced that they successfully opened and closed a Lightning channel with an embedded DLC channel on the mainnet. According to their blog post, it appears that the Crypto Garage team forked the Lightning Development Kit to add support for sharing a Lightning channel, which has enabled them to create a DLC channel within a Lightning channel. From there, they were able to create special transactions—a split transaction and a glue transaction—that would allow the various parties engaged in a DLC to update the contract state within the Lightning channel and the DLC channel without giving either party an unfair advantage, which was one of the major design challenges previously unsolved. This is a big step in the right direction.
That said, the Crypto Garage team cautions that this implementation is in its early days and should not be considered stable. In fact, they warn that you will likely lose your stake if you try to do this on the mainnet. Still, this is amazing to see. Shoutout to the Crypto Garage team and those who helped them push this forward.
Slowly but surely, as every naysayer on the planet claims bitcoin is a failed Ponzi scheme, those who recognize the revolutionary nature of the protocol are building the tools that make bitcoin more useful to individuals around the world.