Introduction to Blockchain Technology. Tiana Laurence
Читать онлайн книгу.a message, such as the transfer of cryptocurrency to a new address, using a recipient’s public key, the recipient can decode it using their matching private key and gain ownership of the cryptocurrency. Whoever is in possession of the private key can transfer cryptocurrency to a new address. The ledger holds a record of all these transfers between addresses. Anyone can see the history of transmission between addresses.
The extraordinary mathematical properties of private and public keys make them inverse. If you encrypt a message, such as the transfer of cryptocurrency with your private key, it can only be decrypted by its matching public key. So, when you send a cryptocurrency to a new public address, only the recipient can decode it, and everyone can see that you had the right to transfer cryptocurrency. This is because mathematically only you, with your private key, could have encrypted the transaction. This is called “signing your transaction”.
It is evident that you need to keep your private key safe and secure. If your private key is destroyed or lost, you won’t be able to transfer your cryptocurrency. If a criminal person copies your private key by physical access to your computer or through malware on your device, then they can transfer your cryptocurrency to a new address. The blockchain will not know that the criminal is pretending to be you and sign your transaction. The transfer of cryptocurrency can only be done with a private key for the public address that the cryptocurrency was last sent to, so once a cryptocurrency has been sent the transaction is irreversible.
2.2 What is a hash?
You have learned how blockchains allow any two parties to send each other cryptocurrency using public and private keys. Sending the cryptocurrency between addresses created transaction receipts. These receipts are written in an ever-expanding record. The record is known as the blockchain ledger.
In this section, you will discover how the network secures the records of transfer of cryptocurrency from one address to another using what is known as hashes. You should note that this process was pioneered for the transfer of cryptocurrency but can be applied to many other applications where authentication is required. These digital fingerprints of data make sure that the record of ownership is not falsified. Hashes, like most of the technology that makes blockchains, came from a much earlier time. Hans Peter Luhn, an engineer at IBM, first conceived of hashes in the 1950’s as a way to organize both numbers and text.
From blocks to hashes
The way that blockchains ensure their records are not corrupted is by using hashes. A hash is similar to symmetric encryption, except that instead of having a key that unlocks the data, the data itself creates a fixed length key via a one-way mathematical proof. The data is the key.
A hashing algorithm is used to take a data input of any size and produce a fixed length string. The fixed length string is the hash and acts as a “signature” or “fingerprint” for the data input. If any of the input data is changed, it will create a completely new digital fingerprint, or rather hash, as can be seen in figure 12.
In the case of blockchains, the data input is a block of transactions.
Each block is run through a hashing algorithm to produce a unique hash that only that block could produce. This unique hash is represented by a fixed length string of numbers and letters. Bitcoin, for example, used a hashing algorithm called SHA256 (Secure Hashing Algorithm 256).
What this means is that all the data in the block can only ever create one unique fixed-length string of numbers and letters. If any of the data in the block is changed or missing, then it would create an entirely different hash. This allows the nodes that are securing the blockchain records to quickly check that everything is intact and has not changed.
Figure 13 Hashes.
The hashes of each block are published in the next consecutive block creating a chain of records. The hashes prove the order of the blocks and, by default, the order of the transfer of cryptocurrency from one address to another.
Here are some key features of hashes:
■ All hashes are deterministic, no matter how many times a block is run through a hash function you will always get the same result.
■ Hashes are easy for nodes to compute. Think of this like Sudoku. It is easy to see that the puzzle was solved correctly, but it is difficult to reproduce.
■ Hashes must be very sensitive to changes in data input. Any change to the blockchain record will create a completely different hash.
■ Hashes must be what is known as “collision resistant”. This means that it is practically impossible to create the same hash from two different sets of data.
2.3 Ledgers
Ledgers, the records of economic transactions, are even older technology than encryption. Savvy business owners and governments understood that they needed to account for the things they purchased, orders they had given to traders, and the receipts for these goods later.
Many of the ancient clay tablets from Mesopotamia are accounting logs, known as ledgers, that are over 5,000 years old. The very earliest accounting record known is a 20,000-year-old bone from the Democratic Republic of Congo. It has matched tally marks that were used to account for something. Believe it or not, accounting for things may have been why humans created written languages and mathematics. Ledgers made trade and life in a complex society possible.
Transactions and trade
A transaction is when two parties exchange something. Humans have been looking for better and safer ways to transact with one another since the birth of trade. When our ancestors wanted something that someone else had, they had to be in possession of something their counterparty needed.
For example, if they have some apples, and the other party has some fish then they may have been able to trade some of their apples for the other party’s fish. But that did not always work. As I’m sure, you can imagine this type of trade was difficult as the two parties had to have something the other wanted at the same moment. Human ingenuity in trying to solve this difficult trade and transaction problem led to the creation of money.
The birth of money
The first forms of money were goods that everyone wanted all the time and did not deteriorate over time like apples and fish. They were products like salt and beautiful shells. Thousands of years ago Greek slave traders often bartered salt for slaves. And you can still see remnants of these early transactions and money terminology. Expressions like “they are not worth their salt” and the word slave both come from this time. Salt is still used as money by nomads in Africa today.
The next big evolution in terms of money was trusting a third party to hold your funds and protect it from thieves. The Knights Templar were a famous group that set up a network of banks. Their system allowed pilgrims to deposit assets in their home countries and withdraw funds in the Holy Land.
It is believed that they used cryptography to ensure that no one cheated on the amount of funds they would request in their new location. Since the days of the Knights Templar, even more, elaborate schemes have been developed to protect people’s assets. The transfer of value is a vulnerable time for disintermediation and holding value of any kind leaves you open to theft.
Trading promises
The notes that were used by pilgrims have evolved significantly. The note itself represented the option to retrieve value. Whoever held the note was in effect the owner of the deposited value that the third party promised to keep safe. This is known as a bearer instrument.
Soon people figured out that they could directly trade notes for goods and services. The abstraction came