Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Understanding Block chain with Database thinking

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

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

As a veteran of the database industry, I can see that under the upsurge of blockchain technology, students of traditional IT technology have maintained a very rational, even repulsive attitude. In fact, whether it is enthusiastic or exclusive, from a bipolar point of view, I think we should explore blockchain technology from a perspective that IT people can understand. Because the nature of blockchain is very similar to database technology, many mechanisms use the concept of database to understand it very intuitively and accurately.

For blockchain and traditional data technology, I think the theme of the future development of blockchain technology is "convergence". We interpret the technical points in the blockchain technology system from the perspective of database, and make a good integration of blockchain and database technology through the concept of "decentralized database".

I. current situation of block chain technology

The current blockchain world is known as 1.0, 2.0, and even to the 3.0 era, but from a product or technology polishing point of view, I think the current blockchain is equivalent to the database in the 1980s, in the era of a hundred flowers contending with all kinds of ideas.

For technical people, this is the best era, where a large number of fresh ideas and ideas erupt, bringing fresh breakthroughs in the dreary field of technology; at the same time, it is also the worst time, and no product or direction is certain to be the mainstream of the future. any fresh ideas may not prove feasible in a few months' time.

Therefore, we should correctly understand the change and development of the current blockchain technology, so let's compare the path taken by the database in that year and see how the blockchain world will develop in the future.

1. The evolution of technology

First of all, I think that the blockchain will certainly evolve from the current specialization to generalization. At present, almost all public chain products are implemented and optimized for a specific scenario, but I think the future will not be an application chain, but there will be a general development paradigm. Just like the traditional database, no matter what kind of application you develop, you can use such a limited number of general-purpose products to meet most business scenarios.

Second, the evolution to standardization. For block chain technology, each chain basically has its own development paradigm, and even many public chains try to make a programming language by themselves, which is actually a sign that the industry is in the primitive period. How to judge that an industry is beginning to mature? That is, the business model is basically fixed and the development mode is basically fixed, so that a large number of programmers can be promoted.

Third, productization and modularization have been continuously strengthened. At present, whether it is Ethernet Square, Bitcoin or many other new common chains, most of the architectures are very tightly coupled. Compared with our Hadoop in big data field, almost every module can be configured and customized as an independent plug-in. Therefore, I think that with the continuous maturity and stability of blockchain technology, there will be a mature product in the future, which can meet a variety of consensus algorithms and security mechanisms through pluggable configurations and plug-ins.

Finally, the improvement of performance and scalability. In fact, this is also the road taken by the database, the current block chain world wants to go through the changes of the database in the past decades through side chain, fragmentation and other mechanisms in a short time.

Next I'll show you where the biggest performance and scalability constraints of blockchain are from a database perspective and how they should be optimized.

2. The present situation of development

Let's go back and take a look at the current situation of the blockchain industry.

Putting aside some applications in the upper layer of the blockchain and innovations in the financial field, from a technical point of view, I have always thought that the biggest innovation lies in the establishment of peer-to-peer data storage mechanism.

In the database industry, everyone has been following the master-slave architecture, and the complete "multi-live" system has always been a legendary thing since it was proposed decades ago, and no product has ever really achieved multiple activities.

When we look at the current blockchain technology in terms of innovative multi-active databases, we will find three problems that are in urgent need of improvement:

First of all, the architecture of the blockchain is very chaotic now, and it has not been classified into transaction, stored procedure, authentication, master-slave synchronization and other modules like the traditional database, and most people's cognition of the blockchain is still in the mysterious black box stage. Second, the development language of blockchain is completely unsystematic. After the beginning of the "warring States period", the database gradually used SQL to achieve the unification of the industry. At present, the blockchain is obviously still in the "warring States period", and there is not a unified standard for development and use. Third, the variety of requirements, some requirements or the business introduction of the white paper is reliable, while others are completely whimsical. In fact, this is related to the new business model brought about by the blockchain, and many people are still exploring new business models, resulting in the lack of a standard paradigm for requirements.

II. Block chain vs database technology: similarities

From the point of view of database, block chain technology is decentralized multi-active database technology, and there is no essential difference between the two.

Here I list some of the more important technical points in the blockchain and in what form these technical points exist in the database field. The one-to-one correspondence between these concepts and the technical concepts in the database is as follows:

Consensus mechanism

Consistency control-consensus mechanism

Distributed database is called consistency control, including traditional master-slave replication, new generation of Raft, Paxos and other algorithms. In order to solve the extra Byzantine problem in the block chain, the algorithm is improved to PBFT, PoW, PoS and other protocols.

Storage mechanism

Database log-ledger

The chunk chain structure is basically equivalent to the transaction log of the database, and its main new content includes that the Merkle Tree structure is used to quickly verify the correctness of the data, but its essence is equivalent to the transaction log of the database. At the same time, the database will include enterprise-level capabilities such as transaction control in the log, which is not available in the block chain data structure.

Intelligent contract

Intelligent contract-stored procedure

A smart contract, like a database stored procedure, is managed code. In essence, intelligent contracts are no different from database stored procedures, which execute a piece of code through external calls or virtual machines, and can share managed code with other users to make calls.

Slice

Database slicing mechanism existed as early as the era of MPP database. By dividing a large amount of data into different slices, we can limit the total amount of data in each shard and improve the total throughput and storage space.

Application development interface

At present, the block chain is still in the early era similar to that of the database, and the interface is not unified and standardized. Depending on the blockchain project, the interface can be defined according to database, object storage, API calls, or even PaaS platform standards.

Safety.

The security mechanism of block chain is similar to that of database. Database security is generally divided into two modules: authentication and authorization, which represent user login and access rights respectively. The blockchain currently supports only record-level write authorization, but is fully shared for read operations. Therefore, in terms of security strategy, the database is much better than the current block chain.

Third, block chain vs database technology: differences

Functional Architecture Diagram of Database and Block chain

1. Functional architecture

The × × part is the function of both the block chain and the database schema. The white part is a unique feature of the current database.

We also mentioned above that the SQL capability of the database is an important part of achieving its versatility, and SQL is important for fixing the development pattern of the later blockchain.

Index management is mainly used to improve the performance efficiency of data management and data query in the database. When specific application scenarios appear, performance will become an important part that needs to be improved in the next stage. Therefore, the index of the stored data becomes a very important component.

2. Mechanism

Mechanically, the main differences between a blockchain and a database are as follows:

Consistency

The biggest difference between the design idea of blockchain and the traditional database design idea is that it is more active, that is, the difference of the consistency model brought by the decentralized system.

Traditional relational databases follow the ACID strong consistent model, and the written records can be read immediately. While some new distributed databases adopt the ultimate consistency, that is, the BASE model, the written data may not be read for the time being, but it will exist eventually.

However, there is a significant difference in the design idea of blockchain or decentralized database, that is, there is no concept of "permanent confirmation" for any operation. Even if it is similar to Bitcoin, from the core principle, the content before six blocks is only "basically not to be rolled back".

To take an extreme example, if the wide area network between China and the United States is suddenly cut off for three days for some reason, and then it is restored, there will certainly be a large-scale bifurcation of Bitcoin. During this period, if an account is spending a lot of money in China and the United States at the same time, if you want to restore a main chain, you have to sacrifice a large number of people's transactions to achieve a pullback.

Then, since there is no way to guarantee strong consistency in the peer-to-peer architecture, the consistency in the block chain system is essentially different from the traditional database, which leads to a series of design differences.

In the final analysis, in any database model with traditional master-slave architecture, people will do everything possible to prevent "brain cracks" in the cluster, that is, two nodes in the same cluster think they are the master nodes.

But this problem can occur all the time in the peer-to-peer database system, and this phenomenon is called bifurcation in the block chain, which is very different from our traditional database consistency model.

Locking mechanism

Among them, the locking mechanism can be said to be the biggest difference between the blockchain and the database in ensuring data consistency.

It is impossible for all students who have studied the database not to have heard of locks. When we do a transaction, the records of all session changes before committing are locked and cannot be modified by other sessions.

On the other hand, in the decentralized database, because each account node operates local data, the change information will be transmitted asynchronously, so there is no global lock that can notify others when recording changes. Therefore, under the premise of no lock, how can the decentralized database, that is, the blockchain, ensure data consistency?

Bitcoin uses the UTXO structure, which is similar to the "optimistic lock" idea of the database, that is, it is not locked during the operation, but only in the final submission process to determine whether the record has changed.

Bitcoin determines whether there is a transaction conflict by whether the coin is spent or not. On the other hand, Etay Fang uses nonce as the incremental counter of each record to determine whether there are repeated transactions for a certain account, which is actually a disguised mechanism of row-level locking.

Security mechanism

Another block chain industry people talk about more is the security mechanism.

First of all, I am not an expert in encryption algorithms, so I will not discuss the specific encryption algorithms used here, but from the design of the security model of the entire storage system, let's discuss how to ensure data security under the full peer-to-peer architecture in blockchain technology.

In my opinion, the security system of blockchain is divided into three levels, record level, block level and chain level.

Record-level security mainly determines whether an operation record is legal or not, and in some implementations, it also includes whether it is visible to different users.

The block level is how to judge that the block itself has not been tampered with when the node receives the block sent by another node, then it can be done through mechanisms such as Merkel tree, mining results and so on.

Finally, how to ensure the integrity of the chain? For example, each data block needs to contain the check of the last data block in the chain, and how to roll back when the bifurcation occurs, and so on, to ensure the integrity of the whole chain structure.

IV. Decentralized database architecture

What will be the result of the integration of blockchain technology and database technology?

Can we organize the existing blockchain into different modules such as kernel, runtime, plug-ins, and SQL parsing optimization?

Since the core essence of the database is still the immutable transaction log, which is equivalent to the chain structure of the blockchain, does it mean that we have a general programming and access interface if we set up the SQL engine in state store or even let the SQL engine access the data in the chain directly?

Another example: for security components, whether we can achieve security authentication at the column level, row level, table level and node level, and at the same time, through configuration, we can specify which tables need to be digitally signed and some fields of which tables are shared, but other fields need to be encrypted by multiple signatures.

In addition, for consistency, can we specify that some tables are global shared tables and some tables are local tables, which can replace the current deployment of block chains mixed with databases.

I think there will be a "decentralized database" formed by the integration of the two in the future.

The basic characteristics of a decentralized database:

Decentralization: the architecture is completely decentralized, there is no central control node, each node has the function of reading and writing, and the data of each node is consistent; no global lock: due to the use of peer-to-peer architecture on the wide area network, decentralized database is impossible to achieve global locking, so the system can only use to some extent weaken locks and consistency to meet the needs of high availability Non-fixed node generates logs: non-fixed nodes generate logs, which are the logs of the entire database. In the decentralized architecture, any node has the right to record logs, thus forming a decentralized architecture without a master node. Any node has the opportunity to temporarily become an outbound block of accounting nodes; asynchronous transaction confirmation: because there is no global lock, some transaction mechanisms must be adjusted compared with traditional databases. It may be a feasible idea to roll back the commit of transactions asynchronously; consistency strategy adjustment: in the state of multi-active block chain, the consistency strategy of data will be different from the traditional database consistency mechanism; row-level security and triggers: for data security, decentralized database will ensure data security at row level or even column level.

5. Integration of blockchain and database technology: centralized database

For blockchain and traditional data technology, I think the theme of the future development of blockchain technology is "integration"!

Now the business concept of blockchain is developing rapidly, but from the point of view of the technology itself, I think the current technology of blockchain is still similar to the database technology stage of the 1980s, in the growth period of technology. As we mentioned above, blockchain technology still has a long way to go in terms of generality and standardization.

Based on the similarity of technical route and architecture design, the integration of database technology and blockchain technology is actually a general trend. Through the introduction of blockchain technology and mechanism, the decentralization of the database may be an important direction of technological development in the future.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report