Popular Science | 7 Steps Getting Started Blockchain

2017 is the year of the outbreak of Bitcoin. After so many years of diving, the price of Bitcoin has soared from around $1,000 to nearly $20,000. How many people have changed and become "cryptography currency trading experts."

It’s true that you can make a fortune when you catch up, but wake up and the feast is gone.

– Bitcoin price chart from October 2013 to October 2018 (Source: Coinmarketcap.com) –

Although the main reason for the adrenaline burst is the rapid rise in market value, this wave of enthusiasm was originally initiated by technology. Blockchain technology still has great potential. Now is the time for business developers, entrepreneurs and individual enthusiasts to get on the bus. However, in addition to the turbulent blood, the first thing to do is to improve the understanding of blockchain technology.

Unfortunately, the current article on blockchain technology does not involve too many complicated technical terms, it is too superficial and lacks depth. These two types of articles are not convenient for the reader to clearly understand the content of the article. How to do it? I suggest you start with this article. In just 10 minutes, you can understand why blockchain technology is so disruptive. Spending this time is still worth the money. I wish you a happy reading.

introduction

First, the blockchain is a method of storing electronic data . The data is in the form of blocks, imagine that there are many blocks that store digitized data. These blocks are linked together to give immutability to their internal data. When a block of data is linked to this chain, its internal data can no longer be changed. Once a block is added to the chain, the data inside is publicly visible to anyone. This technology is of extraordinary innovation and can be used to record almost any data we can think of (eg property rights, identity, balances, medical records, etc.) without the risk of being tampered with.

Suppose I bought a house and uploaded a photo of the title card to the blockchain. I can prove that I enjoyed the ownership of the property at that moment. Once this information is on the chain, no one can change it (well, there are ways to change it, here is an advanced reading material, I suggest you read it later). Therefore, a blockchain is a method of storing data and ensuring that data is not tampered with. This sounds good, but the question that comes with it is: How do we implement such a technology?

(Proofreading Note: For the sake of nitpicking, this paragraph is not invulnerable, but you can remember it first.)

First order – transaction data

 

Ok, let's take the Bitcoin blockchain as an example. The Bitcoin blockchain is the oldest blockchain in existence. On the Bitcoin blockchain, each block is about 1 MB in size. By the time of the deadline, there were 525,000 blocks accumulated in the chain, and the total amount of data stored on the chain was about 525,000 MB. (Proofreading Note: In fact, there is no 52.5 MB, because in the early days, many blocks did not play 1MB. Also, as of today (April 2019)

On the 24th, 573,000 blocks have been accumulated, with a total data volume of approximately 250 GB. )

Only bitcoin transaction data is stored on the Bitcoin blockchain . It is like a huge transaction record library that dates back to the first bitcoin transaction. In this article, we assume that there is a blockchain that stores transaction data, just like the Bitcoin blockchain.

Second order – (by hashing) link block

 

Imagine three blocks that store transaction data (as shown in Figure 1).

There are some transaction data in all three blocks. This is nothing special. It's like three separate word documents that describe the content of the transaction and the balance changes. Document 1 records from the first transaction in chronological order until the amount of data reaches 1 MB, and subsequent transactions are recorded in Document 2 until the amount of data reaches 1 MB, and so on. These documents are data blocks. They are linked one after the other (link). To do this, each block generates a special (digital) signature based on its internal data string. If there is any change in the data in this block, even if only one number is changed, the signature of this block will change. How is this achieved? For more information, please read the hashing section in Step 3.

(Proofreading Note: As mentioned above, the blocks in the actual situation are not all close to the upper limit of the block size. The actual data size depends on how many transactions are recorded by the miners packing the block in the block. They won't wait until they have 1MB of transaction data to start working. See below for the actual situation)

Suppose there are two transactions recorded in block 1, namely transaction 1 and transaction 2. The total amount of data for these two transactions reached 1 MB (in fact, the number of transactions included in one block is far more than this). A signature is generated based on the data string within this block. Suppose this signature is "X32". As shown below:

Keep in mind that even if the data stored in block 1 changes a number, you get a completely different signature ! As long as the signature of block 1 is added to block 2, the data of block 1 can be associated with block 2. The signature of block 1 is also included in the data string of block 2, so this signature, like the other data in block 2, becomes the data basis for the block 2 signature. As shown below:

It is these signatures that link the blocks together to form a blockchain. Now add block 3, the whole chain is as shown below:

Now assume that the data in block 1 has been changed . For example, the transaction between Damian and George has been changed. Damian sent 500 instead of 100 bitcoins to George. Since the data string in block 1 has changed, its signature has changed accordingly. After changing the data, the signature of block 1 is no longer "X32", but becomes "W10", as shown below:

– Visit r/BlockchainSchool to learn more about the blockchain science knowledge –

As a result, the new signature "W10" of block 1 conflicts with the old signature "X32" previously added to the block 2 data string. The link between block 1 and block 2 is broken. Other users on this chain will know that the data in block 1 has been changed. In order to maintain the immutability of the blockchain, other users will refuse to synchronize the changed transaction information, and still maintain the original transaction record (that is, Damian sends 100 BTC to George), and the entire chain remains intact. This means that in order to tamper with the transaction, the old signature of block 1 in the block 2 data string must be replaced with a new one. However, once the data string in block 2 changes, the signature of block 2 will change accordingly. Assume that the signature of block 2 has changed from "9BZ" to "PP4". Then the link between block 2 and block 3 is broken!

The blocks on the blockchain are visible to everyone. Therefore, if the tamper wants to tamper with the transaction without warning, it must be ensured that the blocks after the tampering are still linked (otherwise it is easy to find out which block is not connected to other blocks, and then judge the The block has been changed). In other words, changing a block must calculate a new signature for all subsequent blocks. It can be considered that this is almost impossible, but to understand why this is the case, please see below.

Third order – generate signature (hash value)

 

Then, let us take block 1 as an example to draw a schematic diagram. Suppose block 1 only records one transaction, that is, Thomas sends 100 BTC to David. A signature needs to be generated based on this data string. On the blockchain, this signature is generated by a cryptographic hash function. The cryptographic hash function is an extremely complex mathematical formula: Substituting an arbitrary data string as an input value into a formula yields a unique 64-bit output value. For example, you can substitute the word "Jinglebells" into this hash function (there are many types of hash functions, this is just one example), and the resulting output is:

761A7DD9CAFE34C7CDE6C1270E17F773025A61E511A56F700D415F0D3E199868

As long as one of the characters in the input changes, including changing the case or adding spaces and punctuation, you get a very different output. If you add a period after this input to "Jinglebells.", the resulting output becomes:

B9B324E2F987CDE8819C051327966DD4071ED72D998E0019981040958FEC291B

If we remove the period, we can still get the same input as before:

761A7DD9CAFE34C7CDE6C1270E17F773025A61E511A56F700D415F0D3E199868

For the same cryptographic hash function, the same input will definitely get the same output, and different inputs will definitely get different output. The Bitcoin blockchain uses the hash function to generate a signature for the block. The data in the block is used as input, and the output obtained is the signature of the block. Let's take a look at Block 1 with only one transaction ( Thomas sends 100 BTC to David).

Suppose the data string in block 1 is as follows:

Block 1 Thomas -100 David +100

Enter this data string into the hash function and get the output (signature) as follows:

BAB5924FC47BBA57F4615230DDBC5675A81AB29E2E0FF85D0C0AD1C1ACA05BFF

This signature will be added to block 2. Suppose now that David has transferred 100 BTC to Jimi and the deal is packaged into Block 2. Then as shown below:

The data string for block 2 is as follows:

Block 2 David -100 Jimi +100 BAB5924FC47BBA57F4615230DDBC5675A81AB29E2E0FF85D0C0AD1C1ACA05BFF

Enter this data string into the hash function and get the output (signature) as follows:

25D8BE2650D7BC095D3712B14136608E096F060E32CEC7322D22E82EA526A3E5

This is the signature of block 2. Each block generates a digital signature using this cryptographic hash function. There are many types of hash functions, and the bitcoin blockchain uses the SHA-256 hash algorithm.

However, (only the above measures are obviously not enough). If someone wants to tamper with the data in the block, TA can generate a new signature after tampering, stuff it into a block, and then generate new signatures one by one. The latter block still forms a chain, and others can't tell that the data has been changed. How to prevent this situation?

The answer is that only hashes (signatures) that meet specific requirements will be affected by block links. This is the mining described in the fourth order.

Fourth stage – what is a qualified signature? Who will sign the block?

 

Not all signatures meet the requirements. The blockchain protocol pre-determines certain requirements. For example, on a bitcoin blockchain, only blocks corresponding to digital signatures starting with consecutive zeros can be chained. For example, the corresponding block can only be chained if the digital signature begins with no less than 10 consecutive zeros .

However, as can be seen from the third subsection, the hash value corresponding to each data string is unique . What if the signature (hash) of a block starts with less than 10 zeros? In order to obtain an eligible block signature, the input data string needs to be changed repeatedly until a signature starting with 10 consecutive zeros can be generated. However, since the transaction data and metadata (block number, time stamp, etc.) need to be left as they are (otherwise the meaning changes), each block has an additional length of data that can be changed. When you want to add a block to the chain, people can change this data continuously until they find a qualified signature and then determine the specific value of the next piece of data. This piece of data is the nonce of the block. Nonce is not a predetermined data, but a series of completely random numbers that should be found in actual need (Note: other data shown in the figure can be composed of any character, and nonce can only consist of numbers).

In summary, the block contains: 1) transaction data; 2) signature of the previous block; 3) nonce. This process of repeatedly changing nonce, hashing block data, and finding qualified signatures is called mining , which is what miners do. The miners put a lot of power into the power, and they continue to substitute the nonce for hashing until they find a qualified signature (output). The more computing power a miner has, the faster the hashing process will be, and the higher the probability of finding a qualified signature. This is a process of trial and error, as shown in the following figure:

– Note: nonce must be a number (please read the explanation on r/BlockchainSchool for details) –

Any user on the blockchain network can participate in mining by downloading and launching mining software. In effect, this is the calculation of the nonce of the block using their hardware computing power. Take Block #521,477 on the Bitcoin blockchain as an example:

– From blockchain browser blockchain.com –

 

It can be seen that the hash value (signature) of this block and the hash value of the previous block start with the same number of zeros. Finding such a hash is not an easy task, it takes a lot of computing power and time, or luck . Yes, sometimes the miners who are out of luck can calculate a qualified signature within a few minutes, and the amount of calculation is small. Block #523034 is an extremely rare example. A small miner with little computing power quickly found a qualified signature, while the other miners' combined power was 7 trillion times his. In comparison, the probability of winning the Powerball lottery jackpot is 292 million, and the lucky one is 1/24000 in the jackpot.

Don't underestimate these zeros. The focus of this section is that it is difficult to find a qualified signature.

The fifth order – how is the immutability of the blockchain achieved?

 

As described in the third stage, changing a block causes its signature to change, not matching the subsequent block record, and thus disconnecting from the subsequent block. In order for other participants on the network to accept the changed block, it must be relinked with the following blocks. That is to say, the signature of a block has changed, and the signatures of all the blocks following it have to be changed in order to make others think that this is a consistent chain.

Do you think of anything?

As stated in Section 4, the signature must meet the requirements! Although changing the signature of all blocks seems feasible, it takes a lot of cost and time, so it is considered impossible because of the following reasons:

Suppose a miner maliciously tampers with a transaction within a block and then generates a new signature for the block along with all the blocks following it based on the hash, so that other participants in the network accept A transaction that has been tampered with. The problem is that other miners in the network are constantly signing new blocks on the original chain. As the new blocks continue to be chained, the evil miners also have to recalculate the signatures of these blocks. He must ensure that all blocks are linked together, including new blocks that are constantly being added to the chain. Unless the miner has more computing power than the rest of the network, he will never be able to surpass other miners.

(Proofreading Note: The actual meaning of this paragraph is that as long as the miners are mining on the longest blockchain they see, all the computing power will naturally converge on a main chain over time, and the attacker only creates one A chain longer than the current main chain can successfully change the transaction record that everyone agrees with. This principle of always taking the longest chain as the main chain (effective chain) is the so-called "longest chain rule", which is Nakamoto Concensus ( Part of the Nakamoto Satoshi consensus mechanism. In addition, not all blockchains have adopted the Nakamoto consensus.)

Millions of users are now mining in the Bitcoin blockchain, which can be assumed that the computing power of a malicious participant or entity is unlikely to exceed the rest of the network. This means that other participants in the network are unlikely to accept any modifications to the blockchain, thus achieving the immutability of the blockchain . Once the data is added to the blockchain, it can't be modified.

The only exception is that the computing power of malicious participants really exceeds the sum of the computing power of other people on the whole network. In theory, in this case it is possible to tamper with the blockchain (ie change the history of common recognition). This is called a 51% attack (I wrote another article to explain this situation), and in the past there have been many blockchains that have suffered such attacks.

(Proofreading Note: So far, the famous blockchain that has suffered 51% attacks has bitGold, Verge, and Ethereum Classic.)

In fact, the 51% attack on the Bitcoin blockchain can yield far less than the high cost of attack. In order to get enough computing power, in addition to the cost of hardware, cooling equipment and storage space, it must bear the risk of being hit by thousands of people, and more importantly, it will cause extreme damage to the ecosystem of the attacked blockchain. Big damage, the proceeds from the attack will also depreciate sharply. The 51% attack is actually fighting against other users on the blockchain. This is why the more users involved in mining, the higher the safety of the entire chain.

Congratulations, you have entered another stage! Now, you should already understand why the (large) blockchain is considered to be unchangeable. But now there is another important question: how to prevent miners from adding fake transaction data to the blockchain? Technically it can't be done. A detailed explanation of blockchain trading can be found in this article.

(Proofreading Note: Only the private key controller can spend the funds in the corresponding address, and the miner does not know your private key. Others can only verify whether a transaction was initiated by your public key. So forgery Not feasible)

The sixth order – how to manage the blockchain? Who decides the rules?

 

The blockchain protocol automatically takes the transaction record on the longest chain and treats this chain as a chain representing the vast majority of participants. Building the longest chain requires spending most of the computing power of the entire network. Blocks that have been tampered with are disconnected from the longest chain, so they are automatically rejected by most nodes on the entire network.

On the Bitcoin blockchain, all transaction history and wallet balances are publicly visible (blockchain.info). Anyone can view the balance of any wallet or all transactions from the first transaction (January 3, 2009). Although anyone can view the wallet balance, most of the owners of these wallets are unknown. For example, there are 69,000 bitcoins in a wallet, which is worth about $500 million at the time of this writing. This wallet was used once in April 2015 and has never been traded since.

(Proofreading Note: This section does not actually answer the question “Who decides the rule”, only to explain that “this technology is achievable according to existing rules.” Public chain governance is a complex issue and goes beyond The scope of this article needs to be explained.)

The seventh order – what do these mean for cryptocurrency?

 

Cryptographic currency is essentially a variant of Bitcoin. Most cryptocurrencies are built according to their own blockchain protocol, following rules that differ from bitcoin. Bitcoin should be classified as a currency , which means that it has a clear currency function. Monroe is also a cryptocurrency with the same features, but its blockchain protocol also adds rules to enhance privacy (increasing the difficulty of tracking transactions).

However, assets issued in blockchains can be given a variety of different uses, as determined by the issuer, and assets so issued are generally referred to as "tokens." These tokens can give certain rights to their owners, such as gaming licenses, social media channels, utilities, and more. All of these asset transactions are recorded on different blockchains and can be traded online through exchanges such as Coin.

Tokens are actually a new type of Internet currency that may affect some industries. A typical example is the stock market. In the future, property rights such as company shares are likely to be stored in the blockchain in the form of tokens. The blockchain is not limited to representing the physical value in the form of tokens, but can also safely record medical records, identities, historical records, tax records and other data. This is the greatness of blockchain technology, not to mention another important feature of the blockchain: decentralization.

Original link: https://blog.goodaudience.com/blockchain-for-beginners-what-is-blockchain-519db8c6677a

Author: Jimi S.

Translation & Proofreading: Min Min & A Jian

(This article is from the EthFans of Ethereum fans, and it is strictly forbidden to reprint without the permission of the author.