Cryptocurrency Mining For Dummies. Peter Kent
Чтение книги онлайн.
Читать онлайн книгу Cryptocurrency Mining For Dummies - Peter Kent страница 12
In the context of cryptocurrency, the blockchain is a digital ledger recording cryptocurrency you send to others, and cryptocurrency you receive from others.
Think of it this way. Say that you’re a little compulsive and like to keep a record of the cash in your pocket. You carry a notepad, to record every time you put money into your pocket and every time you spend it, and you calculate the current balance. That notepad is a kind of transaction ledger, right?
Cryptocurrency is very similar to this ledger of cash transactions … except there’s no pocket. The blockchain is the ledger; it stores a record of every transaction (when you first purchased or were sent the cryptocurrency, when you spent it or sold it, and the balance you own).
But there’s no pocket and no cryptocurrency sitting in storage somewhere. The blockchain is simply a series of “mythical” (or virtual) transactions stored in the ledger. No currency is being physically transferred; we simply update the record to state that currency has been transferred.
The ledger says you own cryptocurrency, so everyone can validate and accept that you own it. And remember, that ledger can’t be edited after being solidified into the chain — it can’t be hacked. (See the preceding section for more on this topic.) So if the ledger says you own, say, half a Bitcoin, then you absolutely do, and you can sell that half Bitcoin to someone else by modifying the ledger to say that they own it!
But what about the wallet? The wallet must store money, right? No, cryptocurrency wallets do not store cryptocurrency. They store private keys, public keys, and addresses. Private keys are the most important because they control the addresses with which your cryptocurrency is associated in the blockchain.
What’s the Crypto in Cryptocurrency?
The crypto in cryptocurrency refers to cryptography. So, what exactly is cryptography?
According to The Oxford English Dictionary, cryptography is “the art of writing or solving codes.” Wikipedia’s explanation is more complicated and more digital: “The practice and study of techniques for secure communication … cryptography is about constructing and analyzing protocols that prevent third parties or the public from reading private messages.”
The history of cryptography goes back at least 4,000 years. People have always needed to send secret messages now and then, and that’s what cryptography is all about.
Today’s cryptography, with the help of computers, is far more complicated than the ancient ciphers of the classical world, and it’s used more extensively. In fact, cryptography is an integral part of the Internet; without it, the Internet just wouldn’t work in the way we need it to work.
Almost every time you use your web browser, you’re employing cryptography. Remember the little lock icon, shown in Figure 1-2, in your browser’s Location bar?
FIGURE 1-2: Your browser’s lock icon means that data submitted back to the web server will be encrypted with cryptography.
The lock icon means the page is secured. When you send information to and from the browser to the web server and back, that information is going to be encrypted — scrambled — so that if it’s intercepted on the hundreds or thousands of miles of Internet transmission between the two, it can’t be read. When your credit card number is transmitted to an ecommerce site, for example, it’s scrambled by your browser, sent to the Web server, and then unscrambled by the receiving server.
Ah, so, the blockchain is encrypted, right? Well, no. Cryptocurrency uses cryptography, but not to scramble the data in the blockchain. The blockchain is open, public, and auditable. Figure 1-3 shows you an example of a blockchain explorer designed for Bitcoin. Using a blockchain explorer, anyone can investigate the blockchain and see every transaction that has occurred since the genesis block (the first block of Bitcoin created).
FIGURE 1-3: An example of a blockchain explorer tool, found at https://live.blockcypher.com/btc
.
ENCRYPTED BLOCKCHAINS
You can build encrypted blockchains and encrypt data within a blockchain. For example, while the Bitcoin blockchain is unencrypted and open to inspection by anyone (see the blockchain explorer in Figure 1-3), it is still possible to create encrypted blockchains that obscure the transaction data, such as Zcash, but, in general, cryptocurrency blockchains are not encrypted, so anyone can read the transactions stored within them.
No, cryptocurrency isn’t used to encrypt the data in the blockchain. It’s used to sign messages that you send to the blockchain. These messages are the ones that trigger transactions and updates to the blockchain ledger.
Public Key Encryption Magic
Public key encryption is a clever little trick created using digital cryptography. And, by the way, this type of encryption is all accomplished using hugely complicated mathematics — the sort of mathematics that even most people with degrees in mathematics don’t understand, the sort of mathematics that has names like Carmichael numbers and Goppa codes, the sort of mathematics that we certainly don’t understand, and you don’t either (well, most of you, dear readers, don’t). But that’s fine: Gravity isn’t well understood either, but we all use it every day.
So, forget how this amazing stuff works, and consider instead what it is actually accomplishing. Now, imagine a safe, with two keyholes and two associated keys. One is a public key, and one is a private key. Now imagine that you put something into the safe and lock it using the public key. Once the door is closed and locked, the public key no longer has access to the safe; it can’t be used to unlock the safe and extract the item. The private key, however, will work. The only way to open the safe is to use the private key.
In fact, this magical mathematical safe works both ways. You can lock it with the private key, but after you lock it, you can’t use the private key to open the safe. Only the public key will open a safe locked with a private key.
Oh, and these two keys are magically associated. They work only with each other and no other keys. Private Key X will work only with Public Key X, and vice versa. You can’t lock the safe with Public Key X and then unlock the safe with Private Key W or Private Key K, for example.
Okay, same principle, but now think of electronic messages. You can lock an electronic message with a public key — that is, you can use a key to scramble, or encrypt, the message. That message may be an email or information being sent from your browser to a web server.
After