Another potential problem with decentralized networks like Bitcoin is storage.
Where the hell can we store everyone’s balances and transaction history?
In a traditional centralized system, there is a dedicated server owned and managed by a financial institution such as a bank, where all information is stored. Although this information is kept very secure and confidential, there have been several instances in recent years of hackers gaining access to this information.
In the Bitcoin system, there is no single authority to manage this information. Instead, all information is made public.
Bitcoin does this by applying a peer-to-peer (P2P) decentralized network in which individuals are directly connected. This information is distributed among thousands of participating computers, also known as nodes. Nodes are connected to the Internet. Each node has access to a ledger (or blockchain), which is updated whenever new transactions (or blocks) are added.
These transactions are conducted according to a set of rules called the Bitcoin protocol.
How will the transaction be conducted?
Again, suppose Yeong-hee wants to send 1 bitcoin to Cheol-su.
First, we need to make sure that Younghee owns at least 1 Bitcoin. In a blockchain network, there is no single item that can tell how much money a person owns. Instead, the balance can be found by counting all previous transactions, and this operation is called a chain of transactions.
Upon downloading the Bitcoin software, users receive a complete copy of the transaction chain. (Download takes up to 24 hours because of this) Once you receive the transaction chain, it is very easy to check Younghee’s current balance.
Once Younghee confirms that she has enough Bitcoin to carry out the transaction, the next step is to publish the transaction message. The message contains the addresses of the sender and recipient, the amount of money being transferred, and a digital signature generated by the sender . After the message is published publicly, any node in this network can forward and execute the message.
Before executing a transaction, a transaction must be added to the unconfirmed transaction pool, which is called the mempool (momory pool). Here, miners can choose to trade.
Miners basically act as arbiters to prove transactions. (You can read more about this below.) Once the transaction is verified, the miner can add it to a new block. Since the size of a block is fixed, a new block is created after a certain number of transactions are added. The current block is connected to the previous block, and as this process repeats, a block chain is formed.
But, who decides that these transactions should be added to the new block?
In general, miners are free to choose or not choose any trades they want. To entice miners to choose mine, you can pay miners a portion of the transaction as a fee. However, the fee is not mandatory. This is because miners have an incentive called Block Reward that they can receive when they form a block .
Whenever a new block is added to the chain, the miners who submitted it are rewarded with new bitcoins. The amount of bitcoins rewarded changes over time and decreases as the network grows. Block rewards are the most natural way to make a profit in this system.
When the transaction becomes part of the blockchain, the transaction can be considered officially executed.
How can I check the validity of a block?
Above we have seen how a newly confirmed transaction is added to a block, and how this block is added to an existing blockchain. But how do we know that this new transaction is legitimate?
Miners must perform proof-of-work .
In essence, proof-of-work is a concept based on the belief that the most reliable public ledgers are those generated by the most computational methods. The principle of proof-of-work is that the information itself is complex and time-consuming, while verification is quick and easy.
In this work, we use the hashing technique discussed in Digital Signatures. As mentioned earlier, a hash is formed by applying an algorithm to the input to produce an output of a certain length.
Here, miners have to solve mathematical puzzles to add their blocks to the existing blockchain. This puzzle takes time to solve. Specifically, the puzzle is to guess the input that resulted in a hash starting with a certain number of numbers zero (0). So let’s see how it works:
Suppose a miner works on blocks. At the top of this block is the hash of the most recent block in the blockchain. Below that are all the trades the miner has chosen so far. Below that , a number called a nonce is added by the miner. After that, the miner performs a hash algorithm on the entire block.
As mentioned above, the miner’s goal is to obtain a hash that starts with a certain number of numbers zero (0). If the input changes even slightly, the output is completely different. This means that in order to get the exact number of zeros, the miner first needs a very specific number. So how do miners know this number?
Miners have no choice but to guess at random until they get the correct hash. The first miner to get the hash can add his or her block to the blockchain.
According to the Bitcoin protocol, this entire process takes about 10 minutes to complete. Since new miners with different computing power are constantly appearing, the required number of zeros also changes regularly.
This process not only allows new blocks to be added to an existing chain, but also performs another important function. That is, the role of preserving the security and integrity of the entire system.
How can I preserve it?
Each block has the hash of the most recent block as a header. So, changing one character in any transaction changes not only the hash of that block, but all the blocks in the chain.
This mean if somebody deal to change if , the previous all the blocks again to calculate that a means , computing power required for this can be enjoyed on the impossible. In addition, the new block is added each time , the block chain than it is safe to view can be .