Episode 93: The Great Consensus Cleanup Revival (And an Update on the Tornado Cash and Samourai Wallet Arrests)
51 minAudio
In this episode of Bitcoin, Explained, Aaron and Sjors discuss the Great Consensus Cleanup Revival soft fork(s). This proposal would fix some known bugs in the Bitcoin protocol, specifically the timewarp vulnerability, large block validation times, 64 byte transactions and BIP 30 verification. Sjors also provides a quick update on the court case against Tornado Cash developer Alexey Pertsev, and places this in the context of the recent arrests of Samourai Wallet developers Keonne Rodriguez and William Hill. Chapters 00:00:00 Introduction and COLDCARD sponsor 00:01:49 Tornado Cash conviction and developer liability 00:07:13 Samourai Wallet arrests, Whirlpool and Ricochet 00:13:40 The Great Consensus Cleanup Revival 00:16:49 Timewarp attacks and the proposed fix 00:26:47 Slow scripts and block validation limits 00:32:49 64-byte transactions and Merkle tree ambiguity 00:45:04 Duplicate coinbases: BIP 30 and BIP 34 00:48:27 Soft fork activation and future Bitcoin upgrades === This episode’s sponsor: CoinKite, maker of the ColdCard Aaron’s Twitter: @AaronvanW Aaron’s Nostr: npub1art8cs66ffvnqns5zs5qa9fwlctmusj5lj38j94lv0ulw0j54wjqhpm0w5 Sjors’ Twitter: @provoost Sjors’ Nostr: npub1v25jqj332n630klwtqeqxgyrjl4alw4phmluhu2x6lcxzwy9m03suqexw3 If you’d like to sponsor the show, please email info at bitcoinexplainedpodcast.com. https://bitcoinexplainedpodcast.com/
Audio and video play straight from the show's own hosting. PodSubs stores and serves no media.
Transcript
From the show. Tap a time to play from there.
Aaron van WirdumLive from Utrecht, this is Bitcoin,
Sjors ProvoostExplained.
Aaron van WirdumSjors, it's been a month. That means you had a whole month to think about this poem that you told me you're going to tell our dear listeners for this episode. Let's hear it. Let's hear it.
Sjors ProvoostThat's right. So it's cold outside. The government is cold. You know what else is cold?
Aaron van WirdumSjors, our sponsor.
Sjors ProvoostThat's right.
Aaron van WirdumThe COLDCARD. The COLDCARD. If you have coins, you want to store them. COLDCARD is the place for that. Is the audio okay? Are we too loud?
Sjors ProvoostIt's too much echo.
Aaron van WirdumToo much echo? Okay, uh, COLDCARD COLDCARD COLDCARD COLDCARD COLDCARD COLDCARD I think that was like our 20 seconds that we're obligated to talk about the COLDCARD. What do you think?
Sjors ProvoostI think it's great, but it's a hardware wallet, for people who don't know.
Aaron van WirdumYes. Why did you say the government is cold?
Sjors ProvoostWell, that's a segue to our next section.
Aaron van WirdumSo this episode we're going to talk about the Great Consensus Cleanup Revival, which is a proposed soft fork, which sort of includes several soft forks into one, you could kind of argue, right? Basically, that's what it comes down to. But before that, a lot has happened in the Bitcoin and Ethereum space in a way that's relevant to Bitcoin as well. So you want to touch on that a little bit first. You've been following it pretty closely.
Aaron van WirdumLet's start with... Where do we start? Let's start with what happened with Tornado Cash in the Netherlands.
Sjors ProvoostYeah, in case anybody was living under a rock, the Tornado Cash, we talked about that in episode 69. But he got convicted, so that's bad.
Aaron van WirdumYeah, Alexey Pertsev, one of the Tornado Cash developers, got convicted for 64 months in prison.
Sjors ProvoostYep.
Aaron van WirdumWhich does seem to have a lot of relevance for Bitcoin because... really he was just writing codes, uh, you know, he was writing privacy code, but he was never… Maybe you should give the context. Well, why do you think it's relevant for Bitcoin?
Sjors ProvoostWell, the main point of relevance for us, I think, is the fact that he was building a non-custodial system. So a system that does not hold the coins yourself. I mean, there's a website and those kind of tools. So that's a very dangerous precedent, I think, because it's not very clear where that line is.
Aaron van WirdumYeah, we already knew that running a custodial mixer, which a lot of other mixers were, where you just send coins to someone and that someone sends different coins back. That was always illegal, and everyone knew that was illegal. If you're doing that, that's basically money laundering, and that is illegal.
Sjors ProvoostWell, I think you can narrow it down slightly. It's not illegal to mix the coins, but it is when you don't do KYC, I guess. That's maybe a different interpretation.
Aaron van WirdumRight.
Sjors ProvoostBut for all practical purposes, you can't build a mixer with KYC in an ethical way anyway. So it, you know, effectively mixers are illegal, but technically I think the the non-KYC part of the mixer is what makes it illegal.
Aaron van WirdumFair enough. In either case, so far it was generally assumed that, yeah, if you're taking coins and they're sending other coins, then you you're at risk, but if you're just developing software which allows other people to send their coins to other people, then, you know, that that then you're not the one money laundering. However, the Dutch court just struck that down. And now it looks like, nope, just developing code can make you responsible for how other people use that code, right?
Sjors ProvoostWell, probably, but we don't really know because this verdict was extremely unclear about that. So we don't know if it's simply the act of writing code or it is the, you know... making that code available on your own website, or making that code available on some automatic website-like system, or whether it's about maintaining this code after you've written it once, or if it's about promoting the code or making money from the code, it's very unclear. And in fact, the prosecutor seemed to emphasize making money from the code, but the judge much
Sjors Provoostless so.
Aaron van WirdumYeah, the prosecutor really... honed down on it essentially being a business. And that's why you say the making money part was important. But the judge didn't even really seem to focus on that. The judge just said, look, if you write this code knowing that it can be used for this purpose and you don't do anything to stop that, then you're responsible if it's really used for that purpose, right?
Sjors ProvoostYeah, pretty much.
Aaron van WirdumThe purpose here, of course, being money laundering.
Sjors ProvoostYeah, what was especially interesting, though not clear entirely how that's going to apply to Bitcoin, was the argument that... he made the whole thing unstoppable. So in Ethereum, part of the system at least is unstoppable. It's a smart contract, unless you stop Ethereum itself, of course. And the fact that he did that, where the prosecutor just tried to argue, well, it's not all decentralized. Some of it is fake decentralization. Others is real. The judge completely ignored that and basically said, well, the fact that you even tried to make it decentralized, that is actually making it worse.
Sjors ProvoostAnd that argument, of course, can apply extremely broadly because you could say, well, if you just publish source and you know that other people are using that source and you just keep updating that source code, well, that's also kind of unstoppable in a way.
Aaron van WirdumYeah.
Sjors ProvoostSo that might also be a problem. And of course, we all know somebody, or we don't know them, somebody who created an unstoppable system a long time ago and kept working on it.
Aaron van WirdumSo you're referring to Satoshi Nakamoto.
Sjors ProvoostExactly. So we're waiting for his arrest warrant, I guess.
Aaron van WirdumYeah, well, the short way of looking at it, I would say, is we all thought so far that there was a fairly clear line of what would make you, you know, what would be… what would make you responsible, which is custody in a way. And now it's kind of an all bets are off type of situation.
Sjors ProvoostYeah, and this creates a bit of a problem because we assumed that this line existed, we did not do much to defend people who built custodial mixers. And in retrospect, that was probably a mistake because as soon as you lose that line of defense, now... I guess the only way to win now is to go all the way back and say, no, all mixers should be legal, including custodial ones. But now you have all this precedent that wasn't stopped. So that's a problem.
Aaron van WirdumRight. Okay, let's move on to the actual Bitcoin case, which is the Samourai devs.
Sjors ProvoostAnd just add one little detail. As far as I know, he is going to appeal. So we'll see what happens. And appeals can quite dramatically change things.
Aaron van WirdumYeah, is there any timeline?
Sjors ProvoostI don't know.
Aaron van WirdumOkay, so let's move to the more Bitcoin relevant case.
Sjors ProvoostThe more direct Bitcoin case.
Aaron van WirdumYeah, exactly. So the Samourai wallet developers, Keonne Rodriguez and Bill Hill, William Hill. Both of them you know, right?
Sjors ProvoostYep, yeah. I used to work with them when I was at blockchain.com. Back in time, blockchain.info.
Aaron van WirdumRight, so they were arrested as well. One of them in Portugal, one of them in the United States, but both on, uh, behalf of the Department of Justice. Justice, DOJ. Uh, so, how… What what do you want to say about that, if anything? How…
Sjors ProvoostWell, I'm not surprised that this happened, because, you know, the fact that, uh, they were going after Tornado Cash made it clear that they would go after non-custodial systems after non-custodial mixer. So it seemed like a matter of time before they would go after it. And then obviously they always go after the biggest or at least a big one. So the only question was, were they going to go after Wasabi or were they going to go after Samourai? Samourai has some interesting marketing that maybe made them more interesting to prosecute, but I don't know if the
Sjors Provoostdifference, you know, and of course we know that Wasabi was doing some proactive compliance-ish things. But I don't know why they picked one and the other. Ultimately, we'll find out. What else was I going to say about it?
Aaron van WirdumWell, it was my suggestion to just sort of explain how the Samourai mixing actually worked. But at this point, should we just move on to the main topic of the episode?
Sjors ProvoostNo, I think it may make sense to briefly explain a little bit. So there's three aspects to Samourai Wallet, I think, that are relevant. But one is it's not just a mixer. Definitely not. It's a wallet, right? It's a non-custodial wallet. And so far, it seems that that wallet was taken down mostly as a side effect of taking the mixer down, not as a direct target. But it is down. But fortunately, it was a non-custodial wallet and people wrote down their 12 words, hopefully. And so they should be fine because they can just import it into another wallet.
Sjors ProvoostBut there was also a mixer component. I think the two most important parts of that are something called the Whirlpool, which is a five input, five output mixer that you can use multiple times.
Aaron van WirdumYeah, it's just a CoinJoin which uses equal amounts.
Sjors ProvoostYeah. And then there is something called Ricochet, which basically just, as far as I understand it, just forwards your coins a couple of times. So you're making a couple of unnecessary transactions and then you send the amount that you want to send. And that might help when you're dealing with an exchange that only looks at, say, five hops ago or two hops ago. then maybe you can get around that. I don't know how effective any of these things are.
Aaron van WirdumYeah, you're basically making transactions to yourself a couple times.
Sjors ProvoostYeah, now it should be noted that from my reading of the indictment, they don't even talk about whether or not these tools, these mixing tools were effective or not. They just, you know, the fact that it's doing any mixing, that is the problem. So that's something to keep in mind.
Aaron van WirdumYeah, I would say the Ricochet one, the fact that that one is even mentioned, is blatantly absurd. Like, every wallet, with every wallet you can send coins to yourself. This is just a button that just sort of automates that you do that a couple of times.
Sjors ProvoostExactly.
Aaron van WirdumThat this is even… Like, the other, the Whirlpool, I can sort of at least understand why it's seen as some… I mean, I don't agree with…
Sjors ProvoostWell, the Whirlpool requires coordinating with other users, right? Whereas the Ricochet thing does not. It's just your wallet sending a transaction to itself essentially five times in a row.
Aaron van WirdumYeah, which again, literally every wallet can do.
Sjors ProvoostBut I would be very surprised if in the court case they're going to debate the specific details of what is and what is not mixing. My guess is they just go go with the marketing. They say, well, you guys called it a mixer, and that's all we care about.
Aaron van WirdumRight, anyways. Yeah, seems like a new era in Bitcoin and Bitcoin development to me.
Sjors ProvoostYeah, and I think we could briefly do a recap of the differences, how these cases relate to each other. So we brought up most of the things. So the interesting thing about Samourai is that it's only happening in the US, whereas the Tornado Cash trial is happening in the US and the Netherlands in parallel, which is interesting.
Aaron van WirdumYeah, you didn't mention that yet, but yeah, one of the other... Tornado Cash co-founders was arrested in the US and will be on trial there.
Sjors ProvoostYeah, and this is interesting because the Dutch court system is not very transparent. You can go to the court hearings, but you don't get to see any of the dossier. Whereas in the US, it's much more transparent. So we'll probably learn much more about the Dutch case through the US case. Both of them are non-custodial. Both of them use a... Well, no. So the Samourai uses a central coordinator. So that might be a service. Whereas in Tornado Cash, it's a smart contract. So
Sjors Provoostthat's not really a service. Although the prosecutor argued that it's a service anyway.
Aaron van WirdumYou mean the main smart contract?
Sjors ProvoostYeah, the main smart contract and everything around it. You could argue like it's an autonomous system, so it's not really a service, but that's what they're arguing, I think, in both the Netherlands and the U.S. against or for, depending on which side you're at. I'd say Samourai used fees, fairly, pretty direct fee system, whereas the... Tornado Cash system did not charge fees directly. At least the fees don't go directly to the developers or operators. They have a more convoluted tokenomic
Sjors Provoostsystem where at least the prosecutor argued that these tokenomics are, you know, how it is how the business works.
Aaron van WirdumI think the short summary I would give is if the Tornado Cash developer is guilty in the Netherlands, which he is, then the Samourai developers have to be as well. So it's sort of even more straightforward.
Sjors ProvoostExactly. Samourai is a simpler case.
Aaron van WirdumRight. So, yeah, bad news. Let's move on to our actual topic for the podcast. What do you think?
Sjors ProvoostYeah, also some bad news in a way.
Aaron van WirdumYeah, but bad news that we're gonna fix, right?
Sjors ProvoostSure. Yeah, exactly, that we hopefully fix in time.
Aaron van WirdumSo we're gonna talk main topic of the of the podcast. Finally we're here. We're here, ladies and gentlemen. We're gonna talk about the Great Consensus Cleanup, or maybe more specifically the Great Consensus Cleanup Revival. That's right, because the Great Consensus Cleanup was proposed by Matt Corallo a couple years ago and was recently revived by Antoine Poinsot. Am I saying that right?
Sjors ProvoostProbably.
Aaron van WirdumIt was him, right? I got the person right, at least, whether I got the name pronunciation right… Well, yeah, not sure about that one. Uh, and the Great Consensus Cleanup Revival, maybe what's the difference between the original and the revival? Is there a difference?
Sjors ProvoostYeah, there is. So the revival adds something, and I guess I'll let you know when we get to that new bit.
Aaron van WirdumOkay, and as far as I understand, the great consensus cleanup would be, well, would basically be one soft fork that bundles several soft forks, and these soft forks sort of fix existing bugs in the protocol.
Sjors ProvoostYeah, there could be individual soft forks, and in the worst case, maybe out of the four components, people really like three of them and are kind of arguing about the fourth one, then you can simply do three and not do the other one.
Aaron van WirdumOkay, and if I understand correctly, basically everyone, and when I say everyone, I mean everyone that has enough expertise to have an opinion in the first place, agrees that at least the bugs are problems. there's maybe at most like some conversation about the best way to solve these problems, whether these are the best ways. But the problems are real. There's no one that says, no, these are actually features, right? These are just real problems, bugs that exist in the Bitcoin protocol.
Sjors ProvoostI think when it comes to the time warp attack, there might have been someone who could think of some interesting schemes that you can do using a time warp attack.
Aaron van WirdumThat's right. Yeah, you're thinking of Mark Friedenbach, who had some sort of proposal years ago to sort of increase the block size. And yes, yeah, yeah, you're right, but let's…
Sjors ProvoostEvery bug is a feature.
Aaron van WirdumYeah, let's table that for a second. Although, I mean, it is interesting that you bring that up.
Sjors ProvoostBut, well, I mean, that won't work if somebody exploits the time warp maliciously before the legitimate use case happens, I think.
Aaron van WirdumWell, is the legitimate use case still possible after this bug would be fixed?
Sjors ProvoostActually, I'm not sure.
Aaron van WirdumProbably not, right?
Sjors ProvoostWe'll show that. So there may be, you know, as always, there may be some ways that you could use this to your advantage. I think it's better to fix them.
Aaron van WirdumYeah. Okay. And so there are basically four bugs, right? There are four bugs. There are four things that this would solve.
Sjors ProvoostThat's right. Plus an open invitation to anyone who knows another bug.
Aaron van WirdumOkay, so four. Let's start with the first one. So the first one, you already mentioned it, the time warp attack, the time warp problem, what do we call this?
Sjors ProvoostYeah, the time warp attack.
Aaron van WirdumYeah, and so it's about the the time warp… The time warp attack is possible now and we're talking about fixing that that is possible. Like, that shouldn't be possible, essentially, right?
Sjors ProvoostThat's right. And we did an earlier episode about the time warp attack. It's episode number five, so scroll all the way back.
Aaron van WirdumThat's a long time back.
Sjors ProvoostWhere we explain how it works, I think. I didn't listen back to it. Um, but basically, I mean, the TL;DR is that you can mess with the timestamps in every block. So miners can, you know, Bitcoin is not a clock contrary to popular belief, but blocks do have a timestamp in it. And this timestamp cannot, I mean, the miner can pick this timestamp however they want, but there are a few restrictions on it based on earlier possible attacks. One of the restrictions is that it cannot be more than two hours in the future as determined when you
Sjors Provoostreceive the block. The other rule is that every, I think it's the rolling average or the median, I should say, of the last 11 blocks has to go up by one second every block. And so basically, the block time has to go up a little bit and it can't be too far in the future. Those are the only two restrictions, but it turns out you can still mess with the system with those two rules.
Aaron van WirdumHow so?
Sjors ProvoostWell, you can basically fool the system. I think we need to explain another related bug here first, which is how the difficulty adjustment works. So the goal of the system is to keep one block every 10 minutes, and this is achieved by looking at the last block in the difficulty adjustment period and comparing it to the first block in that period, and then dividing it by 2016. And there are multiple problems with that,
Sjors Provoostbut the biggest one is that you are not comparing the first block of each period to the first block of each last period. You're comparing the first block of a period to the last block of a period. And that allows you to kind of mess around the edges.
Aaron van WirdumOh, yeah. Okay. So how do you mess around the edges?
Sjors ProvoostWell, one thing you can do here is you can increase the timestamp of... Basically, you increase the timestamp of every block as little as possible. So the entire two-week period... will look like it's only a few minutes, basically.
Aaron van WirdumYeah, and to be clear, this would require a majority of miners to collaborate, right?
Sjors ProvoostYeah, the time warp attack is a 51% attack, basically, or requires a 51% attack.
Aaron van WirdumSo a majority of miners is faking the timestamps, and all nodes on the network will accept this because it's not breaking the rules. The nodes are just looking, is this block mined in the future? And is it mined at least one second previously, later than like the 11 blocks before?
Sjors ProvoostExactly.
Aaron van WirdumSo then you can mine, you can fake the timestamps to make every blocks look like it was all mined within the same minutes, basically.
Sjors ProvoostYeah.
Aaron van WirdumLike a whole period mined within the same minute.
Sjors ProvoostWhy would you want to do that? Well, there's another part of this attack, which is where you take the last block of the difficulty adjustment period, and there you don't lie. You just put it two hours in the future or right now. It doesn't really matter. If you do that in just one difficulty adjustment period, it really has almost no effect, right? Because the first block in that period had a real time because you weren't lying. The last block in the period has a real time because you weren't lying. You were only lying for all the other blocks. So the difficulty will just stay the same because it took you two weeks to make these
Sjors Provoostblocks. But the attack has already begun, even though it doesn't have any visible effect yet. For the next two weeks, you do the same thing. So the first block, you set a fake time as low as possible. So much older than the last block of the previous period. You just keep that original clock going.
Aaron van WirdumRight. So now you're back in the original minute, so to say.
Sjors ProvoostYes. And now the last block, you're speaking the truth again. The last block of the period. And now if the blockchain is looking at what to do with the difficulty, it's seeing the last block of the period, which is real. And it's seeing the first block of that new period, which is now four weeks ago.
Aaron van WirdumRight.
Sjors ProvoostBecause we've only increased that timer very slowly.
Aaron van WirdumYeah.
Sjors ProvoostAnd so that means the difficulty can be cut in half now.
Aaron van WirdumYeah.
Sjors ProvoostAnd then you repeat this little trick.
Aaron van WirdumYeah. The rest of the network, all nodes are looking at these two blocks and they're thinking, wow, it took a whole month to mine 2016 blocks it's way too long. We got to decrease the difficulty by half. So now difficulty is divided by half. Even though that was not really necessary, it's just the timestamps were all being faked.
Sjors ProvoostExactly. So now you can make two weeks worth of blocks in just one week.
Aaron van WirdumAssuming that all the hash power is still the same, now you can mine two weeks of blocks in one week.
Sjors ProvoostBecause again, and then at the end of that one week...
Aaron van WirdumBut you're still faking the timestamps. So we're still sort of back mining in the first minute.
Sjors ProvoostYeah, so at the end of that week, which for the blockchain is two weeks, you're like, okay, this was five weeks. This took five weeks to produce this block. So it could decrease the difficulty even more. And then it gets cut in half again. So now you can mine in about two and a half days, the equivalent of two weeks. And the blockchain is like, whoa, that took five weeks and two days. I've got to reduce the difficulty again. And so the difficulty goes to one very, very quickly in a matter of about 40 days, according to Antoine's calculation.
Aaron van WirdumRight. So, yeah, miners, like you said, it's basically 51% attack where miners can drive the difficulty down to one. And then they can mine all remaining coins that are still to be mined.
Sjors ProvoostExactly.
Aaron van WirdumOver the next century.
Sjors ProvoostThey mined the equivalent of until the year 2106. They've got every last sat. We've got, you know, millions of blocks in a very short period of time.
Aaron van WirdumYeah.
Sjors ProvoostAnd then they probably stopped the attack because there's no need to do it anymore.
Aaron van WirdumYeah. And then on top of that, that would mess up probably a bunch of like smart contract things, time lock types of things.
Sjors ProvoostNo, well, time locks are, well, they might be affected, but... because time is moving more slowly, your time locks would indeed not expire because… But that's that's probably not a big deal, like, during this attack, because the attack takes five weeks plus a little bit to suck all the coins out.
Aaron van WirdumWell, it could definitely… The time locks that are locked on a certain block in the future…
Sjors ProvoostYeah, so if you're looking at height locks, I guess you call them, height locks are definitely affected, because if you have a contract that expires in block one million, well, guess what, that is that happens immediately. Yeah, but a time lock would be kind of during the attack, it would be effective because your time lock is never happening because they keep the time behind. But once they stop the attack, it'll be fine. So you might be unlucky if your lightning thing is in the wrong place. Yeah, it could be bad. But the worst aspect of this attack, other than the five-week disruption, is simply that they have now exhausted the full
Sjors Provoostsubsidy. And so we were hoping to not have to deal with the no-subsidy world, uh only 20, 30 years from now, but we have to deal with it in, well, 40 days, if this is exploited, and it could happen at any moment.
Aaron van WirdumOkay, so…
Sjors ProvoostAnd a majority of miners, you know, might think, well, you know, why not? We're the majority of miners. Well,
Aaron van WirdumI mean, one reason why not is that it would probably undermine trust in the protocol, but let's ignore that. Let's see if we can fix the protocol instead of, uh, relying on that kind of trust. So what's the fix here?
Sjors ProvoostThe fix is actually fairly simple. Well, the ideal fix would be that we just compare every block to the same block in the last period, but that's a hard fork.
Aaron van WirdumOkay.
Sjors ProvoostSo instead, at least I think it's a hard fork.
Aaron van WirdumSo by that you mean instead of comparing the first to the last block within the same period? and checking if that's two weeks, we should really just check the first block to the next first block. But that's not possible, right?
Sjors ProvoostAs far as I know, that's a hard fork, so I can't do it.
Aaron van WirdumBut also, how is that even possible? Because by then, the difficulty should have already... adjusted, right? By the time the first block of the next period is made.
Sjors ProvoostWell, obviously you'd have to change exactly how the difficulty adjustments happen, but you should just do the difficulty adjustments correctly. Yeah. But the simplest solution here is that every first block or block zero of every period needs to be in the present or two hours ago, but no more than that.
Aaron van WirdumEvery what?
Sjors ProvoostEvery first block of every period, so block zero, block 216, et cetera, has to be in the present, the timestamp. And it can be two hours ago for weird mining-related reasons. And it can, of course, not be more than two hours in the future. But basically, it has to be in a four-hour window between two hours ago and two hours in the future.
Aaron van WirdumEvery first block has to be.
Sjors ProvoostYes.
Aaron van WirdumRight. Okay, yeah, that sounds like a pretty simple fix.
Sjors ProvoostYeah, because remember the attack involved comparing the last block to the first block and really messing with the first block. That's the part of the messing that you weren't messing with the last block already, but you were messing with the first block and this fix basically makes that impossible and therefore the difficulty adjustment will be correct, problem solved.
Aaron van WirdumOkay, makes sense.
Sjors ProvoostYeah, and as far as I know, that's still the proposed fix that hasn't changed.
Aaron van WirdumOkay, that was a time warp attack fix. What's the next one?
Sjors ProvoostSlow scripts. So as you know, it takes a while to validate the whole blockchain. And some blocks take a bit longer than others. That can be because there's tons and tons of transactions in them. But there's certain, you know, at least we have a limit on the block size. A block can be more than four megabyte. So there's some limit to how much you can do in a block. But it turns out you can make some special transactions that are really quite slow to verify. And that's usually a combination of lots of signature checks. Because signature checks take a while.
Sjors ProvoostYou have to do the ECDSA thing. And hashing. So we talked about this signature checking speed problem back in episode, let me see, I think episode 32 and episode 76. Um, yeah, yeah.
Aaron van WirdumSo from what I understand, the problem here essentially is like every transaction includes scripts. And for many transactions, that's just a straightforward check that the signature is valid type of thing. But you can make more complex transactions that includes, like you say, hashing or more signature validation. And if you would intentionally want to design a transaction or maybe even a block full of transactions with complicated stuff,
Aaron van Wirdumthen that could, in the worst case, lead to blocks that take minutes to actually validate.
Sjors ProvoostYeah, and so, you know, people have been… Uh, Antoine, I believe, has been doing some math on seeing what is the absolute worst you can do. And he came up with something that took more than one hour to validate on a Raspberry Pi 4.
Aaron van WirdumRight.
Sjors ProvoostAnd that's not good. Now, you could say, well, it sucks to have a Raspberry, but it'd be nice if it didn't.
Aaron van WirdumAnd even on a fast laptop, it took several minutes, right?
Sjors ProvoostYeah, and several minutes would be bad, right? So if you are a miner and you receive that block that takes you several minutes to validate, well, now your competitor can do all sorts of shenanigans because you're kind of stuck validating.
Aaron van WirdumYeah, or not shenanigans, just get a head start on finding a nice block, for example.
Sjors ProvoostRight, that's one shenanigan, but I think there might be other things you can do.
Aaron van WirdumYeah, it would be a disruptive thing for the network if blocks take minutes or even longer than that to validate.
Sjors ProvoostAnd so the question is, how do we prevent those blocks from being created? Now, for now...
Aaron van WirdumJust to give you a comparison, how long does it take to validate an average block right now?
Sjors ProvoostI think on a good laptop, a fraction of a second.
Aaron van WirdumYeah. And on like a Raspberry Pi?
Sjors ProvoostProbably one second.
Aaron van WirdumYeah. Okay. Just to sort of paint the context there. Okay. So the solution.
Sjors ProvoostWell, the solution is in the original proposal by BlueMatt, there was a solution, which was... Just changing a few rules, I think now there's discussion about a slightly different solution. So that's actually still ongoing research, what is the actual best solution. But the gist of it is that there are certain extra rules in SegWit and in Taproot that make the script safer. This was why the block size could be increased with SegWit, because any of these extra SegWit transactions would not be as expensive and as slow. These worst case couldn't
Sjors Provoosthappen. But it looks like some of these rules should also be applied to legacy scripts, to legacy transactions. And then the problem is you can't just apply all of SegWit's rules to legacy transactions. So you have to be very careful which ones you'd want to apply. Main problem there is, you know, somebody might have a transaction that they put in a cold wallet. Or like offline wallet, right? So we don't see it on the blockchain. And now they want to broadcast it, but we changed the rules and now they can't spend it anymore.
Sjors ProvoostNow, you know, the changes that people have in mind would only impact the most bizarre, unrealistic transactions that you can possibly imagine. But still, that could still be controversial. So the key is to find the absolute minimum extra rules that you need in order to fix the problem and no more. Because the simplest solution would just be to say, hey, you know what? You can only make Taproot transactions. That would fix the problem. But it would make a lot of people very angry.
Aaron van WirdumYeah, I thought the idea was also to, like, only apply these new rules from a certain block height, so if you already had your coins in some…
Sjors ProvoostSo those are other things you could do to restrict the possible damage that a rule could do. But the trade-off there is complexity. So a rule that says only do this after this block or only when the coins you're spending is from this block, that's extra complexity that you'd prefer not to have. Plus, you know, if the attack, this is one of the problems, once you publish the exact fix, somebody might come up with what it is fixing. and then do the attack before the software is activated. That's probably inevitable anyway, just like
Sjors Provoostthe time warp attack. Everybody knows what to do there.
Aaron van WirdumYeah.
Sjors ProvoostSo there's that.
Aaron van WirdumYeah. Well, you really want to avoid that people lose their coins, right? That's kind of a...
Sjors ProvoostYeah. So realistically, even the original proposal by BlueMatt, I think it was changed a bit by him because there were several things that he wanted to change for this problem. And I think they ended up dropping one of these things. So hopefully there's a way to make sure that you can, like, this that nothing gets unspendable. It might just take more fees, for example. Right.
Aaron van WirdumOkay, so that was slow scripts. Are we done with those scripts?
Sjors ProvoostYep, we are.
Aaron van WirdumAll right, and the next point is about banning 64 byte transactions. Is that right?
Sjors ProvoostYes. 64 bytes, bad. Why? Well, we've mentioned this a few times in other episodes. I don't think we've done an actual episode about it. But in our episode 81, we talked about a change to Bitcoin Core 25 that makes transactions that are 65 bytes or greater. I think they make them illegal again or something weird about that. I forgot what exactly we discussed. The point is 64 byte transactions are
Sjors Provoostbad. And the reason they're bad is because they look the same as two 32 byte transactions next to each other in the block. Because of the way the Merkle trees are made.
Aaron van WirdumSorry, we have to take a step back here, Sjors. What does it mean? Why is there such a thing as a 64 byte transaction and also such a thing as a 32 byte transaction? Why aren't all transactions the same number of bytes?
Sjors ProvoostBecause the size of a transaction depends on the number of inputs, the number of outputs, what kind of script you have in those inputs and outputs and whether it has a witness or not.
Aaron van WirdumOkay. And then 64, but a 32 transaction would also look like two 16-byte transactions, right?
Sjors ProvoostYeah, but I don't think you can make a 16-byte transaction because simply it wouldn't fit.
Aaron van WirdumOkay, and a 128-byte transaction would look like four 32 bytes. Why is 64 singled out is my question.
Sjors ProvoostOkay, so the Merkle tree that the Bitcoin transactions are stored in takes the SHA-256 hash of every transaction and then puts that next to the SHA-256 hash of the next transaction. So you take all the transactions and you take their SHA-256 hashes and then in pairs you put those hashes next to each other. And the size of a hash is 32 bytes.
Aaron van WirdumRight. That's always 32 bytes.
Sjors ProvoostYes.
Aaron van WirdumYeah. I vaguely remember this problem. We discussed it.
Sjors ProvoostSo two hashes next to each other is 64 bytes. And so then the question is, when you are... So I guess it's not two 32-byte transactions because you can't have 32-byte transactions. Too small.
Aaron van WirdumRight.
Sjors ProvoostBecause the minimum size of a transaction, keep in mind that a transaction has an input, at least. And the input is already 32 bytes plus a little bit more. Because the input of a transaction refers to the hash of a previous transaction. We just set the hash to 32 bytes. So then it has to have a number and a few other things. So yeah, a transaction cannot be 32 bytes. But it can be 64 bytes. It would be a pretty nonsensical transaction, but it can be 32 bytes. And so...
Aaron van Wirdum64.
Sjors Provoost64, yeah.
Aaron van WirdumBut that would look like two hashes that are both 32 bytes. And why is that a problem? Like, where are these hashes in the blockchain?
Sjors ProvoostIt's caused multiple problems in the past, exactly. So in each block is a Merkle tree of all the transactions in that block. And all the leaves of the tree are 32 bytes, these transactions. And then you go one level up, and it's 32 bytes again, it's 32 bytes again. And now what you can do is you can give somebody a block and say, here's a block, and here's all the transactions in this block. And then you verify it, and you see these 32 transactions. Sorry, you see these two times 32s, and you combine them, and it looks all good. But somebody could
Sjors Provoostleave out the actual transactions and just pretend that it's only a 64-byte transaction instead of two separate ones. But then you validate the 64-byte transaction, and you say, hey, this is an invalid transaction, so the whole block is invalid. And now you think this block is invalid. And the next time you see this block, because somebody gives you the same block hash, you're like, I don't, you know, I'm not going to check this block. It's invalid. But actually it's not invalid. Because somebody sent you, because now you got the real one where you actually
Sjors Provoosthave the two separate transactions in it.
Aaron van WirdumI'm lost. Who's the target here? What's the problem? And what's the, like, who are we targeting?
Sjors ProvoostWell, they're different targets. So this example, I think, could be used to make a network split. where you would make a real block with two 32-byte transactions in it, but that when you combine those two 32-byte transactions, it would also make a real 64-byte transaction. So the hashes of those two transactions, not 32-byte transactions, but the hashes of those two transactions, if you add them together, look like a real transaction, but it's an invalid transaction. So now... you are, or the other way around, the 64 byte thing is valid, but
Sjors Provoostthe two individual transactions are invalid. So if you give somebody a block, it will have the same hash at the top because the Merkle tree is the same at the top. And that's the only thing you're communicating when you're communicating a block hash. So I'm giving you a block hash and I'm giving somebody else the same block hash, but I'm going to give you the two transactions. And I'm going to give this other person the one 64 byte transaction. And now one of you is going to say this block is invalid and the other is going to say this
Sjors Provoostblock is valid. Now you have a network split.
Aaron van WirdumYeah, okay. I kind of get that now, except what do you mean? Why would they check for different things?
Sjors ProvoostBecause I've given you the block hash, the root of the Merkle tree. I've also given you all the transactions individually. Okay, so you're actually putting those back in a tree. But I'm giving you a different set of transactions than I'm giving the other person. They get the same root of the tree, but one of them will say, hey, this transaction is invalid because, I don't know, it's spending more money than it's earning. Some other rule that's violated.
Aaron van WirdumRight. And that's because it's not really a transaction. It's really two 32-byte hashes.
Sjors ProvoostYeah.
Aaron van WirdumAm I saying that right?
Sjors ProvoostOf real transactions.
Aaron van WirdumOf actual transactions. Yeah. So for one person...
Sjors ProvoostOne person sees a 64-byte transaction.
Aaron van WirdumOne person sees one invalid 64-byte transaction.
Sjors ProvoostOr valid. One person sees one 64-byte transaction. The other person sees two other transactions. Doesn't matter what size they are.
Aaron van WirdumYeah.
Sjors ProvoostAnd if these two transactions are invalid, but the 64-byte one is valid, then you come to a different conclusion out of the block.
Aaron van WirdumAnd this depends on which transactions you saw earlier, essentially, kind of.
Sjors ProvoostWell, the rest of the block is the same, right? So it's just that one of these transactions is actually invalid. So the 64-byte transaction might be invalid or it might be valid. It has nothing to do with what you've seen before. You're basically just giving two versions of the same block that [unclear] think is the same block because it only remembers the hash and it's not. So that bug has been fixed by simply not storing the block if it's invalid.
Aaron van WirdumNo, hang on. I have a question. I still have one question. You and I are both running a node, okay? Now... Some joker sends us a block that has this one 64-byte transaction in it.
Sjors ProvoostYes.
Aaron van WirdumWhy would my node look at this like two 32-byte transactions while your node is looking at it like a one 64-byte transaction?
Sjors ProvoostBecause as the joker is sending you the hash of the block and is sending you all the individual transactions. So he's sending you... two individual transactions at the end of this block. And it's sending me one individual transaction of 64 bytes. So they're sending us different things.
Aaron van WirdumIsn't that just in the block? Isn't that just the block that he's sending? That's the block, right? The in the block is the transaction.
Sjors ProvoostA block, when you receive a block, what it really is, is a message, right? And the message starts with the header and it's followed by the list of every single transaction.
Aaron van WirdumYeah.
Sjors ProvoostAnd so... that list of transactions, yeah, it's very… It's different. So if you were to look at the bytes on on the… If you printed it out a piece of paper, you would see that at the end of the piece of paper it's different.
Aaron van WirdumOkay.
Sjors ProvoostYou and I got a different block.
Aaron van WirdumWe got a different block. It just has the same hash.
Sjors ProvoostYes.
Aaron van WirdumIt hashes to the same hash.
Sjors ProvoostAnd because you say it's invalid.
Aaron van WirdumYeah. Because it is invalid. The one you sent me is invalid. It's yours.
Sjors ProvoostExactly. But now if somebody else sends you the correct one…
Aaron van WirdumIt's only sending you… Yeah. Then I'll be like, no, I already saw this and it was invalid.
Sjors ProvoostYeah. And that problem, you know, keep in mind that this problem was discovered in 2012 or something. So back then that attack was cheap.
Aaron van WirdumRight.
Sjors ProvoostRight now this attack would be expensive, but the attack was fixed because basically when this happens to you, you say, hey, this block is invalid, you just forget it. And so the next time somebody sends you the correct one, you're fine. So that attack is fixed. But then there was other ways that you can fool light clients like SPV wallets using the same trick because they are asking just for an SPV proof. So they just want proof that a transaction was included and you could now give them a transaction that they think is included because you gave the SPV proof, but it wasn't included. Because the real block had two separate transactions that happened to combine to this one fake transaction. And this
Sjors Provoostcould be used to steal light wallets, but possibly also to rob sidechains if those sidechains only use SPV proofs for peg-ins and peg-outs. And that problem, I think, was solved by telling light clients to be careful. I don't think it was actually solved.
Aaron van WirdumOkay, back to the great consensus cleanup revival. What's the solution here?
Sjors ProvoostDon't allow 64 byte transactions.
Aaron van WirdumWell, what if my transaction is 64 bytes though?
Sjors ProvoostThen you are out of luck. So if you still have one of those in the safe, you better spend it.
Aaron van WirdumI create a transaction that consists of 64 bytes because I want to pay exactly... this many people, this many coins with this many UTXOs, then the Bitcoin network say, no, your money is not valid.
Sjors ProvoostYeah, I think the actual examples would be burning coins. So you can make an OP_RETURN transaction that burns your coins, doesn't send it anywhere. And that can be shorter than 64 bytes, but it could also be 64 bytes. So if you want to burn your money using an OP_RETURN that is exactly 64 bytes in total, then yeah, you can't do that.
Aaron van WirdumAre there no normal transactions that are exactly 64 bytes?
Sjors ProvoostI believe not. So you can already not send those in the mempool today. It won't be relayed.
Aaron van WirdumOkay.
Sjors ProvoostAnd so I think that was the change in version 25. So I think there was a rule that says nothing under 64 bytes or sorry, nothing under 65 bytes. That was the mempool rule. And then people were like, well, but it could be useful to have a 63-byte or a 62-byte transaction to burn your coins. And so I think the rule was changed to no 64 bytes. So the difference is make this consensus rather than policy.
Aaron van WirdumOkay. So most transactions are well over 64 bytes or at least more than 64 bytes. That's normal for a transaction to be more than 64 bytes. If you see a 64-byte transaction, it's kind of something special.
Sjors ProvoostYeah, then it's probably an attack.
Aaron van WirdumOkay, right. And now the Great Consensus Cleanup says let's just get rid of that all together. However, 63 or 62, that's still okay, if you really do, like, if you're not attacking but you're burning coins, that that should work. But yeah, so basically if people make 64 byte transactions in the future and the soft fork happens, then their transaction wouldn't be confirmed.
Sjors ProvoostYep.
Aaron van WirdumThen I have to make a new transaction that's either 63 or 65 or something else, as long as it's not 64.
Sjors ProvoostAnd you can probably malleate it. So we… I think we talked about transaction malleation, where you can, like, mess with another transaction, so you might, even if you lost the original coin that you used to make this thing, I think you might be able to just make it one byte longer, but I'm not entirely sure about that.
Aaron van WirdumRight. Okay, got it. Sounds like…
Sjors ProvoostBut this is another case of like, yes, you could just ban anything under 64 or anything under 65, but you want to make the minimum change possible to reduce controversy. That's not too complicated.
Aaron van WirdumOkay. Last one. BIP 30, 34.
Sjors ProvoostYeah, we did a whole episode about this called episode 87. It was called the block 1,983,702 problem.
Aaron van WirdumRight. What was that problem again? It was about two transactions that look similar, right?
Sjors ProvoostYeah, so the TL;DR of this one is that there was a BIP 30 that prevents duplicate transactions. Because having duplicate transactions, transactions with the same hash, it causes problems. You can override coinbases, do all sorts of weird things. It happened a few times in the beginning of Bitcoin. It was fixed. The problem of this fix is that it was a slow fix. So every time there's a new block coming in, you have to check every transaction to make sure that it doesn't already exist. And this check is expensive, requires a lot of disk reading.
Sjors ProvoostUnfortunately, and so there was a way to speed it up. The way to speed it up was to force the coinbase transaction to have the block height in it. So that makes every coinbase transaction unique. And since every transaction eventually descends from a coinbase transaction, every descendant is unique.
Aaron van WirdumYeah, that way you can't have duplicate transactions anymore.
Sjors ProvoostYeah, and so then people thought, okay, so we can turn off this expensive check. But it turns out you can't because there are some very old transactions before this BIP 34 rule was introduced that if you read them, you could interpret the first bytes of those transactions as a version. Sorry, as a block height.
Aaron van WirdumYeah. So there's something in these old transactions, in these old UTXOs, I guess we should say.
Sjors ProvoostYeah, that is effectively the same as putting a block height in there, but the wrong one.
Aaron van WirdumYeah.
Sjors ProvoostAnd so these ones, we're going to start encountering these, and we've already encountered a few, but they didn't cause problems. So we got lucky. And so as of the first one, we're going to encounter again is block 1,983,702. So there is an old transaction out there that looks like it's at that height. So in theory, somebody could then make a coinbase transaction that's a duplicate of that old one. And we don't want that. So the BIP 30 check, the slow check, is re-enabled from that height on.
Sjors ProvoostThat's annoying because that check, as we said, is slow. So the proposal here is to do something else that makes sure that this duplication cannot happen. So not just putting the height in the coinbase, but also putting something else in it. What that something else is, we don't know. My favorite is to make SegWit mandatory, as in SegWit commitment, because every SegWit block has an OP_RETURN and followed by the hash of the witness data. And right
Sjors Provoostnow, if there is no transactions in a block, including if there's no SegWit transactions even in the coinbase, well, then there's no witness commitment. And so that OP_RETURN is not present. But you could make it mandatory from off. Basically, you could make it mandatory starting at block 1,983,000. And so people will have 20 years to upgrade.
Aaron van WirdumYeah.
Sjors ProvoostBut if they don't, they could accidentally mine an invalid block at that height.
Aaron van WirdumRight.
Sjors ProvoostThere's different ways to do it.
Aaron van WirdumWe discussed this at length in the other episode, of course, which was 87, for anyone who wants to know more about this problem. And then also the potential fix, 87.
Sjors ProvoostSo that's the whole great consensus cleanup. And so as you can hear, some changes are very straightforward. There's not really any discussion. Some, there is discussion. And so we'll have to figure that out. And then at some point, somebody will have to take the initiative to... actually propose this as a soft fork, do activation parameters, hope there's no drama.
Aaron van WirdumWell, that is kind of one of the, you know, side goals of this proposal, I would say, is figuring out how we actually do soft forks and how we actually do Bitcoin upgrades.
Sjors ProvoostExactly. This was proposed long before Taproot as a way to sort of get over the SegWit trauma.
Aaron van WirdumYeah, like, we're still… it's still not clear how we're supposed to do these kinds of things. So then the idea was let's do something that's very uncontroversial that everyone should or does or will agree on. There's nothing, like, it's just very obvious bugs that we're gonna fix, and then we can figure out how we're actually supposed to do these soft forks. And then, you know, it's sort of a good trial run for future soft forks, I guess.
Sjors ProvoostYeah. Now we've already done Taproot, but of course there was still discussion about how that soft fork was activated. So I don't know if we really now have broad consensus on how to do this.
Aaron van WirdumWe definitely don't, Sjors.
Sjors ProvoostBut this may be another case of nobody cares what the activation mechanism is just activate it. The main thing is, of course, this takes away the options of miners to do a time warp attack, so if they actually like to keep that option, they might veto it, and then you get into more difficult territory. Um, well, but they may…
Aaron van WirdumI don't know if we want to get… We don't want to get into the activation discussion in this podcast episode.
Sjors ProvoostWe do not. I'm just saying, like, it might be straightforward, it might not be, and we'll have to… We may have…
Aaron van WirdumNo, I'm telling you it will not be.
Sjors ProvoostOkay.
Aaron van WirdumFor sure.
Sjors ProvoostI'm more bullish. Okay. And of course, we keep in mind that you can deploy multiple soft forks in parallel. So this doesn't have to be before or after your favorite feature X. You can activate, I don't know, 10 soft forks at the same time.
Aaron van WirdumYeah, remember when people thought that would actually happen? Good times. Good times.
Sjors ProvoostGood times, indeed. I'm just saying, you know, don't worry about that aspect. Okay, I think that's all we've got. Thank you for listening to Bitcoin,
Aaron and Sjors discuss Bitcoin Core 32.1 and its updated security disclosure policy in this live conference recording, followed by audience questions. Links Bitcoin Core 32.1 release announcement and release notes...
Aaron and Sjors discuss the COLDCARD hack: the bug itself, how it could have happened, and some reflections on having had Coinkite as a sponsor. Note: If you’re using a COLDCARD and still haven’t moved your funds to a...
The COLDCARD hardware wallet has a critical vulnerability. If you are using the COLDCARD to store bitcoin, move them to a secure location as soon as you can. More information:...
Aaron and Sjors discuss what’s new in Bitcoin Core 31. Chapters 00:00:00 Episode 100 and Core 31 00:02:41 Cluster Mempool 00:10:45 Package Relay and Fee Selection 00:18:59 Private Broadcast over Tor 00:24:03 ASMAP and...