CN110908801B - Data processing method and device based on block chain, computer equipment and storage medium - Google Patents

Data processing method and device based on block chain, computer equipment and storage medium Download PDF

Info

Publication number
CN110908801B
CN110908801B CN201911100293.XA CN201911100293A CN110908801B CN 110908801 B CN110908801 B CN 110908801B CN 201911100293 A CN201911100293 A CN 201911100293A CN 110908801 B CN110908801 B CN 110908801B
Authority
CN
China
Prior art keywords
service
container
data
containers
node
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911100293.XA
Other languages
Chinese (zh)
Other versions
CN110908801A (en
Inventor
唐俊峰
杨波
张良杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Kingdee Software China Co Ltd
Original Assignee
Kingdee Software China Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Kingdee Software China Co Ltd filed Critical Kingdee Software China Co Ltd
Priority to CN201911100293.XA priority Critical patent/CN110908801B/en
Publication of CN110908801A publication Critical patent/CN110908801A/en
Application granted granted Critical
Publication of CN110908801B publication Critical patent/CN110908801B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5038Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/542Event management; Broadcasting; Multicasting; Notifications

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to a data processing method and device based on a block chain, computer equipment and a storage medium. The method comprises the following steps: each service container determines service containers of other classes in at least two classes of service containers and services registered in a service registration center container; each service is used for executing a processing link of the node data processing logic sequence; when data to be stored are obtained, data processing is carried out according to corresponding services through service containers of corresponding classes according to a node data processing logic sequence; and after the node agrees with other nodes in the block chain network, storing the data to be stored through a service container which provides storage service in at least two types of service containers. By adopting the method, the service efficiency of the block chain network can be improved.

Description

Data processing method and device based on block chain, computer equipment and storage medium
Technical Field
The present application relates to the field of blockchain technologies, and in particular, to a method and an apparatus for processing data based on a blockchain, a computer device, and a storage medium.
Background
With the development of computer technology, blockchain technology has emerged. The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism and an encryption algorithm. The block chain network mainly comprises a node module, an intelligent contract module, a consensus module, a storage module and a cache module. A conventional blockchain service architecture runs all or most of the modules within a blockchain in the same container. When a transaction calls the blockchain network, the blockchain business process comprises a client-side initiating request, independent verification of each node, generation of a simulation result by an intelligent contract, consensus achievement of multiple nodes, generation of a block after the consensus, storage of the block and return to the client-side.
However, in the conventional blockchain network, the data processing capabilities of the modules are different, and the modules are highly coupled, so that when the serial service flow is processed, the data processing capability of the whole flow is reduced due to the insufficient data processing capability of any one link, and the service efficiency of the blockchain network is low.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a method, an apparatus, a computer device and a storage medium for processing data based on a blockchain, which can improve efficiency of a blockchain network service.
A data processing method based on block chain is applied to a node in a block chain network, wherein a service registration center container and at least two types of service containers are operated on the node; the method comprises the following steps:
each type of service container determines service containers of other types of the at least two types of service containers and services registered in a service registration center container; each service is used for executing a processing link of the node data processing logic sequence;
when data to be stored are obtained, data processing is carried out according to corresponding services through service containers of corresponding classes according to a node data processing logic sequence;
and after the data is agreed with other nodes in the block chain network, storing the data to be stored through a service container which provides storage service in the at least two types of service containers.
A blockchain based data processing apparatus for implementing nodes in a blockchain network, the apparatus comprising a service registry container and at least two types of service containers;
each type of service container is used for determining services registered by other service containers in at least two types of service containers in a service registration center container; each service is used for executing a processing link of the node data processing logic sequence;
the service container is used for carrying out data processing according to corresponding services through the service containers of corresponding classes according to the logical sequence of node data processing when the data to be stored is obtained; and the data storage device is further used for storing the data to be stored through a service container which provides storage service in the at least two types of service containers after the data storage device agrees with other nodes in the block chain network.
A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program:
each type of service container determines service containers of other types of the at least two types of service containers and services registered in a service registration center container; each service is used for executing a processing link of the node data processing logic sequence;
when data to be stored are obtained, data processing is carried out through the service containers of the corresponding classes according to corresponding services according to the node data processing logic sequence;
and after the data is agreed with other nodes in the block chain network, storing the data to be stored through a service container which provides storage service in the at least two types of service containers.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
each type of service container determines service containers of other types of the at least two types of service containers and services registered in a service registration center container; each service is used for executing a processing link of the node data processing logic sequence;
when data to be stored are obtained, data processing is carried out according to corresponding services through service containers of corresponding classes according to a node data processing logic sequence;
and after the data to be stored is in consensus with other nodes in the block chain network, storing the data to be stored through a service container which provides storage service in the at least two types of service containers.
The data processing method, the data processing device, the computer equipment and the storage medium based on the block chain register the services provided by each type of service container to the service registration center container. Therefore, when the data to be stored is acquired, the node executes each processing loop of the node data processing logic sequence, and the corresponding service provided by the corresponding class can be acquired through the service registry container. And after the network node agrees with other nodes in the block chain network, acquiring storage service through the service registration center container and storing the data to be stored. Thus, the service required by each service container is acquired through the service registry container. Each service container is independent, and each service container can be flexibly expanded, so that the service efficiency of the block chain network is greatly improved.
Drawings
FIG. 1 is a diagram illustrating an exemplary implementation of a blockchain-based data processing method;
FIG. 2 is a flow diagram that illustrates a method for blockchain-based data processing in one embodiment;
FIG. 3 is a block-chain network service architecture diagram according to an embodiment;
FIG. 4 is a diagram illustrating an exception state for a service container in a node in a blockchain network, according to one embodiment;
FIG. 5 is a flow chart illustrating a data processing method based on block chains according to another embodiment;
FIG. 6 is a block diagram of a data processing apparatus based on a blockchain in one embodiment;
FIG. 7 is a block diagram showing a structure of a data processing apparatus according to another embodiment;
FIG. 8 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The data processing method based on the block chain can be applied to the application environment shown in fig. 1. The application environment includes a terminal 102 and a node 104 in a blockchain network. The terminal 102 and the node 104 communicate through a network, and each node in the blockchain network also communicates through the network. The user terminal 102 may be a desktop terminal or a mobile terminal, and the mobile terminal may be at least one of a mobile phone, a tablet computer, a notebook computer, and the like. The nodes 104 may be implemented as individual servers or as a server cluster of multiple servers. Each type of service container in the node 104 determines service containers of other types of the at least two types of service containers and services registered in a service registry container; each service is used to perform a processing element of the data processing logic sequence of node 104. When the node 104 acquires the data to be stored from the terminal 102, the data is processed according to the corresponding service through the service containers of the corresponding class according to the data processing logic sequence of the node 104. After reaching consensus with other nodes in the blockchain network, the node 104 stores the data to be stored through a service container providing storage service in at least two types of service containers. Those skilled in the art will understand that the application environment shown in fig. 1 is only a part of the scenario related to the present application, and does not constitute a limitation to the application environment of the present application.
In one embodiment, as shown in fig. 2, a data processing method based on a blockchain is provided, which is described by taking the method as an example applied to a node 104 in a blockchain network in fig. 1, and includes the following steps:
s202, each type of service container determines other types of service containers in the at least two types of service containers and services registered in a service registration center container; each service is for performing a processing element of the node data processing logic sequence.
Wherein a container is a process that processes data. A service registry container is a type of registration container used to register services, discover services, and check the health status of services. The service container is a container in which a module is operated to provide a service corresponding to the module. A service is a function provided by a module, such as a service that provides at least a portion of the functionality in a blockchain, a service that implements links of a transaction, or a service that implements links of a social interaction.
A blockchain network is a carrier and organization way to run blockchain technology. Block chaining (bt) is a technology of internet database, also called distributed book technology. The method is characterized by decentralization, openness and transparency, and each person can participate in data recording. The blockchain technology is a brand new distributed infrastructure and computing mode that uses blockchain data structures to verify and store data, uses distributed node consensus algorithms to generate and update data, uses cryptography to secure data transmission and access, and uses intelligent contracts composed of automated script codes to program and manipulate data.
In the embodiment of the invention, each node in the block chain network runs a service registration center container and at least two types of service containers. Each type of service container on the node may register the service with the service registry container, and each type of service container may further determine services for which other ones of the at least two types of service containers are registered with the service registry container.
In one embodiment, the blockchain network may have at least three nodes, and the nodes may communicate with each other through the network. At least one service registry container and at least two types of service containers are operated in each node, and the number of each type of service container can be one or more than one. Each type of service container is independent, and when each type of service container needs the service of other service containers in at least two types of service containers, the service registered by each type of service container in the service registration center container can be acquired.
Referring to fig. 3, in one embodiment, a blockchain network exists with nodes A, B, C and D communicating between nodes A, B, C and D through a P2P container. And a service registration center container and six types of service containers are respectively operated on each node. The six types of service containers are respectively a P2P (Peer-to-Peer) container, a node container, a cache container, an intelligent contract container, a storage container and a consensus container. Among other things, the P2P container may provide services for communication between nodes in a blockchain network. The node container can provide a service for verifying the data to be stored sent by the terminal and broadcasting the data to be stored through the P2P container. The cache container may provide a service to store temporary data or frequently accessed data. The intelligent contract container can provide a service for generating an intelligent contract simulation result according to the computer protocol and the data to be stored. The storage container may provide a service of storing the blocks generated by the data to be stored in a hard disk or a database. The consensus container can provide a service of consensus among all nodes in the block chain network through consensus operation.
And S204, when the data to be stored is obtained, processing the data according to the corresponding service through the service containers of the corresponding class according to the node data processing logic sequence.
In particular, the terminal may send data to be stored to nodes in the blockchain network. When the node acquires the data to be stored, the data to be stored can be processed according to the corresponding service through the service containers of the corresponding classes according to the logical sequence of the node data processing.
In one embodiment, the data to be stored sent by the terminal to the nodes in the blockchain network may be transaction data. The transaction data may specifically include the name of the transaction, the time of the transaction, the amount of resource transfer, the number of transactions, and the account names of the two parties to the transaction. The node can verify the validity of the transaction data, specifically, verify the validity of data information, the accuracy of the transaction data and the like. The transaction data which passes the validity verification is the transaction data which is complete in record, correct and has not been tampered.
And S206, after the node agrees with other nodes in the block chain network, storing the data to be stored through a service container which provides storage service in at least two types of service containers.
Specifically, the processing result after data processing is performed according to the corresponding service through the service container of the corresponding class is sent to the block chain network for consensus operation. When the node agrees with other nodes in the block chain network, the node stores the data to be stored locally through a service container which provides storage service in at least two types of service containers.
In one embodiment, the consensus operation in the blockchain network may be implemented by a consensus algorithm. Common consensus algorithms in the blockchain network include POW (Proof of Work), POS (Proof of interest), DPOS (cleared Proof of interest), PBFT (Practical Byzantine Fault Tolerance algorithm), and the like. The embodiment of the application does not limit the consensus algorithm adopted by the consensus node.
In one embodiment, a node may have a cache container and a storage container running thereon. The cache container can cache data processing results sent by other nodes in the blockchain network, and the data processing results in the cache container are stored in the storage container after the data processing results in the cache container reach a consensus in the blockchain network. Therefore, when the block chain network processes a large amount of data to be stored, the burden of the storage container can be greatly reduced, and the storage speed is improved.
In the above data processing method based on the blockchain, the services provided by each type of service container are registered to the service registration center container. Therefore, when the data to be stored is acquired, the node can acquire the corresponding service provided by the corresponding class through the service registry container when executing each processing loop of the node data processing logic sequence. And when the node agrees with other nodes in the block chain network, the storage service is acquired through the service registration center container, and the data to be stored is stored. Thus, the service required by each service container is acquired through the service registry container. Each function module in the traditional block chain is packaged into a service container which can independently run respective service in a single node, each service container is independent, and each service container can be flexibly expanded, so that the service efficiency of the block chain network is greatly improved. In addition, each module is packaged into independently-operated service, and is in an extremely-low coupling state with other modules, so that the version iterative development and maintenance of each module in the follow-up process become easier and the cost is lower.
In one embodiment, in step S202, that is, each class of service container determines the service container of the other class of service containers, and before the step of serving the service registered by the registry container, the method for processing data based on the blockchain further includes: acquiring a service registration center container mirror image and a service container mirror image; mirror-image running of a service registration center container to form a service registration center container, and mirror-image running of the service container to form a service container; the service container registers the corresponding service in the service registry container.
The mirror image is a file storage form and is a type of redundancy, and data on one disk has an identical copy on another disk, namely the mirror image. Common Image file formats include ISO (Open Systems interconnection), BIN (Binary file), IMG (Image file), TAO (Track-At-one), DAO (Disk-At-one), and the like. The embodiment of the application does not limit the format of the mirror image file.
In particular, a node in a blockchain network may obtain a service registry container image and a service container image. Furthermore, the node may run the service registry container mirror as a service registry container and the service container mirror as a service container by running the technology of the program. After the service registry container and the service container are both started, the service container can register corresponding services in the service registry container.
In one embodiment, the technology for running the program may specifically be a Docker technology. The Docker is an open-source application container engine, and related applications and dependency packages can be packaged into a portable image through the Docker technology and then distributed to computer equipment. The Docker technology is characterized in that the containers operated by the Docker technology do not have any interfaces with each other. In addition, the technology for running the program may specifically be Tomcat technology. Tomcat is a Web (World Wide Web) application server. The Tomcat technique is characterized in that the vessels operated by the Tomcat technique are independent of each other.
In one embodiment, the service registry container may be implemented by the Consul technology. Consul is a service grid solution. Consul is a distributed, highly available system. Consul provides a fully functional control plane. Consul is mainly characterized in that: service discovery, health check, key value storage, security service communication and multiple data centers. The service registry container may also be embodied in Zookeeper technology. Zookeeper is a highly available, high-performance and consistent open source coordination service designed for distributed applications, is a basic component of a big data distributed cluster, and provides distributed lock service for the cluster. The service registry container may also be implemented in particular by Etcd technology. Etcd is a distributed KV (Key-Value, Key-Value pair) storage facility. Etcd is characterized in that: the method has the advantages of consistency, high performance and high availability.
In the above embodiment, the service registry container is obtained, and the service registry container is operated as the service registry container in a mirror image manner, so that the service registry is provided for the node. By acquiring the mirror image and the service container mirror image, the service container mirror image is operated to be a service container, so that each service container can be operated independently. And registering the service provided by each service container to the service registry container, so that each service container can acquire the corresponding service from the service registry container.
In one embodiment, the node may determine the number of each of the at least two types of service containers based on the service performance of each type of service container. Specifically, the number of each type of service container running on the node can be flexibly selected according to the performance of each type of service container. For example, a service registry container and six types of service containers are operated on the node. The six types of service containers are respectively a P2P container, a node container, a cache container, an intelligent contract container, a storage container and a consensus container. The node container has lower efficiency of processing data than other five types of service containers. Then, more than one node container can be run on the node, and the more than one node container can process data simultaneously, so that the data processing efficiency of the whole block chain network can be improved. The number of each type of container can be preset, or a plurality of same service containers can be automatically started by detecting the performance of each type of service container.
In an embodiment, the step S202, that is, the step of determining, by each service container, a service container of another class of the at least two classes of service containers and a service registered in the service registry container specifically includes: each service container determines a service identifier of a service to be called; the service identifier is the service identifier of the service registered by the service container of other types in the at least two types of service containers in the service registration center container; and each service container inquires services corresponding to the service identifications from the service registration center container according to the service identifications.
The service identifier is an identifier used for uniquely determining the service provided by the service container, and may specifically include a character string of at least one character of letters, numbers, and symbols.
Specifically, each type of service container running on a node can determine the service identifier of the service required to be called by the current data processing link. Furthermore, each type of service container can inquire the service registered in the service registry container by the service container from the service registry container according to the service identifier, and the service corresponding to the service identifier is registered in the service registry container. And the subsequent service container can call the corresponding service container for providing the service according to the inquired service to perform data processing.
In one embodiment, the service identification may determine services provided by more than one homogeneous service container. For example, three node containers may be run on a node, and since the services provided by the three node containers are the same, the services provided by the three node containers may be marked by the same service identifier. When other service containers in the node call the service of the node container, any one of the three node containers can be acquired as a provider of the service in the service registry container through the service identifier.
In the embodiment, the service identifier of the service registered in the service registration center container by the service container of the other class of the at least two classes of service containers can quickly and accurately inquire the service corresponding to the service identifier in the service registration center container when the service container of the other class of the at least two classes of service containers calls the service, so that the service inquiry time is saved.
In one embodiment, the method for processing data based on block chains further comprises: the service registration center container monitors the state of the service container; when at least one service container is in an abnormal state, the service registration center container periodically checks the state of the abnormal service container; and when the abnormal service container is recovered to the normal state, informing the service container needing to call the service.
Specifically, the service registry running on the node may detect a state of the service container running on the node, and when at least one of the at least two types of service containers running on the node is in an abnormal state, the service registry container running on the node may periodically check the state of the abnormal service container. When the service registration center container detects that the abnormal service container is recovered to the normal state, the service container needing to call the service can be informed to call the service.
In an embodiment, the abnormal state of the service container may be specifically a failed start-up of the service container when the service container is started, or a suspended service caused by an uncontrollable external factor received during the operation of the service container, for example, a hardware damage of the service container due to a natural disaster. In addition, the abnormal state of the service container may also be a software fault occurring during the operation of the service container, for example, data of the service container is tampered by a human being.
In one embodiment, when the service registry container detects that at least one service container is in an abnormal state, the service registry container may check the health status of the abnormal service container immediately, or after detecting the abnormality, the service registry container may check the health status of the abnormal service container according to a preset time, for example, after 5 minutes.
In the above embodiment, the service registration center container periodically checks the health state of the abnormal service container, so that after the service container returns to the normal state, the service provided by the recovered service container can be timely called by the service calling party, thereby ensuring the timeliness of data processing and further improving the service efficiency of the block chain network.
In one embodiment, the node may further comprise at least one service container of the same type as the anomalous server, and the service registry container may monitor the status of the service container. When the service registry container detects that the abnormal service container is not recovered to a normal state, the service registry container can determine at least one service container which is similar to the abnormal service container. The service registry container may notify service containers that need to invoke services, and determine a service container to invoke services from at least one service container that is the same as the abnormal service container.
Referring to FIG. 4, in one embodiment, a service registry container, two node containers, and three intelligent contract containers are run on a node. When the intelligent contract container 3 is in an abnormal state, the service registry container may inform the abnormal state of the intelligent contract container 3 of the node container 1 and/or the node container 2 which called the intelligent contract container 3 service, and the node container 1 and the node container 2 do not call the intelligent contract container 3 any more subsequently. Because the services provided by the intelligent contract container 1 and the intelligent contract container 2 are the same as the intelligent contract container 3, the node container 1 and/or the node container 2 can invoke the services of the intelligent contract container 1 or the intelligent contract container 2 according to the condition obtained by the container query in the service registration center, thereby ensuring the normal invocation of the services.
In an embodiment, step S204, that is, when the data to be stored is obtained, according to the logical sequence of node data processing, the step of performing data processing according to the corresponding service through the service container of the corresponding class specifically includes: when data to be stored are obtained, determining a data processing link in a node data processing logic sequence where a node is currently located; according to the data processing link where the node is currently located, searching services provided by service containers of the class corresponding to the data processing link in a service registration center container; and calling at least one service container in the class corresponding to the service to process the data to be stored.
Specifically, the processing of the data to be stored by the node may be sequentially performed according to the logical order of the node data processing. When the node acquires the data to be stored, the node can determine the data processing link in the node data processing logic sequence where the node is located currently. According to the data processing link where the node is currently located, the node can search the service provided by the service container of the class corresponding to the data processing link in the service registration center container. Furthermore, the node can call at least one service container in the class corresponding to the service to process the data to be stored.
In one embodiment, the processing of the data to be stored acquired from the terminal may include broadcasting the data to be stored, verifying the validity of the data to be stored, processing the valid data to be stored through a computer protocol to generate an intelligent contract simulation result, caching the intelligent contract simulation result, consensus the intelligent contract simulation result, and storing the consensus data.
In the above embodiment, the service required by the current data processing link can be quickly determined by determining the data processing link in the logical sequence of the node data processing in which the node is currently located. Furthermore, the services provided by the service containers corresponding to the current data processing link can be quickly and accurately found in the service registration center container. Therefore, the service container corresponding to the service can be called to process the data to be stored.
In one embodiment, in step S206, that is, after reaching a consensus with other nodes in the blockchain network, before the step of storing the data to be stored by using a service container providing a storage service in at least two types of service containers, the method for processing data based on blockchain further includes: acquiring processing results fed back by other nodes in the block chain network; and performing consensus operation on the processing result in the block chain network through at least one service container of the corresponding class of the consensus service registered in the service registration center container.
Specifically, other nodes in the blockchain network may process the data to be stored, and feed back the processing result to the node. The node can obtain the processing result fed back by other nodes in the blockchain network and locally cache the processing result. At least one service container of the corresponding class of the consensus service registered in the service registration center container can send the processing result of the local cache to the block chain network for consensus operation.
In one embodiment, a node in the blockchain network may vote for the processing result of the data to be stored. And when more than half of the nodes in the block chain network process the data to be stored and obtain consistent processing results, the consensus is passed. When more than half of the nodes do not exist in the block chain network and the processing results obtained by processing the data to be stored are consistent, the data to be stored needs to be pulled again for calculation until more than half of the nodes exist in the block chain network and the processing results obtained by processing the data to be stored are consistent.
In the above embodiment, the processing results fed back by other nodes in the blockchain network are sent to the blockchain network, and the consensus operation is performed on the processing results through at least one service container of the corresponding class of the consensus service registered in the service registration center container, so that the consistency of data of each node in the blockchain network is ensured.
In an embodiment, the step S206, that is, after reaching a consensus with other nodes in the blockchain network, of storing the data to be stored through a service container providing a storage service in at least two types of service containers specifically includes: when the common identification is achieved with other nodes in the block chain network, generating a block by the data related to the data to be stored; searching a service container providing storage service in a service registration center container; and storing the block through the searched storage service provided by the service container.
Specifically, after the processing result of the data to be stored agrees with other nodes in the block chain network, the nodes may pack the data to be stored and the processing result of the data to be stored into blocks. Further, the node may look up a service container that provides storage services in the service registry container. The nodes may store the blocks locally through the storage services provided by the container.
In the above embodiment, the data related to the data to be stored is generated into the block, so that the data related to the data to be stored is exactly in the same block. Through the storage service registered in the service registration center, the newly generated blocks can be rapidly stored, and the service efficiency of the block chain network is further improved.
As shown in fig. 5, in a specific embodiment, the data processing method based on the block chain includes the following steps:
s502, determining the number of each type of service container in at least two types of service containers according to the service performance of each type of service container.
S504, acquiring a service registry container mirror image and a service container mirror image.
S506, the service registry container is operated in a mirror mode to be the service registry container, and the service container is operated in a mirror mode to be the service container.
S508, the service container registers the corresponding service in the service registration center container.
S510, each service container determines a service identifier of a service to be called; the service identifier is the service identifier of the service registered by the service container of other service containers in the at least two types of service containers in the service registry container.
S512, each service container inquires services corresponding to the service identifiers from the service registration center container according to the service identifiers.
And S514, when the data to be stored is acquired, determining a data processing link in the node data processing logic sequence where the node is currently located.
S516, according to the data processing link where the node is currently located, the service provided by the service container of the class corresponding to the data processing link is searched in the service registration center container.
S518, the service registry container monitors the status of the service container.
S520, when at least one service container is in an abnormal state, the service registry container periodically checks the state of the abnormal service container.
S522, when it is detected that the abnormal service container is not recovered to the normal state, the service registry container determines at least one service container similar to the abnormal service container.
S524, notifying the service container needing to call the service, and determining one service container from at least one service container similar to the abnormal service container to call the service.
And S526, when the abnormal service container is recovered to the normal state, notifying the service container needing to call the service.
S528, at least one service container in the class corresponding to the service is called to process the data to be stored.
S530, obtaining the processing result fed back by other nodes in the block chain network.
S532, performing consensus operation on the processing result in the block chain network through at least one service container of the corresponding class of the consensus service registered in the service registration center container.
S534, after reaching consensus with other nodes in the blockchain network, generating a block from the data related to the data to be stored.
S536, in the service registry container, the service container providing the storage service is searched.
S538, the block is stored through the storage service provided by the searched service container.
According to the data processing method based on the block chain, the services provided by each type of service container are registered to the service registration center container. Therefore, when the data to be stored is acquired, the node can acquire the corresponding service provided by the corresponding class through the service registry container when executing each processing loop of the node data processing logic sequence. And when the node agrees with other nodes in the block chain network, the storage service is acquired through the service registration center container, and the data to be stored is stored. Thus, the service required by each service container is acquired through the service registry container. Each service container is independent, and each service container can be flexibly expanded, so that the service efficiency of the block chain network is greatly improved.
It should be understood that, although the steps in the flowchart of fig. 5 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a portion of the steps in fig. 5 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performance of the sub-steps or stages is not necessarily sequential, but may be performed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
In one embodiment, as shown in fig. 6, there is provided a data processing apparatus based on a blockchain, including: a service registry container 601 and at least two types of service containers 602, wherein:
each type of service container 602 is used for determining services registered by other service containers in at least two types of service containers in a service registry container; each service is used for executing a processing link of the node data processing logic sequence;
the service container 602 is configured to, when data to be stored is obtained, perform data processing according to a corresponding service through the service containers of the corresponding class according to the node data processing logic sequence; and the data storage device is also used for storing the data to be stored through a service container which provides storage service in at least two types of service containers after the data storage device agrees with other nodes in the block chain network.
In one embodiment, each type of service container 602 is also used to register the corresponding service with a service registry container.
In one embodiment, each type of service container 602 is further configured to determine a service identifier of a service to be invoked; the service identifier is the service identifier of the service registered by the service container of other types in the at least two types of service containers in the service registration center container; and inquiring the service corresponding to the service identifier from the service registration center container according to the service identifier.
In one embodiment, the service registry container 601 is used for the service registry container to monitor the status of the service container; when at least one service container is in an abnormal state, periodically checking the state of the abnormal service container; and when the abnormal service container is recovered to the normal state, informing the service container needing to call the service.
In one embodiment, the service container 602 is further configured to determine, when the data to be stored is acquired, a data processing link in a node data processing logical sequence where the node is currently located; according to the data processing link where the node is currently located, searching services provided by service containers of the class corresponding to the data processing link in a service registration center container; and calling at least one service container in the class corresponding to the service to process the data to be stored.
In one embodiment, the service container for providing the consensus service in the service containers 602 is used to obtain processing results fed back by other nodes in the blockchain network; and performing consensus operation on the processing result in the block chain network through at least one service container of the corresponding class of the consensus service registered in the service registration center container.
In one embodiment, the service container for providing the chunk store service in the service container 602 is configured to generate a chunk from data related to data to be stored after reaching a consensus with other nodes in the blockchain network; searching a service container providing storage service in a service registration center container; and storing the block through the searched storage service provided by the service container.
In one embodiment, the service registry container 601 is further configured to, when it is detected that the abnormal service container is not restored to a normal state, determine at least one service container that is the same as the abnormal service container by the service registry container; and informing a service container needing to call the service, and determining a service container to call the service from at least one service container similar to the abnormal service container.
Referring to fig. 7, in one embodiment, the block chain based data processing apparatus further includes: an image processing module 603 and a determination module 604, wherein:
a mirror image processing module 603, configured to obtain a service registry container mirror image and a service container mirror image; the service registry container is mirrored to operate as a service registry container and the service container is mirrored to operate as a service container.
The determining module 604 is configured to determine the number of each type of service container in the at least two types of service containers according to the service performance of each type of service container.
The data processing device based on the block chain registers the service provided by each type of service container to the service registration center container. Therefore, when the data to be stored is acquired, the node can acquire the corresponding service provided by the corresponding class through the service registry container when executing each processing loop of the node data processing logic sequence. And when the node agrees with other nodes in the block chain network, the storage service is acquired through the service registration center container, and the data to be stored is stored. Thus, the service required by each service container is acquired through the service registry container. Each service container is independent, and each service container can be flexibly expanded, so that the service efficiency of the block chain network is greatly improved.
For specific definition of the data processing apparatus based on the blockchain, reference may be made to the above definition of the data processing method based on the blockchain, and details are not described here. The respective modules in the above block chain-based data processing apparatus may be wholly or partially implemented by software, hardware, and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be the node 104 of fig. 1 described above, and the internal structure thereof may be as shown in fig. 8. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operating system and the computer program to run on the non-volatile storage medium. The database of the computer device is used for storing data processing data based on the blockchain. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a block chain based data processing method.
It will be appreciated by those skilled in the art that the configuration shown in fig. 8 is a block diagram of only a portion of the configuration associated with the present application, and is not intended to limit the computing device to which the present application may be applied, and that a particular computing device may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In an embodiment, a computer device is provided, comprising a memory and a processor, the memory storing a computer program which, when executed by the processor, causes the processor to perform the steps of the above-described blockchain based data processing method. Here, the steps of the data processing method based on the blockchain may be steps in the data processing method based on the blockchain in the above embodiments.
In one embodiment, a computer readable storage medium is provided, in which a computer program is stored, which, when being executed by a processor, causes the processor to carry out the steps of the above-mentioned blockchain-based data processing method. Here, the steps of the data processing method based on the blockchain may be steps in the data processing method based on the blockchain in the above embodiments.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database or other medium used in the embodiments provided herein can include non-volatile and/or volatile memory. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
All possible combinations of the technical features in the above embodiments may not be described for the sake of brevity, but should be considered as being within the scope of the present disclosure as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (13)

1. A data processing method based on block chain is applied to a node in a block chain network, and is characterized in that a service registration center container and at least two types of service containers run on the node; the method comprises the following steps:
each type of service container determines service containers of other types of the at least two types of service containers and services registered in a service registration center container; each service is used for executing a processing link of the node data processing logic sequence;
when data to be stored are obtained, data processing is carried out on the data to be stored according to corresponding services through service containers of corresponding classes according to a node data processing logic sequence;
and after the data is agreed with other nodes in the block chain network, storing the data to be stored through a service container which provides storage service in the at least two types of service containers.
2. The method of claim 1, wherein each service container determines service containers of other of the at least two service containers, and wherein the method further comprises, prior to servicing a service registered by the registry container:
acquiring a service registration center container mirror image and a service container mirror image;
mirror-image running the service registration center container into a service registration center container, and mirror-image running the service container into a service container;
and the service container registers corresponding services in the service registration center container.
3. The method of claim 2, further comprising:
and determining the number of each type of service container in the at least two types of service containers according to the service performance of each type of service container.
4. The method according to claim 1, wherein the determining, for each service container, the service container of the other of the at least two service containers, the service registered in the service registry container comprises:
each service container determines a service identifier of a service to be called; the service identifier is a service container of other types in the at least two types of service containers and a service identifier of a service registered in a service registration center container;
and each type of service container inquires the service corresponding to the service identifier from the service registration center container according to the service identifier.
5. The method according to claim 1, wherein when acquiring the data to be stored, performing data processing according to the corresponding service through the service container of the corresponding class according to the logical order of node data processing comprises:
when data to be stored are obtained, determining a data processing link in a node data processing logic sequence where a node is located currently;
according to the data processing link where the node is located at present, searching for services provided by service containers of the class corresponding to the data processing link in a service registration center container;
and calling at least one service container in the class corresponding to the service to process the data to be stored.
6. The method of claim 1, further comprising:
the service registration center container monitors the state of the service container;
when at least one service container is in an abnormal state, the service registration center container periodically checks the state of the abnormal service container;
and when the abnormal service container is detected to be recovered to the normal state, notifying the service container needing to call the service.
7. The method of claim 6, wherein the node further comprises at least one service container that is similar to the abnormal service container, and wherein after the service registry container periodically checks the state of the abnormal service container when the at least one service container is in the abnormal state, the method further comprises:
when the abnormal service container is monitored not to be recovered to a normal state, the service registration center container determines at least one service container which is similar to the abnormal service container;
and informing the service container needing to call the service, and determining one service container from the at least one service container similar to the abnormal service container to call the service.
8. The method according to claim 1, wherein before storing the data to be stored by a service container providing a storage service in the at least two types of service containers after reaching a consensus with other nodes in the blockchain network, the method further comprises:
acquiring processing results fed back by other nodes in the block chain network;
and performing consensus operation on the processing result in the block chain network through at least one service container of the corresponding class of the consensus service registered in the service registration center container.
9. The method according to any one of claims 1 to 8, wherein the storing the data to be stored through a service container providing a storage service in the at least two types of service containers after reaching a consensus with other nodes in the blockchain network comprises:
generating a block from the data related to the data to be stored when the block is identified with other nodes in the block chain network;
searching a service container providing storage service in a service registration center container;
and storing the block through the searched storage service provided by the service container.
10. A blockchain based data processing apparatus for implementing nodes in a blockchain network, the apparatus comprising a service registry container and at least two types of service containers;
each type of service container is used for determining services registered by other service containers in at least two types of service containers in a service registration center container; each service is used for executing a processing link of the node data processing logic sequence;
the service container is used for carrying out data processing on the data to be stored through the service containers of the corresponding class according to corresponding services according to the node data processing logic sequence when the data to be stored is obtained; and the data storage device is further used for storing the data to be stored through a service container which provides storage service in the at least two types of service containers after the data storage device agrees with other nodes in the block chain network.
11. The apparatus of claim 10, further comprising:
the mirror image processing module is used for acquiring a service registration center container mirror image and a service container mirror image; mirror-image running the service registration center container into a service registration center container, and mirror-image running the service container into a service container;
the service container is also used for registering corresponding services in the service registry container.
12. A computer arrangement comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any of claims 1 to 9 when executing the computer program.
13. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 9.
CN201911100293.XA 2019-11-12 2019-11-12 Data processing method and device based on block chain, computer equipment and storage medium Active CN110908801B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911100293.XA CN110908801B (en) 2019-11-12 2019-11-12 Data processing method and device based on block chain, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911100293.XA CN110908801B (en) 2019-11-12 2019-11-12 Data processing method and device based on block chain, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN110908801A CN110908801A (en) 2020-03-24
CN110908801B true CN110908801B (en) 2022-07-12

Family

ID=69817406

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911100293.XA Active CN110908801B (en) 2019-11-12 2019-11-12 Data processing method and device based on block chain, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110908801B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111625593B (en) * 2020-04-21 2023-09-08 金蝶软件(中国)有限公司 Block chain-based data processing method and device and computer equipment
CN112422320B (en) * 2020-10-27 2022-11-11 北京金山云网络技术有限公司 Master-slave switching method and device of server and server

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111756550B (en) * 2017-03-28 2023-08-22 创新先进技术有限公司 Block chain consensus method and device
CN107103054B (en) * 2017-04-12 2019-03-26 北京航空航天大学 A kind of intelligent contract asynchronous execution storage system and implementation method of privately owned block chain
CN107450981B (en) * 2017-05-31 2020-04-24 创新先进技术有限公司 Block chain consensus method and equipment
CN107579931B (en) * 2017-09-08 2019-09-10 杭州云象网络技术有限公司 A kind of block chain, that is, Service Source adaptation method based on Kubernetes
WO2019089778A1 (en) * 2017-10-31 2019-05-09 Jordan Simons Management of virtual goods in distributed multi-ledger gambling architecture
CN110430259B (en) * 2018-04-16 2020-12-01 腾讯科技(深圳)有限公司 Data service system, server, and computer-readable storage medium

Also Published As

Publication number Publication date
CN110908801A (en) 2020-03-24

Similar Documents

Publication Publication Date Title
CN109474578B (en) Message checking method, device, computer equipment and storage medium
CN110730225A (en) Data processing method of Internet of things based on block chain, Internet of things and storage medium
CN109308227B (en) Fault detection control method and related equipment
CN111049696B (en) Method, node and computing device for node management of blockchain system
CN112035472B (en) Data processing method, device, computer equipment and storage medium
CN110222535B (en) Processing device, method and storage medium for block chain configuration file
CN110908801B (en) Data processing method and device based on block chain, computer equipment and storage medium
CN111488372A (en) Data processing method, device and storage medium
CN108366132B (en) Method and device for managing service between servers, computer equipment and storage medium
CN111260475A (en) Data processing method, block chain node point equipment and storage medium
CN111782456B (en) Anomaly detection method, device, computer equipment and storage medium
CN111339551B (en) Data verification method and related device and equipment
JP2024506093A (en) Cross-chain transaction processing methods and devices, electronic equipment and computer programs
CN117319412A (en) Management method of block chain network and related equipment
CN113515322B (en) Application program loading method and device, computer equipment and readable storage medium
CN114637611A (en) Information processing method and device based on message queue and computer equipment
CN108389124B (en) Data processing method, data processing device, computer equipment and storage medium
CN111291063B (en) Master and backup copy election method, system, computer equipment and storage medium
CN112200680A (en) Block link point management method, device, computer and readable storage medium
CN113643030A (en) Transaction processing method, device and equipment
CN115567218A (en) Data processing method and device of security certificate based on block chain and server
CN115221244A (en) Block chain cross-chain method and device, computer equipment and storage medium
CN113902415A (en) Financial data checking method and device, computer equipment and storage medium
CN114217911A (en) Cross-chain transaction processing method, device, computing equipment and medium
CN115017550B (en) Electronic contract data processing method and device, computer equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant