Bitcoin for Developers 1 | Study Session 3

let's dive into it. Unit three covers what is a digital signature covers introduction Bitcoin transactions and how Bitcoin transactions use signatures. But what we'll focus on today is we'll really get a bit in depth on pay to public key hash transactions. And I think if we really.

Dive into that and focus on walking through that here today. That will cover, help us get a understanding of, all of these topics here, that units three covers. And again, this is supplementary to unit three of the course, so we're not gonna cover everything that's in unit three.

But here today we'll focus on pay-to-public-key-hash transactions. And that's really still the, I think the most common type of Bitcoin transaction. And it's not quite the original, but like it does just call it like the original form of Bitcoin transactions. So if we really grasp what's happening in P2PKH transactions, then we can that gives us a really solid foundation for understanding what's going on and all kinds of other transactions.

They're now on the network. So let's go ahead and get into that. Again, digital signatures Hope y'all can't hear my neighbor's dog going nuts. But this is a lovely graph we have here showing some elliptic curve mathematics, some graph there of that, which is quite cool. So we did in the last unit two, talk a bit about cryptography and public and private key pairs and the different ways, the different cryptographic functions that we use in Bitcoin.

And we'll come back to that a bit more and we will focus in a bit on signatures. And at the end of this session today, we will do a quick example where we'll go through. Creating a signature and validating it in Python. But we're not gonna dive too heavily into the math. Again. There's description of Elliptic Curves, math, mathematics and how it's used to generate public and private keys and all that good stuff that we cover in the course from the book mastering Bitcoin.

But then again, we're not, we're just going to need to be aware. We just need to be aware of what this stuff is and that'll help us work with it. Alright, we're not gonna dive too much into the math. So let's start first with a bit of a history lesson. Pay to public key hash is the most common type of Bitcoin transaction.

Not quite the original because first there was pay two public key but for some security and privacy reasons, that was pay-to-public-key-hash also helps compress the data that goes in the blockchain. So for a couple of those reasons, pay the public key was changed to public key. But it's, I think it's helpful just to think about, pay to public key because this is a very, a more simplified version.

And if we can understand what was the thought process was, is Bitcoin is the system that's built on this, Key infrastructure, right? This idea that you have this public in private key pairs, right? And everything's built up upon that. So the idea is originally as we walk through these transactions, you can think of maybe the way Satoshi was thinking about this is Okay.

I have a public and private key pair. I'm keeping that private key private. That public key is public. And if someone wants to send me Bitcoin, they essentially send that Bitcoin to my pub key, right? It lock it to my pub key. And then once that Bitcoin is locked to my pub key, the only person that can spend it is me because I have the private key associated with that pub key and that key.

and the only way to spend it's to have the network agree that this is a valid transaction is if I produce a signature on that transaction that we can all validate came from the private key associated with that pub key that the Bitcoin is locked to. So that's basic idea of, how this simplified form or the most simple form of Bitcoin transactions work is that we just all have these pub.