Skip to content
PodSubs
ShowsPeopleGuestsJobsNewsEvents
More
BlogPodCred
Menu
ShowsPeopleGuestsJobsNewsEventsBlogPodCredNetworksSign in
Join nowSign in
  • Shows
  • People
  • Jobs
  • News
  • More
    • Guests
    • Events
    • Blog
    • PodCred
    • Networks
    Join nowSign in

Magic Internet Math

Magic Internet Math artwork

Elliptic Curve Cryptography: A Self-Study Guide

Feb 16, 20261 hr 56 minAudio

The Study guide: https://ecc-study-guide.magicinternetmath.com/guide.pdf In this episode of Magic Internet Math, Rob and Fundamentals discuss the math behind Bitcoin's security, exploring elliptic curve cryptography, modulo arithmetic, and digital signatures. Key Topics: Seed-Phrase Generation Elliptic Curve Cryptography Modulo Arithmetic Securing Bitcoin with Math The Importance of Primes Understanding Finite Fields LibSecP and Its Significance Quantum Computing Deterministic Nonces Summary: The conversation begins with an overview of how Bitcoin secures money, moving from helpful abstractions like seed phrases to the foundational math involving finite fields and elliptic curves. They discuss how a 12 or 24-word seed phrase is a BIP39 way of generating a BIP32 extended private key, which is essentially a map to the elliptic curve Bitcoin operates on. At its core, you need entropy, a random element, to generate these keys. The hosts emphasize the importance of randomness in key generation and the mathematical assurance that keys are safe from accidental or intentional collisions. They caution against trusting human intuition for randomness, advocating for methods like dice rolls to enhance key security. The discussion touches on the concept of repeating words in BIP39 seed phrases and addresses common misconceptions about randomness. The hosts discuss the vastness of possible Bitcoin private keys. They emphasize how the number of potential Bitcoin private keys far exceeds the number of atoms in the observable universe. This immensity is crucial for security, making it virtually impossible to guess a private key. They touch upon the importance of understanding magnitudes of size and recommend the book "Innumeracy" by John Allen Paulos. The discussion moves to the concept of seed phrases as deterministic treasure maps, enabling the generation of multiple child keys for different addresses, all derived from a single genesis number. They highlight the asymmetry between knowing a private key and proving ownership, which is fundamental to Bitcoin's functionality. The discussion transitions into modulo arithmetic, explaining it as focusing on remainders rather than quotients. This concept is introduced using simple examples, such as dividing by two and clock arithmetic. They also touch on the importance of modulo a prime number for elliptic curve cryptography. They explain that using a prime number ensures every non-zero number has a multiplicative inverse. This is critical for the field addition process, which is the mapping from a private key to a public key. The significance of congruence is discussed. Next, the hosts delve into elliptic curve cryptography and the specific curve used by Bitcoin which is Y squared equals X cubed plus seven. They explore the properties of this curve, including how any two points on the curve will intersect a third point. The intersection can be reflected across the X axis to find the sum of the original two points. This property is important to how elliptic curve cryptography works. They discuss the specifics of the LibSecP256K1 curve, explaining the origins of its name and its significance. They discuss an incident in 2013 where the NSA was caught trying to backdoor elliptic curve standards and the reason why Satoshi made the choices he did. The hosts talk about ECDSA (elliptic curve digital signing algorithm), which Satoshi used due to patents on Schnorr signing algorithm. Rob and Fundamentals then move on to discuss practical examples of how Bitcoin transactions are made and secured using elliptic curve cryptography. Rob states "all of the Bitcoin, everything is, I know a number." The hosts explain how the generator point is utilized to ensure that all potential outputs can be utilized in the system. Then Rob and Fundamentals discuss quantum computing and how this might threaten the security of the Bitcoin network, as these computers would be much more efficient at guessing private keys. Rob explains how Schnorr signing algorithms are more secure against quantum computers because all addresses look the same. The conversation touches upon the use of deterministic nonces to prevent key reuse. The podcast episode concludes by discussing how code can be made more secure at a software level, to prevent timing attacks on the network. Fundamentals references RFC 6979 which defines how to produce deterministic signatures for elliptic curve cryptography. They emphasize the importance of constant-time operations to prevent side-channel attacks. They highlight the significance of LibSecP, the battle-hardened cryptography library, in ensuring the security of Bitcoin transactions. They express pride in covering the material and hope listeners can at least start to begin to reason and understand where if you had a beer if you're at pub key you're having a beer and you want to talk about this stuff you may not be able to do the full mathematical proof of every line but at least you understand in aggregate the moving pieces and what's important and why things are important to be able to explain how this thing works.

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.

All right, good morning. This is good morning. Sorry. How dare you say good morning back to me when I'm not finished introducing this podcast. We've been, were you like on Noster all morning and you're just good morning. Good morning. Yeah, I'm just, I'm locked in. I'm locked in for my morning. Good morning. This is the magic internet math podcast. Episode three title unknown. um what's up man how you been doing well how are you i'm great dude i'm excited like every time i

get to do this i'm excited really like i'm excited for what we're gonna do today i feel like we're you know we spent the last two episodes setting up you and i kind of just shooting the shit right it's been good yeah and i think now we're gonna get into a little bit of meat We've lulled the subscriber base Into a full sense of security And now we're going to bring them into the actual math stuff This is why I brought you on, man To explain to me what the hell we have been doing

Thank you That is exactly what we've done Do you think it's okay To motivate why we're about to have this discussion today? Yeah Um, so I think today what we're going to start talking about is how Bitcoin actually secures money, right? There's a lot of very helpful abstractions we give to people so that the first time they hear about Bitcoin, they're not learning about a bunch of finite field math and a bunch of electric curves and all this stuff.

We say, hey, you have a secret. Here are your secret words. You do not share these with anyone. And that is an abstraction on top of an abstraction on top of an abstraction. What do I mean by that? Your 12 or 24 seed words is from BIP39. And it's a way of generating a BIP32 extended private key. And that extended private key is basically your map to the elliptic curve on how Bitcoin operates.

At the most foundational level, you just need entropy. You need a random thing. Those 12 and 24 words, you can reasonably discern if you generated, like if you didn't just, you know, pick them yourself. or if you didn't, you know, if you had a good trusted setup in how to generate that. It's the first time those 12 or 24 English words have ever been assembled in that order. Yeah. So there's, yeah. When you get a key, unless it's like in alphabetical order, it's going to look pretty random to you.

Right. Or unless they all start with the same letter or something like that. It's going to, the thing I was like, when you first, the second you started talking, The image that came to my mind with people. Have you ever seen the picture of, I don't know if it's a frog or a beaver, but it's drinking out of a fire hose? I'm not sure if I've seen that one. So this used to, in my last company, I had a boss who had this picture right outside his office. And it was like a frog drinking out of a fire hose.

And that's basically because that's kind of like what we are all doing when we get into Bitcoin, especially when it comes to the math. and we don't even really know it. At some point, you don't even realize you just opened wide, jammed a fire plug, and turned it on. And I think that's why a lot of people just, like I think it's like a reflex reaction to be like, all right, dude, like what? Everything over 21 million, okay? That's the math, okay? And there's just so much, like everything you just said,

and it wasn't that much, but it's like it implies so much uh math behind it yes and some of it's actually i think it's like you know you get a 12 word key from a wallet that you make and trust or you make it yourself and you tell me if i'm wrong when i say everyone has probably asked themselves the question how do i know this is this key is like safe and no one can yeah no one can act even accidentally collide with it or intentionally like people are worried about back doors and wallet providers rightfully

so because there's no way like i said so when you visually inspect your key right unless it's like unless it's absolutely ordered for human sight you're not going to have too many clues that it is either random or not random or you know so you have to kind of like this is one of those exercises that it would be nice if you can just if we can do it yourself you know i always love the dice role thing. Because otherwise, there's really no way for you to just trust God so much that that

key is that no one can recreate it. Nobody could accidentally stumble on it. Those kinds of questions. I feel like no matter whether you care about math or not, every Bitcoiner is asked that question when they made a key. Right. Because it's the math that you have to fundamentally, it's one part of the map that's in your control. Everything else just works as software within the Bitcoin protocol. But like it start, there's a genesis somewhere of something you did, which is getting those keys. And from those words, you generate your addresses

and your ability to sign your signatures and everything else, right? So it is incredibly foundational. Now, when you're, you mentioned dice rolls. Humans are really bad at perceiving if things are random or not. So even if like, like I wouldn't even trust an eyeball heuristic of a something random or not, because you could easily have like the number one, 100 hashed and turned into a C phrase. Right. Sure. So like you, you actually, there is no human heuristic eyeballing that can go about it.

But that's my point, right? It's like, unless you get 12 of the same word, your brain's not going to say something's wrong here. And this is a funny thing too. Like, so in the BIP39 spec, you're allowed to repeat words. It can happen. And as someone who has generated hundreds. And that's a feature of pseudo-randomness, right? Not in a certain way, right? Well, right. Oh, you would perceive that like, oh, right. That you shouldn't get repeat words.

You could repeat it. Well, but you can like repeat instances or maybe you don't. This is like the classic, like, is it a shuffle? is like your iPad shuffle, a random number. Right. And it's not totally random because you, you know, if it were random, truly random, you could get six in a row. Exactly. Right. Yeah. Exactly. Right. And so you have this element where I've, I've generated hundreds of seed phrases with testing, spinning up wallets, looking at stuff. And one time I was walking someone through a wallet setup, like for a test account, just to like, see how it works.

And they're like, wait, I think something's broken. I just got the same word twice in a row. And I was like, that could happen. So there's 2,048 words in the bit 39 words, and they each correspond to a portion of bits. And when you take 12 or 24 of them together, when you take 12 of them together, you get 2 to the 128, which is a pretty large number. And if you do 24, you get 2 to the 256. And just before we even start to talk about like the expanded possible universe, 2 to the 256 is the total amount of valid numbers that fit on what we're going to talk about today, this, you know, elliptical, elliptic curve.

2 to the 256, there are more possible Bitcoin private keys that exist than atoms in the observable universe. Just to talk about, because another thing humans are bad at, not just like detecting randomness, but being able to truly appreciate the size and scale of numbers. 2 to the 256 is incredibly, incredibly, incredibly massive in the scale that is beyond things on even like a universe. level of observing. If every single atom in the observable universe was a Bitcoin private key,

there would be plenty more Bitcoin private keys that were available. Right? Yeah. So real quick, I'm going to recommend a book. People should read this book. Okay. It's actually incredible and really important. It was written by my probability professor in college. His name is John Alan Paulos. I will probably bring his name up a lot. and I did it a lot and motivate the math. And this guy was one of the most important people I ever encountered in my life. It turned out he was a bestselling author of books.

He was like on David Letterman talking about a book he wrote called Math and Humor. But the real bestseller that he wrote was called Innumeracy, subtitled Mathematical Illiteracy and Its Consequences. And in the prologue of the book, he really spends four or five pages trying to get you to understand how do you know how big something actually is? And like, how do you even imagine? How do you just imagine magnitudes of size?

You know, I don't think it's not cryptography based. This book was written in like 1992. But like, which doesn't mean it could be. But basically it's like – just imagine like a million grains of sand. What happens in your mind when you even try to visualize or imagine something so unimaginable? And I think this is why like all the cheesy interview questions were like, tell me how you would count all the manhole covers in New York City or things like that. They're all really just getting at this question of how do you think about things that are sort of unthinkable?

And when, you know, knowing the size of things, I mean, it's true, even to me, two to the 128th versus two to the 256. Like, there's clearly a universe of difference between those two numbers. But in my mind, it's hard to really discern between those two, right? Absolutely. Yeah. And so basically, as we're starting this off and kind of hitting at the touchpoint where most Bitcoiners interact with this, your C phrase, which maps to an extended private key, which we don't have to get exactly into, it's BIP32 of basically your big, big keychain.

it is the genesis point of how you pick random numbers to be securing your money. And this is important because while your seed phrase, your words are the gateway to your money, it's not just one number. You have one genesis number, which then generates children numbers. And the reason is, is because every time you use a Bitcoin wallet, if you give me a new address, That's a new number. And basically your seed phrase acts as a deterministic treasure map. If you start with this, you can generate many children for any other address that you need that your wallet can control.

Now, to tie this –

to be on the curve. And so when you multiply the generator, you multiply that private key. Private key is a point on the curve. Nobody knows what it is. And then you multiply it by some number. That's going to be on the curve. That's really important. I have to stop using the word key to note importance. But that is the translation in mathematical structure. And what we'll be talking about today will be sort of how to understand, how do we build towards understanding

that mathematical structure? Absolutely. Right. Yep. Absolutely. That's a good thing. Moving away from the concept of a key and turning this into a mathematical language of this is a point on a curve and all of the transformations you do on the curve, any of the, like you said, the field that addition is contained within the set of the data points that exist on the curve. for our ultra premium subscribers at home who have the video feed. You can see I'm wearing my LibSecP shirt today. You joke, but we are going to have it.

Yeah. The curve exists. It's something that you probably would have seen in like 10th, 11th grade math. It's not super complicated. but this jump off point the last thing just to say on entropy is just the reason why you need to keep that secret because if someone else has that same exact starting point you have they can trivially figure out everything else which maybe goes into just as an initial point of why is this principle important

is there is an asymmetry between knowing a private key and proving you own it and someone looking at that proof and being able to understand where your private key came from. So that asymmetry is critically important when it comes to the function of how this works, because you're able to essentially have the ability to prove that you own something without revealing what it actually is.

And that is the entire basis of how Bitcoin works. the rest of the network sees the end result of this mathematical transformation, which is the point on the curve, which is mapped then to a public key. But only you have the requisite ability to prove that you have the private key tied to that public key. Very last point is I used to kind of make this metaphor, explaining to non-technical people, going to Lloyd's of London and explaining the concept of a public and a private key. And I would say you would walk into

a post office and you have a wall of plexi class boxes, like your PO boxes, but instead of metal, they're like pure plastic. Like so you can, they're transparent. You can see through them. Yeah. And basically that is the Bitcoin blockchain, the entire UTXO set of all the addresses. And you can count how many envelopes are in each one. And anyone can look at any time at those public keys, but to necessarily move them, you have to publish a proof, which is a Bitcoin transaction that you control the underlying private key. And that's what your mailbox key is. That allows you to open up the box, take the envelopes out, and you can move the envelope somewhere else by putting it back in the mail sheet.

So I think we've done a good amount of high-level easing into the water so we can kind of just jump right in. And I think the most important place to start, if we're going to talk about the first mathematical concept and how this field addition works, is modulo arithmetic. Mod. Yep. Right. So let's quickly – okay, if you're like brand new here, this is going to sound like – this is going to sound weird and strange.

But if you've even like looked at this, if you're like intelligent enough to have found the podcast and hit play, this is something you'll realize you probably should have learned in third grade. and um maybe you even did but you didn't you know let's you know look these were around this modulo concept was around for a really long time it was gauss who just basically put it all into this type of framework and made it easy for everybody to grok it's right and it's modulo

means remainder and i don't know about you but like i've been around math my whole life and when I first heard this concept, I was like, oh, that is remainders suck. I hate remainders. I like when there's no remainder. I remember, I would even push back to say that I think everyone has learned the concept of modulo, even if they didn't realize it, because the first thing you do when you learn long division is learn about what the heck a remainder is. That's right. And it's like the most disappointing and painful thing to deal with. It's like, oh, what? Why can't it just divide evenly. What the heck? I hate the number seven. That doesn't divide anything.

And let's start with the easiest example, right? So three divided by two doesn't go into it evenly. If it was two divided by two, it'd be one. If it was two divided by four, it'd be two. So if you do three divided by two, your remainder is one because two goes into three one time. It can't do it twice. it's too many then so it three divided by two is one remainder one so there's one left over and that would be like the simplest initial place to start is you're and you could take any number

and you were able to derive divided by two you can get some number in there the you know it's either one or zero um i'm assuming using whole integers you're not using fractions and stuff right but like if you're using whole numbers you're either going to have a remainder of zero or you have a remainder of one. It's going to be a remainder of zero for every single even number because it goes in evenly and perfect. And you're going to have a remainder of one for odd because it's always going to be one away from an even number. That's the simplest place to start. Right. And so the key point here is that we are really, you know,

in the world we came from, we basically divided things and we eliminated the remainder. We didn't care about the remainder. We only cared about how many times that, you know, things divide. In this world, we only care about the remainder and we toss everything else out the window. So in this world, any number that has a remainder of one, in other words, any operation that results in a remainder of one is the same thing. And like you can call, there's a name for that in what you just described called the odd numbers, right? We just name it.

Or where you say there's this world where there's two types of numbers, right? There's this two types of numbers modulo two, right? Right. Which is those that have a remainder of zero, i.e. the even numbers, or those that have the remainder of one, i.e. the odd numbers. But what we're abstracting is off the remainder. And, you know, like Bitcoin, the modulo, we're not divided by two or divided by two to the 256. Right. In certain ways, like in a hash function, that's what we're dividing by.

That's the mod, right? But basically, the key is all of those remainders now, anything with the remainder of one or two is going to be the same. So in other words, if you're dividing by three, then the number four has a remainder of one. Number seven has the remainder of one. Number 10, right? So all those numbers are basically the same in this construct. All numbers that have the same remainder now are considered the same.

And when dividing by three, there's three types of numbers. Those with the remainder of zero, remainder of one, and those with the remainder of two. And this is how we kind of build what is called the finite field. But this text we're going through starts with – they call it clock math. And then we build. And we're actually going to build – so when I asked you about motivating this thing, right? It was more of like, well, what are we actually, are we building to? We're building to potentially a conversation with a particular person. And that is like where we want to build from the most simple building block to LibSec, LibSec 256.

And I think we've created a document that can do that. And that will link that. Yeah. Link that to the website, magicinternetmath.com. um so is that like i guess we've we've motivated it enough yeah so yeah i think we've motivated enough one last very simple example because we talked about clock arithmetic so we have divided by like the two one divisor where the remainder zero or one is like the simplest abstraction you can go to one that people use all of the time is that a clock you basically do modulo arithmetic

You divide it by 12. So if you're not using military time, I'm going to put that aside for a second. If it's 1 a.m. and if it's 1 o'clock and 1 a.m., 1 o'clock in the morning and you say 15 hours from now, it's not 16 o'clock. it's 4 o'clock, sorry, it's 5 p.m. Right? So you're doing a modulo 12, a.m. and p.m., a.m. and p.m. Every 12 hours, you could take whatever number

and you just flip it from a.m. to p.m. Right? And you're basically looking at it that way as like a modulo 12. Now, what we actually do in Bitcoin, which you mentioned, is we take a prime number, which is one of the other things that mathematic, like things that mathematicians are most obsessed about is prime numbers. Um, the actual, yes. And the actual point that we're going to do all of our modulo arithmetic from is two to the 256 minus two to the 232 minus 977.

Yeah. That's probably worth like just memorizing that, that, that those three numbers, two to the 256 minus two to the 32nd power minus 977. Yeah. and you can actually expand factor that out and it becomes two to the 256 minus two to the 232 minus two to the nine minus two to the eight minus two to the seven minus two to the six minus two to the four minus one and there's a binary representation of this too and that you know like there's a there's actually a reason um you know it'll be fun when we get there but

that's a reason why that is the space that's the number right yeah there's a special name for these kind of prime numbers where you basically take 2 to the n of some number and then child factorizations of those minus 1 it's actually a very common heuristic of what you're able to do it's called a Mersenne prime right so this is something that has been proven

to be a prime number and an important thing to ask is why modulo a prime number with elliptic curve cryptography, right? You could pick any number. You're doing this curve. Why does it matter that you're doing modulo arithmetic with a prime number? Yeah. And before you answer, we just want to remember the fact that, you know, primes can't be divided. They don't have, like, primes are unable to be divided by anything other than itself in one, right?

Yeah. But this is actually going to tee up into our next concept, though, is that the reason why you pick a prime number and do modular arithmetic, it proves that every non-zero number you put into this modular arithmetic. Now, again, remember, you could take any number and throw it into this operation, and you will get some modular remainder. And what's really important is when you have a prime number as the unit in which you do modulo arithmetic, you will always have a multiplicative inverse.

You always will have a multiplicative inverse, which is very important. A translation for the non-technicals, because this is multiplicative inverse is a terminology that probably you learn somewhere in high school or college, right? But all it means is that you can divide it by something other than zero. You can understand that you're never allowed to divide by zero. So if a number has an inverse, it means that it can be divided validly.

Yeah. So we just need to know. When we're dealing with massive numbers that we can't see and verify, we just need a way to know that it's all legit. Yes. And that's the point is that you're not going to have a number that you generate a point on the curve that's going to break. The example of not using a prime number, by the way, is say like if you're doing modulo four, right?

Yep. Two times two is zero. So two doesn't have an inverse if you're using mod four. To the number two, there's nothing you can multiply it by to actually give it a modulo, to give it a remainder of one. Right. And since the remainder is what ultimately matters for this ability to find points on the curve, you need to have a non-zero number. Because if it's zero, then you don't have enough requisite information to do all of the field addition that we're talking about.

And like you said, with two, like even if we go back to the clock example, why don't we just do modulo 12? Remember, we said that like the remainder is the thing we care about, which means you need to have a robust, like you need to be able to take many, many different numbers and ultimately make sure that you don't get a remainder of zero. And three times four on that is 12. And 12 modulo 12 is zero. And now you're back at the start where you have a zero, but you can't actually derive any information to be able to do that field addition.

So just know zero is an unacceptable result for us. And, you know, like you could imagine building a system of money without actually knowing that every potential number on this curve can be transformed into another number on the curve. If you don't know that, the only way to know that is to actually, well, right now for humans on Earth right now, the only way we know that is that every number has an inverse. In other words, every number has a number. It could be multiplied to equal the number one.

And that's what we say is an inverse. In the real numbers, we say 5, the inverse of 5 is 1 fifth because 5 times 1 fifth equals 1. But in the number system of what we call a finite field, which is like we described before, the field of remainders modulo some number prime, right? The way we divide is by multiplying by the inverse, but we don't have fractions. We just have other numbers in the system, right? And so we just need to make sure, but we still need to make sure we can take any two numbers and get the number one modulo, the prime.

Yeah. And so I think as the point to tie this together, to explain why this matters, this field addition that we do is the mapping from the private key to the public key. That is ultimately what we're doing. and we need to be able to take, and this is also just an important concept of someone did not go through and look at all numbers between 0 and 2 to the 256 and figure out, okay, like, does this number work? Does this number work? Does this number work? This is proven on a higher mathematical abstraction

that you will be able to find this inverse. And the reason why the numbers are between 0 and 2 to the 256, you can pick a number bigger than 2 to the 256 when you do this operation. But if you remember, the field in which we're doing this modular arithmetic is two to the 256 minus two to the 232. So if you take a number even bigger than two to the 256, it will work. Like it's not like you're gonna break Bitcoin if you find a bigger number to put into this thing.

It is just going to get compressed down into the field of remainders where the largest number is two to the 256. It's like asking for 50 o'clock. It's like you're looping around. Exactly. That's two hours. That's two hours from now. Right. Exactly. Right. And so that's exactly right. This all comes down to the basically the really remarkable elegant simple proofs that Gauss did that showed that all of the math we know works in this space like you don really have to think that much about it but we go through the dot like

it just works adding works in this space multiplying works in this space um adding multiplying are basically the operations of rings and fields so adding and multiplying is what you need to worry about. And that's why when we don't divide, we multiply by an inverse to divide. And that's like a big concept. So, yeah. So basically what we're talking about now is the concept of congruence. Okay. Right. So like we, we talked, we're talking about congruence

modulo a number, which is like in, in the world we came from, we talked about the two things, two numbers being equal to each other, five equaling five. But now in the world of congruence, we're just saying that actually five could be equal to an infinite amount of numbers that when divided by your modulus, the remainder is five, right? Right. When we talked about the number one in a mod three concept, we said one, four, seven,

10, et cetera, are all congruent. They're not equal. They're congruent. Right. Because as that final emphasis, all we care about is the remainder. That's all we care about. So that's why if you pick a number bigger, you can loop around. You're just going to, what you're going to do is if you pick a number larger than 2 to 256, you're just going to get a number that is going to map to another number within this modulo operation. Just like two o'clock and, you know,

if you're doing modulo 12, 2 a.m. and 2 p.m. are the same remainder. so like you're gonna get to the same thing yeah so real quick i want to read out of the document um please a snippet um and it's another thinker i think you're gonna hear a lot from from me is rudolf steiner who's the uh um renaissance man from the late 18th sorry the late 19th century early 20th century who created the waldorf schools where my children went were educated but really had a lot to say about thinking knowledge and really lines up with, it's probably

the reason I think this way is because I've studied his work also for the last 15 years. So anyway, these documents include his thinking. And I just want to read this real quick. It says, what is the number three? Not three apples, not three tally marks, not the symbol three, The number itself, you cannot see it, hear it, or touch it. Yet, you can think it with perfect clarity, and your thinking of it is identical to every other person's thinking of it.

Steiner argues that mathematical objects are the paradigm of thought content realities that exist for thinking alone, independent of any sensory medium. The number three is the same, whether represented by Roman numerals, binary digits, or Babylonian wedge marks. The representations change The thought content does not The modular arithmetic makes this vivid So in Z7 Z7 means like that's when the modulus is 7

We're dividing everything by 7 So in Z7 the number 10 is 3 It doesn't represent 3 It's not equivalent to 3 But it is 3 What we call the residue class Which would be 3, 10, 17, 24, etc That's a single mathematical object perceived by thinking as a unity, despite having infinitely many representatives. So when you compute 5 plus 6, and remember in this mod 7, that equals 4. So 5 plus 6 equals 4 mod 7.

You're not manipulating symbols. You are perceiving a relationship among thought contents, a relationship that holds necessarily, universally, and eternally. and as one last um extended line out for people who may be lost the reason why six plus five equals three in this context is six plus five equals eleven sorry equals four because six plus five equals eleven you're killing these guys i'm killing it i'm killing it i'm killing them i'm still waking up here so six plus five equals eleven and when you divide eleven by seven

it goes into it once and you have a remainder of four. So that's why in this context, six plus five, modulo seven equals four. And now we're going to... Yeah, we may be taking for granted our own speed of like those types of addition and subtraction. So if you guys are like, if you need to pause and just be like, all right, do I need to pull a pen and paper out? Don't be ashamed. It's okay. I think this point right here is a good checkpoint of if you're, if what I just explained does not make sense...

And you want to learn, rewind and give it a listen the second time. And from here now, we're going to take a step forward and talk about in the, like, the domain is this very large prime number and all of its remainders. And they map onto an elliptic curve, which is kind of the next point. So we have this. Oh, sorry, real quick. I want to just interject one thing. We're not going to get that deeply into it, but I have covered it on prior podcasts.

that you can go look up. The way that we can know that what we're doing in our minds around numbers we understand, like 10 and 11 and 7, the way we know that all that math applies in the 2 to the 256 realm, in a realm we can't possibly visualize or understand, is the way we know is through something. Usually it's through something called mathematical induction, but there are many There are many ways that we prove things.

That is going to be a topic that we do get into, which is like, how do we really know? That's always the big thing I talk about. How do you really know? And so usually the way we extrapolate knowledge from the sort of knowable, observable world we live in to the unobservable, almost infinite, but we say it's not, is this concept of mathematical induction, meaning if you can prove it at a very basic level, and then you can prove that every

increment, every next increment is true, then eventually you can just extrapolate mentally. And there is a rigorous construct for that that we're not going to get into. But I just want to build that bridge that there needs to be that bridge that we know that one plus one equals two. We can sort of extrapolate these operations into numbers we can't understand. Yeah. And I think there's some interesting visual points. I know this is primarily an audio podcast, but if you're sitting here, if you're listening

to this, what we're about to start talking about is this curve, the LibSecP256K1 curve. We'll get into exactly what that means. But if you type in LibSecP256K1, enter, and Google images, you'll see it. And it's a graph, it's a curve that you would have easily seen some point in your high school math education, for sure. You wouldn't have realized it was that important. But the elliptic curve... I've seen it in Bitcoin a lot. I mean, you see it in Rob's shirt right now.

Yeah, the shirt I'm wearing, it gets thrown around here and there. It's almost the logo of a magic internet math, but it's not. I kind of like transformed it into an infinity kind of. Yeah, yeah. More of an alpha symbol. Yeah. But it's basically, and I'll do one quick, it's basically a curve that loops on itself across the X and Y axis. So across the X axis, any point on the X axis, there's actually two points on the Y axis that you can go to.

Let's say the bell curve flipped on it, turned it on the side. Oh, yeah. So if you took a bell curve and you've rotated it 90 degrees, if you're a shape rotator. It just looks like that. It looks like that. It's not that, but it looks like that. No, like we're not saying it has the same tails. We're just saying visually it kind of looks like a bell curve. Absolutely. 90 degree rotation. And so I'm going to explain what the equation is. We're going to talk about why this is helpful. Like we're going to build on this. But I'm just going to make the jump and say the curve that Bitcoin specifically uses is Y squared equals X cubed plus seven.

And we're going to talk about why that is. And if you can see on my shirt or if you look up online, it's slightly pushed up a little bit. And that's when that plus seven comes in. Why the hell does this matter? If you take any two points on the curve and you drew a straight line so that they touched, it's always going to hit one additional point. And that one additional point is because it's a cubic operation, X cube. So you're always going to have a given point. You're going to have the three intersections. and if you reflect that x point across if you reflect that that third point across the x-axe

that's the sum of the two original points and this is kind of like the whole magic of how this works and this works for any curve that follows the general y squared equals x cubed plus ax plus b like the general function of these libraries and we're going to get into like why that if you take two points you connect them you can take the third and flip it over the x-axe and you get the sum of the two, like why that's really important. But to start, like even the Y squared equals X cubed

plus seven was a choice. Why that? And that is the libsec P256k1 curve. Um, SEC, the SEC, standards for efficient cryptography, P, it's because it's using a prime field. We already talked about the prime field, right? You already, you already understand why there's a prime field in any of this at all. The 256, is it because it's 256 bit prime? All right. So that seems like we're, we've already done a lot to demystify what libsecp256k1 means.

What's lib? Sorry, is lib for, is this a political statement? Is this a political statement? Is this a library you import? Yeah, yeah, yeah. I don't want to get you going, but a lot of people think that there's political statements. Yeah, it's all these libs, all these damn libs. No, lib is the library, right? Because you're pulling from this library of sec p256k1 uh so we got through sec p256k is um a koblet uh a koblet's curve um yeah and we've talked i've talked about those in the past um and i have there's a course on magic

internet math.com on koblet's book number theory and cryptography and then one is that it's the first and only such of its curve now the koblet's part is actually really important and i actually tweeted this out last night um probably two days ago by the time this gets out the door for everyone to listen to how finney in 2011 opens a thread on bitcoin talk and says like why this curve right and like a bunch of like greg maxwell christian decker uh gavin andreason mike hearn like all of

the original like big bitcoin developers time yeah of course of course that's there yeah um The curve was actually invented on Little St. James, for sure. And so the ultimate point that gets talked about and somewhat inferred is that this curve doesn't have anything weird going on about it. You could be like, oh, why is it plus seven? But that's not meaningfully a big transformation in the context of what we're about to talk about, is that there's no weird constant that just doesn't make any sense whatsoever.

I would more ask why the middle coefficient is zero. Why do you go right? That's a good point. That's like the one of the things I've always wondered. Yeah. Well, if you actually make the A zero, it allows you to do simpler mathematical transformations and it makes it 30% faster than other standard NIST curves. Because you're just taking something to zero that's less transformation and less computational overhead. So it actually makes the curve more efficient. and further talking about... Can you circle roughly when in history was this being determined?

Not for Bitcoin, but when was this curve? When was SecP 256K1 created? I don't want to get into the whole history right now, but you know what I mean? Just so people don't realize, Satoshi didn't invent this. It wasn't part of... It was invented prior to 2008. Well, so it was invited prior to the cobblitz curve. The cobblitz curve itself. Yeah. In other words, this X cubed plus seven was sorry.

This is Y squared equals X cubed plus seven. Yeah. Y squared equals X cubed plus seven was a known curve that was used for things. Potentially. Yes. That was a no. It wasn't like Satoshi said, I understand this library. I am going to just conjure. It wasn't like conjured. It was like selected from things that had been played around with. Correct? Correct. Yes.

And I'm pulling up the exact year right now. So I'm trying to- It had some known properties. Yes. It had some known properties. It wasn't really used at any large scale anywhere outside. like there wasn't like a bunch of applications that were running this curve specifically um but you locked in and said that's a candidate yes and i'm what i'm doing right now is i'm trying to find i was actually looking into this last night and i'm trying to find my original uh conversation that i was having with this um if you give me a moment it would be pre-deeded 2008

And I think as I'm pulling this up, just the thing to sprinkle through, what we're going to be mainly talking about today is ECDSA, elliptive curve, digital signing algorithm, which is what Satoshi originally started with. This did not use Schnorr signing algorithm. That was something that was actually patented through 2008. So when Satoshi originally came out with this, he couldn't use Schnorr, which was known to be more efficient. um the um what was i going to say the uh

schnorr's slightly different group structure characteristics and they're more designed we've talked about it a little bit when in the i did this with gary in one of those episodes i'll try to remember it and link it but like we talked a little bit about there it has slightly different group characteristics, which allows, there's like additional closure that allows you to abstract maybe more of the information. So it's not all, you know, you can kind of abstract a couple of the variables into single

objects so that you're showing less. And like the thing with Schnorr was like, you can, everything looks like one address. So you don't, you can't easily diagnose a two of two multi-sig and say, oh, that's clearly a two of two multi-sig. That's a lightning channel. Absolutely. Yeah. And so basically the biggest upside you get with Schnorr is that you're able to effectively add keys together in a very efficient way. That allows you to, as a result, since you can add the keys together, you can take individual shards and you can aggregate the signature.

So you can have a two of two. And that's a result of the group structure. That's correct. Of Schnorr. Yeah. I just need to emphasize that here, right? Because that's really what we're talking about and why we learn about the structures. Yeah, so the curve SecP predated Bitcoin roughly the year 2000 was when it was invented. So it had been around for almost a decade when Satoshi picked it. And the point I'm getting to is why that matters is because the curve you pick is kind of like, this is the entire field in which you're doing all of your public private key mapping.

and going taking it back to this Hal Finney post um he basically everyone starts inferring that it's the one curve in that general family and library that doesn't have any really weird traits about it and you would be like well Rob you know like this all of this stuff is weird like what do you what like this is all weird like why why does that matter um basically what's a weird what's an example than in this world of something weird that they declined they rejected yeah so other curves

hold constants within the curve that don't immediately make sense and it's very popular um in what does that mean real quick what does that mean so what that means is that when you are setting up this equation they'll tack something onto the end like some extra little thing and typically like a constant number you meaning so in other words yeah or it's an object a constant object or like so for example okay slightly you have to know

calculus to answer this question but like when you integrate a number of sorry you integrate a function like x and you get one half x squared you have to say plus c because you don't really know So unless you define the limits of the integration, I'm sorry if I just derailed. No, no, no, no, no, no, no, no. So like there's another, there's a NIST, you know, and NIST, NIST is like the National Institute for Standards and Technology.

It's a government. I should put that. I should put those on my website. I got the BIPS. I got the BOLTs. I got the NIST. I should get the NIST standards in there. Here's the thing. Unlike BIPs, the NIST comes from the government, which means even the mathematicians in Bitcoin don't trust the government. And the reason why this matters is that there was another curve. There was a NIST P256 curve that could have been used. It has a coefficient from a mysterious SHA-1 hash that no one really knows where it came from.

and basically there was a scandal in 2013 where the NSA was caught trying to backdoor elliptic curve standards and this is why Satoshi picked the curve he did is it didn't have a mysterious NSA backdoor whereas if he picked if he was like well I want to be taken seriously so I'm going to use the credential the elliptic curve library to make sure that like other cryptographers it's like instantly the domain in which we're operating in is not an academic one where we're trying to get peer review and get accolades and kind of like

work our way up through a corporate structure or political pseudo corporate political structure like a university. Yeah. We are trying to make unfuckable money, which means that you have to really go foundational level primitives to understand why things work. And if Satoshi had picked the accredited curve, Bitcoin would have been dead by now. Absolutely. It would have been entirely backdoored and destroyed. Maybe they'd still be waiting. Maybe. Well, that's true. They could just be waiting for something to happen, right? And so Satoshi picking this curve that was invented in 2000 that was seldomly used was actually very intelligent because it was the curve that fit all the properties we've talked to up to this point that would be good for elliptic curve cryptography to secure Bitcoin and secure money in a trustless way that didn't have these back doors, right?

And so I think that kind of just lays out the highest level. Now, now we're going to take two things and we're going to combine them together. We have this curve, this curvy object on a graph. And we have this field of finite points. Sideways bell curve. We have the sideways bell curve graph. It's sleeping. And we have this modulo arithmetic, right? We have all of these little dots. So what you do to casually draw it is you draw a series of connected numbers. like one continuous line for this entire sideways bell curve in reality if you interrupt you real

quick like just as an example for lay people imagine drawing you would draw a circle with a radius of one you would take this function called x squared plus y squared equals one and then you would start taking combinations every combination of x and y you can basically imagine and that that make that equation work and plot right you'd plot every one of those X, Y's and Cartesian, you know, and Cartesian coordinates. And what you would, if you had, if you asked Python to do it, you would see a circle getting

drawn very quickly. That's right. And so that's, that's essentially like, so it's just like what we're natively used to doing is the number, like the real number system that we grew up with. Whereas you're doing the same thing in something called an elliptic curve, but your plot, the equation is now the, is a remainder. Yeah. Yeah, and so rather than drawing, and the reason like this Cartesian plot with x squared plus y squared equals one to draw a circle with a radius one, right? You're taking, when you're drawing a continuous line, you're basically, in shorthand, you're taking all possible x values and filling them in for all possible y values, and it's continuous.

Like, there is no break in the curve. For this elliptic field, to combine these two concepts of the sideways bell curve, this elliptic curve, and this field of finite numbers, super zoomed out, it looks like it's all connected. like one continuous line but if you zoom in and you zoom in and you zoom in it's actually a series of dots so there's not actually really a continuous line it's a bunch of little points that map out all of the remainders as it relates to this very large mersane prime of two to the 256

minus two to the 232 you know well but we what you're trying to say is it's discrete too right Yes, that too. And so we now at this point have been able to stumble. Sorry, the book Mastering Bitcoin, the Antonopoulos book, has a very, I think, a good illustration of this where he just shows it at a larger and larger moduli drawing this curve. If you recall, I think, chapter four. So if you have that book, it's a good visual cue for this right now.

yeah mastering bitcoin by intelophilus and also programming bitcoin by jimmy's song we're basically we're going through the initial introductory chapters of how this all works um and so we now have the foundation to actually talk about how we use this stuff so we have this sideways bell curve that's what we're just going to call the lipsec p curve because that's what it visually looks like so you have this curve you take all of the modulo possible remainders from this very large prime number and you connect them into this function and you're able to get

this curve that gets drawn out and you're able to see all these little dots so from here we are now at the point where we're actually going to do some actual math equations what we've done like visualized like some basic math equations but now we're going to start smashing things together. We have this field of modulo prime numbers, so it's not continuous, but you have this curve that the math gets transformed on. And we're going to start talking about now

what the hell this has to do with Bitcoin. So your starting place is this random number. Now, whether that random number is literally your seed phrase encoded into a number or like in your own abstraction. The way it actually works though, as I mentioned earlier, is you have your master extended private key and that to generate child keys.

And those child keys are just numbers between zero and two to the 256 that then get placed on this curve. You take that private key. Yeah. And if we start just, if we just start in a small place, right. And we just say, what's the, if we look at a finite field modulo five. Okay. And you start with this number two. I did this last week. So do it again. Right. Let's start with, start with the number two.

You can generate every point on the curve with this number. So when you double it, you get four. Right. So like in other words, in modulo 5, we're looking for the points 0, 1, 2, 3, 4, right? And we can do this with the number 2 because 2 times 2 is 4. And then you multiply by 2 again, and you get 8, but mod 5 is 3. So you go 2, 4, 3, right? Because 4 times 2 is 3. 3 times 2 is 1, right?

So now you've got, what would we say? 2, 4, 3, 1. and then multiply that by two again. Basically, you've done it, right? You've completed the loop. You've completed the loop. You've generated every point with this operation of addition. Multiplying by two is basically adding a number to itself. Yeah. So you've generated every point. So I'm just trying to get a tangible thing you can do.

And then now we're going to move to the tableau of this curve that is based on things we can't as easily determine, but we can abstract the concept and the functionality. Yeah. Right? You can generate every point in that curve with this massive prime number. You're able to generate every single point in that curve. That's right. And that's why the, and again, just to really hammer it home, that's why we pick a very large

modulo base is that you're not going to really be able to get that closure where you can quickly loop through and get all possible options. The space in which you're doing this module arithmetic on is so large, you're not going to be able to trivially close that loop and get back to where you started. And you can't check it with pen and paper. And knowing it's a group, part of is also how you know it preserves these operations. It's almost all you know. Yeah. All you really know and all we care about. That's why I love groups.

I love structures because all we really care about in this instance is that we have the closure and the operations are preserved. That's literally all we care about. That's why the mathematicians invented this thing called group. Yeah. is so that we know this and we can move into this space of maybe not being able to check with a pen and paper. Yes. But we know, we know for a fact, and you can, you know, you can study it and go through the proofs and know for a fact that these operations are preserved and you maintain closure.

Yep, exactly. And so from, from this context, we're going to get into the next like thing that we may take a second to pause just to fully connect it together is you take this private number that only no one else knows. This is your private key. This is not your seed phrase. This is your seed phrase is literally the seed in which all of your child private keys can derive from. So you're taking your first child private key, which is just a number between zero and two to the 256. That's the starting point. You put it on the curve. Your private key is the grain of sand on that curve that you just happen to know that's the point and no one else does. No one else knows

that point. And the ability, the asymmetry is because there's so many possible points on the curve, the only way someone would be able to reverse engineer that is if they guessed all of the possible grains of sand combinations to see if they could find your key. That's right. Which, from a game theory of Bitcoin, which is actually just interesting in general, you're economically more incentivized to just, if you have spare compute cycles, to just try and find a block. Yes. It is. You have, as infinitesimally unlikely it is that your computer would be able to solo mine

a Bitcoin block. it is still infinitely more likely that you will find a block mining on your computer with like half a giga hash of hash rate yeah then it would be for you to randomly stumble upon someone else's private key and that's like the really important thing to go into here is that like even like outside of the math for a second just thinking about from a game theory perspective if you have spare compute cycles like i think many people when they first get into Bitcoin is like I just going to build a script It just going to guess all of the numbers If you have spare compute cycles you are infinitely better off just trying to mine a block

Even though it's like a little bit more heavy of an operation, it's greatly offset by the possibility and probabilistic likelihood that you're going to find a block could technically happen before the heat death of the universe. Whereas you're waiting for the heat death of the universe to go through the entire index of all two to the 256 numbers to try and get a reverse engineer of a key at random chance. Yes. I want to ask. So we have this. I want to ask a quick question just because it's the elephant in the room. And I want to know if we're capable of handling it in 60 seconds or less. But like. Yes.

What about what about when we have quantum computers? Yeah. So a quantum computer. Yeah. So I think this was going to be a legit question. It's just, yeah, this was going to be like the culminating thing we're going to end on is like the discrete log problem. So a quantum computer essentially breaks down the space in which the computer necessarily has to compute to be able to get an answer. It's like, how does it affect the game theory?

I guess you're right. How does, without having to explain what it is, right? It greatly reduces the doors in which you need to randomly guess through to be able to get to an answer. It's an efficiency, an ability to find the inverse with a public key, the private key. We're talking about how you have this private key, you do some mathematical transformations, you get a public key. And the asymmetry is such that to be able to find that public key, your best option is to randomly guess everything.

A quantum computer breaks this heuristic, so it's no longer a random guess. and you are essentially able to use that generator point that we're about to talk about and very quickly find the... Very quickly in a timescale and sense compared to what we currently have available of guessing everything. It could still take like a day, a week, right? But like it is no longer talking about heat death of the universe. You're talking about in some measurable, realistic human timeframe. If you had a cryptographically relevant quantum computer,

you could take a public key and find the private key. It becomes a pretty good idea for some time. It becomes a good idea to try to find Satoshi's coins. Right? But then the question is, in the game theory, what's the response? Is there a fairly easy response in the game theory? Yeah. We're not going to sit there and be like, we're not going to sit and watch it eat all the Bitcoin. Right. And so this is funny. As someone who loves deep Bitcoin nuance and lore,

this was one of my favorite nuggets of things like four years ago. And now it's like the most common talking point, which is fine because it's a real point. Like it's a legitimate thing. It's just, it's funny because like I've been thinking of this lens for years. When Bitcoin was first originally created, there was not like the main default way that you would receive funds was through a public key, pay to public key where you just put the raw public key on the Bitcoin blockchain. So Satoshi's coin specifically use this very, very old legacy address. and those are prime uh those are for the picking basically when it comes to a quantum computer

because those public keys have been publicly available for anyone to look at since 2009 when the genesis which really goes to show you how secure that is right now right right millions of coins right and and to get into the bitcoin level a little bit the thing is is that it's not like if i get one cracked i get a million bitcoin all of satoshi's bitcoin each address that satoshi has has a different public key. So you have 200,050 Bitcoin lotto tickets that a, in theory, a quantum computer could

go try and attack. Now, this is definitely outside the scope of the conversation today. But just to put a small point on this, a quantum computer's ability to reverse engineer a public key to a private key is different than being able to undo a one-way hash function. And why does that matter? is that very early in Bitcoin, like by 20, even like actually, even in the first couple thousand blocks, there were a couple of these, but you can hash your public key and put the hash on chain, which gives you a certain level of protection

because to be able to reverse engineer the hashing function uses its Grover's algorithm versus reversing a public private key is Shor's algorithm. And quantum computers handle this with different levels of efficiency. There are efficiencies, but it's not the complete catastrophic breakdown of the ability to find the inverse or find the pre-image as it relates to hashes. So that's kind of what we're talking about now is definitely entering that realm of when people start talking about quantum computers.

Like this is the foundational math we're talking about that would be broken apart. And what I really want people to just be able to do, and you're not going to do it in this conversation, but I think as we go on the podcast, I want us to be able to say, okay, if there's a risk, let's say it's quantum computers or whatever it is, there's a risk. It's not like a all or nothing risk. It's like certain things are exposed. Certain things are not. Certain things have easy answers. Certain things don't. And that's like the kind of thinking. And when we start bringing the experts on here to talk about these things, it's like this is what we are building right now is sort of the we're prying apart the nylon threading of the all piece, the all or nothing piece, prying apart a little bit, just then, you know, maybe mixing the glue, breaking up that glue so that we can start to see that there's more.

it's more than all or nothing. And it takes some brainpower and thought and discussion and a little bit of rigor to pull these things apart so that we can, when we finally have like the real conversation about this stuff, it can really land. That's exactly right. We want, we want to be able to serve the audience in a way where if you listen to like the prerequisite material, which is the podcast, having it somewhat self contained that when we were, when we have guests on or we have subject matter experts on, um, you're not starting at a cold start you will have the foundational requisite pieces of the

underlying math to where and to be clear we're also going to be struggling when we get deep into the technical nuances of the implementation of all this stuff but you'll at least have a life raft and like a a lifesaver get thrown out to you so that you can if you want to go through the journey with us you have the foundational pieces laid out um so we have this curve we have this field of finite math, the way this ultimately works as a starting point, you pick that private key.

That private key is then computed to find the public key. And how do you do that? This is where we get something called a generator point. And this is kind of what you were just talking about as it related to finding and completing the loop of the circuit, right? You take this generator. Basically, if you take a number and throw it into this modular arithmetic, you can generate children like you get like a family of generations of like what you get and so

you take your private number you throw it through this function and you get a new number when you get there when you put it through and putting it through there essentially gives you a public key that you can go talk about and I'm going to pause there for a second because I know in my own standards that that was not done as cleanly as possible if you want to take a throw at the generator point and how that works. I just think the grounding is we're just plotting points in a curve. We may not be doing it in Euclidean XY coordinates also.

So it's just a – if I go back to the circle analogy, I mean I'm kind of deathly afraid to talk about something called polar coordinates. But like if you can draw a circle by plotting all the XY points, that gives you X squared plus Y squared equals one. But there's also another way to view it, which is you can say, I already know the radius is one, right? And I can pick any point and I can just keep rotating the angle on the x-axis. I can just rotate that angle, right?

And eventually I'm going to rotate it 360 degrees and have my circle. I'm going to plot every point just by rotating the angle like a little bit until I have the whole circle. and then the reason why that is um like sort of relevant is that that gives you the repeatable that's like the clock math okay eventually you repeat and you just end up plotting the same points in the same curve and because an eletric curve you're not it's not xy it's not exactly xy

well i guess it is right y cubed equals x yeah it's x squared plus seven so it is xy but but But the domain is a finite field so that it will keep eventually repeating. You'll keep cycling through not in order necessarily, right? Yep. So you have – the generator point is just a point on the curve. It's a point. It's literally some – we call it G. So why is it confusing then? This G is an X and a Y. G is an XY point that makes Y squared equaled Y cubed plus 7.

So the G is just a name that contains the X and the Y, right? And if you go on any of the Bitcoin GitHub, you can see those massive numbers, the X and Y that give you the public, this G, this big capital G, right? That's right. That's right. And so it's a publicly known point that everyone agrees upon in the network. Everything traces back to it. If you have a private key, your public key is your private key and adding, taking the

generator point and adding it to itself, the number of times that number is that your private key. So just to make it simple, if your private key was one, which would not be secure because it's something that is not random and someone would be able to reasonably guess, you take the generator point against itself and you get a public key. And when you sign and you produce that signature, what you're doing is you're taking the generator point and you're adding to it K times. And we'll talk about this too.

I'm realizing that we may be getting a little bit into nonces. I just had another kind of thought here on just what is the significance of a generator point? And if you've studied number theory, you've suffered enough to know that not every number generates the whole curve. Yes. And it's actually – it's a lot of work sometimes to find – like I went through modulo 5. I showed you that 2 does generate the whole curve.

It turns out 3 does too, but 4 doesn't. So like if we just go through the exercise, 4 plus 4 is 3. Well, maybe I might have just stepped into shit again. Maybe it does. Four plus four is three, right? Three plus four. I guess it does. Not every number. The point is not every number does. And it's actually not that easy. It's not that easy to find the generator point. So it was really important that that's set for everybody. Yeah. And so the reason why the generator point that was selected is there, It is, it was the smallest X coordinate that generates a group of the correct order prime

N. And it's what we call in like the general form of cryptography, nothing up my sleeve numbs. And it's deterministic and verifiable. It was not cherry picked to hold a random value that was arbitrary that maybe inadvertently has a backdoor somewhere. Right. this is compared to the what we talked about earlier with the NIST-P curve the generator was derived from an unrevealed seed and with the reason why they picked that number was like hey if we pick this generator

number and you do this backdoor operation you can actually reverse engineer every public-private key pair through this generator point so the picking and not just of the curve and of the finite field but the generator point you use on the curve is also foundational to the security of the entire operation. And so what's important about this is that with this generator point, the entire group that generates it,

you can get every single point on the curve, which means that the full field of all possible outcomes is available. And when you keep adding the generator to itself, you could just go out to infinity and you will get all of the points. And it's important to know it's also like, and I guess everyone should know, I step in shit all the time because I'm not like a, I'm not the mathematician. I just engage. That's why we got Rob here. But, you know, it's, it's important not just to know it generates the whole curve, but like, but you just said, I didn't realize that, that the generator point was the smallest X coordinate.

So that's like actually also pretty important thing as well. And as you wade and slog a little bit more through number theory and abstract algebra, that will, I think, become pretty clear as to why it's important that you know the smallest point. That's remarkable that that could be known that we can have a cryptographically secure system and we know the generator point, right? We don't have to guess at that. And the fact that it really is remarkable.

I'm sorry for this aside. It's not mathematical, but it's remarkable to be able to abstract all of this for, you know, anybody in the Nigerian jungle can use this thing, you know, like it's also abstracted. And I think that like we I almost think that human beings have figured out it's abstracted enough for human beings to use much faster than like the Internet was. Yep. which is partly why we're in this state of like so many people know how well it works and we're like what the hell waiting for the world to figure it out right it's because of how freaking

daftly the math has been extracted for use yes incredibly uh as a force multiplier being able to leverage this stuff without knowing all the nuance think about it like you get to have ownership because you have something that no one else knows about like you could just literally like people say, you could just know 12 words in your head and you have a unique ability to leverage all of this cryptography in a way that allows you to touch money. And so at the highest level, again, let's say you have a private key.

You then take the generator point and you add the generator to itself the number of times the size of your private key. yeah you just keep adding to it just keep adding and in the document there in the document there's a there's a function so i think it's called square multiply but it's like there's a method out the methodology you've had to do that for really big numbers as you know we've extracted a lot out of the document but kind of i would say i would expect motivated people to really go through it and just

try to learn math and um the arithmetic and do the exercises and stuff absolutely uh for sure I definitely recommend as a follow along for this podcast, this is more of like a director's cut commentary of the study guide is what we're talking about right now. So you take this number, your private key, you add the generator point to itself that many times. The reason why the generator point matters again is because it can generate all of the possible values on the curve. And remember, the curve, the sideways bell curve, is actually a series of points that are just dotted along,

mapping across this function. and you are able to ultimately get a point, another point on the curve. And that point on the curve is your public key. So you almost have this machine where you put in a number, you add the number to itself, the generator point number to itself, the number of times that is the number of your private key. You get a new point on the curve that is not deterministic or it's not like the point next to it. And you can't apply an easy mathematical concept to be able to reverse engineer where that came from.

But you have a now point on the curve, which is the public key. And that public key is where people can send you money, right? That public key maps to a hash, which maps to an address. Now, the beautiful thing now is if you send me money to this public key that I give you, which gets abstracted into an address, how do I prove my ownership? And you can do this without ever revealing your original private key. You know a secret, which is your private key. and you know where it lands on the curve.

And you need to convince everyone that you know the secret without giving the secret. And then this is what you do. You provide a second secret. This is called a nonce, number only used once, a nonce. And with that nonce- I like to think it's almost nonsense. That's right. But you have to pick an additional, you bring a one-time secret. A nonce is a only used once, it's a one-time secret. So you have your permanent secret, which is the private key. And then you have this nonce. And what you do is you pick a fresh nonce.

And I'll get to it in a second. This is actually really important. You pick a fresh nonce and you bounce into the generator that many times. Yeah. It's like a test multiplier. Yeah. Yep. And then what you do, yeah, so you pick a random number as a one-time use. And I'll get into how that gets actually picked in a second. It's really important. you then you take this random number this nonce you put it to the generator point and you create a challenge by hashing

together your signature and the original public key and the transaction message and you can combine these together and show that the secret equals this combination of the transaction message and your public key and the nonce now there are like five things that I just want to very quickly explain here. One, the nonce, just like your private key has to be random. Now, there is a beautiful deterministic way that is standard

for how you actually derive this deterministic nonce. You basically pick a number that is related to the transaction message itself. And what do I mean by that? So now we're going to take a half step away from math and just explain how Bitcoin works. When you provide a signature, what you're doing is you're actually signing a hash. Now, what is that hash? What does that mean? What does that mean, signing a hash? I actually really do feel like there are people that with this Nod's thing

are lost to see already. Let's start at the basic thing. I want to send you Bitcoin. I have my transaction data for my UTXOs and I want to send a Bitcoin to you. That is like, I view this as like you're writing a check. I'm going to the bank of Bitcoin and I'm saying, hey, I want to send fundamentals, one Bitcoin to this address. And now the question is, is what you can do is you can take that check that hasn't been signed yet.

All of the encoding transaction data and you can hash it. so rather like you don't sign like you can hash anything you can literally hash anything you can literally hash anything and you will always get some ramp pseudo right like you will get a random what you'll get a random functions are called cryptographic one-way hash functions the reason why they're one-way hash functions is i could take the word dog and it'll look like a bunch of gobbledygook but anyone else in the world can take the word dog and get the same exact gobbledygook. And from that gobbledygook output, you cannot infer what the original pre-image is

by just looking at it. The interjection here is that hashes are just as useful just operationally as they are cryptographically. Because you can take literally anything in the world, throw it into a hash function, and it'll look the same. It'll look like the same object. And so that's extremely useful for indexing if you think about databases and we get into that. So like just hash as a tool is as much for obfuscation as it is for staging the next operation because you're getting a very standard input into the next thing.

Absolutely. Right. And so, and just one quick example of why hashes are useful is if you're, they're often used in the background, you don't even realize it for security. If I'm writing software, I write my software and I say, hit compile, and then I can take the binary of my code and I can hash it. And then I can say like, Hey, this is the official hash for my software. So if you download my software and it doesn't match this hash, someone messed with your system, right? Like that's a very simple example because it's a hash. I also look at it as like a fingerprint. it is a unique fingerprint for some bit of data so i like to think of it as a you're holding the

needle in the haystack yeah yeah now you're like this specific hash means something to me and you could prove by revealing the pre-image which is what you put into the hash function is a pre-image before you do the hash that um what that data is so i have this transit bitcoin transaction think of it like a check i rob in sending one bitcoin from this utxo to fundamentals and I haven't signed it yet, but I now have this data. Go ahead and sign it, please. Thank you. And then when I sign it, what I do is I don't sign that big blob of data.

I take the entire check of the metadata of the transaction and I hash it. So now I'm, and rather than signing a very large bit of data that could be really, really big, like Bitcoin transaction could be up to four megabytes, rather than doing a signing operation across four megabytes, I do a hash and now it's a 256 bit number. SHA-256. Which now is small. Which now is a small number. Which is a small number in the context of doing this multiplication because that's ultimately what a signature is.

It's a multiplication operation of adding itself to the field generator because if you... And again, we're talking about addition. What do you mean multiplication? Well, if you're taking a number and then you're multiplying it, you're adding to itself a certain amount of times. Like if my generator point is five, if G plus G plus G plus G plus G five times, that's just G times five, right? So that's what we're talking about here with multiplication. This is the beauty. If I know a number, right? That's my private key. I map it to this public key by going through the generator point.

I now have a Bitcoin address. You send me Bitcoin to that address. It's now time for me to prove that I own it. What I do is I write a Bitcoin transaction with all of the requisite metadata making sure it informs consensus. I then hash it. So I collapse all of that data into a number. So now I have this message that I'm signing, which is the Bitcoin transaction. You then take a new random number, and I'm about to get right to, and then what you do is you throw that through the generator point, and you can take an output, and you can show that, hey, this signature, which is the multiplication through the generator point with my nonce, maps to my signed message to this public key.

and how the hell do you even pick what your nonce is because you could pick the number three but then if someone's able to kind of if you you have problems if someone can actually find out what your nonce is and ultimately this is where it gets into deterministic nonces uh but like you know just to land the plane though, it's that one multiple of your private key

and another multiple of your private key are going to be able to sort of reconcile. Yes. Right. To the public key. You're able to do a little... For the public key, right. You're able to do a bunch of private key operations and show that they relate to the public key without revealing the private key itself. Yeah. It's kind of like if you remember in seventh grade when you learned Y equals MX plus B. right you say oh if i know the slope and i know a point on the curve i can draw the whole line or if i know two points in the curve i could draw the whole line and it's like um

that it's it feels to me like that type of that that just like that type of abstraction yeah right where at least on the public line i can verify right i can sort of verify that i can we can all generate, you know, we can generate the public line with this, with this information. Yeah. So now for the nonce specifically, how do you pick one? There is a spec called RFC request for comment 6979. And it's how you can deterministically, whenever you're doing

elliptic curve math operations, you can get a true, like basically a random nonce that an attacker would not be able to derive. And what it ultimately is, your nonce is basically a hash of your private key and the message. So you're taking information no one else has. You're the only one with the private key. And you take that private key and you smush it together with the message that you're signing, the Bitcoin transaction. You smash those together and then you hash it.

And that gives you a number. It's a hash and a hash. And the reason why this is important is because since no one else knows your private key, they aren't able to be able to reasonably reverse engineer what your private key is. And also, if you use the same Bitcoin public address, if you reuse your address, you have to reuse your private key. You do not want to reuse your nonce. And that's why you're deterministically linking your private key with the specific metadata you're signing to make sure that no one is ever able to do that. And when you throw into the hash function, you're going to get a unique value that no one else is going to be able to start with, which is when you do a SHA-256 hash,

and say number between zero and two to the 256, which again, all ties together why we use that number for the curve. I think we might've missed a little bit of context slightly in so far as I think we spent a lot of time on why the private key works and generates the whole curve. The context we might've missed is once we go into the public space, which Bitcoin requires you to do, and it's the why Bitcoin works, that you start moving out of your, you move into a, into the public square, right?

The Bitcoin box. And now you're moving, you know, in order to operate, right? Because you can send, you can send money to yourself all you want without really, you know, you can send, you know, in order to change is when you're in public though. In order to move Bitcoin, you have to now go to this public square called the Bitcoin blockchain, this public place that like the PO box that everyone can see through. You have to actually go there and interact. And like in the Y equals MX plus B example, right?

What you want to do is you want to give that second point and draw the line without revealing what your first point is. That's like the key. Now what you're really worried about is giving any information that reveals what your private key is, what your private number is. You don't want to reveal any of that with anything you expose. And that's what Rob is talking about. That's what the nonce does. In other words, you have to provide something. You can actually provide your own private key to make the whole thing work.

You don't want to do that. Technically, you could. Your nonce could be your private key. Technically, you could. You don't want to do that. But when you're talking about entering the public square, you have to enter the game theory of hostile actors. And you need to understand that within a contained system, talking to yourself, you can have certain trust assumptions, but you have to be trustless when you enter the public square. That's right. And that's why all of these requisite little pieces are designed in such a way with the assumption of if you can keep your private key private, you can prove ownership without compromising the secret.

And that's how this all works, right? That's why I just want to address why are we talking – what the hell – all of a sudden you introduced this thing called a nonce. And like why is that – why are we doing that? The reason why is you need to provide subsequent data to the Bitcoin blockchain, proving you know what that private key is without revealing it. So in theory if someone just sent me Bitcoin and I never spend it I just gave them a public key and I never spent it then nothing really matters then because I never at any point in the future come back to prove ownership of that information But basically, spending Bitcoin is proving that you know a private key, that you know a number.

That's all it is. All of the Bitcoin, everything is, I know a number. That's right. That's all. So the reason why you need a nonce is when you go to the network, you went to it the first time when you gave it the public key. You did your transformation from your private key to a public key. That was your first time you revealed information to the network saying you can send me money here. Now, when it's time for you to prove that you own it, you need to do an additional operation that shows that you own, that you know the number that belong, that private key.

But you don't want to reveal the private key. So you need to do a new mathematical proof, basically, of I understand this information. And you don't want to – it's like you just don't want to unintentionally reveal the private – did you ever watch The Wire? Yes. Okay. So I'm thinking – I want to say that season four opens with this scene where Prez Beluski is leading the class and he's asking – this class is so disengaged and he's doing some basic math problem.

It's almost like he's being – I don't know what the word is, but like really kind of pathetically trying to relate to these kids. So he's like, oh, let me put it in terms you understand and like this drug dealer does this – he collects this much money. And he's like trying to really reach these kids really hard and no one's listening. And he has these four answers on the board and he's asking the question like what's the answer?

And one of the kids with that almost like Gauss surprising the teacher, like doesn't do any work and just answers the question. And he's like, how did you know? And he had all these chalk marks because he kept pointing to the right answer as he was asking the question. And the kid's just like the dinks. That answer has all the dinks. And it's like he like he's unintentionally revealing the answer by trying to get the job that he's trying to get done. And he's unintentionally revealing the actual answer.

And that's what we're trying to – that's why we use annonce to avoid – you're showing a point on that elliptic curve and you want to make sure your eyes are not on your private key and anyone can figure out what your private key is when you decide to show a point on that curve in public. Right. Because the signature, you have to present publicly. So the integrity, and since it's public, anyone can look at it. So you need to have a secure way in revealing that public message that doesn't compromise your private key.

And so- You don't want to show the dinks. Right. Yeah, exactly. And so you have this signature. And what you're able to do mathematically is you could look at the signature and you can do a little bit of algebra, which we can get into, but you could do a little bit of algebra and say, with this signature, it's related to this public key. and you're able to prove the signature is linked to the public key in which the money was sent to and i mean it's somewhat elegant insofar as like how it all works um like a sniper

it's very hard for a sniper to get a shot off without revealing its position yes right so like they're very judicious because they know they're going to reveal their position and you know that's the thing about bitcoin is like you want to be able to spend to move at utxo without revealing the secret that that gave it to you that's the whole point of public key cryptography here right but but this is in the operation so like this isn't the thing you're going to find in a math book what you're this is the thing that actually is going to um

i think jimmy song did a really good job on this one thing of showing the math as to why if you do actually give away this nonce you're screwed like it's it's actually trivially easy and it is a and it is a y equals mx plus b it is that simple to just now find your find your private key if you do so if you do this so it's an important it's an important pile of shit not to step into absolutely yeah and so like working through the chain i'm going to go through it at a high level

here, you have this Bitcoin transaction because you want to spend your Bitcoin. That's basically a message that you broadcast to the network. You hash that. You now have this hash of a message. And what you do is you take that hash of a message and combine it with your private key, because no one else knows what your private key is, and you hash it. So now you have like a, you now have a number that exists on the curve that no one else knows what it is. Because to be able to get to that point without randomly guessing all possible numbers, you would need that private – that your private key.

Now, that then gives you your deterministic nonce. And you would say that the nonce point that you're starting with is the generator that you're putting numbers in through the equation plus your nonce, your number only using once, which is this combined number of your private key in the message. Yeah. And so now you now have a challenge that's called in cryptography. The challenge is proving that, Hey, can you prove to me you own this?

Like, you know, the private key corresponding to this public key. And that ultimately is a hash of all of this together. The nonce point, the message and your original, you know, it's the combination of both the hash of your nonce point this random number you're only using once the hash is like making soup right what does it takes any data and it collapses it to the field of the prime numbers that the curve operates on there's a reason because remember we this goes back all the way to the beginning we're talking about like modular arithmetic it's this two to

the 256 minus two to the 232 minus 977 is a prime number which encompasses all that that when you apply it onto a field, you will always get something within there. But you can't guess the recipe of the soup. No. You can only know. And that is really where you're getting it now. So hashing is like, okay, we're going to make soup with the knots. Yep. You're collapsing it into the field of the curve. Because SHA-256, what you're hashing this with is two to the 256 possible opportunities,

which is the opportunity size of the curve. So you're collapsing any data whatsoever to be able to be mapped onto this field. The sideways bell curve with a bunch of little points for all of the pieces. Yeah. Now you have your hash message, which is the transaction. You get your deterministic nonce by smashing it together with your public key. And then when you hash it, you just roll it to a random, like a number on the curve that only, you know, so you now have two numbers that only, you know, the nonce, which is derived in part from your private key and your private key. You then have this challenge statement.

And what you're able to do is combine a signature where you combine the the challenge statement plus your nonce times your private key that many generation points through. And you now have a signature. And that signature has two points, R and S, basically, because at any point on the curve, there's going to be like the two points. And this signature, what you can do with it for verification, this is what's so beautiful, is you can take this signature and you're able to basically take the R and the S values

in the signature. For a second, let's just say like... So we're off the curve. I want to do this a little slower here, I think. We're off the curve now. Once you hash, once you do the hash... You're on the curve. You're on, yeah. Because even a hash of... So you're saying the hash function still guesses, still puts, the result of the hash function is still a point on the curve. Yes. So the curve is closed under hashing. any data that you hash with SHA-256 will live on the curve.

And that's why you hash things. So then- To be able to make the mathematical transformation. And so you still, so when you hash something, you still have an XY coordinate that lives on the curve. Yes. Right? So what is all, you just then said, but then you have all, this is why I was maybe just introducing the idea of Apollo coordinates showing the same thing. thing is this what is like is that is that what's happening now whereas we actually know we have different dimension of what makes the curve we're not looking at an xy anymore

now we're looking at two different components that essentially build the same thing yep yes personally this is where i found it super confusing it's like what's r and s now no so this is interesting right so r being the actual like signed output proving the message S is actually a point on the curve that's kind of hiding your private key. And the reason why it's hiding it is because you use a deterministic non so people can't reverse engineer. If you wrote, if you rolled your own cryptography by hand and you're like, I'm just going to

always multiply by 12, right? And then someone could start looking at your S values and start just walking through random field operations and be like, oh, I found the private key. And that's why you need a random number for this one time use to sign the data. and that random number is tied to the message you're signing because the R is the signature. S is the point on the curve that's kind of hiding your private number, your private key within the transformation. So these objects are also...

So in other words, you can plot XY, right? You can also use the fact that a hash is on the curve and a hash can be decomposed into something called R and S. Yeah. that have a little more meaning now in how Bitcoin works. The R and S are what have meaning. The X and Y, not necessarily. It's now the R and the S that have meaning. It's kind of like how when we drew the circle, the angle and the radius had meaning that maybe the points didn't have.

Yeah. And so basically you can verify, to tie this all together. If you have the signature values of R and S, you have your public key. What you're able to do is you're able to take R plus your public key times your hashed message. So there's a very simple multiplication and it's multiplication over the field of the

and plus R equals the signed message. And what that allows you to do algebraically is you can actually break things out and show that in three line, like this is where I wish we just had a whiteboard so I could just literally, I'm realizing that like, this is like one of those moments that a whiteboard would be really, really important. That you're basically able to do substitution and you can verify that this signature is tied to this public key. I'm thinking of making a video, not myself, but now that I have my AI tools, I'm thinking of making a video that does just this.

That's what I just wrote down. Yeah. Like literally just this. Like, because this is like the culminating point I think we would probably want to get to today is going from like what is Bitcoin crypto? Like what is this thing? And getting all the way to now we've gotten all the way through the high level mathematical concepts between, you know, coherence and set theory and like finite fields and Mersane primes and the generator point. we've all got and why this curve, we've all got to the point of the magic is that I'm able to do

with some pretty trivial algebra, a proof to you that I have the private key material related to the public key that I gave you. And the rest of the network can all independently verify that within fractions of a second. We're talking on the scale of microseconds. The proof doesn't reveal the key. And the proof does not reveal the key. Ever. Yeah, that's the net, right? It's so remarkable, but that's a really important piece. Yes, exactly.

Who needs a quantum computer when you can just wait for somebody to reuse their knots? Well, so it's not really even hypothetical or abstract. This was a very common thing that wrecked people in early days of Bitcoin. Totally. Someone would roll their own cryptography library and oopsie doopsie, I was doing something. and there's like multiple there's like there's many layers here that can break if you're talking about in the real world of like not abstract whiteboarding on how this works but like how you actually write this in software there's called um timing timing side channel attacks where you do

timing analysis and you can actually infer based on the cpu cycles to do each of these individual pieces that someone in theory could actually reverse engineer your private key because if you're not doing all operations in constant time this is in the document by the way i'm pretty sure this because this is um um jonas's partner on libsec there's tim ruffing yes tim ruffing sorry there is a um there's actually and i was wondering what this meant now that you're talking about it this is actually also in the document um yeah about how libsec was actually created for something

called tls and i don't know what that stands for but it was not ssl ls which is like https like your open SSL library, like how you do encryption on the web. Yeah. And so that was not, they needed to actually make it more, more time. Yes. More time based for, you know, for this. Everything needs to be constant. Everything needs to be a constant time operation to prevent side channel attacks. So they literally took this initial code base and this as a way to kind of like full circles, begin closing out the episode. This is the difference between sec P two 56 K one,

the curve and lib sec P two 56 K one. And we were joking before about like, oh, what's the lib about? The lib is the actual Bitcoin implementation library that takes these abstract mathematical concepts and codifies them into a battled hardened cryptography library that is properly done. And when Satoshi originally just kind of pulled it in, it wasn't entirely, it wasn't homegrown. It wasn't a perfect puzzle piece at all. It wasn't.

It technically worked. There were a lot of compromises that he could see. Right. It was prescient that the people that followed were able to mold it into Bitcoin before it ever showed any of the vulnerabilities that would have had the thing break. Exactly. That's how these things work. I just want to say this is why – one of the things I really focus on a lot at the Magic Internet Math Academy is math history. I've done a lot already to put on – And it's because if you understand, like, this is a real aside, but like the history of math, it's not the history of mathematics.

It's the history of mathematicians. And it's important to understand their lives. One is like, you know, you have to figure out where you fit in the world. Sure. As, you know, whether you like it or not, if you're using Bitcoin, you're now a mathematician. Yeah. Sorry. It's just like you are either someone who's going to YOLO the number 12, like Rob said, or you may ignore all of it and you take your risks. But you are a mathematician.

Yep. And you are either a first, second, third, fourth, fifth, or a billionth class citizen in this world. You don't gain power in this world by doing favors for other politicians. You gain power in this – and you don't gain power really by running a note a little bit. But you gain power by knowing this, by understanding this. And, you know, mathematicians, it's never clean, right? Nobody – they never know the answer really.

Only some really special ones knew certain things. But like, you know, you take – Satoshi had a number of like balls of clay that he could have picked for this. And he picked the one that he had probabilistically thought had the best likelihood of succeeding. And it really was up to guys like Jonas Nick and Tim Ruffing to mold that clay. Yeah, no, that's exactly right. And you have to think about it from Satoshi's perspective. He was already designing a new computer science paradigm of data structure, of the blockchain, and all of these different moving pieces.

for him he just took what was available from when he desuces a reasonable curve and took the available code from the open ssl tls library and threw it in there and that works as a proof of concept the math is correct but there are a lot when you go from the abstract here's the whiteboard explanation to this is the zeros and ones that run on your machine to do the operations and you're dealing with a world where the mathematical computation is money like you're just like the the number is money and the transformations to go from number to signature to public key private

like all these things are our money and any brittleness in any of that could result in um things that you were making assumptions for no longer being true and that's where we went from where satoshi originally the the libsec p part of the code base was like 500 lines of code and today it's 50 000 and there's a reason why is because there was a continual let's go one step deeper Let's go one step deeper. We have dependencies on things we don't like. We need to rewrite those from scratch. We need to make sure that all of the foundational building blocks for each point that we're building on from scratch

have sound, not just mathematical abstract ideas, but how it actually gets implemented and having operations run in constant time. So that if there's a malicious process sitting on your computer, that's like looking at the spikes of your CPU, they can't see the variance of the computation time and basically find your private key by looking at the variances because each number would have a unique signature as it goes through these computer operations so that is like the levels upon levels of not just like the mathematical

high level but then getting to the silicon level and the code level and the assuming a hostile environment level how many levels down you need to go to be able to do that and it's not trivial And every step you go deeper down the rabbit hole, you have a whole new world of assumptions that you need to be understanding and kind of locking in place and kind of proving mathematically are true. And those are all of the transformations and optimizations and security improvements the LibSec P library has had since its original genesis. Yeah, there's probably no cryptography, at least that'll be under attack at scale like this because it's money.

Now, like, yeah, I would go back in time and say, yeah, like, you know, the launch codes, you know, things like – Enigma machine. Things of those nature I think clearly are going to try to be – things that attack power are going to be under attack. But something that is so – you know, like this perfect money also is so – when I say the reward, the reward isn't just like I get to buy more things. So you get money that is easily transferred anywhere.

I mean, the attack surface of this is enormous. And it's why it's also anti-fragile. It becomes anti-fragile because there's so many attacks happening in real time from its infancy that is being adjusted. And that's what the 50,000 lines of code is right now. and it's you know i think that's i saw those 50 000 lines of code and it was it also wasn't like letters it was a lot of it was not legible to a human being really and that's like if your goal

is to validate you know if you leave a lot of skin in bitcoin you want to validate it you really do have to grapple with this at some point i don't see any way around it yeah no entirely and i'm actually very proud of what we're able to get through today looking through the study guide I know we may have at a point here and there kept it at a higher level. And I think certain things like doing little follow up videos, really driving home these specific points of like the nonce with a signature. Like there's a couple of real pieces to kind of like like hammer on to really drive the point home.

but looking through all of this we've been able to at the highest level at least introduce the ability for you to at least start to begin to reason and understand where if you had a beer if you're at pub key you're having a beer and you want to talk about this stuff you may not be able to do the full mathematical proof of every line but at least you understand in aggregate the moving pieces and what's important and why things are important to be able to explain how this thing

works and i think that's the best we can do on the podcast is an opening introductory door to bring you in and kind of point your paths go deeper down the rabbit hole where they're watching the follow-up videos or do the study guide and like i think this is i think like i think every bitcorner should have at least this level of understanding of understanding how the I agree. And I'm like, like you don't have to do the full mathematical everything, but like, like I'm going to tell you 99 out of a hundred people who hold Bitcoin can't

explain what we just went through. Yeah. I think probably 999 out of a thousand. You're underestimating, but like, yeah. So the first thing, I guess I'm really trying to, part of this evolution is me discovering the division of labor between the podcast and the other tools. And it's like, what's we had, this was painful conversation, but like, you know, probably for a little bit, but not as bad as it could have been. Cause I know like the division of labor is, I'm pretty sure now I have these other tools that are going to be pretty effective. The other thing is we got to talk to Thomas about getting whiteboards at

Pokey. Oh, that'd be great. Right. There's no reason not to have whiteboards on the wall. Yeah. Well, my joke is I, I, I always show up whenever I'm in New York state, I show up at pub key at open and I treat it like a coworking space. You know, you show up totally. You show up at one, I show up like one, two o'clock whenever they open in the afternoon. Three o'clock. In the whole back area. Sorry, I've been three. But we show up earlier because we believe we're special. That's true. But like the whole back area, like there's some natural light that comes in. It's nice. I just hang out, grab a beer, grab some tallow fries or something, and I just work.

And it's awesome. Totally. I've gotten plenty of work done there. It is a workspace. I mean, you know, Evan Kalupas built my ZeusPay site sitting at the end of the bar. He built it in an hour for my book. You know, it's amazing. Yeah. Yeah, so I really hope people made, you know, God bless you guys. You made it this far. I'm pretty proud of this conversation. I'm really looking forward to getting it up and talking about it and getting some of the support,

trying to create some supporting uh tools also this is great this is you know very good we are leading that's okay so if you got this far maybe it's okay to reveal we are leading to getting um some guests on here to actually you know we we're building for ourselves so we don't sound like idiots that's right when we're talking to the real the real folks right what we're saying is we're basically near the end of our rope of being able to explain these things so at least you're at our level now when we have people on. We've gotten some confirmations, people who want to come on,

we just have to set up time and schedule. I think a lot of people that work on this stuff are excited to just be able to explain what they do, because most of the time, they either have no exposure to talk about their work, or it's always in the context of, here's my latest paper doing this latest thing. But like a lot of their foundational work is just doing very boring, very important, critically, like life support, critical importance to the Bitcoin protocol. But it's not sexy or glamorous or it's not a new shiny object. So it kind of gets looked over. Yeah. And it's not like, I think one of the things we are really doing here is we'll close

it maybe on this. It's just the like, especially in the world we live in now. And again, I'm going to say this to the end so we don't get into a rabbit hole on it. But like, I feel like the average Bitcoin only thinks Bitcoin, like Bitcoin horror or that that's the software and they don't see this that like i validated like bitcoin in like a day like that was nothing and then trying to validate then getting to this live you know getting to this step was like opened up an entire crisis that this whole now apparatus this whole magic internet math apparatus exists to address

this crisis and you know yeah no i would say out of like to your point like out of 10 000 people who hold Bitcoin, one out of 10,000 is probably the people that are like, oh, and the elliptic curve and the generator. Yeah, yeah, yeah. Cool. Got it. Yeah, I understand that next. Whereas for your point, you're like validating Bitcoin in a day. You had to hold constant an assumption of this thing must be true. And then everything else works. Right. But then you realize like, OK, I need to evaluate my assumptions and my understands how this works. And even if like

you can understand why Bitcoin works if you kind of hand wave elliptic curve cryptography, assume this works, everything else clicks into place but to actually do the requisite level of understanding of why does the elliptic curve cryptography work even if you're a math person like you have to walk through all of these pieces like we discussed easily uh a half dozen different like mathematical concepts today alone that probably have their own introductions if you're not familiar if you don't think in modulo math finite fields um elliptic curve transformations like the generator

point and being able to do multiplication by adding a number to itself a certain number of times And like all of that requires time to kind of break down and decompress so you can understand how it works. And I think we did a really good high level conversation going through the next level of removing the abstractions and having tangible pieces to wrestle with. That's right. We're mixing the glue. It takes – it's a slog. And I just want to make it possible and make it easier. Yes. And, you know, hopefully those who are, who have some motivation to really want to learn it won't just get destroyed.

Right. Like we now have a bridge. We like, we are building a little bit of a bridge. It might, it might be a bridge where you risk, you know, you're jumping. It's a bridge of stones perhaps in a, in a, you know, in a tidal wave, but right. But that's where we got to start somewhere and that's where we are. And I'm pretty happy with this. Yeah. This is part of the word. Parting word. Only parting word is that my parting word would be we've done a lot to kind of demystify the one layer down of abstraction of elliptic curve cryptography.

Each of the points we talked about today are things that you could further drill into and understand more. I would recommend the study guide that we're referencing that we kind of loosely based our conversation off of as the starting place. Yes. You start there. That'll prompt it. and this is an infinitely recursive rabbit hole you can go down. There's always another layer. I think getting to this layer is a huge step in each person's individual understanding and just be curious and interested and ask questions and use the study guide. Maybe listen

to this episode a second time if you really want to, once you get to the end in the aha moment, go through one more time to kind of get through the whole process and just keep grinding at it. You know, it takes time. This is not stuff that I knew about how it worked in Bitcoin. Genuinely, until like I started Anchor Watch, like where I went, I had to go deep, deep down because I needed to really understand each piece. These are things that I at a high level abstractly understood and maybe a little bit here and there. I understood like a generator point maybe, but I never went into the depth of why the generator point is what it is. like just let your follow your curiosity and through it all you're going to get a well-rounded

appreciation bitcoin but also just kind of understanding and analyzing large complex systems and kind of going through there i think it's a good generalized skill to have yeah and then um at pub key we don't we can maybe just have placemats that are pages of the study guide that'd be kind of cool that's right that'd be fun yeah all right very good episode three in the books peace that was fucking

Open the transcript file

Hosts and Guests

Nobody is credited on this episode yet.

Credit the people on this episode

Be the first to rate this episode

More episodes

All episodes
  1. Exponential Got Less Exponential

    Nov 2, 20261 hr 10 minAudio

    In this episode, we picked back up on our red-team tour of Bitcoin cryptography and tried to make sense of the last few weeks of fast-moving math news. We unpacked why the recent excitement around the exponential time...

    Credit the people on this episode

  2. Red Teaming Elliptic Curve Cryptography

    Oct 11, 20261 hr 27 minAudio

    OpenAI just dropped roughly 300 math papers with Lean proofs, mathematicians are crashing out, and the vague-posting has started: "math is breaking, so cryptography is next." Brian and Rob Hamilton refuse to hand-wave....

    Credit the people on this episode

  3. Hash Functions, Linear Algebra, and Alice in Wonderland

    Sep 28, 202650 minAudio

    Magic Internet Math: https://www.magicinternetmath.com/ Shout out to https://x.com/uncleJim21 for the Alice in Wonderland story and the following rebuke of Lewis Carroll: https://www.youtube.com/shorts/33FYXpEWgyA This...

    Credit the people on this episode

  4. Kayfabe Math is Now Mainstream

    Sep 13, 20261 hr 17 minAudio

    We’re back because math keeps refusing to stay in the classroom. In this episode, I unpack two very different kinds of “math pop culture.” First, we revisit entropy, seed generation, and wallet security through a...

    Credit the people on this episode

  5. Legalize MATH

    Sep 2, 20262 hr 2 minAudio

    Magic Internet Math is back. After the summer that set the Bitcoin world on fire - the Cold Card entropy disaster - Brian and Rob Hamilton (AnchorWatch) reunite for a two-hour deep dive on the event Rob spent three...

    Credit the people on this episode