Take you an article to understand Blockchain + NoSQL database

Source | Tyler Mitchell

Translator | Fire Sauce, Chief Editor | Carol

Picture source | CSDN download from Visual China

Both NoSQL databases and modern blockchain ledgers benefit from a common set of principles. Because the two platforms can complement each other, when they serve the same application, they can cooperate to complete a variety of tasks.

In this article, we will review the overlap between the two and learn how to use Couchbase's NoSQL platform to support our next enterprise distributed ledger application (for example, using Hyperledger). In fact, the content of this topic is very profound, but in this article, we will only touch on two relatively simple ideas, briefly outline their commonalities and opportunities: distributed computing and the state of the world.

Distributed Computing

Distributed computing is the core of modern enterprise architecture-whether it is a parallel processing CPU/GPU environment, a multi-node database cluster, or a global data center with synchronized clusters in different regions.

By leveraging the distributed processing speed, recoverability, and scalability of these architectures (this is another topic), application developers can focus on building the required user experience, and the back-end data system will do the heavy lifting work.

What does "distributed" mean? In short, there are multiple servers to manage as part of a node cluster. Under ideal circumstances, there is no single point of failure or centralized control in a distributed system.

In addition, it also assumes that the workload item is broken down into fragments that can be processed by the underlying atomic processor, for example, to distribute work tasks to multiple nodes.

The names of such systems often include "point-to-point networks, cluster computing, parallel processing" and so on. There is a good list on Wikipedia, which lists various related systems so far.

List address:

https://en.wikipedia.org/wiki/Distributed_computing?ref=hackernoon.com

Blockchain is the epitome of distributed technology

Although distributed technology has many advantages, its application is not as wide as imagined. Even in modern enterprises, the phenomenon of system centralization is still very common. These include industries that are designed to be more flexible, such as global financial systems or supply chain management. In fact, these industries tend to prefer mainframe computing.

By the way, the centralized system is very easy to distinguish, because when it fails, all work will stop! When all data or services are running on one machine, once there is a downtime, the system will stop operating completely.

This may be because it takes time to start a replacement machine, or it takes time to identify the fault before rerouting users, or it may be because of various other devastating engineering reasons. The centralized system is the opposite of the point-to-point network we expect.

However, with the advent of platforms such as Bitcoin, the next generation of digital currencies and "ledgers" have gradually proven their feasibility. Now, thousands of different cryptocurrencies and dozens of blockchain backends are applying decentralized technology.

In addition, please note that "distributed ledger" is not equivalent to the "proof of work" used in many cryptocurrencies. Instead, we want to treat the ledger as having established trust in the updated application, without having to perform any specific tasks in order to be added to the chain.

Distributed NoSQL

Similarly, companies are also looking for more ways to utilize distributed technology for their internal systems to reduce downtime. If you want to build a ledger-based system, there are currently many methods to choose from. If you want to make a general database, there are many options, especially in data management.

In enterprises running distributed systems, most of the technologies can be found in the database, especially the NoSQL platform. This distributed feature has become one of the pillars of Couchbase since its first day of appearance, filling in the inevitable critical gaps in traditional databases.

             

Couchbase introduces the concept of multidimensional expansion-that is, the ability to scale applications and services across multiple nodes or multiple clusters.

If it is only running on a single node, it is no different from introducing a JSON document storage. Similarly, if another blockchain technology is not equally distributed in machine clusters, it does not make any sense.

There must be a single point of failure and control point in a centralized system, which undermines the trust of the entire system. Fortunately, Couchbase, blockchain and related technologies all provide demand and value for the existence of distributed systems.

Hyperledger (Hyperledger) component

Another common feature of blockchain distributed ledgers such as Hyperledger and Couchbase is that use cases show a single "current" view of managed assets.

According to Hyperledger Fabric (a specific distributed ledger implementation), there are mainly two types of data processing components at play in its system.

  • Operational transaction (Operational transaction) is the core of all ledgers-it verifies, creates and records all transactions in the ledger. Hyperledger Fabric handles all built-in permissions, confirms who can initiate transactions, and stores them in various back-end technologies.

  • World state, as another main component, is another data view that maintains the current state value of the account. When a transaction from one entity to another is executed, the world state will also be updated to maintain the current latest value. Previous transactions will not be stored in the world state.

Each account in the world state system will have a separate value, but its overall history will be accurately and detailedly stored in the transaction system.

NoSQL information source

Both of the above two components can be implemented using Couchbase NoSQL database as the backend. Couchbase is used to handle high-throughput operational transactions in many different use cases (finance, fraud detection, IoT, etc.). Distributed ACID transactions are also possible. We will discuss this topic in a future article.

Using Couchbase as the main back-end database of the blockchain system can facilitate the storage/retrieval of world state data.

Couchbase is often used to store data collections from multiple different databases, providing the so-called Source of truth. Similar to the state of the world, it also stores materialized images of relevant current data.

Therefore, Couchbase is very suitable for application developers who need to store application user configuration files. For example, although other back-end systems may update each piece of data, when the user logs in, the user profile will immediately appear in the JSON document.

In this case, the ultimate benefit of using Couchbase is that you can enjoy all the built-in advantages provided to developers. Once the data is put in the database, we can access powerful SQL-based query tools, use natural language for full-text search, large-scale big data analysis for large data sets, and so on. In this way, developers can focus on products and users, while keeping the back-end systems managed and synchronized.

Why choose NoSQL+Blockchain?

The purpose of writing this article is not only to compare these two technologies, but also to encourage developers and architects to study how to combine these two technologies. This is a good way.

Couchbase can be used as an application development layer on top of any distributed ledger or blockchain technology. It can be an operational database component or a world state. If the enterprise solution you are building needs to provide end users with account details quickly and easily, then the world state database would be an excellent research use case.

For example, when a blockchain transaction occurs and the world state needs to be updated, the same update will also be sent to Couchbase for users to use. Because Couchbase has a mobile SDK and comprehensive SQL analysis support, it can provide a more powerful data interface than a blockchain system.

This becomes especially important when we want users to have quick access to the latest information.

The blockchain system requires a certain amount of time to transmit information, but with the help of advanced protocols, Couchbase can achieve this in a shorter time-the data view can be established as soon as the change occurs. And because Couchbase runs in a multi-cluster environment, the stability and flexibility of its platform is not inferior to the blockchain system.

integrated

Although there is currently no ready-made Couchbase and Hyperledger integration, the Couchbase SDK supports all major programming languages. Anyone who builds a blockchain-based ledger can use the blockchain API and Couchbase API to send current world status updates to the NoSQL database via JSON.

If you are interested in building this kind of integration, you can look at the back-end providers in Hyperledger Fabric and choose one of them to apply to Couchbase Server.

In addition, when the smart contract application is updated in the ledger, this function can also be implemented directly in the sent chaincode. I have only just begun to get involved in this aspect, but in the following articles, we can compare/compare database user-defined functions (UDFs) with blockchain chain codes for your reference.

There are still many things worth digging deeper in the blockchain field, but I hope that the similarities and overlaps mentioned in this article can help you sort out your own perceptions.

Original link:

https://hackernoon.com/an-introduction-to-blockchain-nosql-databases-qm2f341y

This article is translated by CSDN cloud computing, please indicate the original source


More reading recommendations

Guess you like

Origin blog.csdn.net/FL63Zv9Zou86950w/article/details/111713679