A brief understanding of blockchain technology and principles

Blockchain Technology and Principles

what is blockchain

It is a special database technology designed for Bitcoin, based on the elliptic curve digital signature algorithm to achieve a decentralized p2p system design.

what a block looks like

write picture description here

  • index (block): which block is this (initial block index is 0)
  • Hash: Is the block valid
    A fixed- length value used to identify unique data
    Hash is calculated by taking the index, previous hash, timestamp, data, and random number as input.

  • Previous Hash: Is the previous block valid?

  • Timestamp: when the block was added
  • Data: The value information stored in the block
  • Nonce: How many times do we repeat to find a valid block
    A nonce is a number used to find a valid hash.
    The random number keeps iterating until the hash is valid. In our case, a valid hash must start with at least four zeros. The process of finding a valid hash corresponding to a random number is called mining (mining).

Why is it like this

Because he ensures that the blockchain is immutable.

If we have such a blockchain A → B → C, someone wants to modify the data on block A. The following happens:

  1. Modify the data on block A.
  2. The hash of block A changes because the data used to calculate the hash has changed.
  3. Block A is invalid because its hash does not start with four zeros.
  4. The hash of block B changes because the hash value of block A used to calculate the hash of block B has changed.
  5. Block B is invalid because its hash does not start with four zeros.
  6. The hash of block C changes because the hash value of block B used to calculate the hash of block C has changed.
  7. Block C is invalid because its hash does not start with four zeros.

The only way to modify a block is to re-mine the block and all blocks after it. Since new blocks are added continuously, it is almost impossible to modify the blockchain.

Blockchain from a different perspective

From a data perspective: it is a distributed database (distributed shared ledger), distributed includes distributed storage of data, and distributed records of data. To put it simply: it can realize distributed recording of global data information (collectively recorded by system participants, not by a central record) and distributed storage (can be stored in all nodes participating in the recording of data, rather than centrally stored in the center) institutionalized).

From the perspective of effect: It can generate a set of chronological records that cannot be tampered with and can be trusted. This database is stored in a decentralized manner and data security can be effectively guaranteed.

Conclusion: Blockchain is a data structure that combines blocks in a chain. It is suitable for storing simple, sequential data that can be verified in the system. Cryptography ensures that the data cannot be tampered with. and unforgeable. It enables participants to establish a consensus on the time sequence and current state of the entire network transaction records.

Talk about today's blockchain

Today's blockchain can be summed up as a technology that collectively maintains a reliable database in a decentralized and trustless manner. He is not a single, brand-new technology, the second is the integration of a variety of existing technologies (such as encryption algorithms, p2p file transfer) and so on.

It is a technology in which everyone participates in recording and storing information.

In the past, people handed over the work of data recording and storage to a centralized organization,

The blockchain allows everyone in the system to participate in the recording and storage of data. Under the distributed peer-to-peer network without a central control point, a p2p self-organizing network is constructed using the method of distributed collective operation. Through a complex verification mechanism, the blockchain database can maintain integrity, continuity and consistency. Even if some participants cheat, they cannot change the integrity of the blockchain, let alone tamper with the data in the blockchain.

The technical points contained in the blockchain

The key points involved in blockchain technology include: Decentralized, Trustless, Collectively maintained, ReliableDatabase, Time stamp, AsymmetricCryptography, etc. .

Trustless: Blockchain technology redefines the way of generating credit in the network: in the system, participants do not need to know the background information of other people, nor do they need to rely on the guarantee or guarantee of a third-party organization, and the blockchain technology guarantees the system Record, transmit, and store the value transfer activities, and the final result must be credible.

The background of blockchain

The source of the principles of blockchain technology can be summed up in one mathematical problem: the Byzantine Generals problem. The Byzantine Generals problem extends to Internet life, and its connotation can be summarized as follows: in the context of the Internet, when it is necessary to exchange value with unfamiliar counterparties, how can people prevent them from being deceived by malicious saboteurs, Confused to make wrong decisions. Further extending the Byzantine Generals problem to the technical field, its connotation can be summarized as: in the absence of a trusted central node and a trusted channel, how should each node distributed in the network reach a consensus. Blockchain technology solves the long-known Byzantine Generals problem - it provides a way to create a consensus network without trusting a single node.

The essence of blockchain technology is an internet protocol.

Do your best to use a global database in the Internet

If we now want to build a global database in the Internet world, then we will face three problems that need to be solved urgently, and these three problems are also the core of designing blockchain technology:

  • Question 1: How to establish a rigorous database, so that the database can store massive information, and at the same time can ensure the integrity of the database in a system without a centralized structure?

  • Question 2: How to record and store this rigorous database, so that even if some nodes involved in data recording crash, we can still ensure the normal operation of the entire database system and complete information?

  • Question 3: How to make this rigorous and completely stored database reliable, so that we can successfully prevent fraud under the background of no real name on the Internet?

In response to these three core problems, the blockchain has built a complete set of coherent database technologies, which are also the three core technologies of the blockchain.

Three core technologies of blockchain

block + chain

Block: In blockchain technology, data is permanently stored in the form of electronic records, and the files that store these electronic records are called "blocks". Blocks are generated one by one in chronological order. Each block records all the value exchange activities that occurred during its creation, and all blocks are aggregated to form a record collection.

Block Structure: The block will record the transaction data during the block generation time period, and the block body is actually a collection of transaction information. The structural design of each blockchain may not be exactly the same, but the overall structure is divided into two parts: the header and the body. The block header is used to link to the previous block and provide integrity guarantees to the blockchain database, and the block body contains all the verified records of the value exchange that occurred during the block creation process.

We quote a passage from "Blockchain: The End of Internet Finance" (Xiao Feng) to summarize the basic structure of blockchain: "People package information (including data or code) generated over a period of time into a block, which covers The upper timestamp is connected with the previous block. The page capital of each next block contains the index data of the previous block, and then new information is written in this page to form a new block. End-to-end connected, and finally a blockchain is formed." The magic of this structure: block (full history) + chain (full verification) = timestamp

Advantages of Block + Chain

The "block+chain" structure provides us with a complete history of a database. From the first block to the latest block, the blockchain stores all the historical data of the system.

The blockchain provides us with the search function of every piece of data in the database. Every transaction data on the blockchain can be traced back to the source through the structure of the "blockchain" and verified one by one.

Block + chain = timestamp, which is the biggest innovation of the blockchain database. The blockchain database allows the recorders of the entire network to stamp a timestamp in each block for accounting, indicating that the information was written at this time, forming a database that cannot be tampered with and cannot be forged.

Distributed Architecture - Open Source, Decentralized Protocol

Question: After having the data of the blockchain + chain, the next step is to consider the issue of recording and storage. Who should we involve in recording the data, and where should we store this time-stamped data?

In today's centralized system, data is recorded and stored in a centralized computer, but the blockchain structure does not agree to record and store data on one or several centralized computers. All data transaction nodes record and store all data.

  • 1. Regarding the issue of how to allow all nodes to participate in the recording, the method of the blockchain is to build a set of protocol mechanisms, so that every node in the entire network can verify the correctness of the recording results of other nodes while participating in the recording. Only when most nodes (or even all nodes) in the entire network consider the record to be correct at the same time, or when all the nodes participating in the record have passed the comparison results unanimously, the authenticity of the record can be recognized by the entire network, and the recorded data is allowed to be write into the block.

  • 2. Regarding the question of how to store the rigorous database of "blockchain", the method of blockchain is to build a network system with a distributed structure, so that all data in the database can be updated in real time and stored in all participating records. in the network node. In this way, even if some nodes are damaged or attacked by hackers, the data records and information updates of the entire database will not be affected.

According to the open source and decentralized protocol determined by the system, the blockchain builds a distributed structure system, so that the information of value exchange is sent to the whole network through distributed transmission, and the content of information and data is determined through distributed accounting. After timestamping, the block data is generated, and then sent to each node through distributed propagation to realize distributed storage.

Distributed advantages

Through the three "distributions" of distributed accounting, distributed communication, and distributed storage, we can find that no one, no organization, or even no country can control this system, the data storage, transaction verification, and information transmission processes in the system. All are decentralized. In the absence of a center, large-scale participants reach consensus and jointly build a blockchain database. It can be said that this is the first time in human history that a truly decentralized system has been constructed. It can even be said that blockchain technology builds an immortal system - as long as all participating nodes in the network do not collectively collapse at the same time, the database system can continue to operate.

Asymmetric encryption algorithm

What is asymmetric encryption? In simple terms, it allows us to use two ciphers respectively in the process of "encryption" and "decryption", and the two ciphers have asymmetric characteristics: (1) The cipher when encrypting (in the blockchain is called "" Public key") is publicly visible to the whole network, and everyone can use their public key to encrypt a piece of information (the authenticity of the information); (2) the password for decryption (called "private key in the blockchain") ”) is known only to the information owner, and the encrypted information can only be decrypted by those who have the corresponding private key (information security).

Advantages of asymmetric encryption algorithm

We can see that from a trust perspective, the blockchain is actually the product of a mathematical approach to the problem of trust. In the past, people may rely on "comrades" in the society of acquaintances, "comrades" in the society of political parties, and "Alipay", the trading platform in the traditional Internet, to solve the problem of trust. In the blockchain technology, all the rules are expressed in the form of algorithmic programs in advance. People do not need to know whether the counterparty of the transaction is a "gentleman" or a "villain", and they do not need to seek help from a centralized third-party organization. Endorsement of transactions, and mutual trust can be established only by trusting mathematical algorithms. Behind the blockchain technology, in essence, the algorithm is creating credit for people and reaching a consensus endorsement.

script

Why have a script

A script can be understood as a programmable smart contract. If the blockchain technology is only to adapt to a specific transaction, then the embedding of the script is not necessary, and the system can directly define the conditions that need to be met to complete the value exchange activity. However, in a decentralized environment, all protocols need to obtain consensus in advance, so the introduction of scripts is indispensable. With the script, the blockchain technology will give the system the opportunity to deal with some unforeseen transaction patterns, ensuring that the technology will not be outdated in future applications, and increasing the practicality of the technology.

The essence of scripting

A script is essentially a list of many instructions, which are recorded in each value exchange activity, how the recipient of the value exchange activity (the holder of the value) obtains the value, and spends the retained value that he has received. What additional conditions need to be met. Typically, a script that sends value to a target address requires the holder of the value to provide the following two conditions in order to use the value it has previously received: a public key, and a signature (proving that the holder of the value has the same public key as above) the corresponding private key).

Advantages of scripting

The magic of scripting is that it has programmability: (1) It can flexibly change the conditions under which the retained value is spent, for example, the scripting system may require two private keys, or several private keys, or no private key at all. etc.; (2) It can flexibly attach some conditions for value re-transfer when sending value. For example, the script system can stipulate that the sent value can only be used to pay the handling fee of CITIC Securities, or pay to the government, etc. .

Article reference:

The clearest explanation of blockchain principles

Blockchain Technology and Principles

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324451408&siteId=291194637