Is Bitcoin still a Turing-Incomplete System?

16 replies 247 views
Posts: 252 · Reputation: 12
#1Apr 22, 2019, 11:28 PM
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.
5 Reply Quote Share
alexsatNewbie
Posts: 278 · Reputation: 15
#2Apr 23, 2019, 08:51 PM
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.
3 Reply Quote Share
max2013Newbie
Posts: 99 · Reputation: 24
#3Apr 23, 2019, 10:55 PM
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.
4 Reply Quote Share
gang2015Member
Posts: 682 · Reputation: 62
#4Apr 24, 2019, 01:43 AM
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.
5 Reply Quote Share
wallet_vaultFull Member
Posts: 321 · Reputation: 431
#5Apr 24, 2019, 05:41 AM
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.
3 Reply Quote Share
0xLaserFull Member
Posts: 252 · Reputation: 641
#6Apr 26, 2019, 10:20 AM
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.
2 Reply Quote Share
Posts: 252 · Reputation: 12
#7Apr 28, 2019, 08:50 AM
I like how you explained that with examples. If you wanted to show a basic version of a loop, you could use something like a Brainfuck implementation.
3 Reply Quote Share
dave.forkMember
Posts: 375 · Reputation: 185
#8Apr 28, 2019, 10:54 AM
Could you replicate that pseudocode example in C? I’m more familiar with C, and it would be nice to see how it translates.
2 Reply Quote Share
Posts: 252 · Reputation: 12
#9Apr 28, 2019, 03:15 PM
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?
1 Reply Quote Share
0xLaserFull Member
Posts: 252 · Reputation: 641
#10Apr 28, 2019, 03:57 PM
Good point. Those four limitations you mentioned, are there any solutions yet? Because it feels like there's a lot more to unpack.
5 Reply Quote Share
dave.forkMember
Posts: 375 · Reputation: 185
#11Apr 29, 2019, 02:51 PM
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?
3 Reply Quote Share
0xLaserFull Member
Posts: 252 · Reputation: 641
#12Apr 29, 2019, 05:48 PM
Not sure about your C code there. I think it might not work as you expect. What about the OP_ADD? How does that tie into the whole script?
2 Reply Quote Share
Posts: 252 · Reputation: 12
#13Apr 29, 2019, 09:29 PM
Oh, if we talk loops, BF language has basic while loops. OP_IF runs once, but OP_WHILE can run indefinitely based on your conditions.
5 Reply Quote Share
alexsatNewbie
Posts: 278 · Reputation: 15
#14Apr 30, 2019, 01:02 AM
Right. A locking script needs to be in play here. The sender needs to know they’ll get those 2 BTC, which means conditions have to be set.
5 Reply Quote Share
v3ct0r365Member
Posts: 11 · Reputation: 41
#15Apr 30, 2019, 05:58 AM
Yeah, I get that. So basically, OP_ADD would add the top two numbers from the stack. If you push the right values, it could lead to the necessary sum.
3 Reply Quote Share
Posts: 3523 · Reputation: 35
#16Apr 30, 2019, 11:19 AM
True. Lightning Network transactions do use Bitcoin Script, even if they happen off-chain. The conditions in those contracts don’t need Turing completeness.
2 Reply Quote Share
Posts: 3523 · Reputation: 35
#17Apr 30, 2019, 11:34 AM
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.
6 Reply Quote Share

Related topics