Arbitrary Bitcoin Contracts over LN



Summary:

A recent discussion on an IRC channel questioned whether smart contracts could be transported via LN. It is theoretically possible as long as the contract can be implemented as a Bitcoin SCRIPT. However, Poon-Dryja is superior to Decker-Wattenhofer or Decker-Osuntokun-Russell for transporting arbitrary contracts. The only smart contract worth transporting is HTLC, which can also be used for swap options and multi-step swaps. Of these, Decker-Osuntokun-Russell "eltoo" is far superior to Poon-Dryja "LN-penalty" in other ways except for the transportation of arbitrary contracts.For the transportation of an arbitrary contract C over a channel between nodes A and B, under Poon-Dryja, there must first be a channel anchoring transaction on-chain. From there, a symmetrical series of transactions are created that include (signA signB, revoke) || (A && B && C), where (revoke) is the revocation key. Note that only signA and signB need to be shared, while the witnessC can be fulfilled by each side automatically. Under Decker-Osuntokun-Russell eltoo, the transaction series is simpler with no additional script necessary. However, the CSV in the second transaction may interfere with the operation of the contract C if it is time-sensitive.Poon-Dryja is inferior in many other ways such as not using nLockTime in a sufficiently clever way, having "toxic waste," and symmetrical chains of transactions different for both parties instead of a single chain. Arbitrary contracts are not particularly useful either, compared to HTLCs, which are an important building block for digital value transfers. Ultimately, Decker-Osuntokun-Russell remains a superior technology over Poon-Dryja.


Updated on: 2023-05-25T02:01:54.396106+00:00