Why Bitcoin isn’t Turing Complete?
Turing completeness is a programming language essentially means that the program has the ability to loop. Loops are useful construct in programming, so you may be wondering at this point why validation Script doesn’t have the ability to loop. There are lot of reason for this, but let’s start with program execution. Anyone can create a Script program that every full node on the network executes. If Script were Turing complete, it would be possible for the loop to go on executing forever.
This would cause validating nodes to enter and never leave that loop. This would be an easy way to attack the network that what would be called a denial-of-service (Dos) attack. A Single Script Program with an infinite loop could take down Bitcoin. This would be a large systematic vulnerability, and protecting it against this vulnerability is one of the major reason why Turing completeness is avoided.
Ethereum which has Turing completeness in its smart contract language, Solidity handles this problem by forcing contracts to pay for program execution fees which is called “gas”. An infinite loop will exhaust whatever gas is in the contract because by definition, it will run an infinite number of times.
Another reason to avoid Turing Completeness is because smart contracts with Turing Completeness are very difficult to analyze. A Turing-complete smart contract’s execution conditions are every difficult to enumerate, and thus it’s easy to create unintended behavior. Unintended behavior means bugs. Bugs in a smart contract mean that coins are vulnerable to being unintendedly spent , which means the contact participants could lose money. Such bugs are not theoretical : this was the major problem in the DAO (Decentralized Autonomous Organization), A Turing -Complete smart contract that ended with Ethereum Classic Hard Fork.