 Okay, awesome. Thank you, Mike. All right. So we're sharing screen. So we are going through Unit 6. And this one is all about... Hold on, am I on the right? There we go. Unit 6 is all about... Well, the topics covered in Unit 6 are what a node does, who runs a node and why, and the functions of a Bitcoin wallet. And that's what we'll be focusing on today, wallets. And then finally, after all this talking about Bitcoin, we get to set up today our own Bitcoin node. We'll do that in reg test, and we'll talk about what that is again. But we get to set up our own Bitcoin node, run the software, and try some commands out for ourselves. So that should be fun. And as always, this is an opportunity for you all watching to get your questions answered. So please ask all the questions as they come up, whether they're questions specifically related to Unit 6 of the course and the material we're covering today. But if you have any questions from your reading of the course, or from anything that we're talking about here today, please ask all the questions, and we'll break regularly to answer them. If we get all the live streaming software sorted out so you can post those questions. Okay. All right. So let's get rolling with this. Let's first talk about wallets. All right. So here we have a wallet. And yes, we'll do storytime here. So this is the first implementation or the early implementations of Bitcoin, right? So I'm thinking back to when I first got into Bitcoin, it was the software that, right? I installed on a Windows computer that I was running at the time. And it was Bitcoin QT. And there was this, you know, program that would pop up that is Bitcoin. It had user interface. And it was running a wallet in it, right? That was sort of my first Bitcoin wallet was the Bitcoin Core software. And from there, I could, you know, receive Bitcoin payments or send them out. And it had a wallet. But this is a very old school type of wallet called J, we like to call JB okay, or just a bunch of keys, right? And so this is a sort of graphical representation, right? Of what that type of wallets, you know, like what this might look like. Obviously, it's, you know, doesn't quite look like this in code. But this is, you know, a way if you can think of the wallets that was included in the first, some of the first versions of Bitcoin. And it looked like this. And we've talked already at length about key pairs, public and private keys. But what would happen is the Bitcoin software would generate when you started it up, it would, it didn't already, you know, have that wallet file. The file that I remember correctly was just called wallet.dat that you could find if you went digging through, you know, where that program was stored on your computer. And it would just generate 100 private keys, right? And chuck them in that file, the wallet.dat file. And then from there, it would use those private keys to derive public keys. And then from those public keys, it would derive addresses. So when you start up the Bitcoin software, it creates 100 private keys, right? Chuck them in this wallet.dat file, which you can think of like this. Imagine that there's 100 of these keys, right? And then when I say I want to receive some Bitcoin, I would generate an address, it would generate a corresponding public key for one of those private keys, and it would generate an address, give it to me. I would give it to someone who wanted to send me some Bitcoin, I would receive on the Bitcoin blockchain, there would be Bitcoin locked to that address, right? And if I wanted to spend that Bitcoin, right, then I would have to produce a signature from the corresponding private key that is stored in my just a bunch of keys wallet, right? And so how you would back this up, right, was not very user friendly at all. Actually, I had this, I ran into this the other day, I had this fabulous little necklace, which was like this horribly gaudy thing with like these fake gemstones on it, but it had a USB stick in it. So I thought this was quite cool to have a necklace with a USB stick hidden in it. And I would use that to back up my Bitcoin wallet. So you just plug it into my computer and I would do copy the wallet dot that file and then drop it into my little USB necklace. This is not a good way to back up a wallet. This is right a lesson on what not to do, but thankfully I got away with it at the time, right? So I would just grab this wallet file that had all these private keys stored into it and just drop it onto this USB stick on this horribly gaudy little necklace, right? And that was my backup. Now, this is a horrible way to back up a wallet, right? Because what the Bitcoin course software does is it tries to care about privacy. And so it won't reuse addresses. So every time you want to receive, whether there's a change address coming back to you, it'll generate a new private key so that it can generate a new public key and then just generate a new address from that. So it kind of rotates through these keys. Maybe let's say key number one in this 100 key file that originally received some funds, right? But then something went out, something came back, all these sort of transactions going on and each time I do something, it will generate like send those funds to a new address associated with a different key. So after say 100 transactions, if I, when I started this program up, if I took in that wallet.dat file and copied it onto my dodgy little backup necklace, then after say 100 transactions, all that value has moved to a completely different set of keys and my little backup on my USB stick is no longer valid, right? All of those keys, those private keys that I had backed up no longer hold any value. So as you can see, this is a big usability issue, right? Because thankfully it did not happen to me, I got lucky there, but very easily could have happened to me where I thought I had things backed up, but I come back months later, plug it in and all the Bitcoin software reads those keys and corresponding public keys and addresses and says, hey, there's no value associated with any of this, right? Very easily could have happened. So this is a JBOK wallet, just a bunch of keys wallet, and you can see it has a lot of usability issues for it because it is just the file that holds some private keys and the value rotates, you know, from older private keys to newer private keys. So this is a usability disaster. So let's talk about some of the upgrades that have been made to wallets over the years in Bitcoin to get to really much, much more usable software. All right, so this is what we started with. And then we moved along to deterministic wallets. And this is where we get seeds. And we'll talk about wallet seeds a bit in the discussion here today. But of course, in the course, we read through chapters for mastering Bitcoin on wallets, which really gets pretty in-depth, so we won't cover that in all the detail that it covers in the book. But the idea is that you can take the seed, right? Which is, you know, information, right, that includes sort of a private key. It's a bit more complicated, but you can take this seed and from it, you can create this private key and a thing called a chain code, which is like another bit of information, a bit of instructions, right? And from that, you can say, okay, I'm going to generate one private key, but then I can keep using this chain code to determine this pattern for how I'm going to generate another private key, another private key, and another private key. And if I have that seed that tells me the starting private key and sort of the pattern, the recipe for generating all the subsequent private keys, right? So this is a method usability improvement, because then what you can do is instead of backing up just a file with a bunch of a random set of private keys, you know, just backing up that file, which, you know, is going to expire if you use those keys too often, right? Instead, I can take a seed, right, and I can back up that seed. And I can come back, you know, theoretically many years later, and that software will know how to read that seed, determine what was the starting, you know, private key, what is that chain code, right? The recipe for deriving subsequent private keys and can go through the process of deriving all those keys and searching for value stored at all the addresses associated with those keys, right? And this is a dramatically improved way to back up wallets, right? But it gets better. So we started with just a bunch of keys wallets, then we go to deterministic wallets, and then we get even more sophisticated when we get into hierarchical deterministic wallets, right? So here now is the idea that instead of having just a seed that you can use to derive these keys from, you can derive them but in this sort of patterned way, rather than just this sequence, which you can kind of see here, but you can do it out in this whole patterned fashion. Obviously, there's a lot of math that goes into this, and we're dramatically simplifying it just by showing you this picture. But this is the important part for you to remember if you're someone who's going to be working with this software as opposed to actually building the cryptography of a wallet, right? So here with hierarchical deterministic wallets, we again start with that same seed, but then we create a master key, and then that master key can have a whole bunch of children. I think it's four billion, right? So that sort of parent key can then go and have four billion child keys, and each one of those child keys can have four billion grandchild keys, etc. So you get this massive tree, right? This incredibly large tree where we can have all these different keys, all starting from this one seed, right? So that's really, really powerful. Then if I back up just that one seed for an HD wallet, then I can store that, right? So perhaps my dodgy USB stick necklace, one of the better ways to do it, please don't do that. And then years later, theoretically a decade later, I can come back and if there's some software, Bitcoin wallet software that's still compatible with that version of that seed, I can recreate the entire wallet that I had off this one seed. So that's really quite cool and quite powerful, and let's talk a little bit more about what this does. And of course, I'll check in with Mike to see how the tech issues are going and to see if we have any questions at this point. Sorry about that. Yes, hopefully our tech issues are resolved. I can see some people in the chat. So I think you found us. I'd like to apologize for pushing out about three or four wrong, wrong links before we got the right one, but I'm not seeing any questions right now. Obviously, if people are joining us later, you can obviously go back and watch the part that you missed and ask a question about that later or leave a comment. And we'll see those comments later, but I'm not seeing any questions right now. Hello people in the chat. Hello to people from Chicago. The Windy City. It's pretty windy here also. Not as windy as in Chicago. Yeah, yeah, Chicago. Chicago weather. That's a topic for another day. I will do another, I'll do just a very short recap. Anyone for anyone who's just joining. So we're talking about wallets today. We just discussed just a bunch of keys wallets, which is sort of the original implementation of a Bitcoin wallet and one of some of the original versions of Bitcoin core, which is just this file. So I believe it's called wallet.dat, if I remember correctly, and it was just a collection of private keys thrown in there. Of course, backing things up this way becomes a very big issue because Bitcoin would rotate through private keys and move value, you know, from being associated with one key to being associated with a different key. So if you had backed this up with the original set of 100 keys and then did 100, 200 different transactions and then tried to use that backup, all the keys you had on that backup, well, all the value was then rotated off those keys onto different keys so that backup was now worthless. Big problem. So then we moved into deterministic wallets where we have a seed and we can use that seed to create sort of a private key and then a recipe for deriving subsequent private keys and you can have that one seed which backs up, you know, just an incredible amount of private keys from there, which you can recreate following that pattern derived from that seed. And then we get into hierarchical deterministic wallets where you have this seed, again, which creates sort of a parent key which can have 4 billion child keys with each of which can have 4 billion grand child keys, et cetera, et cetera, et cetera, massive collection of keys. So dramatic improvement from a usability perspective, we can back up just this one seed and from there we can hold on to that, you know, for an indeterminate amount of time and come back even if we've done all kinds of transactions and moved funds around from all sorts of different keys. As long as there are keys that are inside this tree created by this one seed, then we can hold on to all that value, back it all up with just this one seed. So huge usability improvement. But let's talk about it a bit more. Again, we're not going into all of the math because the book covers some of that, the Mastering Bitcoin book which we use in portions of the course. So we'll just cover this more from a broad perspective, understand, you know, the different pieces and what's happening here. So here we can see what's going on there. Let's look at the seeds. So we're going to talk about a number of the different bits, right? Bits, of course, the Bitcoin improvement proposal is the way to type up a standard for something you want to add to the protocol, right? And this is bit 39. And I generally really stink at memorizing bit numbers, not my specialty. But just often you don't really need to but when it comes to wallets, this is the one case where you do kind of want to memorize some bit numbers because there are some four different bits which really sort of creates the current modern, you know, standard for Bitcoin wallets and you want to be aware of what those do. So this bit 39, it creates a mnemonic, right? So this is generally 12 or 24 words, which is a way to encode the seed, right? And so the book, this chapter in the book walks through this, but this idea is that you would, you know, use some software to create some, you know, entropy and then you would get these 12 to 24 words, right? So you would take that way to just, you know, encode this data. You would pair that with assaults. So either the word mnemonic or if you wanted to add a password to this wallets or this backup, right, then you can add that. These two things are combined together. They go through this key stretching function, which is basically just a whole bunch of hashing. So 2048 rounds of hashing, that's a lot, right? And then you finally get this 512 bit seed, right? So then from there, you, from that seed, you drive your parent key and all the subsequent child and grandchild keys, et cetera, chain code, all this complicated stuff happens. But what's really interesting to note about here, is you can have the same seed but different passwords that you use with it that would get you different needs, which have sort of essentially different wallets. So that's really interesting. But this is basically how it works. You start with this mnemonic. You add this solter, this passphrase. You do this whole key stretching function. You get spit out with the seed at the end, right? And from that seed, you can then derive this entire tree of private keys, associated public keys that you can use to move funds around on. So this structure gets interesting and has a lot of useful things to it and we'll walk through some of that. Now, here's something that even if you have no intention of getting into the actual nuts and bolts of the cryptography behind HD wallets and dealing with this stuff, here's something that you definitely need to be aware of, which is the derivation path, right? This is Bip44. Again, a Bip number you should probably have memorized. We're going to memorize some Bips. These are good ones, 39, 44, et cetera. All right. So the idea being is if we think about this, right, and we know that each that master key, right, that parent key can have four billion children and each one of those child keys can have four billion grandchildren, like that's just this, I mean, the human brain can't quite grasp how big of a set that is, right? So given that it's that big, if we just go and randomly store some funds there, that tree might be so big that our funds could get lost in that tree, right? And so we have to have derivation paths and they're sort of standard derivation paths, right? So that's like saying we're going to take this path, if it's a Bitcoin wallet, we're going to take this specific path. We're going to go first here, then here, then here, we'll get two into the weeds with it, but the idea is that this tree is so big we have to know your wallet has to know where to look for those funds. So if I start with one wallet, right, if I start with Alice's wallet, Alice made a wallet and I'm using the Alice wallet and I'm done all kinds of transactions and this Alice wallet created this whole tree of keys for me, but it placed, it used keys along a very specific path in that tree, right? And then at some point I want to stop using the Alice wallets and I go to use the Bob wallets and so I take my seed, right? And I just import my seed into the Bob wallets and the Bob wallet says, has an option for that. Would you like to import seed? I say, yes, I would. Here's my seed and then it goes and says, okay, let me see how much money you have stored at those seeds and I will add that to your balance in the wallet, right? Now the Bob wallet, if it doesn't know where to look on this just amazingly large tree, then it might come back and say, I don't have any money here, right? And it's gonna be a big problem. This has caused a lot of panic. People are like, oh, where did my money go? And the money's still there. It's just that perhaps the Alice wallet and the Bob wallet were using different derivation paths, right? They were using different branches of that tree, right? This is something to definitely keep in mind. This is also why it's important to use a wallet that complies with these standards. So if we all use the bit 44 standard, if the Alice wallet and the Bob wallet are using the same derivation paths, the same paths on that tree, then there won't be any issues. I can take my seed from Alice's wallet, import it to Bob's wallet, and Bob's wallet will be able to read and see all the funds exactly on the branch of that tree where that wallet was expecting it, right? So let's have a quick look through what this is. We start with just this M, then we have the purpose, coin type, account, change address. So let's just walk through it. Real quick, Hannah, we had a question down here about the wallets. The question is, so these wallets are actually key chains? Key chains? Well, I'm not quite sure what they technically mean by key chains, but yes, it's a collection of keys or more like the recipe to recreate those keys. Yeah, well, let us know down in the chat if that answered your question, or maybe you can clarify a little more what you mean by key chains, and we can come back to it. Yeah. Yeah, and I'm thinking of, I'm first probably thinking of, you know, talking about ways to store keys in other systems. Excellent. Cool. All right, so let's walk through derivation paths because if you dig into wallets, if you work with them, this is something you'll be seeing and definitely something to keep to be aware of because you could potentially or hopefully not so much these days, but if you have wallets, they're using different derivation paths. You could wind up with someone thinking that they lost all their funds, but actually the funds are totally there. They're just in a different part of the treat and their wallet is looking at. All right, so we start with M. The purpose is for a bit 44 standard is always set to 44 to signal that they're using the bit 44 standard. All right, the next one here is coin type and specifies which coin this branch of the wallet is used for. So we can use zero for Bitcoin and for example, Litecoin is two. So this is really cool because it also makes it possible to have one seed which backs up coins from differing protocols, right? So Bitcoin, Litecoin, et cetera. I can't remember which other ones off the top of my head that comply to this standard. But if you have other coins that use the same structure, use the same method, use the same standard, then you can have one seed which backs up a number of different coins on different block chains which is really pretty cool. But you have, so here's an example, Bitcoin is zero, Litecoin is two, and we would store that in this sort of second, third branch in this path, right? All right, the next one is account and this allows the user to divide their wallet for organizational purposes, right? So for example, one branch for different divisions of an organization. This probably doesn't get used that much unless you really have, you know, I'm sure some of the larger exchanges and more sophisticated setups would use this, your average, you know, user that has like a hardware wallet can talk about in a minute. Probably doesn't really need different accounts, but you might, right? And certainly your, this standard, that would be available to you to have these different accounts set up. Okay, and then we have the change level, which has two different subtrees for receiving addresses and for change addresses. Because, you know, we always, use a large UTXO with more funds that we want to send out, we have to send a change transaction or outputs a UTXO coming back to us. So that's where that would be taken care of. And then we have the address index, addresses are numbered from index zero, sequentially, in sequentially increasing manner, this number is used as child index in 532 derivation. So again, there's some details there. The takeaway is, for this stuff, we'll talk about the X Pub in a second, but the takeaway is, remember these BIPs, these are important. These are, you want to use wallets and work with wallets that comply with these standards. So you don't wind up with situations where funds are lost on some branch of this massive tree because they just were put in a non-standard place, right? Keys from a non-standard branch of that tree were used. All right, before we do questions, let's cover one more thing, which is a thing that if you work with Bitcoin in sort of an e-commerce type setting, there are lots of different situations you might run into an X Pub key, right? So again, from unit stakes, we talk about driving different keys and some keys are hardened and we won't really talk about the map and what that means. It just means they're sort of more, I guess we will, means they're slightly more secure. You can't let the chance of you being able to walk back up the tree if you discover this one's private key, et cetera. So it provides a bit more security, but one thing you can do is create something which we call an X Pub key. So you can go through this branch and then say, awesome, you know, obviously this is simplified. Let's say this one over here, we're going to create that one. We're going to take the public key from that and we're going to use that as an X Pub key. We're going to create an X Pub key. So this is a public key and where this gets used a lot, if anyone's familiar with or used a program called BTC Pay Server, a good example there is BTC Pay Server is e-commerce software for Bitcoin, right? So it's free open source software that you can use it like a payment processor. So you can add your e-commerce website, you can set up BTC Pay Server and that's going to handle processing Bitcoin payments for your e-commerce website. And what you would do when you do the setup process is it'll ask you to copy in an X Pub key, right? So I'm going to take a public key from this whole setup, specifically formatted ones that creates our X Pub key and I can copy, paste that right into BTC Pay Server and what BTC Pay Server can do with that X Pub key is use it to generate more public keys which can be used to generate more addresses. So BTC Pay Server in that scenario doesn't need to have knowledge of any private keys at all. All it needs is this X Pub key and it can keep deriving more public keys and turning those into more receiving addresses. So you can receive funds. So that's super cool. You can have this e-commerce website in this payment process, this Bitcoin payment process or running and it only has a public key so no one can steal the funds even if they get access to your server. Don't want to have that happen. But even if they did, they wouldn't be able to steal funds out of your wallet. But still every time BTC Pay Server generates a new public key and associated address and someone sends funds to that, it's like those funds go straight to your wallet even though your wallet isn't online. So it's a really cool setup and you'll see this. You'll run across this if you're working and a lot of sort of e-commerce scenarios definitely make use of X Pub keys if you're doing those on-chain transactions. So that's super cool. We kind of ran straight through this, this wallet stuff. This is really important stuff to know if you're going to be working with Bitcoin wallets. A couple more things that we're talking about before we do questions is just a few more categories of wallets that are just vocabularies and categories that you should be familiar with when working with this tech. So let's talk about this between a hot wallet and a cold wallet. And simply this is a hot wallet is any wallet where the private keys are stored on a device that is connected to the internet. So if I have a Bitcoin wallet on my smartphone, my smartphone is pretty much always connected to the internet unless I'm on an airplane or something, this thing's connected to the internet. And so I would have private keys on here on an internet connected device. This is a hot wallet, right? In contrast, a lot of people use these hardware wallets. This is a Trezor. It's one of the original hardware wallets. And that has the private keys stored on some chips on there. You never directly connect that to the internet. Sometimes you would connect it to your computer to sign a transaction, but the private keys are like on a different chip than the other key, which is talking to your computer. So the whole idea is to keep private keys away from the internet, right? So that even if someone does manage to hack into your device and gain access to a device of yours, those keys are still kept away from the internet so someone can never remotely access them. So this in roughly is how we distinguish between hot and cold wallets. One more before we do questions is custodial versus non-custodial, right? So I can have different types of wallets. If I have a wallet that I download on my mobile phone where the keys are actually stored on this device, in a chip somewhere on this device, then this is non-custodial because it's in my control. I own it. I control the keys. Well, in contrast, if I set up an account with someone and maybe I can access that account via my phone, but the keys are actually held on, you know, maybe Alice has a custodial service and she has a wallet which I can download from an app store and access. But the private keys are actually held on Alice's servers. Then that is custodial, right? Because Alice is the custodian of my keys. So these are just two distinctions when it comes to functionally working with wallets that we definitely need to keep in mind if we're going to build, you know, any software solutions using Bitcoin wallets. So that was a lot. Let's now pause and see if we have any questions. I'm sure thing. We got a couple of questions here. First one we have here is if I have to restore my backup from the seed phrase, does the new wallet have to generate all of the keys and search the blockchain for UTXO for each key or when would it stop searching? Okay, great question. So there are certain standards and maybe every wallet might implement it a bit differently, but basically you got the idea correct is that if I import my seed from Alice's wallet into Bob's wallet, Bob's wallet is going to take that seed. It's going to use the standard derivation path or whatever method that Bob's wallet is using. We hope it's the standard path, right? And it's going to recreate all of the seeds along that specific path. It's going to then look for addresses and it gets a bit more complicated, right? There can be more information that gets transferred over. That's another discussion. But basically, yes, it will then go and say, okay, these are the addresses that this wallet would have received funds to and I'm going to go search the blockchain to see if there are any UTXOs that have locked funds to these addresses. So it would search exactly that. And I can't remember offhand what sort of a standard is for how long it will keep searching, right? How deep into that tree does it go? But I know there are some wallets. I believe the Electrum wallets, people a lot of time use for wallet recovery because it has a lot of bells and whistles and you can import a seed into Electrum and then you can tell it, I want to use this standard derivation path and maybe I want to use a very weird derivation path that this other wallet is using and I want you to search this deep into the tree, right? So you can give it explicit instructions on how deep into that tree to search. I'm sorry. You cut out there for just one second. You just said explicit instructions. I think the word explicit might have just got cut out. Did you say anything in between there? No, I'm just saying for some wallet recovery programs, you can give them explicit instructions on what part of the tree to search and how deep into the tree to search. So if you suspect there's funds in a seed, in that tree that is lost somewhere, you can go use some recovery software and tell it exactly how to search that tree to look for those ones. All right, awesome. You got a thanks there. So I think that answered that question and we have another question here about old wallets. Could a vulnerability ever expose in a cold wallet via USB slash with an exploit using the USB protocol? Okay. So could you connect a hardware wallet to a device that somehow is going to pull that data out of that? I mean, I want to say no, but it's like that's a whole branch of study all itself, right? And the people that dig really deep into this, but the idea is inside these wallets, there's actually like separate chips, right? And on this chip set over here is where those private keys actually are. And on this chip set over here is the chips that are communicating with the computer, right? So talking to that USB port, right? So I mean, theoretically maybe, but the people who designed these hardware wallets really have this type of thing in mind and really thought long and hard much more than I have, right? About how to prevent exactly that sort of thing from happening. So some really smart people have gone and done a lot of work to prevent that type of thing. So I want to say the odds of that are going to be pretty low, right? I generally don't worry about that. All right, great. Well, I'm not seeing any other questions right now here in the chat, but of course, if you have them, if you go along, feel free to leave them in the chat. Yeah. Drop questions anytime. And I believe now, apologies, I left my dog upstairs and she's attempting to dig a hole in my couch. I know you do. I can't hear that. I don't think we can hear. Okay, cool. All right. Now we are going to do the dangerous parts of the presentation today where we're going to attempt to do a live demo and we're going to set up a node. But I hope some of you will follow along because if you've been following the course to this point, we've been talking about Bitcoin and talking about it and talking about it. Now we get to actually use it. We get to set it up the software and use it. So let's get into that and we'll see how we go. All right. So what we're going to set up today are what these set of instructions are for is setting up what we call a reg test node or a reg test node, depending on how you want to say it. So we talked about this briefly in the previous session, but let's cover it again today because it's rather important. There are different Bitcoin networks. So there is the mainnet, which is real Bitcoin. Bitcoin actually has value that you want to store in a really good wallets that meets with all the standards and back up properly, et cetera. This is real Bitcoin on the mainnet. Then we have a copy of the mainnet. Well, it branched off from the mainnet long ago, but it's running the exact same software. It's just a different set of nodes talking to each other. And this is the testnet. I highly encourage you to use it when working with the software. Please make lots of use of the testnet. This is exactly what it's for. And so you can run the exact same Bitcoin software, but just on a network where if you accidentally wipe your wallets, if you send a malformed transaction, right, you're not actually losing thousands and thousands of dollars in Bitcoin, it's just testnet coins. And we try not to use the testnet coins because we try and give them around to other developers and share them so we can all test our stuff. But stakes are much, much lower on testnet, right? So it's exactly the same software, but a different network. We're talking to a different set of nodes, right? So there's some separate blockchain, right? It's a separate chain with different data. All right, so we can use that. But what we're going to use today is reg test. And this is always where I recommend you start. So start with reg test, then work up the testnet. Then once you launch, then you go mainnet, right? But what reg test is, is again, the exact same Bitcoin software. But instead of talking to other nodes, you're basically only talking to yourself, right? It's a one node network. And you can also, some places I did, we played with this in the office where we have a number of different computers in the local office network all on the reg test. And so we had like our own, you know, four or five person Bitcoin network like running just inside the office. But basically it's, you get your own blockchain, right? So it's the exact same software, but you get your own, your own blockchain. So you're not talking to other people on the public testnet. And certainly it doesn't have any real value like the mainnet. But it's a great place to start to play with all of this stuff. You can just mine your own Bitcoin, right? The difficulty is very, very low. You can just give yourself, you know, 500 Bitcoin, right? And just play with it. And, you know, hopefully we'll do today's, we'll get to actually go through setting it up and then create transactions, you know? And so it really lets us look into the guts of the machine in a way that's really easy to get up and running and is very, very low risk, right? You can just wipe it and start again tomorrow, no worries. Okay. So let's dive right into it. Now, the best thing to do for this example here is we're just going to download a binary, right? From Bitcoincore.org, right? Just download it, find which is the right one for your operating system. I'm demoing everything here on my local machine, which is Ubuntu, I believe 22 is what I'm running. So this is what we're going to just download a binary from there. I've already done that a few weeks ago. So it's already on my computer. So I'll skip demonstrating that step. So you're going to get like a zip file, you're going to extract those files, and then you need to install, right? So here's the command that works well on my computer, right? And because I've got Ubuntu 22, obviously if you're running a different system, you might have to adjust this, but we can just look through it, right? So you go, I'm going to install, I'm going to make these the permissions. I'm going to put it in user local bin, and this is the file that I'm putting there, right? And so what that should do is install a bunch of these binaries on our machine, and we'll look at that. And second, we also need to create a config file, and we're going to come back to this in just a second. But first, I want to tell you that what we are demonstrating here is not in the slightest bit of professional setup, right? So I've set up many nodes, you know, for a professional setting, for some sort of enterprise solution. And what we're demonstrating now is definitely not a professional setup, right? A lesson. Were we doing a lesson on a professional setup? It would cover server configuration, SSH keys, firewalls, configuration files, system D setup notifications and alerts, backups, blah, blah, blah, blah, blah. We're not doing any of that here, right? This is a disclaimer. If you want to set this up professionally, this is not the route. Different ways to do it. But this will get us up and running so we can get familiar with how to work with this software, how to interact with Bitcoin Core, which is our goal for today. Okay. So let me get situated here about my terminal open, all kinds of different stuff going on. So we want to, okay, we're at the point of configuration file. All right. So let me move this here. Mike, can we see my screen? Is this? Yes, you're good, right? Right there. We got a full screen. I'll get you a little out of the way. We're all good. Okay, hold on. Let me just put it right about, oops. Hold on, hold on. Right about here. So here's where I have all the stuff on. You can see I previously, my computer's like half in English, half in Spanish, January. I downloaded that January 30th. And so there's, that's I've already gone through the, the step of, you know, moving it to user local bin. Let's go here. Actually, let's see if I can, let's see if we can look at that. There we go. You see, I have some binaries installed, Bitcoin command line interface, Bitcoin D, Bitcoin QT, which is sort of the user interface which won't be using transaction stuff, utility stuff, wallet stuff will be making use of this. Et cetera. So we can see that that is, this is the command that we got. That's successfully installed. Now the important part is you want to set up a configuration file. So I'm in my home directory here, the way in which I have set this up, it's going to, when I start the software, it's going to look for a configuration file in my home directory. Right. And it will start trying to put all the blockchain data in my home directory. So we want to, if I do this, because I've already run this once, it should, yep. Here is, it's this dot Bitcoin file. Right. So let's go on there. And here is this config file. So let's have a look at this. Now, again in a professional setup, like this would be a massive file with all kinds of different stuff going on here, because we're just getting familiar with it. We're just telling it, hey, we don't need the UI, right? We're just running the Damon and very, very important. We are running on reg test, reg test equals one. Very important that you set this, because if you don't set this, it's going to assume that you want to download the entire mainnet blockchain, right? Which is massive. And probably your laptop doesn't have enough space for it. And you're just going to clog up your whole computer and break things. So please be careful that you do set this configuration file and set the reg test equal one. Also, when you started up on the command line, I believe you can add a flag to tell you you want to run on reg test, but this should be sufficient for what we're doing here. Okay. So we've got that going. Let's see. Go through our instructions. I'm cheating. I have a little screen over here, but we can come back to this. And go here, right? Okay. We're just going to start Bitcoin D. Oh yeah. I'll use my favorite command. There. I'm just going to copy my favorite command. Because I use this one constantly. Okay. All right. Where did now? All right. Yeah. So right now we have the slide underneath your. Bitcoin. Yeah. We got it. Okay. So now I'm going to start. Bitcoin D. Boom. Bitcoin core starting. Excellent. Let's just come back here. And then I'm going to type in my favorite command. That I can actually never remember. I always have to copy and paste it even though I use it three times a day. Hold on. There we go. And we can see that Bitcoin D is indeed running. Right. Excellent. And these are the ports that we would expect. So excellent news. All right. So now that we've done that. We want to run some. Bitcoin CLI commands. And let's start with just dash. Get info. Oops. That's not a dash. Boom. Okay. So again, we're on reg test. Right. And so this is how we know that we've successfully started it on reg test because it's telling us we don't have any blocks yet. Right. Because we haven't created any. So what we're going to do is. We are going to. So now we've got it set up. Right. So that was pretty quick and easy. Right. We followed along. Congratulations. You now have a Bitcoin node. It's on reg test, but you got a Bitcoin node. Now we're going to set it up a little bit. I have, um, as we walk through these steps, I have just another little text document over here while I'll be copying and pasting addresses, et cetera, to form these commands as we work with them. Um, Mike, I think we might go a little bit over. Is that okay? Cause we started a little late or should I aim to cut it off? Right. Um, that's fine with me. Um, I got, I got the time. I assume I assume people don't want us to ground that the recording will be. They can go and watch the recording later. Okay. Cool. So we'll go, I think a little bit over the top of the hour. Okay. So first thing I'm going to do here is just create a wallets. We have a nice wallets. I'm going to, um, get a new address. Right. So we want to, the idea here is to experiment with some of the wallet functionality and then we're actually, I think in this one we're going to construct a transaction, which will be fun and look at how we do that. All right. So let's say please generate a new address for me. Now we talked all about data formats. If I remember correctly, this is a reg tests, um, segwits formatted address. We won't dive into that too much at the moment. Okay. So I've copied and paste, um, this address. Now I'm going to do get block count because we're on reg tests. What do we think the block count is going to be? Let's see. Zero. Right. Cause we're the only computer here. We're the only node and we haven't mined anything. So obviously, uh, there are no blocks. So we're going to use this command, which I think we demoed briefly, um, in the last session where we're just going to, um, this is a command. We're saying gash red chest generate to address. So what I'm doing is I'm saying, hey, go mine some blocks, um, because the block reward is the block difficulty, the mining difficulty levels incredibly low. I'm going to very quickly and easily mine these blocks. And I'm going to give myself that coin base reward. It's going to go straight to this address. So basically I'm going to give myself a bunch of Bitcoin right now. Here we go. Boom. Okay. So here's some of the blocks. I'm just going to, this one looks nice. I don't know. We'll go with the one that starts with four. That's my favorite number. Okay. Cool. There we are. Um, we've generated a bunch of blocks. So now, but let's go back and look at this. Let's go to. Get info. Okay. So now we have 10 blocks. But our balance is zero. Pop quiz. Does anyone know why our balance is zero despite us mining 10 blocks and therefore getting all the block reward for 10 blocks? Let's see if anyone knows the answer to that. Oh, I'll have to queue up. The pop quiz music. I'll have to get it for next week. We need the jeopardy music going. Yeah. The sound alike. We don't have that kind of budget. Um, But, I'm not currently seeing anything. I'll let you know. Um, no value in these coins is the first. Well, there isn't any value in these coins, but because it's not, you know, there's no value in these coins. I don't know. I don't know. I don't know. I don't know. Well, there isn't any value in these coins, but because it's the same software is running on the main net, right? It should show us a balance, right? So watch what happens here. So I'm now going to generate 101 new blocks, right? Boom. That's a lot of blocks. Okay. Now I'm going to go back to get info. Now there are 111 blocks. And wow, look at that. I'm rich. Right. So we have a number of block links. And we'll talk about the block links directly in the sessions, but certainly in some of the materials. From the course, that coin based transaction, which gives the miners the block reward is only spendable after 100 blocks, right? After a hundred confirmations. And there's reasons for that, which we'll talk about in some of the material in unit eight, right? For why that's done. But essentially. You don't get to use your Bitcoin that you earned from mining until it had the 100 confirmations until it's a hundred So now you know. Now let's go back and do, we just did get lock count. Okay, so here we are. We've covered a lot of this stuff. Let's come back here and look over our notes, right? Okay, we've done all of this. Here we are. Okay, so what are the primary functions of a Bitcoin wallage, right? We talked a lot about wallet. It generates and stores keys, right? Generate to generate and store keys. And we already talked a lot about how it stores those keys and why it's very important to store it certain very specific ways for usability and loss prevention. All right, it constructs transactions. We're going to go through that now and construct our own transactions. It signs transactions with those keys that it stored. We'll also get to do that. And it tracks transactions, right? So if you have like a Bitcoin wallage on your phone, it's scanning the blockchain for you and pulling in relevant data for you and sort of presenting that to you in a human readable format. Here's your balance. And of course, your balance is your balance so much as it's a collection of all the UTXOs it could find that it has the keys to, right? All right, so that's a basic here's what your wallet does. Now we'll go through and try to construct our own transaction, which should be fun. Okay, so we have some addresses. I think I only have one address. So let's generate a new address because we're going to want a couple of addresses here. So there I've generated yet another address for myself. Again, with the same SegWrit wedge test format. Okay. Okay, now we can validate address. This is another fun thing that your wallet can do for you is check on the validity of an address. Remember that base 58 check encoding, right? You can use that here is valid, true, excellent. And here this is SegWit stuff, which is not covered here, but it's interesting. So now we're going to pick a transaction. Because if we recall, we want to create a transaction. So all Bitcoin transactions have inputs and outputs. So if we want to create our own transaction, we're first going to have to select some inputs to use to then create our outputs. So let's list transactions. Wow, we get a big long list here. Let's just select one. Let's see if I can pick out where is the transaction. Here's the address. Here we are transaction ID. Copy. Again, I have this little notepad over here where I'm pasting all this stuff in so I can keep a track of it. Okay, so we randomly selected a transaction ID. Okay, now let's go back here and look at what we intended to do because it's complicated. Okay, a note on transaction fees. Remember that these are calculated from the difference between inputs and outputs. You might actually have a look at that in a second here. All right, so let's construct a transaction. So we'll select to generate two addresses to use in our transaction. Note that we are using two addresses here as we'll need a change transaction. All right, this is what we're going to create. So hopefully I tried to make this readable with different colors and bold and, you know, not bold text. But this is what we have to create over here in hand. It's to our Bitcoin wallet. So I'm going to copy this, but let's talk about those fees for a second and note them. So if I come here and do calculator, boom, there we are. Let's go back here. Oops. Okay, so let's look at this. We're going to use a UTXO, which is going to have 50 Bitcoin associated with it because that's the block reward at the beginning of the chain. That's how the Bitcoin software works. All right, then we are going to send out this Bitcoin, 0.111 to another address. We're sending this to Bob. Let's imagine we're sending this out to Bob, right? And then we're going to send this change address back to ourselves, right? But if we do 50, right, minus 0.111, boom, you'll see that this amount, so our 50 Bitcoin minus this amount, this sent back to us. There's a tiny bit missing, right? So this change is what's coming back to us. So minus 49.888, boom. So there's this little bit of Bitcoin here is not accounted for in this transaction structure. And that is the fee, right? So just that bit that isn't accounted for in one of these outputs that leftover bits is the fee that goes to the miner. In this case, we're the miner, we're all the things because we're running on reg tests. But let's keep that in mind. Okay, so now we have to construct our transaction. This is where we got to slow down and make sure we get it correct. So the first thing I have to do is take our transaction ID. So remember we had that transaction from earlier. So over here on my notepad, I'm copying that into where is the transaction ID. Excellent. We look back at that transaction and scroll back up. Not sure is this hard? It doesn't matter. Like here we'll look and we'll see our amount 50 and the V out, right? The number associated with that output is zero, right? So when I come back and look at this, I need to tell it what the V out is. So that's that transaction. But what outputs am I using from that transaction? Okay, so I'm going to use zero. And I know that's correct because all these transactions that we've done so far are very, very simple. There's only going to be like one output. So it's going to be zero, it's going to be worth 50 Bitcoin. Okay. Now the address we are sending funds to. So I'm going to take one of these addresses that I generated earlier, and I'm going to send the funds there. So I'm now copying and pasting that in. Boom. But we also have to send funds back to ourselves. So we need that change address. So that's why we have those two addresses we created. So again, I'm copying and pasting that into this transaction. Cool. Okay. So if all goes well, the above command will output a hex string, which is the transactions details, details encoded in hex decimal. Okay. So I've attempted to copy and paste on my little notepad here. Now we're going to see if I did a good job of copying and pasting. So let's go here. If I did a good job, we'll get hex a decimal of the output. So fingers crossed. Yes. I copied and pasted correctly. This is the hex a decimal that represents that transaction. So Bitcoin uses a lot of hex, right? So I'm going to come back over here. Put that on my notepad. All right. So that's stored there. All right. So we have this transaction, right? So this is one function our wallet has done for us. It's created a transaction. We've instructed exactly where we want to send funds to what fee we want to include is sort of implicit in what we've done. All right. Now, in order for this to be valid, we have to sign it with one of the keys that our wallet is holding onto for us. All right. So we're going to go with this, this command. And here we are. This command is sign raw transaction with wallet. Very aptly named command, right? And we have to give it that hex string that is our transaction. I can just copy from right here. Again, we are testing my copy and pasting skills. Okay. Let's see how we go. And let's see what output we get. Hey, that looks pretty good, right? Let's go back to check our slides, make sure that's what we are expecting. All right. So now we have a transaction, right? We need to sign it. All right. So this is what we're expecting. We're expecting hex, the hex encoded transaction. Boom. That's what we got. Fabulous. So let's see what our next steps are. Completed true. Yep. All right. Now we have a completed signed hex encoded transaction, but it won't do anything for us until we broadcast it to the network. And it is mined and incorporated into a block, right? So we are going to send the raw transaction, the signed raw transaction. Okay. So this is the command we use for that. And then we need to copy this transaction, signed raw hex transaction. Okay. Now let's look at this. I think we planned for this. Hold on. Okay. To avoid coin base errors, we need to mine 100 more blocks, right? So it might be the case that what we're doing here is trying to spend in outputs, right? That is from a UTXO that is from a coin base transactions that is not yet, does not yet have 100 confirmations. So we just broke the Bitcoin rules, right? We're trying to spend something, a UTXO that is not yet considered to be spendable. So let's see if we can fix this by saying, okay, no problem. Let's generate 100 new blocks so that it is now spendable. Boom. That's a lot. Then we're going to try to send this transaction again. So we got a confirmation, right? So you see what happened there is we had, we were using an input which did not yet, was not yet spendable according to the Bitcoin consensus rules. All right. So let's see what else we got. Okay. Let's get transaction and we'll use this is our transaction ID. All right. So we'll do one last command here just to check on it. I'll copy and paste. My copy and paste thing is going well today. All right. We'll do that. And then this is our transaction ID. Oops, almost messed up my copy and paste. Okay. And here we can see the transaction that's now broadcast out to the blockchain. It doesn't have any confirmations yet. So let's fix that. You see there's that fee that we calculated. So we got that correct. Here we can see what we sent. Here we can see the change back to us. Now watch this. Let's do boom. Generates another 100. Boom. Now let's get this transaction. Go look at it again. 100 confirmations, right? Because we mined 100 blocks. That transaction is in a block that is now 100 blocks deep in the Bitcoin blockchain. Okay. Cool. So we went a little over but we got to complete our exercise and we got to actually use the Bitcoin software and all of its wallets functionality. There we go. So now I can take any questions if there are any in the chat. All right. Yes. Excellent. Thank you again. As always, Hannah for taking us through that. And I'll just vamp as I do for a little bit while we see if there are any questions. And thank everyone for joining us. Remind everyone that this is a supplement to the Sailor Academy's course which you can find on our website and linked below in the description. As well as a link to the previous videos in this series. If you're just finding us now, you can go back and catch up on that. And I just want to of course thank everyone for joining us. A lot of thank yous in the chats. This was awesome. Thanks for the time. Thank you, Hannah. Love stuff in the chat. Thank you, everyone. And not seen any questions. So I'll probably take us on out and unless you have anything else for us here today. That's all. Well, let's go on and I'll see y'all next week. Okay. Thank you for joining us, everyone. And we will see you next week.