Welcome to Lecture 4 where we'll talk about how we store and use Bitcoins in practice. In section 4.1 we'll talk about the simplest way of storing Bitcoins. And that is simply putting them on a local device. Now, just to review, in order to spend a Bitcoin you need to know two kinds of things. First of all, you need to know some information that's stored on the public blockchain. You need to know what the identity of the coin is and how much it's worth for example. And along with that you also need to know the secret key of the owner of the Bitcoin. Presumably that's you. Now if you think about it, the first piece of information, being on the public block chain, you don't need to worry too much about how to store it. Because you can always get it back when you need it. But the secret signing key is the thing that you'd better keep track of. So in practice when we talk about how you store your Bitcoins, what we're really talking about is how you store and manage your keys. And that's going to be the main topic when we talk about how to store Bitcoins. So really this lecture, which we titled How to Store and Use Bitcoins, might as well be called How to Store and Use Secret Keys, because that's really what it's about. Okay, now when figuring out how we're going to store and manage our keys, there are three goals that we have in mind. The first goal is availability. You want to be sure you can actually spend your coins when you want to. The second goal is security, and that is that nobody else can spend your coins. If someone gets the power to spend your coins, they could just send your coins to themselves, and then you don't have the coins anymore. The third goal is convenience, just that whatever you do it's relatively easy to use. Okay so the simplest approach to managing your keys, what to do with them. Is just to take the key and store it in a file, and put that file on your own local device. On your computer, on your phone or on some other kind of gadget that you carry or own or control. In evaluating that method against our three goals, well for convenience it's great. Nothing, really nothing could be better than to have say an app on your phone where you could push a button or swipe something and spend your Bitcoins. So for convenience it wins, but when it comes to availability and security, storing things on a local device in a simple way is not such a great idea. And the reason is first when you get to availability that your key, your coins, are no more available than your device. That means that if you lose your device, if your device crashes and you have to wipe the disc, if your file gets corrupted or something like that, you're out of luck. The key is lost, therefore your coins are lost. Similarly for security, your keys therefore your coins, are just as secure as your device. If somebody managed to break into your device to compromise it, if they can put malware on your device, a virus or something like that then they can get the key, leak the key to themselves, and then send all of your coins to themselves. So although storing things is very convenient and very simple it really isn't up to the task for availability and security. And the way to think about this is, this is a lot like carrying around money in your wallet or your purse or in your pocket. It's useful to have some spending money but you don't wanna carry around your life savings because you worry that you might lose it or that somebody might steal it. And so what you typically do is store a little bit of information, a little bit of money in your wallet, and keep most of your money somewhere else. Now in order to do all of this we typically, if we're going to follow the local storage approach. We typically use wallet software, and that's just software that manages all the details of keys and makes things convenient. It keeps track of your coins, it gives you a nice user interface. If you wanna send $4.25 worth of Bitcoins to your local Starbucks, the wallet software would give you some easy way to do that. And, by the way, if you're using wallet software, once you're using software to manage keys and such, it's a nice trick, it's a useful trick. To use a whole bunch of different addresses, a whole bunch of different keys. So rather than taking all of your coins and paying them to one address and controlling them with one key, you can have a separate address, a separate Bitcoin address and a separate key for each coin. That keeps things separated so that you get a maximum degree of anonymity or privacy. And you don't need, as an individual, to worry about the management of all these different keys and addresses. Your wallet software takes care of it for you, and just gives you a very simple interface that says how much is in the wallet, and lets you spend it. The wallet software figures out all the details of which keys need to be used, and how to generate new addresses and all of that stuff. So one thing you need to do if you are going to be able to receive Bitcoins in payment into your wallet or spend them to somebody else, is you need to have a way of exchanging an address with somebody. So you can give them an address or receive an address so that payments can happen. And there are two main ways that addresses are encoded or conveyed in this way, the first one is as a text string. And the second is as a QR code. So as a text string what we do is we take the bits of the key and we encode it as a number in base 58 notation. And then we use these 58 characters to encode the digits in our base 58 notation. So what this is basically is it's all of the digits in capital letters and small letters, except that they've taken out a few that might be confusing or might look like each other. For example, capital O and zero are both taken out because they look too much alike. But other than that most of the characters are here and you can encode in first in base58 notation and then using this alphabet. The second method for encoding a Bitcoin address is as a QR code. Something like this, this is a simple 2D bar code. And you can do something like point your phone at this, take a picture. And your phone can scan it and recover the bits of the address. And so this is the sort of thing you might use for example in a store. Or if you want to have a phone to phone communication. My phone might display a bar code like this which is my address on it and your phone might take a picture of it in order to get the address. So this down here actually is an active address and if you'd like to give me some Bitcoins, feel free to do so.