WEBVTT - Automatic transcript; recognition may contain errors. Reviewed for technical wording and speaker labels. Times match the published episode.

00:00:00.530 --> 00:00:02.910
<v Aaron van Wirdum>Before the show, a quick word from our sponsor.

00:00:11.130 --> 00:00:13.830
<v Aaron van Wirdum>Live from Utrecht, this is the Van Wirdum Sjorsnado.

00:00:14.110 --> 00:00:14.330
<v Sjors Provoost>Hello.

00:00:14.970 --> 00:00:15.490
<v Aaron van Wirdum>Hey, Sjors.

00:00:15.710 --> 00:00:15.950
<v Sjors Provoost>What's up?

00:00:16.130 --> 00:00:19.670
<v Aaron van Wirdum>The other day I wanted to send Bitcoin to someone, but I didn't.

00:00:20.150 --> 00:00:21.010
<v Sjors Provoost>Shouldn't you hodl?

00:00:21.210 --> 00:00:26.750
<v Aaron van Wirdum>I hodl all I can, but sometimes I need to eat, or I need to pay my rent, or I

00:00:26.750 --> 00:00:30.750
<v Aaron van Wirdum>need to buy a new plant for my living room.

00:00:31.270 --> 00:00:31.970
<v Sjors Provoost>Yeah, that's true.

00:00:32.130 --> 00:00:36.510
<v Aaron van Wirdum>So the problem was the person I wanted to send Bitcoin to, I didn't have their IP

00:00:36.510 --> 00:00:36.930
<v Aaron van Wirdum>address.

00:00:37.250 --> 00:00:38.810
<v Sjors Provoost>You did not have their IP address.

00:00:38.890 --> 00:00:40.350
<v Aaron van Wirdum>I did not have their IP address.

00:00:40.550 --> 00:00:40.630
<v Sjors Provoost>Okay.

00:00:40.990 --> 00:00:46.450
<v Aaron van Wirdum>Luckily, it turns out there's this trick in Bitcoin called Bitcoin addresses.

00:00:46.930 --> 00:00:47.530
<v Sjors Provoost>That's right.

00:00:47.690 --> 00:00:48.450
<v Aaron van Wirdum>Have you heard of this?

00:00:49.210 --> 00:00:49.690
<v Sjors Provoost>Yes.

00:00:50.090 --> 00:00:54.530
<v Aaron van Wirdum>Maybe our reader, cut that please. Maybe our listener hasn't yet, Sjors. So let's

00:00:54.530 --> 00:00:56.030
<v Aaron van Wirdum>explain what Bitcoin addresses are.

00:00:56.570 --> 00:00:58.830
<v Sjors Provoost>Okay. What are Bitcoin addresses?

00:00:59.110 --> 00:01:03.230
<v Aaron van Wirdum>First of all, so I made a stupid joke about IP addresses, but this was actually

00:01:03.230 --> 00:01:04.250
<v Aaron van Wirdum>an option, wasn't it?

00:01:04.450 --> 00:01:08.410
<v Sjors Provoost>Yeah, so in the initial version of Bitcoin, Satoshi announced it on the mailing

00:01:08.410 --> 00:01:11.610
<v Sjors Provoost>list and said, well, if you want to send somebody some coins, you just enter

00:01:11.610 --> 00:01:16.450
<v Sjors Provoost>their IP address and then it'll exchange, I guess, an address to send it to.

00:01:16.450 --> 00:01:21.490
<v Aaron van Wirdum>Yeah so it was actually possible to send bitcoins to people's IP addresses. I

00:01:21.490 --> 00:01:24.350
<v Aaron van Wirdum>don't think that's possible anymore. That's not in any of the code.

00:01:24.350 --> 00:01:29.110
<v Sjors Provoost>I don't think so either. I haven't seen it. Yeah because the other way is that

00:01:29.110 --> 00:01:32.910
<v Sjors Provoost>you just get an address to send to and then it goes to the blockchain and because

00:01:32.910 --> 00:01:36.490
<v Sjors Provoost>the other side is checking the blockchain also it'll show up yeah.

00:01:37.090 --> 00:01:40.270
<v Aaron van Wirdum>Well, that's actually not how it works at all. But we're going to explain it now,

00:01:40.470 --> 00:01:40.950
<v Aaron van Wirdum>I think.

00:01:41.410 --> 00:01:41.570
<v Sjors Provoost>Yep.

00:01:41.930 --> 00:01:47.070
<v Aaron van Wirdum>Let's go. Okay, first of all, Sjors, when you send Bitcoin to someone, what do

00:01:47.070 --> 00:01:48.090
<v Aaron van Wirdum>you actually do? What happens?

00:01:48.370 --> 00:01:52.510
<v Sjors Provoost>Well, you're creating a transaction that has a bunch of inputs and it has an

00:01:52.510 --> 00:01:56.170
<v Sjors Provoost>output. And that output describes who can spend it.

00:01:56.410 --> 00:01:56.710
<v Aaron van Wirdum>Yeah.

00:01:56.870 --> 00:02:00.830
<v Sjors Provoost>So you could say anybody can spend this. That's not a good idea. We talked about

00:02:00.830 --> 00:02:04.870
<v Sjors Provoost>that in an earlier episode. So what you do is you put a constraint on it. And the

00:02:04.870 --> 00:02:10.750
<v Sjors Provoost>very first version of that constraint was he or she who has this public key

00:02:10.750 --> 00:02:14.970
<v Sjors Provoost>can spend the coins. So that's called pay to public key.

00:02:15.530 --> 00:02:20.210
<v Aaron van Wirdum>Yes, exactly. And then we just mentioned this IP example. So what actually

00:02:20.210 --> 00:02:24.730
<v Aaron van Wirdum>happened was you would connect to someone's IP. I don't know the nitty gritty

00:02:24.730 --> 00:02:28.390
<v Aaron van Wirdum>details, but in general, you would connect to someone's IP and you'd ask for a

00:02:28.390 --> 00:02:32.310
<v Aaron van Wirdum>public key and that person would give you the public key. And I think that's what

00:02:32.310 --> 00:02:33.310
<v Aaron van Wirdum>you send the bitcoins to.

00:02:33.680 --> 00:02:38.140
<v Sjors Provoost>Yeah, I believe so too, but I haven't seen that code in action, so we could be

00:02:38.140 --> 00:02:41.720
<v Sjors Provoost>slightly wrong there. Somebody should dig it up. I'd love to see screenshots of

00:02:41.720 --> 00:02:43.160
<v Sjors Provoost>what that used to look like.

00:02:43.520 --> 00:02:48.120
<v Aaron van Wirdum>Yeah, is there anyone who's ever used this way of paying someone pay to IP

00:02:48.120 --> 00:02:48.580
<v Aaron van Wirdum>address?

00:02:49.060 --> 00:02:50.140
<v Sjors Provoost>Yeah, we'd love to know.

00:02:50.260 --> 00:02:55.600
<v Aaron van Wirdum>It was technically possible. If anyone listening... Has anyone ever actually used

00:02:55.600 --> 00:02:57.520
<v Aaron van Wirdum>this? We'd be curious to hear that.

00:02:57.740 --> 00:03:01.620
<v Sjors Provoost>I mean, it makes sense to think that way in the first version of Bitcoin, right?

00:03:01.700 --> 00:03:04.980
<v Sjors Provoost>Because before that, you had all these peer-to-peer applications and they were

00:03:04.980 --> 00:03:09.660
<v Sjors Provoost>generally very direct. So with Napster and all these things, or Kazaa, I don't

00:03:09.660 --> 00:03:13.380
<v Sjors Provoost>know which one, you would connect to other people and you would download things

00:03:13.380 --> 00:03:17.620
<v Sjors Provoost>from them. And with Bitcoin, you connect to other peers, but nowadays you just

00:03:17.620 --> 00:03:21.000
<v Sjors Provoost>connect to random peers. But perhaps in the beginning, the idea might have been,

00:03:21.120 --> 00:03:25.040
<v Sjors Provoost>okay, you connect to peers you know, and so then you might as well, you know, do

00:03:25.040 --> 00:03:27.880
<v Sjors Provoost>transactions with them. But right now you don't really do transactions with the

00:03:27.880 --> 00:03:31.420
<v Sjors Provoost>peers you're directly connected to, at least not in Bitcoin on chain.

00:03:31.780 --> 00:03:36.200
<v Aaron van Wirdum>Yeah. Well, anyway, so that's one way of paying someone to a public key is you'd

00:03:36.200 --> 00:03:39.960
<v Aaron van Wirdum>connect to their IP address and you'd get their public key. The other way is if

00:03:39.960 --> 00:03:44.720
<v Aaron van Wirdum>you mine Bitcoins. So if you're a miner, then you're actually sending the block

00:03:44.720 --> 00:03:49.600
<v Aaron van Wirdum>rewards to your public key. Is that still the case? It used to be the case in the

00:03:49.600 --> 00:03:50.400
<v Aaron van Wirdum>beginning, at least.

00:03:50.680 --> 00:03:54.640
<v Sjors Provoost>Well, in the beginning, Bitcoin had a piece of mining software built into

00:03:54.640 --> 00:03:58.080
<v Sjors Provoost>software, right? So if you if you downloaded the Bitcoin software, it would just

00:03:58.080 --> 00:04:01.320
<v Sjors Provoost>start mining. And so it would use that mechanism.

00:04:01.320 --> 00:04:02.840
<v Aaron van Wirdum>Well, you just have to press a button, but yeah.

00:04:03.320 --> 00:04:09.260
<v Sjors Provoost>Yeah, I guess. And then later on, you know, you had mining pools

00:04:09.260 --> 00:04:12.780
<v Sjors Provoost>and it all became more professional. So the way they would pay out might be very

00:04:12.780 --> 00:04:18.000
<v Sjors Provoost>different. Probably, you know, might go to a multi-sig address from which it's

00:04:18.000 --> 00:04:23.240
<v Sjors Provoost>paid back to the individual pool participants. Or it could be paid directly to

00:04:23.240 --> 00:04:26.360
<v Sjors Provoost>the pool participants, although that's a bit inefficient because you need a long

00:04:26.360 --> 00:04:30.160
<v Sjors Provoost>list of addresses in the coinbase. But I've seen huge coinbase transactions, so

00:04:30.160 --> 00:04:31.820
<v Sjors Provoost>probably people were doing that.

00:04:32.340 --> 00:04:37.490
<v Aaron van Wirdum>Right. Well, anyway, so the point I was making was this pay to public key way of

00:04:37.490 --> 00:04:41.970
<v Aaron van Wirdum>paying someone. I learned this while doing a little bit of research for the show.

00:04:42.110 --> 00:04:47.950
<v Aaron van Wirdum>That was only ever really used for pay to IP address and for the miner, the

00:04:47.950 --> 00:04:48.510
<v Aaron van Wirdum>block reward.

00:04:48.790 --> 00:04:49.230
<v Sjors Provoost>Okay.

00:04:49.390 --> 00:04:54.420
<v Aaron van Wirdum>It wasn't actually used for anything other than that. What was used? Other than

00:04:54.420 --> 00:05:00.240
<v Aaron van Wirdum>that was pay to public key hash, right? So you're not sending money to a

00:05:00.240 --> 00:05:03.740
<v Aaron van Wirdum>public key, but you're sending money to the hash of that public key.

00:05:04.100 --> 00:05:04.480
<v Sjors Provoost>Yeah.

00:05:04.740 --> 00:05:06.960
<v Aaron van Wirdum>And this is where addresses come in.

00:05:07.120 --> 00:05:07.560
<v Sjors Provoost>Yeah.

00:05:07.720 --> 00:05:11.540
<v Aaron van Wirdum>And this type of payment actually used addresses for the first time. Not for the

00:05:11.540 --> 00:05:14.800
<v Aaron van Wirdum>first time. This was always there. Also something I learned while doing a little

00:05:14.800 --> 00:05:18.980
<v Aaron van Wirdum>bit of research. This was there since day one. There were Bitcoin addresses since

00:05:18.980 --> 00:05:23.250
<v Aaron van Wirdum>day one, but they were only there for pay to public key hash.

00:05:23.250 --> 00:05:29.010
<v Sjors Provoost>Right, so basically so the script on the Bitcoin blockchain would in that

00:05:29.010 --> 00:05:34.470
<v Sjors Provoost>case say okay the person who can spend this must have the public key belonging to

00:05:34.470 --> 00:05:39.630
<v Sjors Provoost>this hash so you know the nice thing about that is that you're not saying which

00:05:39.630 --> 00:05:42.710
<v Sjors Provoost>public key you have or at least at the time it was thought that maybe that was

00:05:42.710 --> 00:05:46.550
<v Sjors Provoost>safer against quantum attacks but the other benefit is that it's a little bit

00:05:46.550 --> 00:05:50.250
<v Sjors Provoost>shorter so it saves a bit on block space although of course that wasn't an issue

00:05:50.250 --> 00:05:53.060
<v Sjors Provoost>back then. So yeah, you pay to the public key hash.

00:05:53.400 --> 00:05:57.480
<v Aaron van Wirdum>Yeah, I guess in a way it's slightly more private as well, right? Because you're

00:05:57.480 --> 00:06:01.020
<v Aaron van Wirdum>only revealing your public key when you're paying. No, that doesn't make sense.

00:06:01.220 --> 00:06:03.460
<v Sjors Provoost>No, I think that exactly doesn't matter.

00:06:03.760 --> 00:06:09.480
<v Aaron van Wirdum>No. Okay, so that's paying to public key hash. And like you said, what you see

00:06:09.480 --> 00:06:15.080
<v Aaron van Wirdum>on the blockchain itself, what's recorded on the blockchain, is the actual hash

00:06:15.080 --> 00:06:19.840
<v Aaron van Wirdum>of a public key. However, when you're getting paid on a public...

00:06:20.610 --> 00:06:26.430
<v Aaron van Wirdum>pay to pub key hash, what you're sharing with someone is not this hash;

00:06:26.430 --> 00:06:27.710
<v Aaron van Wirdum>it's actually an address.

00:06:27.840 --> 00:06:33.000
<v Sjors Provoost>Yes, well you are sharing the hash but you do that using an address.

00:06:33.000 --> 00:06:34.700
<v Aaron van Wirdum>Exactly, so what is an address?

00:06:34.700 --> 00:06:39.300
<v Sjors Provoost>So an address essentially is at least this type of address is the number one

00:06:39.300 --> 00:06:44.280
<v Sjors Provoost>followed by the hash of the public key but it is encoded using something called

00:06:44.280 --> 00:06:45.540
<v Sjors Provoost>base 58.

00:06:45.540 --> 00:06:46.840
<v Aaron van Wirdum>What's base 58?

00:06:46.840 --> 00:06:52.680
<v Sjors Provoost>Okay, so let's go back to base 64. I don't know if you've ever seen

00:06:52.680 --> 00:06:57.720
<v Sjors Provoost>an email source code, like an attachment, all these weird characters in there.

00:06:58.390 --> 00:07:04.230
<v Sjors Provoost>That's base 64. And base 58 is based on that. But maybe to say what it is, it is

00:07:04.230 --> 00:07:09.830
<v Sjors Provoost>all the lowercase letters, all the uppercase letters, and all the numbers, and

00:07:09.830 --> 00:07:13.310
<v Sjors Provoost>without any of the signs, and with some ambiguous things removed. So you do not

00:07:13.310 --> 00:07:16.070
<v Sjors Provoost>have the small O, the big O, and the zero.

00:07:16.530 --> 00:07:17.990
<v Aaron van Wirdum>Should we start with base 10?

00:07:18.780 --> 00:07:21.200
<v Sjors Provoost>Yeah. So, I mean, there's two things.

00:07:21.360 --> 00:07:24.420
<v Aaron van Wirdum>I want people to understand what base means.

00:07:24.600 --> 00:07:27.940
<v Sjors Provoost>Yeah, exactly. So this is what's in base 58, but then the question is, what is base?

00:07:28.100 --> 00:07:28.340
<v Aaron van Wirdum>Yes.

00:07:28.760 --> 00:07:33.580
<v Sjors Provoost>And so base 10 is you have 10 fingers. And so if you want to express, say, the

00:07:33.580 --> 00:07:39.500
<v Sjors Provoost>number 115, you can make three gestures, right? You show a 1 and a 1 and a 5.

00:07:40.040 --> 00:07:45.740
<v Sjors Provoost>And that is base 10 because you're using your 10 fingers three times. And that's

00:07:45.740 --> 00:07:49.380
<v Sjors Provoost>also how you write down numbers. But there have been different bases. I think the

00:07:49.380 --> 00:07:53.540
<v Sjors Provoost>Babylonians were very much into base 360. That's why we have…

00:07:53.540 --> 00:07:57.240
<v Aaron van Wirdum>Hang on, hang on. Because we're not actually using fingers most of the time. So I

00:07:57.240 --> 00:08:02.020
<v Aaron van Wirdum>want to make this clear that it just means we have a decimal system. So that

00:08:02.020 --> 00:08:06.700
<v Aaron van Wirdum>means we have 10 different symbols that represent the number.

00:08:06.960 --> 00:08:07.580
<v Sjors Provoost>That's right.

00:08:08.480 --> 00:08:11.540
<v Aaron van Wirdum>The symbol zero, which is a round thing, and then we have the one.

00:08:11.780 --> 00:08:14.020
<v Sjors Provoost>But it's probably not a coincidence that that happens to [unclear]…

00:08:14.020 --> 00:08:17.560
<v Aaron van Wirdum>I totally agree. I just want to make it clear that we're not actually using

00:08:17.560 --> 00:08:18.620
<v Aaron van Wirdum>fingers most of the time.

00:08:19.000 --> 00:08:19.880
<v Sjors Provoost>No, and so the…

00:08:19.880 --> 00:08:24.220
<v Aaron van Wirdum>Okay, so we have 10 symbols, so that means that once you get by the 11th number,

00:08:24.400 --> 00:08:28.860
<v Aaron van Wirdum>at that point, you're going to have to reuse symbols you've already used, or

00:08:28.860 --> 00:08:33.520
<v Aaron van Wirdum>you're now going to use combinations. So in our case, that would be... Well, it's

00:08:33.520 --> 00:08:37.160
<v Aaron van Wirdum>going to get confusing because the first number is a zero. So then the 11th

00:08:37.160 --> 00:08:38.560
<v Aaron van Wirdum>number is the 1 and the 0.

00:08:39.220 --> 00:08:43.480
<v Sjors Provoost>Yeah, exactly. And there have been different bases in use, right? So base 360, I

00:08:43.480 --> 00:08:49.040
<v Sjors Provoost>believe, was used by Babylonians, or maybe base 60. And then for computers, we

00:08:49.040 --> 00:08:54.060
<v Sjors Provoost>tend to use base 2 internally, because chips are either on or off. So it's a 0 or

00:08:54.060 --> 00:08:59.400
<v Sjors Provoost>a 1, so a long series of 0s and 1s. And you can express any number of that. Now,

00:08:59.520 --> 00:09:04.700
<v Sjors Provoost>in order to read machine code, typically you would use hexadecimal, which is base

00:09:04.700 --> 00:09:09.060
<v Sjors Provoost>16. So that is 0 to 9 and then A to F.

00:09:09.720 --> 00:09:10.320
<v Aaron van Wirdum>Yeah.

00:09:11.520 --> 00:09:16.120
<v Sjors Provoost>Right, and so base 58 is basically this 58 possible characters to express

00:09:16.120 --> 00:09:16.680
<v Sjors Provoost>something with.

00:09:17.000 --> 00:09:21.140
<v Aaron van Wirdum>Yeah, it's it's all it's all numbers and there's different ways of expressing a

00:09:21.140 --> 00:09:27.500
<v Aaron van Wirdum>number based on your base. Yeah, and that determines how many symbols you're using.

00:09:28.160 --> 00:09:32.880
<v Sjors Provoost>The trade-off here is readability, really, because you could represent machine

00:09:32.880 --> 00:09:38.680
<v Sjors Provoost>code as normal characters. So the ASCII alphabet or the

00:09:38.680 --> 00:09:43.840
<v Sjors Provoost>ASCII character set is 256 different characters. So that's base 256. But if

00:09:43.840 --> 00:09:48.840
<v Sjors Provoost>you've ever done something like print and then the name of a file, your computer

00:09:48.840 --> 00:09:52.620
<v Sjors Provoost>will show complete gibberish on the screen and it will start beeping. And the

00:09:52.620 --> 00:09:56.520
<v Sjors Provoost>reason it starts beeping is because one of these... codes somewhere in the base

00:09:56.520 --> 00:10:00.640
<v Sjors Provoost>256 is a beep which actually makes your terminal beep so it is completely

00:10:00.640 --> 00:10:04.880
<v Sjors Provoost>impractical to view a file using base 256 even though there is a character for

00:10:04.880 --> 00:10:09.320
<v Sjors Provoost>every of the 256 things there so that's why you tend to do that in base 16

00:10:09.320 --> 00:10:13.740
<v Sjors Provoost>hexadecimal is relatively easy to read but then it's quite long if you take a

00:10:13.740 --> 00:10:17.220
<v Sjors Provoost>public key and you write it as hexadecimal it's it's a rather long thing to write

00:10:17.220 --> 00:10:22.120
<v Sjors Provoost>down but and base 58 is a little bit shorter so maybe you know it's easier to

00:10:22.120 --> 00:10:27.430
<v Sjors Provoost>copy paste perhaps or it's not even easy to read on the phone. Base 58 is pretty

00:10:27.430 --> 00:10:30.090
<v Sjors Provoost>terrible because it's uppercase, lowercase, uppercase, lowercase.

00:10:30.780 --> 00:10:36.640
<v Aaron van Wirdum>Yeah. Okay. Just to restate that briefly. So base two is just,

00:10:36.740 --> 00:10:41.000
<v Aaron van Wirdum>you're just using two symbols, which is one and zero. And base 10 is what we use

00:10:41.000 --> 00:10:45.840
<v Aaron van Wirdum>most of the time. It's zero, one, two, three, four, up until nine. Then you have

00:10:45.840 --> 00:10:51.780
<v Aaron van Wirdum>hexadecimal, which uses zero through nine plus A, B, C, D, E, F. And

00:10:51.780 --> 00:10:56.160
<v Aaron van Wirdum>then what we're talking about here is base 58, which uses 58 different symbols,

00:10:56.300 --> 00:10:59.540
<v Aaron van Wirdum>which are zero through nine.

00:11:00.960 --> 00:11:06.900
<v Aaron van Wirdum>Most of the alphabet in both capital letters and undercase, right?

00:11:07.180 --> 00:11:11.220
<v Sjors Provoost>Yeah, I think it's lowercase and uppercase and then most of the numbers, but

00:11:11.220 --> 00:11:14.320
<v Sjors Provoost>there are some letters and numbers that are skipped that are ambiguous. So the

00:11:14.320 --> 00:11:19.220
<v Sjors Provoost>number zero, the letter O, both lowercase and uppercase, or at least uppercase is not in there.

00:11:19.800 --> 00:11:25.440
<v Aaron van Wirdum>Yeah, I think, for example, the capital I and the lowercase L are both not in

00:11:25.440 --> 00:11:26.820
<v Aaron van Wirdum>there because they look too similar.

00:11:26.940 --> 00:11:30.320
<v Sjors Provoost>Right, and that's why you get a little bit less than, you know, if you just add

00:11:30.320 --> 00:11:34.440
<v Sjors Provoost>26 letters plus 26 uppercase plus 10 numbers, right?

00:11:34.740 --> 00:11:37.560
<v Aaron van Wirdum>Okay, I think we finally explained what base 58 means.

00:11:37.580 --> 00:11:41.860
<v Sjors Provoost>Yeah, and just as a sidestep, I talked about email earlier, that's base 64. That

00:11:41.860 --> 00:11:46.560
<v Sjors Provoost>is the same, but it also has some characters like underscore and plus and equals.

00:11:46.960 --> 00:11:50.740
<v Sjors Provoost>And that was mostly used for email attachments. And I guess they didn't want to

00:11:50.740 --> 00:11:53.780
<v Sjors Provoost>use all 256 characters either because they didn't want the email to start

00:11:53.780 --> 00:11:57.440
<v Sjors Provoost>beeping, but they did want to squeeze a lot of information into the attachment.

00:11:58.170 --> 00:12:02.570
<v Aaron van Wirdum>Okay, that's base 58. Now, why are we talking about this? What is an address?

00:12:03.010 --> 00:12:09.010
<v Sjors Provoost>Yeah, so the address again is actually the value 0, I believe, but that's

00:12:09.010 --> 00:12:12.350
<v Sjors Provoost>expressed as a 1, because that's the first digit in this character set.

00:12:12.350 --> 00:12:13.610
<v Aaron van Wirdum>Base 58 system, yeah.

00:12:13.790 --> 00:12:18.330
<v Sjors Provoost>Yeah, so it starts with a 1, and then it's followed by the public key hash, which

00:12:18.330 --> 00:12:19.750
<v Sjors Provoost>is just expressed in base 58.

00:12:20.070 --> 00:12:21.390
<v Aaron van Wirdum>Right, is that all it is?

00:12:22.080 --> 00:12:26.800
<v Sjors Provoost>Yes. And keep in mind, so that is the information you send to somebody else when

00:12:26.800 --> 00:12:31.780
<v Sjors Provoost>you want them to send you Bitcoin. You could also just send them 00 and then the

00:12:31.780 --> 00:12:35.940
<v Sjors Provoost>public key. And maybe they would be able to interpret that. Probably not. You

00:12:35.940 --> 00:12:40.000
<v Sjors Provoost>could send them the actual script that's used on the blockchain. Because on the

00:12:40.000 --> 00:12:44.940
<v Sjors Provoost>blockchain, there is no base 58 or base 64 or anything like that. The blockchain

00:12:44.940 --> 00:12:50.340
<v Sjors Provoost>is just binary information. So the blockchain has this script that says if the

00:12:50.340 --> 00:12:55.110
<v Sjors Provoost>person has the right public key hash, has the public key belonging to this public

00:12:55.110 --> 00:12:59.100
<v Sjors Provoost>key hash, then you can spend it. And we talked about in an earlier episode how

00:12:59.100 --> 00:13:02.160
<v Sjors Provoost>Bitcoin scripts work. So you could send somebody the Bitcoin script in

00:13:02.160 --> 00:13:05.700
<v Sjors Provoost>hexadecimal, anything you want. But the convention is you use this address

00:13:05.700 --> 00:13:10.000
<v Sjors Provoost>format. And that's why all traditional Bitcoin addresses start with a one. And

00:13:10.000 --> 00:13:11.420
<v Sjors Provoost>they're all the same, roughly the same length.

00:13:11.560 --> 00:13:17.460
<v Aaron van Wirdum>Okay, so a Bitcoin address is basically just a base 58 representation of

00:13:17.460 --> 00:13:23.280
<v Aaron van Wirdum>a version number plus a public key hash. Sjors, is base

00:13:23.280 --> 00:13:26.060
<v Aaron van Wirdum>58 used for anything else in Bitcoin?

00:13:26.650 --> 00:13:31.100
<v Sjors Provoost>Yeah, you can also use it to communicate a private key. And in that case, your

00:13:31.100 --> 00:13:35.840
<v Sjors Provoost>version number is, well, it's written as 5. But it actually represents, I think,

00:13:35.920 --> 00:13:36.480
<v Sjors Provoost>128.

00:13:36.920 --> 00:13:37.280
<v Aaron van Wirdum>Right.

00:13:37.420 --> 00:13:39.200
<v Sjors Provoost>And then followed by the private key.

00:13:39.620 --> 00:13:45.100
<v Aaron van Wirdum>So that's why all private keys start with a 5. Or at least used to start with a 5.

00:13:45.140 --> 00:13:48.620
<v Sjors Provoost>Yeah, so in the old days you had paper wallets that you could print. And if you

00:13:48.620 --> 00:13:53.180
<v Sjors Provoost>generate them actually securely without a backdoor, then on one side of the piece

00:13:53.180 --> 00:13:56.380
<v Sjors Provoost>of paper you would have something starting with a 5. And on the other side of the

00:13:56.380 --> 00:13:59.430
<v Sjors Provoost>paper you would have something starting with a 1. And then it would say, like,

00:13:59.550 --> 00:14:01.670
<v Sjors Provoost>show this to other people and don't show this to other people.

00:14:01.910 --> 00:14:07.630
<v Aaron van Wirdum>Right. Now, I happen to know, Sjors, that there are also addresses that start

00:14:07.630 --> 00:14:08.370
<v Aaron van Wirdum>with a three.

00:14:08.610 --> 00:14:09.230
<v Sjors Provoost>That's right.

00:14:09.490 --> 00:14:10.330
<v Aaron van Wirdum>What's up with that?

00:14:10.870 --> 00:14:14.410
<v Sjors Provoost>Well, usually those are multi-signature addresses, but they don't have to be.

00:14:14.530 --> 00:14:17.670
<v Sjors Provoost>They could be single-signature addresses. What they are are...

00:14:17.670 --> 00:14:22.450
<v Aaron van Wirdum>They could also be types of SegWit addresses or... They could be many things, right?

00:14:22.750 --> 00:14:23.070
<v Sjors Provoost>Yes.

00:14:23.470 --> 00:14:27.740
<v Aaron van Wirdum>They could also be... Single sig, but you already mentioned that. So let's go on.

00:14:27.880 --> 00:14:30.020
<v Aaron van Wirdum>Okay, three. What does it mean?

00:14:30.360 --> 00:14:35.300
<v Sjors Provoost>So it basically says pay to public key hash. So it is that number followed by…

00:14:33.780 --> 00:14:35.720
<v Aaron van Wirdum>Pay to public script hash.

00:14:36.140 --> 00:14:39.580
<v Sjors Provoost>Sorry, public script hash. Well, not even public, just pay to script hash.

00:14:40.540 --> 00:14:43.520
<v Aaron van Wirdum>We're getting there eventually. Pay to script hash.

00:14:43.700 --> 00:14:49.280
<v Sjors Provoost>Yes, and it says basically anybody who has the script belonging to this hash.

00:14:49.740 --> 00:14:53.380
<v Sjors Provoost>And who can satisfy the script. So just knowing the script is not enough you

00:14:53.380 --> 00:14:55.440
<v Sjors Provoost>actually have to do whatever the script says you should do.

00:14:55.540 --> 00:15:01.540
<v Aaron van Wirdum>Yeah so the first version we just described was pay to public key hash which

00:15:01.540 --> 00:15:06.760
<v Aaron van Wirdum>required people to offer a valid signature corresponding to the public key and

00:15:06.760 --> 00:15:11.940
<v Aaron van Wirdum>now we're talking about pay to script hash which means someone needs to present

00:15:11.940 --> 00:15:16.420
<v Aaron van Wirdum>the script and be able to solve the script. So why do these start with a three?

00:15:16.420 --> 00:15:22.290
<v Sjors Provoost>This is a convention, so as we said, there is a... Basically, a version number

00:15:22.290 --> 00:15:27.470
<v Sjors Provoost>that everything that you communicate through Base58 starts with a version number.

00:15:27.670 --> 00:15:31.270
<v Sjors Provoost>And if it starts with a 1, then you know it's paid public key hash. If it starts

00:15:31.270 --> 00:15:34.690
<v Sjors Provoost>with a 3, you know it's paid script hash. If it starts with a 5, you know it's a

00:15:34.690 --> 00:15:38.890
<v Sjors Provoost>private key. So it's just a convention, and it has no meaning on the blockchain itself.

00:15:39.030 --> 00:15:44.270
<v Aaron van Wirdum>Once again, all this is is a version number plus this hash

00:15:44.270 --> 00:15:47.310
<v Aaron van Wirdum>represented in Base58. Is that all it is?

00:15:47.470 --> 00:15:47.790
<v Sjors Provoost>Yeah.

00:15:48.150 --> 00:15:52.010
<v Aaron van Wirdum>This is all. So much simpler than I once thought Sjors.

00:15:52.390 --> 00:15:55.930
<v Sjors Provoost>No, it's really simple. And the only mystery that has been solved today, I guess,

00:15:56.070 --> 00:16:00.870
<v Sjors Provoost>is, well, what if you only use the public key, but that wasn't done using this

00:16:00.870 --> 00:16:05.290
<v Sjors Provoost>system. So there is no initial letter that would represent trying to do that.

00:16:06.120 --> 00:16:07.980
<v Aaron van Wirdum>Yeah that was never represented.

00:16:07.980 --> 00:16:11.920
<v Sjors Provoost>Otherwise… otherwise probably that would have been version zero, and then all

00:16:11.920 --> 00:16:14.100
<v Sjors Provoost>normal addresses might have started with the two. Who knows?

00:16:14.100 --> 00:16:18.560
<v Aaron van Wirdum>Okay I think for anyone who already knew this which is probably a good chunk of

00:16:18.560 --> 00:16:23.980
<v Aaron van Wirdum>people this is a very boring episode so far but I think it's gonna get better

00:16:23.980 --> 00:16:29.740
<v Aaron van Wirdum>because oh my god because Sjors, we now have a new type of address since

00:16:29.740 --> 00:16:34.080
<v Aaron van Wirdum>I don't know a year or two which starts with bc1

00:16:35.560 --> 00:16:36.860
<v Sjors Provoost>BC1Q even, usually.

00:16:37.160 --> 00:16:40.100
<v Aaron van Wirdum>Yeah, usually, but not always. And we're getting into that, I think.

00:16:40.580 --> 00:16:40.720
<v Sjors Provoost>Yep.

00:16:41.020 --> 00:16:42.580
<v Aaron van Wirdum>So what is this all about?

00:16:42.660 --> 00:16:47.980
<v Sjors Provoost>Well, that is Bech32 or Bech32 or however you want to pronounce it. And it's been

00:16:47.980 --> 00:16:53.150
<v Sjors Provoost>used since SegWit, basically. And again, it is something that doesn't exist on

00:16:53.150 --> 00:16:57.530
<v Sjors Provoost>the blockchain. So it's just a convention that wallets can use. This is a, as the

00:16:57.530 --> 00:17:02.830
<v Sjors Provoost>name suggests, a Base32 system, which means you have almost all the letters

00:17:03.630 --> 00:17:09.590
<v Sjors Provoost>and almost all the numbers minus some ambiguous characters that you don't want to

00:17:09.590 --> 00:17:11.990
<v Sjors Provoost>have because they look too much like numbers or letters.

00:17:12.510 --> 00:17:16.370
<v Aaron van Wirdum>Yeah, and I think one of the big differences compared to base 58 is that this

00:17:16.370 --> 00:17:21.500
<v Aaron van Wirdum>time there are no longer... uppercase and lowercase letters there's just any…

00:17:21.500 --> 00:17:23.340
<v Aaron van Wirdum>every letter is only in there once.

00:17:23.340 --> 00:17:26.500
<v Sjors Provoost>Exactly. The other difference is that it has a benefit…

00:17:26.500 --> 00:17:31.080
<v Aaron van Wirdum>I'll mention one benefit of that which is that if you want to read an address out

00:17:31.080 --> 00:17:35.300
<v Aaron van Wirdum>loud it's going to be a little bit easier now that there's no difference between

00:17:35.300 --> 00:17:36.520
<v Aaron van Wirdum>uppercase and lowercase.

00:17:36.520 --> 00:17:41.280
<v Sjors Provoost>Yeah and the other difference is, I didn't check with base 58 but basically it

00:17:41.280 --> 00:17:45.420
<v Sjors Provoost>doesn't start with zero or anything like that it's it looks pretty arbitrary so

00:17:45.840 --> 00:17:51.680
<v Sjors Provoost>The value 0 is written as a Q. The value 1 is written as a P. The value 2

00:17:51.680 --> 00:17:53.340
<v Sjors Provoost>is written as a Z, etc.

00:17:53.740 --> 00:17:55.980
<v Aaron van Wirdum>Why is the value 1 just written as a 1?

00:17:56.180 --> 00:18:00.880
<v Sjors Provoost>Well, it's completely arbitrary, first of all, right? You can connect any value

00:18:00.880 --> 00:18:02.060
<v Sjors Provoost>to any symbol you want.

00:18:02.180 --> 00:18:02.400
<v Aaron van Wirdum>Sure.

00:18:03.360 --> 00:18:07.340
<v Sjors Provoost>If there is a human interpretation that depends on it, then you don't want to do

00:18:07.340 --> 00:18:13.260
<v Sjors Provoost>anything confusing. But if your only goal is to make it easy to copy-paste

00:18:13.260 --> 00:18:18.360
<v Sjors Provoost>things, and if your other goal is for every address to start with bc1q,

00:18:18.920 --> 00:18:24.560
<v Sjors Provoost>because bc1 sounds cool, then maybe there's a reason why you want to do them out

00:18:24.560 --> 00:18:28.260
<v Sjors Provoost>of order. I haven't read what the rationale is in the order.

00:18:28.660 --> 00:18:30.580
<v Aaron van Wirdum>Okay, now Bech32.

00:18:30.900 --> 00:18:36.280
<v Sjors Provoost>Yeah, so there's a set of 32 characters, and… that means you're… but it's doing

00:18:36.280 --> 00:18:42.160
<v Sjors Provoost>the same thing, right? It's again saying, okay, here's a pay to public key. Yeah,

00:18:42.240 --> 00:18:45.280
<v Sjors Provoost>a pay to public key address. In this case, a pay to witness public key because

00:18:45.280 --> 00:18:50.970
<v Sjors Provoost>it's using SegWit, but it's the same idea, public key hash. So it

00:18:50.970 --> 00:18:56.010
<v Sjors Provoost>says, hello, and then followed by the hash of the public key.

00:18:56.370 --> 00:18:59.970
<v Aaron van Wirdum>Okay, so Bech32 addresses, what are we looking at exactly? Because what we're

00:18:59.970 --> 00:19:05.390
<v Aaron van Wirdum>seeing for each address, it starts with B, C, 1, and then usually a Q, and then

00:19:05.390 --> 00:19:08.890
<v Aaron van Wirdum>a whole bunch of other symbols. So what does this all mean?

00:19:09.170 --> 00:19:14.070
<v Sjors Provoost>That's right. So there is something called the human readable part. And that

00:19:14.070 --> 00:19:18.110
<v Sjors Provoost>doesn't really have any meaning other than that humans can recognize, okay, if

00:19:18.110 --> 00:19:21.030
<v Sjors Provoost>the address starts with BC, then it refers to Bitcoin. And the software, of

00:19:21.030 --> 00:19:23.730
<v Sjors Provoost>course, can see this too, but both humans and software can understand this.

00:19:24.070 --> 00:19:29.410
<v Aaron van Wirdum>Yeah, so if Litecoin would want to use these kinds of addresses, maybe they do

00:19:29.410 --> 00:19:30.130
<v Aaron van Wirdum>actually, I don't know.

00:19:30.230 --> 00:19:31.690
<v Sjors Provoost>Probably, then they might start with LT.

00:19:32.010 --> 00:19:36.470
<v Aaron van Wirdum>Exactly. So these first two letters just refer to which currency is this about?

00:19:36.630 --> 00:19:37.650
<v Aaron van Wirdum>What blockchain is this for?

00:19:37.810 --> 00:19:42.140
<v Sjors Provoost>Yeah, and it can be, I think, a fairly arbitrary number of letters. The idea is

00:19:42.140 --> 00:19:43.340
<v Sjors Provoost>that it's separated by a one.

00:19:43.480 --> 00:19:45.120
<v Aaron van Wirdum>Oh, it could be more than two letters as well?

00:19:45.460 --> 00:19:49.620
<v Sjors Provoost>Yeah, I think initially Bitcoin Cash was using a much longer introduction.

00:19:49.880 --> 00:19:50.400
<v Aaron van Wirdum>I see, okay.

00:19:50.620 --> 00:19:53.980
<v Sjors Provoost>So that's pretty arbitrary. Obviously, you want to conserve space. So BC is nice

00:19:53.980 --> 00:19:59.420
<v Sjors Provoost>and short. And a one, that's a separator, has no value. So if you look at what do

00:19:59.420 --> 00:20:02.220
<v Sjors Provoost>all the 32 numbers mean, then one is not in it.

00:20:02.500 --> 00:20:03.880
<v Aaron van Wirdum>One just means…

00:20:03.880 --> 00:20:04.480
<v Sjors Provoost>Skip this.

00:20:04.880 --> 00:20:09.680
<v Aaron van Wirdum>The human readable part is over. Now the fun stuff starts.

00:20:09.820 --> 00:20:10.420
<v Sjors Provoost>Now the meat and potatoes.

00:20:10.700 --> 00:20:10.820
<v Aaron van Wirdum>Right.

00:20:10.920 --> 00:20:14.340
<v Sjors Provoost>And the fun stuff, it's a little bit easier, actually, than with Base58, because

00:20:14.340 --> 00:20:19.600
<v Sjors Provoost>there's a convention that says if it's... Well, the convention is it starts with

00:20:19.600 --> 00:20:24.990
<v Sjors Provoost>the SegWit version. So the first version of SegWit is 0, which in Bech32 is

00:20:24.990 --> 00:20:30.630
<v Sjors Provoost>written as Q. And then it's either followed by 20 bytes or 32 bytes.

00:20:31.650 --> 00:20:36.170
<v Sjors Provoost>And that is… then it means either it's the public key hash, or it is the script

00:20:36.170 --> 00:20:41.430
<v Sjors Provoost>hash. And they're different lengths now because SegWit uses the SHA-256 hash of

00:20:41.430 --> 00:20:47.360
<v Sjors Provoost>the script rather than the RIPEMD 160 hash of the script. So in

00:20:47.360 --> 00:20:52.760
<v Sjors Provoost>Base58, the script hash is the same length as the public key hash, but in

00:20:52.760 --> 00:20:57.680
<v Sjors Provoost>SegWit, they're not the same length. So simply by looking at how long the address

00:20:57.680 --> 00:21:00.800
<v Sjors Provoost>is, you know whether you're paying to a script or you're paying to a public key

00:21:00.800 --> 00:21:01.940
<v Sjors Provoost>hash, so we don't have to say it.

00:21:02.140 --> 00:21:07.220
<v Aaron van Wirdum>Right, so to reiterate the first two letters, PC, that just means this is about

00:21:07.220 --> 00:21:11.820
<v Aaron van Wirdum>Bitcoin. Then the one says, okay, that was the… part telling you which currency

00:21:11.820 --> 00:21:16.300
<v Aaron van Wirdum>this is, now pay attention to what you're actually going to pay money to. Then

00:21:16.300 --> 00:21:21.640
<v Aaron van Wirdum>the Q means which version is going to follow, which version of address.

00:21:22.060 --> 00:21:22.240
<v Sjors Provoost>Yep.

00:21:22.700 --> 00:21:24.140
<v Aaron van Wirdum>And then what comes after that?

00:21:24.220 --> 00:21:24.860
<v Sjors Provoost>Which version of SegWit.

00:21:25.120 --> 00:21:30.180
<v Aaron van Wirdum>Yeah, what comes after it is actually the Bech32 representation of this hash.

00:21:30.740 --> 00:21:33.900
<v Aaron van Wirdum>Which is either pay to public key hash or pay to script hash.

00:21:34.220 --> 00:21:38.260
<v Sjors Provoost>Yeah, exactly. Or pay to witness public key hash or pay to witness script hash.

00:21:38.680 --> 00:21:41.460
<v Aaron van Wirdum>Sjors, is there anything else cool about Bech32?

00:21:41.800 --> 00:21:47.320
<v Sjors Provoost>Yeah, there is. And it's about error correction. So in base 58, there is a

00:21:47.320 --> 00:21:51.980
<v Sjors Provoost>checksum. So a checksum basically means you add something to the address at the

00:21:51.980 --> 00:21:57.940
<v Sjors Provoost>end. And that way, if you make a typo... then that checksum at

00:21:57.940 --> 00:21:59.920
<v Sjors Provoost>the end of the address is not going to work.

00:22:00.400 --> 00:22:02.540
<v Aaron van Wirdum>[unclear] going to compute with the rest of the address.

00:22:02.740 --> 00:22:04.300
<v Sjors Provoost>So it'll tell you, okay, this address is wrong.

00:22:04.660 --> 00:22:04.780
<v Aaron van Wirdum>Right.

00:22:04.920 --> 00:22:06.080
<v Sjors Provoost>Now there is a certain chance…

00:22:06.120 --> 00:22:09.860
<v Aaron van Wirdum>It doesn't tell you what the correct version would be. It just tells you this is wrong.

00:22:10.240 --> 00:22:14.100
<v Sjors Provoost>Exactly. Now there is, you know, there's a chance that you make a typo that

00:22:14.100 --> 00:22:17.600
<v Sjors Provoost>happens to have a correct checksum. I don't know what the odds are with base

00:22:17.600 --> 00:22:18.440
<v Sjors Provoost>[unclear]. They're pretty low.

00:22:19.320 --> 00:22:21.180
<v Aaron van Wirdum>You'd probably have to make several typos.

00:22:21.410 --> 00:22:25.050
<v Sjors Provoost>Well, yeah, you'd have to have the unlucky typo. I don't know if the odds are 1

00:22:25.050 --> 00:22:26.770
<v Sjors Provoost>in 10,000 or 100,000 or something.

00:22:27.090 --> 00:22:27.210
<v Aaron van Wirdum>Right.

00:22:27.430 --> 00:22:32.630
<v Sjors Provoost>But, you know, there's a lot of Bitcoin users. But in Bech32, it's actually

00:22:32.630 --> 00:22:36.390
<v Sjors Provoost>better because it will not just tell you that there's a typo. It'll tell you

00:22:36.390 --> 00:22:42.300
<v Sjors Provoost>where the typo is. And that's done differently. So where we

00:22:42.300 --> 00:22:47.210
<v Sjors Provoost>talked about in the Base 58 system, there is a checksum, which just... takes all

00:22:47.210 --> 00:22:51.250
<v Sjors Provoost>the bytes, basically takes all the bytes from the address and then hashes it.

00:22:51.950 --> 00:22:56.830
<v Sjors Provoost>Here there is very sophisticated mathematical magic. I don't think it's super

00:22:56.830 --> 00:23:01.250
<v Sjors Provoost>sophisticated, but I can't explain what the actual magic is. But the magic makes

00:23:01.250 --> 00:23:03.970
<v Sjors Provoost>it so that you can actually make a typo and it'll actually tell you where the

00:23:03.970 --> 00:23:08.110
<v Sjors Provoost>typo is. And you can make about four typos and it'll still know where the typo is

00:23:08.110 --> 00:23:13.330
<v Sjors Provoost>and what the real value is. If you do more than that, it won't. And the analogy I

00:23:13.330 --> 00:23:19.230
<v Sjors Provoost>like to make with that... as someone once told me is it's like if you have a wall

00:23:19.230 --> 00:23:24.250
<v Sjors Provoost>and you draw a bunch of circles on it and each circle represents a correct value

00:23:24.250 --> 00:23:28.870
<v Sjors Provoost>and you're throwing a dart at it and you know you might hit the bullseye then you

00:23:28.870 --> 00:23:32.310
<v Sjors Provoost>have the right value or you might just slightly miss the bullseye but you're

00:23:32.310 --> 00:23:36.810
<v Sjors Provoost>still within that big circle then you know you know you know exactly where it

00:23:36.810 --> 00:23:37.290
<v Sjors Provoost>should have been.

00:23:37.290 --> 00:23:39.150
<v Aaron van Wirdum>Are you talking about interlocking circles?

00:23:39.690 --> 00:23:40.850
<v Sjors Provoost>No, they're not overlapping.

00:23:41.190 --> 00:23:41.310
<v Aaron van Wirdum>Okay.

00:23:41.590 --> 00:23:46.450
<v Sjors Provoost>So the idea there is you want the circles to be as big as possible, obviously,

00:23:46.750 --> 00:23:50.490
<v Sjors Provoost>but you don't want to waste any space. So that's an optimization problem in

00:23:50.490 --> 00:23:55.890
<v Sjors Provoost>general. And of course, in the example of a two-dimensional wall with

00:23:55.890 --> 00:23:59.330
<v Sjors Provoost>two-dimensional circles, it's pretty simple to visualize, right? You throw the

00:23:59.330 --> 00:24:02.590
<v Sjors Provoost>dart and you see, okay, it's still within the big circle, so it should belong to

00:24:02.590 --> 00:24:06.590
<v Sjors Provoost>this dot. So that is like saying, okay, here's your typo and this is how you fix it.

00:24:06.790 --> 00:24:07.090
<v Aaron van Wirdum>Right.

00:24:07.690 --> 00:24:12.610
<v Sjors Provoost>But, and in the case of Bech32, the way I think you should imagine it is that

00:24:12.610 --> 00:24:16.510
<v Sjors Provoost>instead of a two-dimensional wall, you have a 32-dimensional wall, and the

00:24:16.510 --> 00:24:19.310
<v Sjors Provoost>circles are also probably 32-dimensional hyperspheres.

00:24:19.390 --> 00:24:23.510
<v Aaron van Wirdum>I find that a little bit hard to imagine, Sjors, but I'm not a wizard like you.

00:24:24.230 --> 00:24:28.690
<v Sjors Provoost>Well, if you've studied something like physics or math, you know that anything

00:24:28.690 --> 00:24:31.710
<v Sjors Provoost>you can do in two dimensions, you know, you can see it in three dimensions, and

00:24:31.710 --> 00:24:35.440
<v Sjors Provoost>you can do it in n dimensions, you can abstract all these things out too… to as

00:24:35.440 --> 00:24:40.440
<v Sjors Provoost>many dimensions as you need. But the general intuition is the same. So now you're

00:24:40.440 --> 00:24:44.240
<v Sjors Provoost>hitting your keyboard, and somewhere in that 32-dimensional space, you're

00:24:44.240 --> 00:24:48.520
<v Sjors Provoost>slightly off, but you're still inside this sphere, whatever that might look like.

00:24:49.160 --> 00:24:53.000
<v Sjors Provoost>And so it knows where the mistake is. But there's a problem.

00:24:53.380 --> 00:24:53.620
<v Aaron van Wirdum>Oh.

00:24:54.080 --> 00:24:54.480
<v Sjors Provoost>Yes.

00:24:54.640 --> 00:24:54.760
<v Aaron van Wirdum>Oh, no.

00:24:54.940 --> 00:24:59.240
<v Sjors Provoost>All this amazing wizardry missed something. And it basically…

00:24:59.240 --> 00:25:01.240
<v Aaron van Wirdum>It lost me a long time ago, but go on.

00:25:01.580 --> 00:25:05.980
<v Sjors Provoost>Well, basically, it turns out that if your Bech32 address ends with a P,

00:25:07.040 --> 00:25:13.020
<v Sjors Provoost>then you can add an arbitrary number of Qs to it, and it still will match

00:25:13.020 --> 00:25:13.580
<v Sjors Provoost>the checksum.

00:25:13.780 --> 00:25:17.300
<v Aaron van Wirdum>Oh, yeah, this is the bug. There was a bug in Bech32.

00:25:17.560 --> 00:25:21.060
<v Sjors Provoost>Yeah, so I guess the analogy would be that the circles are not entirely separate

00:25:21.060 --> 00:25:26.380
<v Sjors Provoost>in some weird way, and that's not good, but that's actually not a problem

00:25:26.380 --> 00:25:26.920
<v Sjors Provoost>originally.

00:25:27.140 --> 00:25:33.080
<v Aaron van Wirdum>So any address that ended with a P… could have any arbitrary numbers of

00:25:33.080 --> 00:25:38.800
<v Aaron van Wirdum>Q following it, and then you wouldn't be told that there's a typo. Your software

00:25:38.800 --> 00:25:41.900
<v Aaron van Wirdum>would think it's right, and then you're sending money to the wrong address.

00:25:42.080 --> 00:25:43.440
<v Sjors Provoost>Yeah, which means it's unspendable.

00:25:43.640 --> 00:25:44.600
<v Aaron van Wirdum>Right, yeah, yeah, exactly.

00:25:44.800 --> 00:25:48.260
<v Sjors Provoost>But the good news is that there's another constraint for the original version of

00:25:48.260 --> 00:25:53.320
<v Sjors Provoost>SegWit, SegWit version 0, which is that an address is either, well, 20 bytes or

00:25:53.320 --> 00:25:54.020
<v Sjors Provoost>32 bytes.

00:25:54.700 --> 00:25:55.140
<v Aaron van Wirdum>Right.

00:25:55.460 --> 00:25:59.620
<v Sjors Provoost>And that means that it's constrained, right? Because if you add another Q to it,

00:25:59.680 --> 00:26:01.460
<v Sjors Provoost>then it's too long. So you still know it's wrong.

00:26:01.660 --> 00:26:05.520
<v Aaron van Wirdum>Yeah, if you have a 20 byte address and you add one Q, then it's 21, which is

00:26:05.520 --> 00:26:10.160
<v Aaron van Wirdum>still invalid. So you'd have to accidentally add 15 Qs or how many were?

00:26:10.560 --> 00:26:10.980
<v Sjors Provoost>12.

00:26:11.240 --> 00:26:11.800
<v Aaron van Wirdum>12 Qs.

00:26:11.900 --> 00:26:13.120
<v Sjors Provoost>Yeah, or something like that. I don't know.

00:26:13.020 --> 00:26:14.800
<v Aaron van Wirdum>That's pretty unlikely to happen.

00:26:15.100 --> 00:26:18.960
<v Sjors Provoost>Yeah, because I might be confusing bytes and characters, but exactly. That's very

00:26:18.960 --> 00:26:24.500
<v Sjors Provoost>unlikely to happen for SegWit version 0. But now we would say, okay, we're going

00:26:24.500 --> 00:26:28.760
<v Sjors Provoost>to have a new, you know, we're going to have future versions of SegWit, such as

00:26:28.760 --> 00:26:29.180
<v Sjors Provoost>Taproot.

00:26:29.420 --> 00:26:29.620
<v Aaron van Wirdum>Right.

00:26:29.740 --> 00:26:35.580
<v Sjors Provoost>You know, it would be bc1p, because p is version one. And I believe for

00:26:35.580 --> 00:26:40.360
<v Sjors Provoost>Taproot, there's also a constraint in how long these addresses are supposed to

00:26:40.360 --> 00:26:45.040
<v Sjors Provoost>be. So it's still not an acute problem. But in the future, maybe we want to have

00:26:45.040 --> 00:26:48.460
<v Sjors Provoost>addresses that are somewhat more arbitrary in length, because maybe you want to

00:26:48.460 --> 00:26:52.320
<v Sjors Provoost>add some weird conditions to it. Or you want to communicate other information,

00:26:52.560 --> 00:26:56.220
<v Sjors Provoost>not just the address. Maybe you want to put the amount inside the address.

00:26:56.540 --> 00:26:57.000
<v Aaron van Wirdum>Right.

00:26:57.300 --> 00:27:03.000
<v Sjors Provoost>So this is why there's a new standard proposed BIP 350, which is called

00:27:03.000 --> 00:27:08.820
<v Sjors Provoost>Bech32m. And it's actually... a very simple change.

00:27:08.820 --> 00:27:14.590
<v Sjors Provoost>I think it adds to the all the math. It adds one extra number to that math and

00:27:14.590 --> 00:27:17.650
<v Sjors Provoost>then it fixes that particular bug and everybody's happy.

00:27:17.650 --> 00:27:22.520
<v Aaron van Wirdum>So it fixes the bug that the Qs don't matter anymore?

00:27:22.520 --> 00:27:25.780
<v Sjors Provoost>Yeah, you can't just add stuff to it without running into problems.

00:27:25.780 --> 00:27:30.880
<v Aaron van Wirdum>But I guess this does mean that wallets that have by now upgraded to support

00:27:32.230 --> 00:27:36.970
<v Aaron van Wirdum>these special SegWit addresses, Bech32 addresses, they now have to upgrade again.

00:27:37.130 --> 00:27:41.730
<v Sjors Provoost>That's right. So that's annoying because it does mean that if your wallet wants

00:27:41.730 --> 00:27:47.370
<v Sjors Provoost>to support sending to a Taproot address, then it has to make a small change to

00:27:47.370 --> 00:27:51.630
<v Sjors Provoost>the Bech32 implementation. And there's some example code on the BIP. It's not a

00:27:51.630 --> 00:27:54.830
<v Sjors Provoost>big change because it just adds one number. And if you look at the Bitcoin Core

00:27:54.830 --> 00:27:58.900
<v Sjors Provoost>implementation, it's a fairly simple change. That does it. But it does mean that

00:27:58.900 --> 00:28:04.480
<v Sjors Provoost>moving forward, when you see a Bech32 address, you have to parse it, then see if

00:28:04.480 --> 00:28:08.720
<v Sjors Provoost>it's the version 0 or the version 1, and then do things slightly differently. But

00:28:08.720 --> 00:28:10.300
<v Sjors Provoost>even that is just a very small change.

00:28:10.640 --> 00:28:10.900
<v Aaron van Wirdum>Right.

00:28:11.040 --> 00:28:14.180
<v Sjors Provoost>But it is annoying. Yeah, it does mean that especially hardware wallets with

00:28:14.180 --> 00:28:16.160
<v Sjors Provoost>firmware updates could take a while.

00:28:16.640 --> 00:28:22.180
<v Aaron van Wirdum>Right. So we started out with base 58 addresses. Now we're all starting to use

00:28:22.180 --> 00:28:27.660
<v Aaron van Wirdum>Bech32 addresses. Is this final? Are we going to keep using Bech32 or are you

00:28:27.660 --> 00:28:32.800
<v Aaron van Wirdum>anticipating some other address format somewhere in the future?

00:28:33.340 --> 00:28:38.980
<v Sjors Provoost>No, I think this will do for a long time. Bech32 is a way to write addresses.

00:28:39.220 --> 00:28:43.000
<v Sjors Provoost>Now, what is actually inside an address, there could be more information in it,

00:28:43.060 --> 00:28:47.920
<v Sjors Provoost>right? And the most interesting example of that is Lightning Invoices. Lightning

00:28:47.920 --> 00:28:52.700
<v Sjors Provoost>Invoices uses Bech32, but they're much longer because they contain a lot more

00:28:52.700 --> 00:28:57.420
<v Sjors Provoost>information. They contain the public key. They contain the amount. They contain

00:28:57.420 --> 00:29:01.640
<v Sjors Provoost>the deadline. They contain a bunch of secrets. They contain all sorts of stuff,

00:29:01.820 --> 00:29:05.660
<v Sjors Provoost>all sorts of routing hints even. It's like a whole book you're sending over. So

00:29:05.660 --> 00:29:09.820
<v Sjors Provoost>Bech32 is just an alphabet, essentially. You can make it as long as you want with

00:29:09.820 --> 00:29:13.700
<v Sjors Provoost>this little caveat in mind that we talked about. But you're probably not going to

00:29:13.700 --> 00:29:17.320
<v Sjors Provoost>manually type Lightning invoices anyway because they're too long. So you tend to

00:29:17.320 --> 00:29:17.960
<v Sjors Provoost>copy-paste them.

00:29:18.340 --> 00:29:23.230
<v Aaron van Wirdum>Yeah, and generally you copy-paste any address. I don't retype addresses, do you, Sjors?

00:29:23.970 --> 00:29:29.330
<v Sjors Provoost>Well, you might, I don't know, you might have some like nuclear cold storage and

00:29:29.330 --> 00:29:32.570
<v Sjors Provoost>the addresses for that nuclear cold storage might be written down on a piece of

00:29:32.570 --> 00:29:35.650
<v Sjors Provoost>paper because you don't want them ever to touch anything that's on the internet.

00:29:36.370 --> 00:29:40.110
<v Sjors Provoost>But, you know, generally people copy paste, but there was some discussion early

00:29:40.110 --> 00:29:44.860
<v Sjors Provoost>on with Bech32, I think, that was explicitly talking about, can this be

00:29:44.860 --> 00:29:46.120
<v Sjors Provoost>communicated over the phone?

00:29:46.640 --> 00:29:48.960
<v Aaron van Wirdum>Yeah, true. That's why there's this…

00:29:48.960 --> 00:29:52.720
<v Sjors Provoost>Even in your nuclear bunker situation, maybe you need to communicate something to

00:29:52.720 --> 00:29:57.450
<v Sjors Provoost>somebody else in another nuclear bunker through smoke signals. And then, you

00:29:57.450 --> 00:30:01.310
<v Sjors Provoost>know, you could use Bech32 for smoke signals, although maybe a Base2 system is

00:30:01.310 --> 00:30:03.130
<v Sjors Provoost>easier. I don't know. I've never done smoke signaling.

00:30:03.450 --> 00:30:04.890
<v Aaron van Wirdum>No, I usually copy-paste.

00:30:05.400 --> 00:30:09.440
<v Sjors Provoost>Okay, that's cool. It's also like a smoke signal, just a bit more complicated. All right.

00:30:09.880 --> 00:30:12.200
<v Aaron van Wirdum>Was that everything there is to know about addresses, Sjors?

00:30:13.090 --> 00:30:16.290
<v Sjors Provoost>I'm sure there's more, but I think this is a nice primer.

00:30:16.650 --> 00:30:17.570
<v Aaron van Wirdum>You're going to call it a day?

00:30:17.850 --> 00:30:20.930
<v Sjors Provoost>We are. So thank you for listening to the Van Wirdum Sjorsnado.

00:30:21.290 --> 00:30:21.650
<v Aaron van Wirdum>There you go.

