So I just stumbled upon "Turing completeness" the other day. Alan Turing popped into my head, thanks to that movie about him. Anyway, turns out this stuff is tied to Bitcoin and Ethereum too. Been trying to wrap my head around it, but Bitcoin keeps pulling me back in.
Yeah, Bitcoin's Script is definitely Turing incomplete. It's on purpose though, since being Turing complete could open up security risks. Like, you can't program loops in Bitcoin transactions, which is a big deal with Turing completeness.
Exactly. In a Bitcoin transaction, if you try to loop, it just won't work. Unlike Ethereum where you can lose gas even if the transaction fails, Bitcoin just doesn't charge you if it doesn't go through.
Adding to that, there are other limitations in Bitcoin's script. Some discussions about it have been floating around here, but honestly, it's complicated.
But why complicate things? Bitcoin's functioning perfectly fine as it is. Adding more features won’t really change its core use, just opens up potential issues.
Totally agree with that. The halting problem is a nightmare. In a Turing-complete setup, you can never be sure when a program will finish. With Bitcoin, it’s a lot simpler just if statements.
Yeah, I can see that working in C. But I'm curious, do those conditions also apply to Lightning Network transactions? Like, when two people create a channel and trade?
In C, that would look like sending 2 BTC to each address that sends 1 BTC to mine. But the real question is, how would you set that up in Bitcoin Script if OP_WHILE existed?
True. Lightning Network transactions do use Bitcoin Script, even if they happen off-chain. The conditions in those contracts don’t need Turing completeness.
Just did a test transaction on the testnet. It shows how a recipient can publish a partially signed transaction, and the sender completes it without needing to communicate.