2

I want to know if BTC script will have loops in it in the future?

9

Turing completeness includes the capability to run programs that might not terminate or that might terminate after a very long time. This would cause the blockchain to stall, hence it is a must to keep the number of instructions to be run predetermined (like BTC) or to be run according to a budget (like ETH).

6
  • 2
    Practical turing-completeness includes a limit on the number of instructions executed and amount of memory used, but we still call it turing-completeness, colloquially
    – user253751
    May 2 at 18:50
  • 3
    it is impossible to determine whether a program will ever halt. – This is a common misconception. The halting problem states that there exists no algorithm which can determine for any program with all possible inputs if it will eventually halt. But there are techniques to prevent infinite loops and the like for arbitrary programs. See for example the Linux kernel eBPF verifier.
    – forest
    May 3 at 3:31
  • @forest Thank you, removed the misconception
    – MCCCS
    May 3 at 9:01
  • @user253751 Then Script is currently Turing complete colloquially?
    – MCCCS
    May 3 at 9:01
  • @MCCCS it has no loops, IIRC?
    – user253751
    May 3 at 9:23
5

I cannot predict the future but below are some arguments against turing completeness in Bitcoin.

  1. More data needs to be pushed in each transaction than a non-Turing-complete language like Bitcoin's stack-based SCRIPT. Fullnodes will need a lot of resources in order to operate, since they have to process a lot of data. Only few that can afford to run datacenters will host true fullnodes.

http://www.reddit.com/r/Bitcoin/comments/lgenu9/who_controls_the_fundamentals/gmrklox?context=3

  1. Security: A self-paying covenant would be equivalent to allowing unbounded loops in computation. Each loop step would be a transaction, and each one would "jump to the top of the loop" by requiring a self-paying covenant. Unbounded loops mean that Bitcoin would now become Turing Complete (except that you would have to pay fees for every step of a loop), which is something we actually want to avoid because doing so would increase the scope for footguns (i.e. shooting your own foot off) similar to what are basically yearly things for some altcoins.

    Thus, learning that we can enable covenants using only Taproot and OP_CAT is a concern, meaning we should really really pause and consider whether we want OP_CAT to ever be reactivated.

http://www.reddit.com/r/Bitcoin/comments/l3mkdz/op_cat_and_schnorr_tricks_i/gki78uu?context=3

  1. Once a transaction enters the mempool of a Bitcoin fullnode, the fullnode knows it does not have to re-execute the Bitcoin SCRIPT, because SCRIPT is simple enough that once it is valid, it is known to always be valid. There are no failed transactions in Bitcoin that pay fees to miners: Do we have failed transactions in bitcoin?

http://www.reddit.com/r/Bitcoin/comments/jlyk97/some_concerns_i_have_about_holding_bitcoin_long_term./gasc3bj?context=3

My opinion: Bitcoin Sidechains like Liquid and Rootstock can be used for things that are not possible using Bitcoin scripts.

Not all smart contracts use turing completeness according to a pie-chart shared in https://levelup.gitconnected.com/should-smart-contracts-be-non-turing-complete-fe304203a49e

turing-complete

Greg Maxwell's opinion: Difference in functionality comes from the amount of resources the smart contracts are allowed to use and IO mechanisms, and NOT from turing-completeness or not. Anyone who tells you otherwise is defrauding you in order to sell you on a scam.

1

Bitcoin itself will never itself offer any kind of Smart Contract functionality, like the Turing complete EVM. Rootstock (RSK) however, is smart contracts platform (turing complete programming) that works alongside Bitcoin to offer the same functionality. It's been in development for some time and I suspect now it will integrate with Lightning, and thus work very well. I haven't tried it out though. https://www.rsk.co/Whitepapers/RSK-White-Paper-Updated.pdf

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.