What is a hash function? (2)
Understanding the meaning and principle of addresses
Blockchains use addresses, which are special schemes that identify senders and receivers. Usually, the banking system manages the user's name, information, and account number as a database, but in the blockchain, all information is managed as an address. The information referring to A or B mentioned in the previous articles is also an address.
What this shows is that the address acts like a bank account number in the blockchain environment. The difference is that the account number is issued by the bank, whereas the address in the blockchain must be created by yourself. This is because there is no centralized entity that controls the issuance.
Just as when I want to withdraw money from my bank, I have to prove that I am the owner of the bank account. This procedure is also necessary in the blockchain environment and the proving is done by utilizing the digital signature that we learned through public-key cryptography in the previous article. However, since the bank has the account number and information about the owner, you can confirm and change the balance. However, in the blockchain environment, there is no centralized administrator, so what can you do?
Here, we need a method of generating the address that has a close relationship with the digital signature, which is the information about the owner. In a public key cryptography system, just as the private key is the information required for a digital signature, the address is also information derived from the private key. The address is the hash value of the public key used when verifying the private key, as shown in the figure below. From the point of view of recipient B, in order to transfer the amount received from A to another person, the fund must first be delivered to address B. And then, recipient B must digitally sign a transaction using his private key to prove that he is the owner of this address.
Due to the characteristics of the hash function, the hash value of the public key derived from the private key is one-to-one with the private key. (Even if the input result is slightly different, the output result is different.) Therefore, the assets stored in the address (like an account number) are designed to give the owner of the private key the sole right to transfer. Because the blockchain is not a system that a third party verifies like a banking system, it is configured to create one's own private key, receive an asset at an address, and prove it (digital signature) by oneself.
What if you send to an address other than the one you originally intended to transfer to? Of the 40-digit address, even if one digit changes, it becomes a completely different address. Unless you have the private key to this different address, it cannot be transferred, and since it is not a system managed by someone in the middle, your money cannot be returned back. Therefore, before making a transaction, you must know the principle of the address and check the address carefully before making a transaction.
Hash functions used in blockchain
In addition to this, hash functions are also used to connect the blocks in a chain-like fashion, thus 'Blockchain'. In the article "What is Blockchain?", it was mentioned that each block includes information that can be found even if there is a slight change in the transaction history. Even a slight change in the transaction history can be detected because the hash value is different.
Also, from the previous article "How did Bitcoin achieve decentralization?", a hash function is used in the quiz called 'Proof of Work'. It can be used to create time-consuming problems by using features that cannot estimate the input data from the output values. The quiz is to match the input while only the output value is known and without knowing the input of the hash value. (Details will be explained later in the Proof of Work section.)
In summary, hash functions in Bitcoin serve three purposes.
  1. 1.
    When creating an address that identifies a user
  2. 2.
    When connecting blocks to easily detect forgery and falsification of transaction details
  3. 3.
    To make a miner's quiz (proof of work)
Now we know the concept of public-key cryptography, digital signature, and hash. These three are basically the cryptographic technologies that make up the blockchain.
However, in a blockchain environment, you have to generate your own private key and create your own address, so what should you do if someone in the world with the same address as you appears? If I keep cryptocurrency at my address and someone else creates and transfers the same address and private key as me, won't I lose the cryptocurrency? The answer to this will be explored along with the safety of the cryptographic system in the next article.
Copy link