This video provides a description and explanation of the core blockchain components.
- Here, we'll cover a series of terms and concepts that, on the face of it, don't seem connected. However, in time, all the pieces will fall into line. We'll start with a nonce. A nonce is a number that is used once, that is, it's used for a specific purpose and never used again. One such use is in digital transmissions to reduce duplicate transactions where that could have negative consequences.
In an era of big data, there's always a possibility that data entered into a database may have the same identifier. Adding a nonce to some identifier makes it additionally unique, thus making it harder for accidental duplication. This is essential to how transactions are approved for adding to a blockchain database that we'll see soon. Next, let's take a look at what a hash function is. A hash function is a mathematical process that takes data of any size, performs an operation on it, and returns a hash, which is data of a fixed-size.
Whether it is a single letter or a Shakespearian soliloquy, the resulting hash is the same size. For example, this sentence called a string, the man in the hat, might provide a hash of this and similarly, the word dog, also a string, will result in this. You can see that both strings resulted in the same size hash output, or signature. Converting a string to a signature is called hashing.
Hashing only goes in one direction and is therefore a good candidate for encryption. Remember, a hash function will take any length string and create a fixed-length output, but you can't take the fixed-length data output and recreate the string. One use of hashing is to keep a database small. If you only keep the hash output in the database, versus the pre-hash content, you can significantly reduce the space requirements. For example, let's say you wanted to have a reference database proving ownership of high-quality photos.
You could hash the photo, that is, take its digital properties, including other details such as time it was taken, who took it, and where it was taken and create a hash output. Only the light-weight digital footprint of the hash needs to be stored in the database since the hash is mathematically associated with the original picture and data. Another reason for hashing is that it creates an almost unique identifier. A hash with 64 characters of numbers and letters creates an astronomical number of combinations and there's little chance of duplication.
In the blockchain, hashes are used as identifiers for blocks, transactions, and addresses. The hashing algorithm used in the blockchain is called SHA-256. SHA, which stands for Secure Hash Algorithm, generates an almost unique fixed-size 256-bit hash. Our final term is mining. Let's think of mining in a traditional context. Whether it is mining for coal, gold, or oil, we could all agree it requires a significant amount of resources in terms of money, equipment, people, and time.
In the case of gold, if mining it were easy, gold wouldn't have much value. The truth is the opposite, gold is hard to discover, mine, and process, and therefore, it has significant value. Now, let's bring mining into a computing context. A person, or more specifically a computer, that performs mining for some reward must expend some processing power and in turn, consume electricity to harvest the result.
The more valuable the result is, it's fair to conclude, the more processing and power that is required. What would make computers work hard at solving really difficult mathematical problems? Okay, get ready for this. We're going to bring back the nonce and the hashing function to create a difficult math problem for a computer to solve. We'll begin with a string. We're going to use Hello, World. We then apply SHA-256 and we get a fixed output.
Let's say we wanted to force the signature of Hello, World to begin with a desired set of numbers or letters. We'll say we want the hash to begin with four zeros. For this, we'll introduce a nonce into the hashing function. For the first nonce, remember, it's a single-use number, we'll choose one. When the hashing function runs again, the output will be different because a nonce of one was introduced. If it didn't result in a hash beginning with four zeros, we'll need to change the nonce to another number and run the hash function again.
As you can imagine, this may take some time if I keep thinking up nonce numbers and running the hash function. What we really need is for a computer to choose you numbers and run the hash function until it reaches a hash that begins with four zeros. This is work that computers are really good at. In fact, in this instance, we have a name for it, we call it mining. A computer is going to solve this mathematical problem by applying its processing capability.
The harder it gets to solve the problem, the more computing power, and thus, electrical power, is required. When the solution is attained, the computer that solves it, assuming many are trying to do it at the same time, should get a reward. That's exactly what we'll see a little later when we discover how cryptocurrency works. Finally, the act of mining and successfully creating a winning hash will also provide another important feature, proof of work. It's beginning to get very interesting now.
- Blockchain basics
- Public and private keys
- How blockchain enables bitcoin
- Blockchain and the electrical grid
- Blockchain and identity management
- Risks of blockchain