What is blockchain? Many people are puzzled by this, because never has a technology been so controversial, bringing wealth, fraud, new technology and so on all at once.

But in fact, this is a kind of over-packaging. I’ve seen a joke that best describes this situation: “They say blockchain can’t cheat, but they cheat with blockchain.” Many people are also cheated because they don’t understand blockchain. But blockchain isn’t complex at all, technically or conceptually.

This article will talk about the details of blockchain operation from the perspective of popular science. Mainly to bitcoin network, the following will also talk about some of the alliance chain. There are many new terms in blockchain, so I will try my best to make it easy to understand.

1. What is blockchain

Derived from Bitcoin, blockchain is used to store transaction data generated in Bitcoin. Blockchain has two characteristics:

  • Once written to a block, data is difficult to tamper with, often referred to as immutable
  • Decentralized, no one can really control the whole system

1.1 Blockchain structure

Blockchain technology itself is not complicated. People who have learned to program are well aware of the linked list data structure. To some extent, blockchain is actually such a linked list.

A blockchain is made up of blocks like this. It is important to note that the direction of the arrow cannot be reversed. The newly created block points to the previous block, and then some data is stored in each block.

So how are these blocks connected?

This brings us to an important part of blockchain, hash functions. This is a concept in mathematics or computers. The nice thing about it is that it can do something to a piece of data, and it outputs a fixed length string called a hash, but you can’t figure out from the output what the input is, but you can quickly verify that the hash is correct from the input.

h = hash("I got 100 bitcoins") //16df768dash
Copy the code

And for a hash function, if the incoming data is just a little bit different, the resulting hash value will be very different.

With hash functions, you just need to know what it can do. And we’re going to use hash functions when we talk about mining.

A block takes advantage of this feature, calculates the hash value of the block in front of it, and puts that hash value into its own block. That is, each block records the hash value of the previous block. And connect them in this way. If any block in the chain is tampered with, the hash value of that block changes, and other blocks after that block cannot be connected to that block.

This is really connected with the whole body, this is the block chain can not be tampered with this feature in the technical implementation.

1.2 Blockchain network

But the blockchain we talk about on a daily basis is actually a blockchain network.

Blockchain networks are decentralized, often referred to as distributed. The Bitcoin network is arguably the most thoroughly decentralized software system. The network is completely open. Anyone can download a Bitcoin software and plug into the network and become a node in the network.

In a blockchain network, each network node maintains the chain. The nodes synchronize data with each other, and eventually each node maintains exactly the same data.

Anyone can plug into the Bitcoin network and synchronize all the blockchain data locally. In other words, the bitcoin network is open and transparent to everyone.

When accessing the block network, we need to generate our own account. An account is actually a collection of public and private key pairs generated through asymmetric encryption. Among them, the public key can be exposed, and the public key can be transformed into an address. This address is what we usually call the wallet address.

In blockchain, the word wallet also appears very frequently. But this wallet is completely different from what we normally think of as a wallet. Different from Alipay or any other banking APP.

Wallet is actually composed of an address and a public and private key, master the private key to master the wallet.

1.3 How are blocks generated

Blocks contain transactions. Transaction is very simple in the Bitcoin network, in fact, it is a transfer, you transfer your Bitcoin to any address is a transaction.

But there is a limit to how many blocks each block can contain. So there is a limit to the number of transactions that can be packaged at once. At this point it is up to the miners to decide which transactions to package into the block. Anyone new to blockchain has heard of miners. The word is confusing, but apt.

That’s where the miners start fighting for bookkeeping rights. The right to account is the right to package the next block. If you get the billing rights, you can get the bitcoin reward after the block is generated. That’s what’s driving so many miners to join the bitcoin network. The process of competing for billing rights is also known as the consensus process.

So how do you fight for bookkeeping rights? So we’re actually doing this. Whoever finds the answer first gets billing rights.

The hash function I mentioned above does work. The problem is to find a string whose hash value is 0x00000…… .

Here, the number of zeros can be adjusted, and the difficulty adjustment in the Bitcoin network is actually adjusting the number of zeros. We mentioned above that it is very difficult to reverse the original data based on the hash value, which can be equated with impossible to do. So the only way is brute force.

Try different strings until you find one that fits the criteria. Once the answer is found, the node synchronizes the result to the other nodes, which, by the nature of the hash function, can easily verify the answer. This process is also known as Proof of Work (PoW) consensus mechanism, which is a consensus algorithm of distributed consistency.

It takes a lot of computing to create new blocks, and as Bitcoin becomes more valuable, more miners join, making the problem more difficult. It’s going to take more and more computation. It also consumes more and more electricity, which is the biggest criticism of Bitcoin.

Distributed consistency algorithms include Paxos/Raft/PBFT etc. Why use PoW as an energy consuming algorithm? Because algorithms like Paxos/ Raft have strict environmental requirements:

  • First it requires Leader election, which is impossible in a blockchain network
  • And it assumes that all nodes are trusted, when in fact, in an open network, no node is trusted
  • The number of nodes in a blockchain network is too large for these algorithms to handle

This is how blockchain networks on public chains are formed. In an untrusted network environment, a trusted blockchain can be constructed through hashing and PoW consensus algorithms.

2. What’s different about alliance chains

In addition to public chains such as Bitcoin and Ethereum, there is also a network of alliance chain, which has an entry threshold. All blockchain applications in China are based on alliance chain.

The biggest difference between the alliance chain and the public chain is that its network is access system and can only be joined after obtaining permission. Therefore, all nodes in the alliance chain are trusted and the number of nodes is controlled within a certain range, and external nodes cannot join at will.

In such a network environment, PoW algorithm is not needed naturally, just the conventional distributed consistency algorithm, and even some alliances do not need consensus algorithm directly.

The temporary absence of coins in the consortium would effectively cut off the most important part of the blockchain network. The key reason why the public chain can operate is that a complete economic system has been formed internally. When can the alliance chain supplement this part? Then the spring of the alliance chain is here.

3. Does blockchain technology have value

After Bitcoin became popular, someone took a piece out of it and called it blockchain. And then somebody took this and said to everybody, this is the future. But in reality, blockchain is just a technology, and there is nothing revolutionary about the technology itself. The technology used in blockchain has been around for a long time. It combines existing technologies to create a new concept.

In bitcoins’ case, the blockchain is simply the data structure it uses to store transactions. What is important is the consensus of many people gathered in the Bitcoin network, which is the real value of Bitcoin. That is to say, the data of Bitcoin itself is not valuable, but those who admit that the data is valuable have already created the value of bitcoin.

Blockchain technology itself has no value, why so many kinds of coins that learn from and copy Bitcoin cannot catch up with bitcoin, it is because the most valuable thing in Bitcoin is not blockchain, but consensus.

The cost of building a blockchain network is pitifully low. With your own laptop, you can build a blockchain network in an hour. For blockchain, it doesn’t matter what chain you use, but how many people recognize it.

But that’s not to say blockchain technology is worthless. The non-(almost) tamper-proof nature of blockchain makes the structure a natural fit as a store of value. Our current mobile Internet has made the cost of information delivery virtually zero. But the transmission of value is still a big problem. Blockchain promises to solve this problem.

4. Summary

Blockchain technology itself is neutral, and various scams have given it a bad name. But like all new things, the beginning is always bumpy. Blockchain technology is still in constant development, and there are also many scenarios that are expected to be solved by blockchain. Rising in twists and turns, blockchain still has a long way to go.

The text/Rayjun