Blockchain scripting and contract firm sCrypt has won the 2024 Bitcoin Olympics Hackathon (Litecoin Track) by showing how it’s possible to make a payment on one blockchain and receive an asset on another. The two-man team of software engineers Mihael Šinkec and Yusuf Idi Maina leveraged SPV and the opcode OP_CAT on the BTC Signet, demonstrating a transaction where a buyer used Litecoin to purchase BTC Ordinal tokens.
sCrypt said the demonstration expands the potential for DeFi applications, exchanging one type of digital asset for another directly between transacting parties. There’s no need for coordination between the two parties and no need to trust third-party intermediaries like exchanges.
Announcing the winner of the Litecoin Track at the #Bitcoinolympics 🥁🥁 For proposing trustless cross-chain interoperability between #Bitcoin and #Litecoin by leveraging the #OPCAT opcode.
The winners: 🏆 @scryptplatform & @gashinge9989 Congrats!! https://t.co/rChp0J78eU— Litecoin Foundation ⚡️ (@LTCFoundation) September 8, 2024
Šinkec said constructing such a transaction using raw BTC ASM (assembly code used to create custom scripts) would be complicated, so the pair used sCrypt’s SDK. The SDK lets developers work in more familiar TypeScript to focus instead on the contract logic. Šinkec and Maina verified transaction preimages on the stack and verified them with “a straightforward function call” in a BTC covenant.
This process also uses Simplified Payment Verification (SPV) on Litecoin, reconstructing a transaction’s Merkle Root by using its data and Merkle Path and then comparing it to the transaction’s Block Header. Using SPV, the client checks the Block Header’s validity without requiring a full download of the blockchain.
Explaining the process on Medium, Šinkec wrote that it was a challenge to verify a Litecoin transaction proof using BTC script since the two blockchains use different PoW algorithms. The team used an oracle that could attest to the validity of Litecoin transactions and Lamport signatures that could be verified in BTC script.
The Litecoin SPV proof was then used to unlock a BTC Ordinal token placed in a BTC covenant and transfer the asset to the receiver’s BTC address. A “covenant” allows a programmer to impose constraints on how specific coins may be spent in future transactions.
Why OP_CAT is necessary
Explaining the covenant transaction, Šinkec said:
“Enabling OP_CAT on BTC opens up many possibilities such as covenants and validation of Merkle Proofs. We leveraged both these mechanisms to implement an Ordinal sales listing as a covenant on BTC. It accepts Litecoin as a payment option without going through an intermediary, such as an exchange.”
OP_CAT is an opcode that existed in the original 2009 Bitcoin protocol, allowing programmers to concatenate two items on the stack. This enables the potential for more sophisticated transaction scripts and thus expands Bitcoin’s range of applications and potential use cases.
However, in a move similar to the one that imposed BTC’s “temporary” 1MB block size limit, OP_CAT and other original opcodes were disabled very early in Bitcoin’s existence due to fears bad-faith actors could use them to “spam” or overwhelm the network before it had the resources to combat such actions. The BSV blockchain re-enabled OP_CAT along with other original opcodes in 2019/2020, one of many moves that expanded BSV’s functionality and restored Satoshi Nakamoto’s original vision for Bitcoin.
There are also moves to re-enable OP_CAT on the BTC main network, but at the time of writing that hasn’t happened yet. For now, sCrypt’s cross-chain transaction works only on the BTC Signet, a more closed-off alternate testnet for blockchain apps, and experiments with new transaction types. OP_CAT has been re-enabled on the BTC Signet.
Since sCrypt’s prize-winning project connects the Litecoin and BTC Signet blockchains, it’s more theoretical than immediately usable as things currently exist. However, OP_CAT works on BSV and has done so for five years now, meaning developers could use the process to enable cross-chain payments. BSV has shown time and time again that more creative uses for blockchain technology are available for creative developers looking for new opportunities.
Watch: sCrypt wants to bring hackathon initiative to more people