MultiversX Tracker is Live!

Is it possible to design a recursive covenant opcode that results in a full node stuck in an infinite verification loop?

Bitcoin Stack Exchange

Bitcoin News / Bitcoin Stack Exchange 188 Views

Thanks to Russell O'Connor and Sanket Kanjalkar for answering this on IRC (I've only lightly paraphrased their answers, any errors are my own though.)

Is it possible to design a new opcode enabling recursive covenants that could result in a full node stuck in an infinite loop of verifying transactions?

No. Recursive in the Bitcoin covenant context only means something like spending an output back to the identical script template.

At the time of writing the only previously formally proposed Bitcoin opcode that when used could result in a script not terminating is OP_EVAL. With scripts that don't use OP_EVAL you can just count the opcodes and each opcode is evaluated at most once.

Consider you have access to OP_EVAL and two other new opcodes: OP_RED (check if the current block has a valid transaction that has OP_BLUE in it) and OP_BLUE (check if the current block has a valid transaction that has OP_RED in it). The block could have two transaction outputs with OP_EVAL, OP_BLUE and OP_EVAL, OP_RED in them respectively. This would require an infinite loop of checks.

The design space for new opcodes is vast. There are lots of principles of various levels of importance that could be violated by newly designed opcodes. For example you would generally want the script result to only be a function of the transaction itself and nothing external to the transaction. You would also want the static analysis of resources to be computable in linear time.

Hence rather than starting from clearly unsafe (but perhaps maximally flexible opcodes) and restricting functionality to make them safe it is probably a better approach to work on proving that certain opcodes are terminating and non-harmful.

The aim of ongoing work on Simplicity is to offer maximal flexibility while still being subject to the desired constraints and principles discussed above. Without something like Simplicity it is difficult to know for sure that any opcodes(s) are provably safe whilst at the same time offering maximal flexibility.


Get BONUS $200 for FREE!

You can get bonuses upto $100 FREE BONUS when you:
πŸ’° Install these recommended apps:
πŸ’² SocialGood - 100% Crypto Back on Everyday Shopping
πŸ’² xPortal - The DeFi For The Next Billion
πŸ’² CryptoTab Browser - Lightweight, fast, and ready to mine!
πŸ’° Register on these recommended exchanges:
🟑 Binance🟑 Bitfinex🟑 Bitmart🟑 Bittrex🟑 Bitget
🟑 CoinEx🟑 Crypto.com🟑 Gate.io🟑 Huobi🟑 Kucoin.



Comments