Bitcoin For Dummies. Peter Kent

Чтение книги онлайн.

Читать онлайн книгу Bitcoin For Dummies - Peter Kent страница 18

Bitcoin For Dummies - Peter  Kent

Скачать книгу

1L7hHWfJL1dd7ZhQFgRv8ke1PTKAHoc9Tq. This is a real Bitcoin ledger address, by the way; when we checked, it had a balance of 0.10701382 Bitcoin.

      

You can see this address for yourself in a blockchain explorer. (Use this link to get to it: https://blockstream.info/address/1L7hHWfJL1dd7ZhQFgRv8ke1PTKAHoc9Tq.) By the time you see it, of course, the balance associated with the address may be different.

      Now, let’s say this is your Bitcoin, and you want to send, perhaps, 0.05 Bitcoin to a friend, an exchange, or a merchant from whom you are buying goods or services.

      You send a message to the blockchain saying, essentially, “I own address 1L7hHWfJL1dd7ZhQFgRv8ke1PTKAHoc9Tq, and I want to send 0.05 Bitcoin to address 1NdaT7URGyG67L9nkP2TuBZjYV6yL7XepS.”

      If you just sent a plain text (unencrypted) message to the blockchain, there would be a huge problem of verification and validity. How would the Bitcoin node receiving this message know that you do indeed own this address and the money associated with it? You could just be spoofing this information and making it up, right?

      What we do is use the wallet to sign the message using the private key associated with the address. In other words, we use the private key to encrypt the message. Then we take the public key, add it to the encrypted message, and send it all out across the Bitcoin network.

      MESSAGE TO THE BLOCKCHAIN

      How do you send a message to the blockchain? That’s what your wallet software does. In fact, wallet software is less like a wallet — your wallet contains no Bitcoin — and more like an email program. Your email program sends messages across the email network. Your wallet sends messages (about transactions) across the Bitcoin network. More on wallets soon.

      Unraveling the message

      So, the node — a computer containing a copy of the Bitcoin blockchain — receives the message. It takes the public key that has been attached to the encrypted message, and decrypts the message. The node “learns” something: “This message must have been encrypted — signed — by the private key associated with the public key.” Of course, that’s not really saying much. It’s virtually a tautology! By definition, if the public key can decrypt a message, the message must have been encrypted with the matching private key. Whoop-de-doo.

      But remember, the public key must be mathematically associated with the address 1L7hHWfJL1dd7ZhQFgRv8ke1PTKAHoc9Tq. So now the node can examine the address specified in the message, along with the public key sent with the message, asking, in effect, “Is the public key associated with the address?” If the answer is yes, then the node also knows that the private key held by the person sending the message is associated with the address (all three are uniquely associated with each other).

      So, what does the node tell itself? It says, in effect: “This message, sending money from the address 1L7hHWfJL1dd7ZhQFgRv8ke1PTKAHoc9Tq, was sent by the private key that was used to create this same address so the address must have been sent by the person who owns the address and therefore owns the money associated with the address.”

      

We know this concept can be confusing and hard to “get your head around.” So here’s another way to think about it: The only person who could have sent an encrypted message with transaction instructions for this address, along with the public key that originally created the address, is the person controlling the associated private key — that is, the owner of the address and the money associated with it. Thus, they are verifying ownership and validating the transaction.

      So that’s the crypto in cryptocurrency! You can control money in the Bitcoin blockchain ledger anonymously through the use of cryptography, using public and private key pairs and associated addresses, by cryptographically signing messages.

      THE HOLDER OF THE PRIVATE KEYS OWNS THE MONEY

      Okay, so maybe more people have access to the key. But as far as the technology is concerned, it doesn’t matter. Whoever has access to the private key has the cryptographic right to control the money assigned to the blockchain address associated with the key. You may hear the phrase, “whoever has the private key owns the money” or “not your private key, not your Bitcoin.” They may not have acquired the private key legitimately or legally own it, but they can control it nonetheless. So, protect your private keys!

The public key is associated with the private key; in fact, it’s created from the private key. The address is associated with the public key; in fact, it’s created from the public key. So, all three are mathematically, and uniquely, associated with each other.

      But you’ll need a wallet

      

As we mention earlier, it’s the wallet that sends messages to the blockchain. But it’s more than that. The wallet is where everything begins as far as your Bitcoin is concerned. When you create a wallet file, the wallet software creates a private key. That private key is used to create a public key, and the public key is used to create an address. The address has never before existed in the blockchain and still doesn’t exist in the blockchain yet.

      After you have an address, you have a way to store Bitcoin. You can give the address to someone from whom you’re buying Bitcoin or to an exchange, for example, and they can send the Bitcoin to that address — in other words, they send a message to the blockchain saying, “Send x amount of Bitcoin from address x to address y.” Now the address exists in the blockchain, and it has Bitcoin associated with it.

       It retrieves data from the blockchain about your transactions and balance.

       It stores your private and public keys.

       It sends messages to the blockchain transferring your crypto from your addresses to other addresses, such as when you make a purchase using your Bitcoin.

       It uses your public keys to create addresses you can give to other people when they need to send Bitcoin to you.

      There’s lots more to find out about wallets; you can discover more about them in Chapter 4.

Here’s a quick summary and an image (see Figure 2-4) to reiterate the wallet’s role and to help you put it all together:

      1 Bitcoin is stored in the blockchain.

      2 Your Bitcoin is associated with an address in the blockchain.

      3 That address is mathematically associated with a public key.

      4 The public key is

Скачать книгу