Understanding Blockchain with Database thinking

Source: Internet
Author: User
Tags rollback

Original address: https://www.admin5.com/article/20180419/845680.shtml

As a veteran of the database industry, I have seen that in the boom of blockchain technology, traditional IT technology students have maintained a very rational, even repulsive attitude. In fact, whether it is hot or repulsive, under the bipolar viewpoint, I think we should discuss the blockchain technology from the point of view that it people can understand. Because the nature of the blockchain is very similar to the database technology, many mechanisms use the idea of a database to understand it very intuitively and accurately.
For blockchain and traditional data technology, I think the future development of blockchain technology, the theme is "Convergence". From the point of view of database, this paper interprets the technology points of blockchain technology system, and makes a better integration of blockchain and database technology through the concept of "de-centralized database".
First, the status of Blockchain technology
The current blockchain world is claimed to be 1.0, 2.0, or even to 3.0 times, but from a product or technical grinding point of view, I think the current blockchain is equivalent to the database of the 80 's, in the various ideas of flowers contending in an endless era.
For the technical people, this is the best of times, a variety of fresh ideas and ideas have exploded, in the dull technical field to bring fresh breakthroughs, at the same time it is the worst of times, no product or direction is certainly the mainstream of the future, any fresh ideas may be proved in a few months later is not OK.
Therefore, we need to correctly understand the current blockchain technology changes and development, then we compare the year of the road to the database to see how the future blockchain world will develop.

1. Technology Evolution Journey
First of all, I think that blockchain is bound to evolve from current exclusivity to generalization. Now basically all the products that do the public chain are aimed at a particular scenario to achieve and optimize, but I think the future will not be an application of a chain, but there is a common development paradigm. Just like a traditional database, no matter what application you develop, you can use a limited number of generic products to meet most business scenarios.
Second, evolve towards standardization. For the blockchain technology, now each chain has its own development paradigm, and even many of the public chain to imitate Ethereum try to make a programming language out, which is actually an industry in the original period of the logo. How to judge an industry to become mature? Is that the business model is basically fixed, the development method is basically fixed, so that a large number of program personnel to promote.
Thirdly, the product and modularization are continuously strengthened. Most architectures are very tightly coupled, regardless of whether they are ethereum, Bitcoin, or many other new public links. Compared to our Hadoop in big data, each module can be configured as a standalone plug-in and can be customized and pluggable. So I think, with the continuous maturation and stability of blockchain technology, there will be a mature product in the future, through pluggable configuration and plug-in way to meet a variety of consensus algorithms, security mechanisms.
Finally, performance and scalability are improved. In fact, this is also the path of the database, the current blockchain in a short period of time through the side chain, fragmentation and other mechanisms over the past few decades of the transformation of the database.
Next I'll look at how the blockchain's biggest performance and scalability constraints are, and how it should be optimized, from a database perspective.
2. Development status
Let's look back at the current blockchain industry.
Aside from some of the applications and innovations in finance in the upper tier of the blockchain, from a technical point of view, I have always believed that its biggest innovation lies in the establishment of the equivalent data storage mechanism.
In the database industry, everyone has been following the master-slave architecture, and the completely "live" system has been a legendary thing since its inception decades ago, and no product has ever really been more alive.
And when we look at the current blockchain technology with an innovative, multi-live database, there are three issues that need to be improved:
First of all, the architecture of the blockchain is now very chaotic, and we have not classified it as a transaction, stored procedure, authentication, master-slave synchronization module like the traditional database, most people's cognition of the blockchain still stays in the mysterious black box stage. Second, the development language of the blockchain is completely fragmented. Database in the beginning of the "Warring States era", gradually using SQL to achieve the industry's unification. And the blockchain is still obviously in the "Warring States era", there is no unified standard development and use standards. Thirdly, the variety of requirements, some requirements or white Paper business introduction is reliable, and some are completely whimsical unintelligible. In fact, this is related to the new business model that the blockchain brings, and many people are still exploring new business models, leading to the lack of a standard paradigm for demand.
Second, blockchain vs database technology: The same point
From the database point of view, the blockchain technology is to go to the central multi-live database technology, there is no essential difference between the two.
Here I have listed some of the more important technical points in the blockchain, and how these techniques exist in the database domain. These concepts and the technical concepts in the database one by one correspond to the following relationships:
Consensus mechanism
Consistency control--consensus mechanism
The distributed database is called the consistency control, including the traditional master-slave replication, the new generation of raft, Paxos and other algorithms. In order to solve the additional Byzantine problem in the blockchain, the algorithm is improved to PBFT, PoW, POS and other protocols.
Storage mechanism
Database Log--Ledger
The blockchain structure is basically equivalent to the transaction log of the database, and its main additions include the correctness of the Merkle tree structure for fast validation of data, but its nature is equivalent to that of the database. At the same time, the database in the log will include transaction control and other enterprise-level capabilities, is not a blockchain data structure.
Smart Contracts
Smart contracts--stored procedures
A smart contract is a managed code, just like a database stored procedure. In essence, there is no difference between a smart contract and a database stored procedure, which is to execute a piece of code through an external call or virtual machine, and to share managed code with other users for invocation.
Sharding
Database fragmentation mechanism already existed in the era of MPP database. By slicing large amounts of data in different shards, you limit the total amount of data per shard and increase the overall throughput and storage space.
Application Development Interface
The current blockchain is still in a similar database at the time of the early days, interfaces are not uniformly standardized. Depending on the blockchain project, its interfaces can be defined in terms of database, object storage, API invocation, and even PAAs platform standards.
Safety
The security mechanism of blockchain is similar to the database security mechanism. Database security is generally divided into authentication and authorization of two modules, respectively, on behalf of the user login and access rights. The blockchain currently only supports record-level write authorization, but is fully shared for read operations. Therefore, the database is much better than the current blockchain from the security policy.
Third, blockchain vs database technology: different points

Database and Blockchain functional architecture diagram
1. Function architecture
The XXX section is a feature that both the blockchain and the database schema have. The white part is the unique feature of the current database.
We have also mentioned that the SQL capability of the database is an important part of its universality, and SQL is important for the subsequent development of the blockchain.
Index management This block, in the database is mainly to improve the performance of data management and data query efficiency, when the specific application scenario, performance will be the next stage need to improve the important part. Therefore, the index of stored data becomes a very important component.
2. Mechanism
On the mechanism, the main differences between blockchain and database are as follows:
Consistency
The design idea of blockchain is different from that of traditional database design, which is the difference of the consistency model brought about by the centralized system.
The traditional relational database follows the acid strong consistent model, and the written records are immediately readable. And some new distributed database adopts the final consistency, that is, the base model, the data written is not necessarily read, but it will certainly exist in the end.
However, there is a significant difference in the design of the blockchain or the central database, that is, there is no "permanent confirmation" concept for any operation. Even like Bitcoin, the core principle of the 6 blocks before the content is only "basic will not be rolled back."
To give an extreme example, if the WAN between China and the United States for some reason suddenly broken three days, and then recover the bitcoin will be a large-scale bifurcation, this period if there is an account at the same time in the United States and China for large consumption, want to restore a main chain will have to sacrifice a large part of the transaction to achieve back.
Then, since there is no way to guarantee strong consistency in the peer-to architecture, then the consistency in the blockchain system differs from the traditional database in nature, which leads to the subsequent series of design differences.
In the final analysis, in any traditional database model of master-slave architecture, people will try every means to prevent "brain crack" in the cluster, that is, two nodes in the same cluster think they are the primary node.
But this problem can happen all the times in the peer database system, and this phenomenon is called bifurcation in the blockchain, which is very different from our traditional database consistency model.
Lock mechanism
The locking mechanism can be said to be the biggest difference between blockchain and database in ensuring data consistency.
All the students who studied the database could not have heard of the lock. When we do a transaction, all records of the session change before committing are locked and cannot be modified by other sessions.
In a centralized database, because each ledger node operates local data, the change information is transferred asynchronously, so there is no global lock to notify others when a change is recorded. Therefore, in the absence of a lock on the premise, to the central database, that is, blockchain how to ensure the consistency of the data?
Bitcoin uses the UTXO structure, a bit similar to the database "optimistic lock" idea, that is, when the operation is not locked, only in the process of final submission to determine whether the record has changed.
Bitcoin is the status of whether or not the coin is being spent to determine if there is a trade conflict. Ethereum, however, uses the nonce as the increment counter for each record to determine if there is a duplicate transaction for an account, which is actually a mechanism for implementing a row-level lock in disguise.
Security mechanisms
Another blockchain industry people talk about more is the security mechanism.
First of all, I am not an encryption algorithm expert, so I do not discuss the specific use of encryption algorithm, but from the entire storage system security model design, to discuss how the blockchain technology in the full-peer architecture of the system to ensure data security.
In my opinion, the blockchain security system is divided into three levels, record-level, block-level, and chain-level.
Record-level security is mainly to determine whether an operation record is legitimate, in some implementations also includes whether the different users have read visible and write visible.
and the block level is when the node receives another node to send the block, how to determine that the block itself has not been tampered with, then through the Merkel, mining results and other mechanisms can be done.
Finally, how to ensure the integrity of the chain? For example, each data block needs to contain the check of the previous data block in the chain, and how to rollback when the fork occurs, is to guarantee the whole chain structure integrity.
Iv. de-Centralized database architecture
How will the integration of blockchain technology and database technology result?
Can we organize the existing blockchain in a database structure into different modules such as kernel, runtime, plug-in, and SQL parsing optimization?
Since the core nature of the database remains an immutable transaction log, which is equivalent to the chain structure of the blockchain, if we even have the SQL engine access to the data in the chain directly by erecting the SQL engine in the state store, Does that mean we have a generic programming and access interface?
Another example: For security components, we can do column-level row-level table level and node-level security authentication, and can be configured to specify which tables need to be digitally signed, which tables some of the fields are shared, but the other fields are required to be multi-signature encryption and so on.
Also, for consistency, can we specify that some tables are global shared tables, and some tables are local tables, which can replace the current way in which the blockchain is mixed with the database.
I think there will be a "de-centralized database" in the future.

Basic features of the de-centralized database:
De-centering: The architecture is completely centralized, there is no central control node, each node has the function of reading and writing, the data of each node is consistent; no global lock: Because of the peer architecture on the WAN, it is not possible to implement global lock in the centralized database, so the system can only use to some extent to weaken the lock and consistency To meet high-availability requirements; Non-fixed node generation log: Non-fixed node generation log, log is the entire database log, in the de-centralized architecture, any node has the right to record the log, thus forming a de-centralized without the master node of the schema, any node has the opportunity to temporarily become the accounting node out of the block Asynchronous transaction acknowledgement: Because there is no global lock, some transaction mechanisms must be tuned compared to traditional databases. It may be a more feasible idea to rollback a transaction for a commit; consistency policy tuning: In a multi-live blockchain state, the data consistency strategy differs from the traditional database consistency mechanism; row-level security and triggers: for data security, The de-centralized database will guarantee data security to row-level and even column-level.
V. Blockchain and database technology convergence: Centralized Database
For blockchain and traditional data technology, I think the future development of blockchain technology, the theme is "Fusion"!
Now the Blockchain business philosophy is developing rapidly, but from the perspective of technology, I think the current blockchain technology is still similar to the database technology stage of the "80 's" in the last century, in the period of technology growth. As we mentioned above, blockchain technology has a long way to go in universality and standardization.
The integration of database technology and blockchain technology is a trend based on the similarity of technical route and architecture design. Through the introduction of blockchain technology and mechanism, the central database will probably be an important direction of future technology development.

Understanding Blockchain with Database thinking

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.