CN116684425A - Block chain data processing method, system, device and computer equipment - Google Patents

Block chain data processing method, system, device and computer equipment Download PDF

Info

Publication number
CN116684425A
CN116684425A CN202310939637.6A CN202310939637A CN116684425A CN 116684425 A CN116684425 A CN 116684425A CN 202310939637 A CN202310939637 A CN 202310939637A CN 116684425 A CN116684425 A CN 116684425A
Authority
CN
China
Prior art keywords
target
node
data
relational
transaction request
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.)
Granted
Application number
CN202310939637.6A
Other languages
Chinese (zh)
Other versions
CN116684425B (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202310939637.6A priority Critical patent/CN116684425B/en
Publication of CN116684425A publication Critical patent/CN116684425A/en
Application granted granted Critical
Publication of CN116684425B publication Critical patent/CN116684425B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • H04L67/1059Inter-group management mechanisms, e.g. splitting, merging or interconnection of groups
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present application relates to a data processing method, system, apparatus, computer device, storage medium and computer program product for a blockchain. The method can be applied to the technical fields of cloud technology, cloud storage, blockchain and the like; the method comprises the following steps: when a transaction request sent by a target application is received, determining a target node matched with the transaction request in a blockchain network; forwarding the transaction request to the target node so that the target node executes the transaction request to obtain state data, and generating a transaction event of the state data based on the intelligent contract; the transaction event is used for indicating the verification node corresponding to the target node to determine the relational data corresponding to the state data and updating the relational data in the relational database; receiving a database update message sent by a verification node after updating a relational database; and reading the relational data from the relational database based on the database update message and returning the relational data to the target application. By adopting the method, the reading efficiency of the data of the block chain can be improved.

Description

Block chain data processing method, system, device and computer equipment
Technical Field
The present application relates to the field of blockchain technology, and in particular, to a blockchain data processing method, system, apparatus, computer device, storage medium, and computer program product.
Background
With the development of internet technology, blockchains are receiving more and more attention; blockchain is a novel application mode of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and the like, and is essentially a decentralised database.
In the related art, there is data with complex structure and large data volume in the blockchain network, and for the data on the blockchain, multiple functions need to be written in the intelligent contract to read and write the data, so that the operation of reading the data on the blockchain is very complex, and the data reading efficiency of the blockchain is lower.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a data processing method, system, apparatus, computer device, computer readable storage medium and computer program product for a blockchain that can improve the reading efficiency of blockchain data.
In a first aspect, the present application provides a method for data processing of a blockchain. The method comprises the following steps:
When a transaction request sent by a target application is received, determining a target node matched with the transaction request in a blockchain network; forwarding the transaction request to the target node so that the target node executes the transaction request to obtain state data, and generating a transaction event of the state data based on the intelligent contract; the transaction event is used for indicating the verification node corresponding to the target node to determine the relational data corresponding to the state data and updating the relational data in the relational database; receiving a database update message sent by a verification node after updating a relational database; and reading the relational data from the relational database based on the database update message and returning the relational data to the target application.
In a second aspect, the application further provides a data processing device of the blockchain. The device comprises:
the target node determining module is used for determining a target node matched with the transaction request in the blockchain network when the transaction request sent by the target application is received;
the transaction request forwarding module is used for forwarding the transaction request to the target node so that the target node executes the transaction request to obtain state data, and generates a transaction event of the state data based on the intelligent contract; the transaction event is used for indicating the verification node corresponding to the target node to determine the relational data corresponding to the state data and updating the relational data in the relational database;
The database update message receiving module is used for receiving the database update message sent by the verification node after updating the relational database;
and the relational data acquisition module is used for reading the relational data from the relational database based on the database update message and returning the relational data to the target application.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor which when executing the computer program performs the steps of:
when a transaction request sent by a target application is received, determining a target node matched with the transaction request in a blockchain network; forwarding the transaction request to the target node so that the target node executes the transaction request to obtain state data, and generating a transaction event of the state data based on the intelligent contract; the transaction event is used for indicating the verification node corresponding to the target node to determine the relational data corresponding to the state data and updating the relational data in the relational database; receiving a database update message sent by a verification node after updating a relational database; and reading the relational data from the relational database based on the database update message and returning the relational data to the target application.
In a fourth aspect, the present application also provides a computer-readable storage medium. The computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
when a transaction request sent by a target application is received, determining a target node matched with the transaction request in a blockchain network; forwarding the transaction request to the target node so that the target node executes the transaction request to obtain state data, and generating a transaction event of the state data based on the intelligent contract; the transaction event is used for indicating the verification node corresponding to the target node to determine the relational data corresponding to the state data and updating the relational data in the relational database; receiving a database update message sent by a verification node after updating a relational database; and reading the relational data from the relational database based on the database update message and returning the relational data to the target application.
In a fifth aspect, the present application also provides a computer program product. The computer program product comprises a computer program which, when executed by a processor, implements the steps of:
when a transaction request sent by a target application is received, determining a target node matched with the transaction request in a blockchain network; forwarding the transaction request to the target node so that the target node executes the transaction request to obtain state data, and generating a transaction event of the state data based on the intelligent contract; the transaction event is used for indicating the verification node corresponding to the target node to determine the relational data corresponding to the state data and updating the relational data in the relational database; receiving a database update message sent by a verification node after updating a relational database; and reading the relational data from the relational database based on the database update message and returning the relational data to the target application.
In a sixth aspect, the present application provides a data processing method for a blockchain. The method comprises the following steps:
receiving a transaction request which is forwarded by a target gateway and is derived from a target application; executing the transaction request to obtain state data; generating transaction events of the status data based on the smart contracts; the transaction event is used for indicating the verification node corresponding to the target node to determine the relational data corresponding to the state data, updating the relational data in a relational database and sending a database updating message to the target gateway; the database update message is used to instruct the target gateway to read the relational data from the relational database and return the relational data to the target application.
In a seventh aspect, the present application further provides a data processing apparatus for a blockchain. The device comprises:
the transaction request receiving module is used for receiving the transaction request which is forwarded by the target gateway and is sourced from the target application;
the transaction request execution module is used for executing the transaction request to obtain state data;
a transaction event generation module for generating transaction events of the status data based on the smart contracts; the transaction event is used for indicating the verification node corresponding to the target node to determine the relational data corresponding to the state data, updating the relational data in a relational database and sending a database updating message to the target gateway; the database update message is used to instruct the target gateway to read the relational data from the relational database and return the relational data to the target application.
In an eighth aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor which when executing the computer program performs the steps of:
receiving a transaction request which is forwarded by a target gateway and is derived from a target application; executing the transaction request to obtain state data; generating transaction events of the status data based on the smart contracts; the transaction event is used for indicating the verification node corresponding to the target node to determine the relational data corresponding to the state data, updating the relational data in a relational database and sending a database updating message to the target gateway; the database update message is used to instruct the target gateway to read the relational data from the relational database and return the relational data to the target application.
In a ninth aspect, the present application also provides a computer-readable storage medium. The computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
receiving a transaction request which is forwarded by a target gateway and is derived from a target application; executing the transaction request to obtain state data; generating transaction events of the status data based on the smart contracts; the transaction event is used for indicating the verification node corresponding to the target node to determine the relational data corresponding to the state data, updating the relational data in a relational database and sending a database updating message to the target gateway; the database update message is used to instruct the target gateway to read the relational data from the relational database and return the relational data to the target application.
In a tenth aspect, the present application also provides a computer program product. The computer program product comprises a computer program which, when executed by a processor, implements the steps of:
receiving a transaction request which is forwarded by a target gateway and is derived from a target application; executing the transaction request to obtain state data; generating transaction events of the status data based on the smart contracts; the transaction event is used for indicating the verification node corresponding to the target node to determine the relational data corresponding to the state data, updating the relational data in a relational database and sending a database updating message to the target gateway; the database update message is used to instruct the target gateway to read the relational data from the relational database and return the relational data to the target application.
In an eleventh aspect, the present application further provides a data processing system for a blockchain. The system comprises:
the target gateway is used for determining a target node matched with the transaction request in the blockchain network when the transaction request sent by the target application is received, and forwarding the transaction request to the target node;
the target node is used for executing the transaction request to obtain state data and generating transaction events of the state data based on the intelligent contract;
The verification node is used for determining the relational data corresponding to the state data and updating the relational data in the relational database; the verification node is a node corresponding to the target node;
the target gateway is also used for receiving a database update message sent by the verification node after updating the relational database; and reading the relational data from the relational database based on the database update message and returning the relational data to the target application.
The data processing method, the system, the device, the computer equipment, the storage medium and the computer program product of the blockchain are characterized in that when a target gateway receives a transaction request sent by a target application, the target gateway distributes the transaction request, a target node matched with the transaction request is determined in a blockchain network, the transaction request is sent to the target node, when the target node executes the transaction request to obtain state data, a transaction event is generated based on an intelligent contract, a verification node executes the transaction event to obtain relational data corresponding to the state data, the relational data is updated in a relational database, the target gateway receives a database update message, acquires the relational data from the relational database, and returns the relational data to the target application; generating a transaction event corresponding to the state data through the intelligent contract, verifying that the node executes the transaction event so as to synchronously update the state data on the chain into a relational database under the chain, wherein the target application can directly read the relational data from the relational database, the data reading efficiency of the blockchain is improved, the read relational data can be directly used for front-end display without reading the data from the chain, and then the data read from the chain is processed, so that the process of synchronously displaying the state data on the chain by the target application is simplified, and the efficiency of synchronously displaying the corresponding content of the state data on the chain by the target application is improved; in addition, the target node matched with the transaction request executes the transaction request, the verification node corresponding to the target node executes the transaction event corresponding to the state data, the relational data corresponding to the transaction request is updated in the relational database of the verification node matched with the transaction request, and further when different target nodes matched with the transaction request are different, the relational data corresponding to different transaction requests can be stored in a database, so that data isolation is carried out on the relational data corresponding to different transaction requests, and the safety of the data is improved.
Drawings
FIG. 1 is an application environment diagram of a data processing method for a block chain in one embodiment;
FIG. 2 is a flow diagram of a method of data processing for a block chain in one embodiment;
FIG. 3 is a schematic diagram of a block chain network in one embodiment;
FIG. 4 is a schematic diagram of a data processing method for performing blockchain in common by a relational data read-write gateway, a target node, and a validation node in one embodiment;
FIG. 5 is a flow chart of a method of processing data of a block chain in another embodiment;
FIG. 6 is a flow chart of a method of processing data of a block chain in yet another embodiment;
FIG. 7 is a diagram of a smart contract interacting with a business contract to execute a transaction request, generating a transaction event, in one embodiment;
FIG. 8 is a schematic diagram of synchronizing sub-database management information and database management information from a core consensus node, in one embodiment;
FIG. 9 is a flow chart of a method of processing data of a block chain in yet another embodiment;
FIG. 10 is a schematic diagram of a data processing system of a blockchain in one embodiment;
FIG. 11 is a schematic diagram of a data processing method performed by a blockchain data processing system in accordance with an embodiment;
FIG. 12 is a schematic diagram of a blockchain data processing system applied to an electronic ticket scene in one embodiment;
FIG. 13 is a block diagram of a block chain data processing apparatus in one embodiment;
FIG. 14 is a block diagram of a block chain data processing apparatus in another embodiment;
fig. 15 is an internal structural view of a computer device in one embodiment.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
Blockchains are novel application modes of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanisms, encryption algorithms, and the like. The Blockchain (Blockchain), which is essentially a decentralised database, is a string of data blocks that are generated by cryptographic means in association, each data block containing a batch of information of network transactions for verifying the validity of the information (anti-counterfeiting) and generating the next block. The blockchain may include a blockchain underlying platform, a platform product services layer, and an application services layer.
The blockchain underlying platform may include processing modules for user management, basic services, smart contracts, and operation detection. The user management module is responsible for identity information management of all blockchain participants, including maintenance of public and private key generation (account management), key management, maintenance of corresponding relation between the real identity of the user and the blockchain address (authority management) and the like, and under the condition of authorization, supervision and audit of transaction conditions of certain real identities, and provision of rule configuration (wind control audit) of risk control; the basic service module is deployed on all block chain node devices, is used for verifying the validity of a service request, recording the service request on a storage after the effective request is identified, for a new service request, the basic service firstly analyzes interface adaptation and authenticates the interface adaptation, encrypts service information (identification management) through an identification algorithm, and transmits the encrypted service information to a shared account book (network communication) in a complete and consistent manner, and records and stores the service information; the intelligent contract module is responsible for registering and issuing contracts, triggering contracts and executing contracts, a developer can define contract logic through a certain programming language, issue the contract logic to a blockchain (contract registering), invoke keys or other event triggering execution according to the logic of contract clauses to complete the contract logic, and simultaneously provide a function of registering contract upgrading; the operation detection module is mainly responsible for deployment in the product release process, modification of configuration, contract setting, cloud adaptation and visual output of real-time states in product operation, for example: alarms, detecting network conditions, detecting node device health status, etc.
The platform product service layer provides basic capabilities and implementation frameworks of typical applications, and developers can complete the blockchain implementation of business logic based on the basic capabilities and the characteristics of the superposition business. The application service layer provides the application service based on the block chain scheme to the business participants for use.
The data processing method of the blockchain provided by the embodiment of the application can be applied to an application environment shown in fig. 1. Wherein the blockchain network includes a target gateway 102, a target node and a validation node 104, the target node including a target service node 106, a proxy node 108 and a target consensus node 110; the target service node 106 is in a service network, the target consensus node 108 is in a consensus network, and the service network and the consensus network interact through the proxy node 108; the verification node 104 may be deployed in a consensus network or in a business network.
The data processing method of the blockchain can be executed by the target gateway 102, can be executed by the target node, and can also be executed by the target gateway 102 and the target node in a cooperative manner.
Taking the data processing method of the block chain as an example, the data processing method is executed by the target gateway 102; upon receiving a transaction request sent by a target application, the target gateway 102 may determine a target node in the blockchain network that matches the transaction request; forwarding the transaction request to the target node so that the target node executes the transaction request to obtain state data, and generating a transaction event of the state data based on the intelligent contract; the transaction event is used for indicating the verification node 104 corresponding to the target node to determine the relational data corresponding to the state data and updating the relational data in the relational database; the target gateway 102 may receive a database update message sent by the verification node 104 after updating the relational database; the target gateway 102 may also read the relationship data from the relationship database based on the database update message and return the relationship data to the target application.
The target gateway and the target node can be independent physical servers or service nodes in a block chain system, and a point-to-point network is formed among the service nodes in the block chain system.
In addition, the target gateway and the target node may be a server cluster formed by a plurality of physical servers, and may be cloud servers for providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), basic cloud computing services such as big data and artificial intelligence platforms, and the like.
In some embodiments, as shown in fig. 2, there is provided a blockchain data processing method, which is performed by the target gateway or the target node in fig. 1, and may also be performed by the target gateway and the target node cooperatively, where the method is illustrated by the target gateway in fig. 1 as an example, and includes the following steps:
step 202, when a transaction request sent by a target application is received, determining a target node matching the transaction request in the blockchain network.
The target gateway can be a relational data read-write gateway and is used for distributing read-write requests aiming at a relational database; for example, it may be used to distribute transaction requests for writing data in a relational database.
The target application is a decentralizing application program (Decentralized Application), the decentralizing application program is completely open-source and self-made, and does not have an entity to control tokens of over 51% of the decentralizing application, the decentralizing application program can be upgraded according to feedback and technical requirements of users, and most of nodes are required to be consensus for upgrading; the data of the off-center application needs to be stored on the public blockchain after encryption.
Wherein the transaction request comprises data which is not verified by the blockchain network, and the data can be data corresponding to at least one transaction, such as logistics data, bill data, commodity transaction data and the like; the transaction request also includes a data write statement, which may be an SQL statement (structured query statement).
In some embodiments, the target application sends a transaction request to the target gateway, the target gateway determines a service corresponding to the transaction request, and determines a target node corresponding to the service in the blockchain network, i.e., determines a target node matching the transaction request.
In some embodiments, determining a target node in the blockchain network that matches the transaction request in step 202 includes: acquiring a service identifier contained in a transaction request; searching a network address corresponding to the service identifier in the database management information; a target node matching the transaction request is determined from the network address.
The transaction request further includes a service identifier, which may be used to reflect the unique identifier of the service, and a target node for processing the service-related transaction request may be determined according to the service identifier.
The block chain network comprises a service network and a consensus network, the service network and the consensus network are layered through proxy nodes to form a layered block chain network architecture, and the layered block chain network architecture ensures that the consensus nodes in the private cloud are safer.
The target node comprises a target service node, an agent node and a target consensus node; the target service node is deployed in a service network in a public network, the target consensus node is deployed in a consensus network of a private cloud, and the proxy node is used for forwarding interaction data between the target service node and the target consensus node.
The service network comprises a plurality of service nodes, and the target service node is a service node matched with the transaction request in the plurality of service nodes; the target traffic node may be a lightweight node (Simplified Payment Verification, SPV) that typically stores only the block header and transaction data associated with the node itself, rather than the complete blockchain data.
The consensus network comprises a plurality of consensus nodes, and the target consensus node is a part of the consensus nodes corresponding to the target service node and is also a consensus node matched with the transaction request.
Illustratively, as shown in FIG. 3, the blockchain network includes a traffic network and a consensus network, the traffic network and the consensus network being layered by proxy nodes; the service network comprises a service node y1, service nodes y2 and … … and a service node yn, wherein the target service node can be the service node y1; the consensus network comprises a consensus node g1, consensus nodes g2 and … …, a consensus node gn, a consensus node gn+1 and … … and a consensus node gn+m, wherein the target consensus node may comprise: a consensus node g1, consensus nodes g2 and … …, and a consensus node gn; the proxy node may forward data between the target traffic node and the target consensus node.
The database management information comprises corresponding relations between each service identifier and each network address; in the database management information, the matched network address can be searched through the service identifier, and the network address can be the IP address of the target service node.
In some embodiments, the target gateway obtains a service identifier included in the transaction request, obtains a network address corresponding to the service identifier in the local database management information, and determines a target service node for processing the service corresponding to the transaction request according to the network address; in the blockchain network, the service node has a corresponding consensus node, and the service node and the corresponding consensus node are used for processing related transactions of a certain service, so after the target service node is determined according to the network address, the target consensus node corresponding to the target service node can be determined.
In the above embodiment, the target gateway searches the network address corresponding to the service identifier included in the transaction request in the database management information, and further determines the target node of the transaction request, so that the transaction request is sent to the target node later, so that the service related transactions are processed by the matched target node, the situation that the target node processes different service related transactions, resulting in disordered data interaction, and the interaction information when processing different service related transactions is isolated, thereby improving the transaction processing efficiency and ensuring the data security.
Step 204, forwarding the transaction request to the target node, so that the target node executes the transaction request to obtain state data, and generating a transaction event of the state data based on the intelligent contract; the transaction event is used for indicating the verification node corresponding to the target node to determine the relation type data corresponding to the state data and updating the relation type data in the relation type database.
The target node comprises a target service node, a proxy node and a target consensus node; the verification node can be deployed in a service network or a consensus network.
The state data can reflect an execution result obtained by executing the transaction request, and the state data is written into a state database on the chain, so that the state database can be updated; it should be noted that the state database includes the latest state data and the historical state data, which is convenient for tracing and inquiring.
The verification node corresponds to the target node and is used for maintaining a relational database under the chain, and the relational database and a state database on the chain synchronously store the execution result of the transaction. It should be noted that the data stored in the relational database and the status database are essentially the same, and the data structures are different; for example, the state database generally stores KV (key value) structured data, and the relational database stores relational data of a two-dimensional table structure.
The smart contract may be used to generate a transaction event that is acquired and executed by the verification node such that the verification node acquires the relationship data corresponding to the state data; the relational data is essentially the same as the state data, and the data structures are different.
In some embodiments, the target gateway sends a transaction request to the target service node according to the IP address of the target service node, the target service node sends the transaction request to the proxy node, and the proxy node broadcasts the transaction request to the corresponding target consensus node so that the target consensus node receives the transaction request.
In some embodiments, the target node performing the transaction request obtains the status data, including: acquiring a permission identifier contained in the transaction request through an intelligent contract in the target consensus node, sending an execution message to the business contract through the intelligent contract under the condition that the permission identifier meets the transaction condition, executing the transaction request through the business contract to obtain an execution result, and determining state data for updating the state on the chain according to the execution result.
The number of the target consensus nodes can be multiple, for each target consensus node, the target consensus node obtains the authority identification contained in the transaction request through the intelligent contract, the intelligent contract sends an execution message to the business contract when the authority identification meets the transaction condition, the business contract of each target consensus node executes the transaction request, the obtained execution result reaches consensus, the validated block data corresponding to the transaction request is generated, the business contract determines the state data according to the execution result, and the state database on the chain is updated by adopting the state data.
In some embodiments, the rights identification may be an identification of the user sending the transaction request; the target consensus node stores a permission table, wherein the permission table comprises a plurality of user identifications, and users corresponding to the user identifications have the permission of writing data in a relational database; the intelligent contract can search the authority identification in the authority table, if the authority identification exists in the authority table, the authority identification is determined to meet the transaction condition, and if the authority identification does not exist in the authority table, the authority identification is determined to not meet the transaction condition.
In some embodiments, generating a transaction event of status data based on the smart contract includes: under the condition that the intelligent contract receives the state data returned by the business contract, acquiring a transaction statement contained in the transaction request; invoking a registry contract through the intelligent contract; determining relational database information corresponding to the transaction request according to the database management information of the registry contract; when the relational database information characterizes that a relational database matched with the transaction request exists, generating transaction events of state data according to the transaction statement and the permission identification.
After the business contract determines the state data according to the execution result, the state data is returned to the intelligent contract, the intelligent contract acquires a transaction statement contained in the transaction request, the intelligent contract calls the registry contract to determine the relational database information corresponding to the transaction request, and when the relational database information characterizes that a relational database matched with the transaction request exists, the intelligent contract generates a transaction event corresponding to the state data according to the transaction statement and the authority identifier.
And the verification node corresponding to the target consensus node acquires the transaction event and executes the transaction event to obtain the relational data corresponding to the state data.
In some embodiments, the intelligent contract generates a transaction event of a preset protocol according to the transaction statement and the authority identification; the verification node periodically detects the event of the preset protocol, and further under the condition that the intelligent contract generates the transaction event of the preset protocol, the transaction event can be acquired by the verification node. It should be noted that, the preset protocol may be a protocol for performing data interaction between the target consensus node and the verification node, and further, a transaction event of the preset protocol may be acquired by the verification node.
In some embodiments, determining the relational data corresponding to the state data and updating the relational data in the relational database includes: acquiring a transaction statement and an authority identifier contained in a transaction event; executing a transaction statement when the permission identification meets the transaction condition according to the permission table to obtain the relational data corresponding to the state data; the relational data is updated in a relational database.
Wherein, the permission identification can be the identification of the user who sends the transaction request; the permission table comprises a plurality of user identifications, and the users corresponding to the user identifications have the permission of writing data in the relational database.
Verifying that the node stores a permission table; the verification node acquires a transaction statement and a permission identifier contained in the transaction event, if the permission identifier exists in the permission table, the verification node determines that the permission identifier meets the transaction condition, the verification node executes the transaction statement to obtain the relational data corresponding to the state data, and the verification node adds the relational data into the relational database.
The verification node executes the transaction statement to obtain the relational data corresponding to the state data, and may execute the transaction statement for the latest relational data in the relational database to obtain the relational data corresponding to the state data, and then add the relational data corresponding to the state data to the relational database.
In some embodiments, there may be multiple verification nodes corresponding to the target node, where one verification node of the multiple verification nodes executes a transaction event to obtain the relational data corresponding to the state data, and the verification node synchronizes the relational data to the other verification nodes, so that the other verification nodes receive the relational data, and adds the relational data to the relational database, so that the multiple verification nodes can update the relational database synchronously.
In the above embodiment, the verification node acquires the transaction event, and the verification node executes the transaction event to obtain the relational data corresponding to the state data, and updates the relational data in the relational database, so that the relational database in the verification node is synchronously updated with the data in the state database on the chain, thereby facilitating the subsequent direct reading of the relational data from the relational database without reading the data from the chain, and further processing to obtain the relational data, simplifying the process of acquiring the data on the chain, and improving the data acquisition efficiency.
Step 206, receiving a database update message sent by the verification node after updating the relational database.
The database update message is a message generated when data in the relational database is updated, for example, when the relational data corresponding to the state data is updated in the relational database, the database update message is generated.
In some embodiments, the target application may subscribe to the relational database through the target gateway, and in the event that the relational data is updated to the relational database, the validation node sends a database update message to the target gateway.
In some embodiments, the data processing method of the blockchain further includes: receiving a subscription request sent by a target application, acquiring a service identifier contained in the subscription request, and forwarding the subscription request to a verification node corresponding to the service identifier so as to realize the subscription relation database of the target application; in the event that the relational data is updated to the relational database, the verifying node returns a database update message to the target gateway in response to the subscription request.
In some embodiments, the verification node generates the database update message according to the relational data, which may be that the verification node obtains a storage location of the relational data in the relational database, and generates the database update message carrying the storage location.
Step 208, reading the relational data from the relational database based on the database update message and returning the relational data to the target application.
In some embodiments, the database update message includes a storage location of the relational data, the target gateway may generate a read request according to the storage location, send the read request to the verification node, the verification node obtains the relational data corresponding to the storage location in the read request, return the relational data to the target gateway, and the target gateway sends the received relational data to the target application.
In some embodiments, where the target application subscribes to the relational database through the target gateway, the verification node may push the relational data to the target gateway, which sends the relational data to the target application, when the relational database is in data update.
In some embodiments, step 208 comprises: forwarding a database update message to the target application; when receiving a data acquisition request returned by a target application, forwarding the data acquisition request to a verification node; receiving relation data returned by the verification node according to the data acquisition request; and sending the relational data to the target application.
In some embodiments, the target gateway forwards the database update message to the target application, the target application obtains a storage location in the database update message, generates a data acquisition request according to the storage location, the target application sends the data acquisition request to the target gateway, the target gateway forwards the data acquisition request to the verification node, the verification node obtains the relationship data according to the storage location included in the data acquisition request, sends the relationship data to the target gateway, and sends the relationship data to the target application through the target gateway.
In some embodiments, the target application may generate a data retrieval statement from the storage location, the data retrieval statement may be an SQL statement, and the data retrieval request including the data retrieval statement is regenerated; and the verification node acquires the relational data from the relational database according to the SQL statement included in the data acquisition request.
In the above embodiment, when there is an update in the relational database, the database update message is forwarded to the target application through the target gateway, the target gateway forwards the data acquisition request sent by the target application to the verification node to acquire the relational data, and then the target gateway forwards the relational data corresponding to the state data to the target application, so that when the data in the relational database is updated, the target application can acquire the updated relational data in time.
In some embodiments, after the target application obtains the relational data, the content corresponding to the relational data may be displayed in a display page of the target application. It should be noted that, the front end of the target application may initiate a data acquisition request including an SQL statement, the verification node may directly search the corresponding relational data in the relational database through the SQL statement, after the front end of the target application receives the relational data, no additional conversion processing is required for the relational data, so that the content corresponding to the relational data may be directly displayed, the process of synchronous display of state data on the chain by the target application is simplified, and the efficiency of synchronous display of the content corresponding to the state data on the chain by the target application is improved.
Illustratively, the target gateway is a relational data read-write gateway, as shown in fig. 4, the data processing method of the blockchain includes: the target application sends a transaction request to a relational data reading gateway, and the relational data reading gateway determines a target node matched with the transaction request and sends the transaction request to the target node; the target node executes the transaction request to obtain state data, the intelligent contract of the target node generates a transaction event corresponding to the state data, the verification node corresponding to the target node acquires the transaction event, the verification node executes the transaction event to obtain relational data corresponding to the state data, and the relational data is updated in a relational database; the verification node sends a database update message to the relational data read-write gateway, and the relational data read-write gateway reads relational data from the relational database according to the database update message and returns the relational data to the target application.
In the above-mentioned data processing method of the block chain, when receiving the trade request that the goal gateway sends, distribute the trade request, confirm the goal node that matches with trade request in the block chain network, send trade request to the goal node, when the goal node carries out the trade request and gets the status data, produce the trade event based on intelligent contract, verify the node carries out the trade event and gets the relational data that the status data corresponds, update the relational data in the relational database, the goal gateway receives the database and updates the message, obtain the relational data from the relational database, return the relational data to the goal application; generating a transaction event corresponding to the state data through the intelligent contract, verifying that the node executes the transaction event so as to synchronously update the state data on the chain into a relational database under the chain, wherein the target application can directly read the relational data from the relational database, the data reading efficiency of the blockchain is improved, the read relational data can be directly used for front-end display without reading the data from the chain, and then the data read from the chain is processed, so that the process of synchronously displaying the state data on the chain by the target application is simplified, and the efficiency of synchronously displaying the corresponding content of the state data on the chain by the target application is improved; in addition, the target node matched with the transaction request executes the transaction request, the verification node corresponding to the target node executes the transaction event corresponding to the state data, the relational data corresponding to the transaction request is updated in the relational database of the verification node matched with the transaction request, and further when different target nodes matched with the transaction request are different, the relational data corresponding to different transaction requests can be stored in a database, so that data isolation is carried out on the relational data corresponding to different transaction requests, and the safety of the data is improved.
In some embodiments, the data processing method of the blockchain further includes: receiving a data query request comprising a service identifier sent by a target application; determining a verification node corresponding to the service identifier according to the database management information; forwarding a data query request to a verification node corresponding to the service identifier so that the verification node obtains target relational data corresponding to the data query request from a relational database; receiving target relation data returned by the verification node corresponding to the service identifier; and sending the target relational data to the target application.
The data query request comprises a data query statement and a service identifier, and the data query statement can be an SQL statement. The database management information also comprises the corresponding relation between each service identifier and each database address, and the matched database address can be searched according to the service identifiers, and the database address is the IP address of the verification node.
In some embodiments, the target application sends a data query request to the target gateway, the target gateway obtains a service identifier in the data query request, searches database management information for a database address corresponding to the service identifier, and sends the data query request to a verification node corresponding to the database address, so as to forward the data query request to the verification node matched with the service identifier.
The verification node receives the data query request, acquires a data query statement included in the data query request, acquires target relationship data corresponding to the data query statement in the relationship database, and sends the target relationship data to the target gateway, and the target gateway can forward the target relationship data to the target application, so that the target application acquires the target relationship data to be queried.
In some embodiments, the number of verification nodes corresponding to the service identifier may be multiple, that is, the number of verification nodes corresponding to the target node is multiple, and the relational databases in the multiple verification nodes are the same; the target gateway can acquire the number of the pending requests corresponding to each of the plurality of verification nodes, determine the minimum number of the pending requests from the plurality of the pending requests, and send a data query request to the verification node corresponding to the minimum number of the pending requests.
It should be noted that the number of requests to be processed is the number of data query requests and data read requests received by the verification node and not yet processed; when the number of the verification nodes corresponding to the service identifier is multiple, the data query request can be sent to the idle verification nodes, and the efficiency of querying the target relationship data from the relationship database of the verification nodes can be improved.
In the above embodiment, the target gateway forwards the data query request to the verification node corresponding to the service identifier, and obtains the target relational data corresponding to the data query request from the relational database of the verification node, where the relational database of the verification node supports direct query, and the complete data does not need to be obtained from the chain, and queries the obtained complete data after performing data structure conversion processing, so that the process of querying the data from the chain is simplified, the data query efficiency is improved, and the data is queried from the relational database of the verification node, so that the data query mode is more convenient and flexible.
In some embodiments, the data processing method of the blockchain further includes: sending an information synchronization request to a core consensus node in a blockchain network; and receiving the database management information returned by the core consensus node in response to the information synchronization request.
The core consensus node is a consensus node in a consensus network, and comprises database management information, wherein the database management information is used for managing a relational database corresponding to each service, and is particularly used for managing the data capacity, the writing authority, the database address of a verification node, the network address of a corresponding target service node and the like of the relational database; the core consensus node is also used for registering a relational database corresponding to the newly added service when the service is newly added.
In some embodiments, the core consensus node maintains database management information through a backbone registry contract; the target gateway sends an information synchronization request to the core consensus node, and the main chain registry contract processes the information synchronization request to acquire database management information and sends the database management information to the target gateway.
In some embodiments, the target gateway may periodically send information synchronization requests to the core consensus node so that the target gateway may be synchronized in time when the database management information is updated.
In some embodiments, when an update occurs to the database management information in the core consensus node, an information update message is sent to the target gateway through a backbone registry contract of the core consensus node, and the target gateway sends an information synchronization request to the core consensus node in response to the information update message.
In some embodiments, the core consensus nodes are in the main chain, the target consensus nodes are in the sub-chains, the core consensus nodes in the main chain manage the related information of the relational databases of the target consensus nodes, do not participate in the processing process of the transaction request, each target consensus node processes the transaction request on the sub-chain, do not occupy the space on the chain of the main chain, fully utilize the space on the chain of each sub-chain, and facilitate the expansion of the relational databases corresponding to new services on the sub-chains; in addition, each target consensus node processes the transaction request on the sub-chain, so that the data interacted when the transaction request is processed on each sub-chain does not need to be interacted on the main chain, the data isolation among different services is ensured, and the safety of the data is improved.
In the above embodiment, the target gateway sends the information synchronization request to the core consensus node to obtain the database management information, so that the target gateway can distribute the transaction request and the data query request according to the database management information, so as to process the transaction request of different services through different target nodes and query the relational data of different services from the relational databases of different verification nodes, thereby realizing data isolation and improving the security of the data.
In some embodiments, the target nodes include a target traffic node, a proxy node, and a target consensus node; forwarding the transaction request to the target node to cause the target node to execute the transaction request to obtain status data, comprising: and sending a transaction request to the target service node so that the target service node sends the transaction request to the proxy node, broadcasting the transaction request to the target consensus node through the proxy node, indicating the target consensus node to consensus the transaction request, and determining state data for updating the state on the chain according to an execution result corresponding to the transaction request under the condition of consensus.
In some embodiments, the target gateway obtains a network address corresponding to a service representation included in the transaction request in the database management information, sends the transaction request to a target service node matched with the transaction request according to the network address, the target service node sends the transaction request to the proxy node, the proxy node broadcasts the transaction request to each target consensus node corresponding to the target service node, and after each target consensus node obtains the transaction request, the transaction request is consensus through the service contract, and under the condition that the consensus is achieved, the service contract determines state data for updating the on-link state according to an execution result corresponding to the transaction request.
In the above embodiment, the transaction request is processed through the target service node and the target consensus node corresponding to the service identifier included in the transaction request, so as to obtain the status data, so that the transaction requests of different services can be processed through different target nodes, thereby realizing data isolation and improving the security of the data.
In some embodiments, as shown in fig. 5, the data processing method of the blockchain is applied to the target gateway, including:
step 501, a target gateway sends a first information synchronization request to a core consensus node in a blockchain network; receiving database management information returned by the core consensus node in response to the first information synchronization request;
step 502, when a transaction request sent by a target application is received, a target gateway acquires a service identifier contained in the transaction request; searching a network address corresponding to the service identifier in the database management information; determining a target node matched with the transaction request according to the network address;
step 503, the target gateway sends a transaction request to the target service node, so that the target service node sends the transaction request to the proxy node, broadcasts the transaction request to the target consensus node through the proxy node, instructs the target consensus node to consensus the transaction request, and determines state data for updating the state on the chain according to an execution result corresponding to the transaction request when consensus is achieved; generating transaction events of the status data based on the smart contracts; the transaction event is used for indicating the verification node corresponding to the target node to acquire a transaction statement and a permission identifier contained in the transaction event; executing a transaction statement when the permission identification meets the transaction condition according to the permission table to obtain the relational data corresponding to the state data; updating the relational data in a relational database;
Step 504, the target gateway receives a database update message sent by the verification node after updating the relational database;
step 505, the target gateway forwards the database update message to the target application; when receiving a data acquisition request returned by a target application, forwarding the data acquisition request to a verification node; receiving relation data returned by the verification node according to the data acquisition request; sending the relational data to the target application;
step 506, receiving a data query request including a service identifier sent by a target application; determining a verification node corresponding to the service identifier according to the database management information; forwarding a data query request to the verification node so that the verification node obtains target relational data corresponding to the data query request from a relational database; receiving target relational data returned by the verification node; and sending the target relational data to the target application.
In the above-mentioned data processing method of the block chain, when receiving the trade request that the goal gateway sends, distribute the trade request, confirm the goal node that matches with trade request in the block chain network, send trade request to the goal node, when the goal node carries out the trade request and gets the status data, produce the trade event based on intelligent contract, verify the node carries out the trade event and gets the relational data that the status data corresponds, update the relational data in the relational database, the goal gateway receives the database and updates the message, obtain the relational data from the relational database, return the relational data to the goal application; generating a transaction event corresponding to the state data through the intelligent contract, verifying that the node executes the transaction event so as to synchronously update the state data on the chain into a relational database under the chain, wherein the target application can directly read the relational data from the relational database, the data reading efficiency of the blockchain is improved, the read relational data can be directly used for front-end display without reading the data from the chain, and then the data read from the chain is processed, so that the process of synchronously displaying the state data on the chain by the target application is simplified, and the efficiency of synchronously displaying the corresponding content of the state data on the chain by the target application is improved; in addition, the target node matched with the transaction request executes the transaction request, the verification node corresponding to the target node executes the transaction event corresponding to the state data, the relational data corresponding to the transaction request is updated in the relational database of the verification node matched with the transaction request, and further when different target nodes matched with the transaction request are different, the relational data corresponding to different transaction requests can be stored in a database, so that data isolation is carried out on the relational data corresponding to different transaction requests, and the safety of the data is improved.
In some embodiments, as shown in fig. 6, there is provided a data processing method of a blockchain, which is performed by a target gateway or a target node in fig. 1, and may also be performed by the target gateway and the target node cooperatively, and the method is illustrated by the target node in fig. 1 as an example, and includes the following steps:
step 602, a transaction request forwarded by a target gateway and originating from a target application is received.
The target node comprises a target service node, a proxy node and a target consensus node.
In some embodiments, the number of target consensus nodes is a plurality, the plurality of target consensus nodes including a target master consensus node and a plurality of other target consensus nodes; the target service node receives the transaction request forwarded by the target gateway, sends the transaction request to the proxy node, the proxy node sends the transaction request to the transaction data channel, the target master consensus node acquires the transaction request from the transaction data channel, and sends the transaction request to the consensus data channel, so that a plurality of other target consensus nodes acquire the transaction request from the consensus data channel.
In some embodiments, step 602 includes: receiving a transaction request forwarded by a target gateway and originating from a target application, wherein the transaction request comprises: receiving a transaction request which is forwarded by a target gateway and is derived from a target application through a target service node; the data processing method of the blockchain further comprises the following steps: the transaction request is sent to the proxy node by the target service node such that the proxy node broadcasts the transaction request to the target consensus node.
In some embodiments, the number of the target consensus nodes is a plurality, the target service node receives the transaction request sent by the target gateway, sends the transaction request to the proxy node, and the proxy node broadcasts the transaction request to each target consensus node corresponding to the target service node, so that each target consensus node receives the transaction request.
The specific process of the target gateway forwarding the transaction request sent by the target application to the target service node, and the target service node sending the transaction request to the target node through the proxy node may be described in the foregoing embodiments, where the step 202 and the step 204 are described.
At step 604, a transaction request is performed to obtain status data.
In some embodiments, after the target consensus node obtains the transaction request, consensus is performed on the transaction request, and under the condition that consensus is achieved, the target consensus node determines state data for updating the state on the chain according to an execution result corresponding to the transaction request.
The specific process of executing the transaction request to obtain the status data for the target node may be described in the above embodiment, with reference to step 204.
Step 606, generating a transaction event of the status data based on the smart contract; the transaction event is used for indicating the verification node corresponding to the target node to determine the relational data corresponding to the state data, updating the relational data in a relational database and sending a database updating message to the target gateway; the database update message is used to instruct the target gateway to read the relational data from the relational database and return the relational data to the target application.
In some embodiments, the intelligent contract obtains the permission identifier and the transaction statement included in the transaction request, invokes the registry contract to determine the relational database information corresponding to the transaction request, and generates a transaction event corresponding to the state data according to the transaction statement and the permission identifier when the relational database information characterizes that the relational database matched with the transaction request exists.
The verification node corresponding to the target consensus node acquires the transaction event and executes the transaction event to obtain the relational data corresponding to the state data, and the verification node adds the relational data into a relational database and sends a database update message to the target gateway; the target gateway reads the relationship data from the relationship database based on the database update message and returns the relationship data to the target application.
In some embodiments, the intelligent contract generates a transaction event of a preset protocol according to the transaction statement and the authority identification; the verification node periodically detects the event of the preset protocol, and further under the condition that the intelligent contract generates the transaction event of the preset protocol, the transaction event can be acquired by the verification node. It should be noted that, the preset protocol may be a protocol for performing data interaction between the target consensus node and the verification node, and further, a transaction event of the preset protocol may be acquired by the verification node.
The verification node determines the relationship data corresponding to the state data and updates the relationship data in the relationship database, which may refer to the specific process in the above embodiment.
The verification node sends a database update message to the target gateway, and the target gateway reads the relational data from the relational database based on the database update message and returns the relational data to the target application, which is described in detail in the foregoing embodiments, and reference may be made to step 206 and step 208.
In the above-mentioned data processing method of the block chain, when receiving the trade request that the goal gateway sends, distribute the trade request, confirm the goal node that matches with trade request in the block chain network, send trade request to the goal node, when the goal node carries out the trade request and gets the status data, produce the trade event based on intelligent contract, verify the node carries out the trade event and gets the relational data that the status data corresponds, update the relational data in the relational database, the goal gateway receives the database and updates the message, obtain the relational data from the relational database, return the relational data to the goal application; generating a transaction event corresponding to the state data through the intelligent contract, verifying that the node executes the transaction event so as to synchronously update the state data on the chain into a relational database under the chain, wherein the target application can directly read the relational data from the relational database, the data reading efficiency of the blockchain is improved, the read relational data can be directly used for front-end display without reading the data from the chain, and then the data read from the chain is processed, so that the process of synchronously displaying the state data on the chain by the target application is simplified, and the efficiency of synchronously displaying the corresponding content of the state data on the chain by the target application is improved; in addition, the target node matched with the transaction request executes the transaction request, the verification node corresponding to the target node executes the transaction event corresponding to the state data, the relational data corresponding to the transaction request is updated in the relational database of the verification node matched with the transaction request, and further when different target nodes matched with the transaction request are different, the relational data corresponding to different transaction requests can be stored in a database, so that data isolation is carried out on the relational data corresponding to different transaction requests, and the safety of the data is improved.
In some embodiments, the target node comprises a target consensus node; executing the transaction request obtains status data, including: acquiring authority identifiers contained in the easy request through intelligent contracts of the target consensus nodes; under the condition that the permission identification meets the transaction condition, sending an execution message to the business contract through the intelligent contract; executing the transaction request through the business contract to obtain an execution result; state data for updating the state on the chain is determined from the execution result.
Wherein the smart contracts may be used to process transaction requests and may also be used to generate transaction events.
In some embodiments, the target consensus node stores a permission table comprising a plurality of user identifications corresponding to users having permission to write data in a relational database; the intelligent contract can search the authority identification in the authority table, if the authority identification exists in the authority table, the authority identification is determined to meet the transaction condition, and if the authority identification does not exist in the authority table, the authority identification is determined to not meet the transaction condition.
In some embodiments, the smart contract may send the rights identification to the database management contract, determine whether the rights identification meets the transaction condition through the database management contract, return first information for characterizing that the transaction condition is met to the smart contract when the database management contract determines that the rights identification meets the transaction condition, and return second information for characterizing that the transaction condition is not met to the smart contract when the database management contract determines that the rights identification meets the transaction condition, and further the smart contract may determine whether the rights identification meets the transaction condition according to the received first information or the second information.
The method comprises the steps that the number of target consensus nodes is multiple, for each target consensus node, under the condition that authority identification meets transaction conditions, an execution message is sent to a business contract through an intelligent contract, the business contract executes a transaction request and obtains an execution result, and under the condition that the execution result reaches consensus among a plurality of target consensus nodes, the business contract determines state data according to the execution result and adopts the state data to update a state database on a chain.
In the above embodiment, whether the transaction request meets the transaction condition is determined through the intelligent contract, and when the transaction request meets the transaction condition, the transaction request is executed through interaction between the intelligent contract and the business contract, and the state data for updating the on-chain state is obtained, so that the relationship data corresponding to the state data can be synchronously updated in the relationship database under the chain.
In some embodiments, generating a transaction event of status data based on the smart contract includes: under the condition that the intelligent contract receives the state data returned by the business contract, acquiring a transaction statement contained in the transaction request; invoking a registry contract through the intelligent contract; determining relational database information corresponding to the transaction request according to the sub-database management information of the registry contract; when the relational database information characterizes that a relational database matched with the transaction request exists, generating transaction events of state data according to the transaction statement and the permission identification.
In some embodiments, after the business contract determines the state data, the state data is returned to the intelligent contract, and when the intelligent contract receives the state data, a transaction statement contained in the transaction request is acquired, the intelligent contract calls a registry contract, the registry contract determines relational database information corresponding to the transaction request, and the registry contract sends the relational database information to the intelligent contract.
The registry contract maintains sub-database management information, which includes the data capacity, write permission, the database address of the verification node, the network address of the corresponding target service node, and the like of the corresponding relation database of the target consensus node.
The sub-database management information is part of the database management information of the target gateway; illustratively, the database management information includes information of a relational database corresponding to all services, and the sub-data management information includes information of a relational database corresponding to a certain service.
The registry contract obtains the service identifier included in the transaction request, searches the relational database information corresponding to the service identifier in the sub-database management information, determines the relational database information as third information when the relational database identifier corresponding to the service identifier exists in the sub-database management information, and determines the relational database information as fourth information when the relational database representation corresponding to the service identifier does not exist in the sub-database management information.
When the relational database information received by the intelligent contract is third information, generating a transaction event of a preset protocol according to a transaction statement and an authority identifier included in the transaction request, so that the transaction event of the preset protocol can be acquired when the verification node periodically detects the time of the preset protocol.
When the relational database information received by the intelligent contract is fourth information, determining that the relational database corresponding to the transaction request does not exist, and further generating no transaction event.
As shown in fig. 7, an intelligent contract of a target consensus node obtains a permission identifier included in a transaction request, sends an execution message to a business contract when the permission identifier meets a transaction condition, the business contract executes the transaction request to obtain state data, the business contract returns the state data to the intelligent contract, after receiving the state data, the intelligent contract calls a registry contract, the registry is in sub-database management information, relational database information corresponding to the transaction request is determined, when the relational database information represents that a relational database matched with the transaction request exists, the intelligent contract obtains a transaction statement included in the transaction request, and a transaction event of a preset protocol is generated according to the transaction statement and the permission identifier.
In the above embodiment, under the condition that the state data is received, through interaction between the intelligent contract of the target consensus node and the registry contract, a transaction event corresponding to the state data is generated, so that the verification node can acquire and execute the transaction event, obtain the relational data corresponding to the state data, update the relational data into the relational database, and realize synchronous updating of the state data on the chain into the relational database under the chain.
In some embodiments, the data processing method of the blockchain further includes: sending a second information synchronization request to a core consensus node in the blockchain network; the receiving core consensus node responds to the sub-database management information sent by the second information synchronization request.
In some embodiments, the target consensus node sends an information synchronization request to the core consensus node, the core consensus node obtains sub-database management information in response to the information synchronization request, and sends the sub-database management information to the target consensus node; the target consensus node may send an information synchronization request to the core consensus node via the registry contract, and accordingly, the sub-database management information obtained according to the second information synchronization request is maintained by the registry contract.
In some embodiments, the target consensus node may periodically send an information synchronization request to the core consensus node, so that the target consensus node may be synchronized in time when the sub-database management information is updated.
In some embodiments, when an update occurs to the sub-database management information in the core consensus node, the core consensus node may send an information update message to the target consensus node, which sends an information synchronization request to the core consensus node in response to the information update message.
Illustratively, as shown in fig. 8, the core consensus node may send the sub-database management information to the target consensus node, so that the target consensus node may determine the relational database information corresponding to the transaction request from the sub-database management information; the core consensus node may send the database management information to the target gateway, so that the target gateway may determine a target node corresponding to the transaction request and determine a verification node corresponding to the data query request according to the database management information.
In the above embodiment, the target consensus node sends the second information synchronization request to the core consensus node, so that the sub-database management information in the core consensus node can be synchronized, and the relational database information corresponding to the transaction request is determined through the sub-database management information, thereby ensuring the consistency of the database information in the blockchain network.
In some embodiments, as shown in fig. 9, a data processing method of a blockchain is applied to a target node, wherein the target node includes a target service node, a proxy node and a target consensus node, and the data processing method of the blockchain includes:
step 901, a target consensus node sends a second information synchronization request to a core consensus node in a blockchain network; receiving sub-database management information sent by the core consensus node in response to the second information synchronization request;
step 902, the target service node receives a transaction request from a target application forwarded by a target gateway; the target service node sends the transaction request to the proxy node so that the proxy node broadcasts the transaction request to the target consensus node;
step 903, obtaining the authority identifier contained in the transaction request by the intelligent contract of the target consensus node; under the condition that the permission identification meets the transaction condition, sending an execution message to the business contract through the intelligent contract; executing the transaction request through the business contract to obtain an execution result; determining state data for updating the state on the chain according to the execution result;
step 904, under the condition that the intelligent contract receives the state data returned by the business contract, acquiring a transaction statement contained in the transaction request; invoking a registry contract through the intelligent contract; determining relational database information corresponding to the transaction request according to the sub-database management information of the registry contract;
Step 905, when the relational database information characterizes that there is a relational database matched with the transaction request, generating a transaction event of state data by the intelligent contract of the target consensus node according to the transaction statement and the authority identifier; the transaction event is used for indicating the verification node corresponding to the target node to determine the relational data corresponding to the state data, updating the relational data in a relational database and sending a database updating message to the target gateway; the database update message is used to instruct the target gateway to read the relational data from the relational database and return the relational data to the target application.
In the above-mentioned data processing method of the block chain, when receiving the trade request that the goal gateway sends, distribute the trade request, confirm the goal node that matches with trade request in the block chain network, send trade request to the goal node, when the goal node carries out the trade request and gets the status data, produce the trade event based on intelligent contract, verify the node carries out the trade event and gets the relational data that the status data corresponds, update the relational data in the relational database, the goal gateway receives the database and updates the message, obtain the relational data from the relational database, return the relational data to the goal application; generating a transaction event corresponding to the state data through the intelligent contract, verifying that the node executes the transaction event so as to synchronously update the state data on the chain into a relational database under the chain, wherein the target application can directly read the relational data from the relational database, the data reading efficiency of the blockchain is improved, the read relational data can be directly used for front-end display without reading the data from the chain, and then the data read from the chain is processed, so that the process of synchronously displaying the state data on the chain by the target application is simplified, and the efficiency of synchronously displaying the corresponding content of the state data on the chain by the target application is improved; in addition, the target node matched with the transaction request executes the transaction request, the verification node corresponding to the target node executes the transaction event corresponding to the state data, the relational data corresponding to the transaction request is updated in the relational database of the verification node matched with the transaction request, and further when different target nodes matched with the transaction request are different, the relational data corresponding to different transaction requests can be stored in a database, so that data isolation is carried out on the relational data corresponding to different transaction requests, and the safety of the data is improved.
In some embodiments, as shown in FIG. 10, there is provided a blockchain data processing system, comprising:
the target gateway 1002 is configured to, when receiving a transaction request sent by a target application, determine a target node matching the transaction request in the blockchain network, and forward the transaction request to the target node.
The detailed process of determining the target node matching the transaction request in the blockchain network and forwarding the transaction request to the target node by the target gateway may refer to the description of step 202 in the above embodiment.
The target node 1004 is configured to execute the transaction request to obtain status data, and generate a transaction event for the status data based on the smart contract.
Wherein the target node performs the transaction request to obtain the status data, and generates the status data based on the smart contract, reference may be made to the description of step 204 in the above embodiment.
A verification node 1006, configured to determine relational data corresponding to the state data, and update the relational data in a relational database; the authentication node is a node corresponding to the target node.
Wherein the verifying node determines the relational data and updates the detailed procedure in the relational database, reference is made to the description of step 204 in the above embodiment.
The target gateway 1002 is further configured to receive a database update message sent by the verification node after updating the relational database; and reading the relational data from the relational database based on the database update message and returning the relational data to the target application.
The target gateway receives the database update message, reads the relational data from the relational database based on the database update message, and returns the relational data to the target application, which is described in the above embodiments with reference to step 206 and step 208.
In the above-mentioned data processing system of the block chain, the goal gateway distributes the trade request when receiving the trade request that the goal application sends, confirm the goal node that matches with trade request in the block chain network, send trade request to the goal node, the goal node carries out the trade request and gets the state data, produce the trade event based on intelligent contract, verify the node carries out the trade event and gets the relational data that the state data corresponds to, update the relational data in the relational database, the goal gateway receives the database and updates the message, obtain the relational data from the relational database, return the relational data to the goal application; generating a transaction event corresponding to the state data through the intelligent contract, verifying that the node executes the transaction event so as to synchronously update the state data on the chain into a relational database under the chain, wherein the target application can directly read the relational data from the relational database, the data reading efficiency of the blockchain is improved, the read relational data can be directly used for front-end display without reading the data from the chain, and then the data read from the chain is processed, so that the process of synchronously displaying the state data on the chain by the target application is simplified, and the efficiency of synchronously displaying the corresponding content of the state data on the chain by the target application is improved; in addition, the target node matched with the transaction request executes the transaction request, the verification node corresponding to the target node executes the transaction event corresponding to the state data, the relational data corresponding to the transaction request is updated in the relational database of the verification node matched with the transaction request, and further, when different target nodes matched with the transaction request are different, the relational data corresponding to different transaction requests can be stored in a database in a separated mode, so that data isolation is carried out on the relational data corresponding to different transaction requests, and the safety of the data is improved.
In some embodiments, the target gateway is further configured to obtain a service identifier included in the transaction request, and search for a network address corresponding to the service identifier in the database management information; a target node matching the transaction request is determined from the network address.
In some embodiments, the target gateway is further configured to receive a data query request including a service identifier sent by the target application; determining a verification node corresponding to the service identifier according to the database management information; forwarding a data query request to a verification node corresponding to the service identifier so that the verification node obtains target relational data corresponding to the data query request from a relational database; receiving target relation data returned by the verification node corresponding to the service identifier; and sending the target relational data to the target application.
In some embodiments, the target gateway is further configured to send a first information synchronization request to a core consensus node in the blockchain network; the receiving core consensus node responds to the database management information returned by the first information synchronization request.
In some embodiments, the target gateway is further configured to forward the database update message to the target application; when receiving a data acquisition request returned by a target application, forwarding the data acquisition request to a verification node; receiving relation data returned by the verification node according to the data acquisition request; and sending the relational data to the target application.
In some embodiments, the verification node is further configured to obtain a transaction statement and a permission identifier included in the transaction event; executing a transaction statement when the permission identification meets the transaction condition according to the permission table to obtain the relational data corresponding to the state data; the relational data is updated in a relational database.
In some embodiments, the target nodes include a target traffic node, a proxy node, and a target consensus node; the target service node is used for receiving the transaction request forwarded by the target gateway and sending the transaction request to the proxy node; the agent node is used for broadcasting the transaction request to the target consensus node; and the target consensus node is used for consensus the transaction request, determining state data for updating the state on the chain according to an execution result corresponding to the transaction request under the condition of consensus, and generating a transaction event of the state data based on the intelligent contract.
In some embodiments, the target consensus node is further configured to obtain, through an intelligent contract of the target consensus node, a permission identifier included in the transaction request; under the condition that the permission identification meets the transaction condition, sending an execution message to the business contract through the intelligent contract; executing the transaction request through the business contract to obtain an execution result; state data for updating the state on the chain is determined from the execution result.
In some embodiments, the target consensus node is further configured to obtain a transaction statement included in the transaction request when the intelligent contract receives status data returned by the service contract; invoking a registry contract through the intelligent contract; determining relational database information corresponding to the transaction request according to the sub-database management information of the registry contract; when the relational database information characterizes that a relational database matched with the transaction request exists, generating transaction events of state data according to the transaction statement and the permission identification.
In some embodiments, the target consensus node is further configured to send a second information synchronization request to a core consensus node in the blockchain network; the receiving core consensus node responds to the sub-database management information sent by the second information synchronization request.
In some embodiments, as shown in FIG. 11, a data processing system for a blockchain includes: the system comprises a client, a target gateway, a target service node, a proxy node, a target consensus node, a verification node and a core consensus node, wherein the target service node is in a service network of a blockchain network, and the target consensus node, the verification node and the core consensus node are in a consensus network of the blockchain network; the target service node, the target consensus node and the verification node are all nodes matched with the transaction request.
The core consensus node maintains database management information through a main chain registry contract, the target gateway synchronizes the database management information from the core consensus node, the target consensus node and the verification node synchronize sub-database management information corresponding to the processed business from the core consensus node.
The target application runs on the client, the target application can send a transaction request to the target gateway, the target gateway sends the transaction request to a target service node matched with the transaction request, the target service node broadcasts the transaction request to a target consensus node through a proxy node, the target consensus node executes the transaction request through an intelligent contract, a service contract and a registry contract to obtain state data, and a transaction event is generated; the verification node executes the transaction event to obtain the relational data, and the relational data is updated in a relational database; the target gateway can acquire the latest relational data from the relational database and forward the latest relational data to the target application, so that the target application can use the relational data for front-end display.
The target application can also send a data query request to the target gateway, the target gateway forwards the data query request to the corresponding verification node, the target relational data corresponding to the data query request is obtained from the relational database of the verification node, and the target gateway returns the target relational data to the target application.
In some embodiments, as shown in FIG. 12, the blockchain data processing system is used to perform the blockchain data processing method, and the blockchain data processing system can be applied in an electronic bill scenario.
The service layer corresponds to the service network in the above embodiment, and the consensus layer corresponds to the consensus network in the above embodiment; the routing agent layer is used for forwarding the transaction request between the service layer and the consensus layer; the target service node is deployed in the service layer, the target consensus node is deployed in the consensus layer, and the proxy node is deployed in the routing proxy layer.
In the electronic bill scene, the target application can be an electronic tax office decentralizing application program, a centralized application program corresponding to an enterprise user or a centralized application program corresponding to a consumer; the target service node can be a background server of an electronic tax office in a service layer, a background server corresponding to an enterprise user or a background server corresponding to a consumer; the electronic tax office may be a local tax office in a private network of the tax office, the enterprise user may be an billing service provider, a reimbursement service provider or a KA enterprise (Key Account enterprise, i.e. a Key customer enterprise such as a large retail enterprise) in a public cloud, and the consumer may be a payment service provider, a reimbursement service provider or a retail enterprise in a private cloud. The core chain 1, the core chains 2, … and the core chain N are respectively blockchains maintained by tax authorities in different areas, and in the embodiment of the application, the core chain 1, the core chains 2, … and the core chain N of the tax private network can be blockchains maintained by consensus nodes corresponding to different services respectively, and the target consensus nodes can be trusted nodes (TrustSQL nodes) in the core chains, and the TrustSQL nodes have the capability of executing transaction requests to obtain state data and generating transaction events of a preset protocol; assuming that the blockchain corresponding to the service identifier in the transaction request is the core chain 1, the trusted node in the core chain 1 is the target consensus node.
The proxy node in the routing proxy layer can be used for carrying out network isolation on the service layer and the consensus layer, and the proxy node has point-to-point service, routing service, certificate cache and authentication service; the point-to-point service enables the proxy node to perform point-to-point network connection with the target proxy node and the target consensus node; the routing service enables the proxy node to communicate with the target service node and the target consensus node; the certificate in the certificate cache may be a public key of the target service node; the authentication service can decrypt the transaction request sent by the target service node through the public key, and the proxy node decrypts the encrypted transaction request through the cached public key, so that the transaction request is not easy to reveal, and the security of the transaction request is improved.
Illustratively, after a consumer generates a consumption behavior, an enterprise user makes an invoice for the consumption behavior through a corresponding terminal device, and generates a transaction request; the target gateway sends a transaction request to a target service node matched with the transaction request, the target service node sends the transaction request to an agent node, after the agent node in the routing agent layer acquires the transaction request sent by the target service node, the transaction request can be broadcast to a target consensus node in a consensus layer, and the target consensus node can perform consensus on the transaction request, generate state data and generate a transaction event of a preset protocol.
The verification node can be deployed in the consensus layer, periodically acquire events of a preset protocol, acquire the transaction event when the target consensus node generates the transaction event of the preset protocol, execute the transaction event to acquire the relational data, and update the relational data in the relational database.
The target gateway may obtain updated relationship data from the relationship database of the verification node and send the relationship data to the target application.
In the above-mentioned data processing system of the block chain, the goal gateway distributes the trade request when receiving the trade request that the goal application sends, confirm the goal node that matches with trade request in the block chain network, send trade request to the goal node, the goal node carries out the trade request and gets the state data, produce the trade event based on intelligent contract, verify the node carries out the trade event and gets the relational data that the state data corresponds to, update the relational data in the relational database, the goal gateway receives the database and updates the message, obtain the relational data from the relational database, return the relational data to the goal application; generating a transaction event corresponding to the state data through the intelligent contract, verifying that the node executes the transaction event so as to synchronously update the state data on the chain into a relational database under the chain, wherein the target application can directly read the relational data from the relational database, the data reading efficiency of the blockchain is improved, the read relational data can be directly used for front-end display without reading the data from the chain, and then the data read from the chain is processed, so that the process of synchronously displaying the state data on the chain by the target application is simplified, and the efficiency of synchronously displaying the corresponding content of the state data on the chain by the target application is improved; in addition, the target node matched with the transaction request executes the transaction request, the verification node corresponding to the target node executes the transaction event corresponding to the state data, the relational data corresponding to the transaction request is updated in the relational database of the verification node matched with the transaction request, and further when different target nodes matched with the transaction request are different, the relational data corresponding to different transaction requests can be stored in a database, so that data isolation is carried out on the relational data corresponding to different transaction requests, and the safety of the data is improved.
It should be understood that, although the steps in the flowcharts related to the embodiments described above are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a data processing device of the blockchain for realizing the data processing method of the blockchain. The implementation of the solution provided by the apparatus is similar to the implementation described in the above method, so the specific limitation in the embodiments of the data processing apparatus for one or more blockchains provided below may refer to the limitation of the data processing method for a blockchain hereinabove, and will not be repeated herein.
In some embodiments, as shown in FIG. 13, there is provided a data processing apparatus of a blockchain, comprising: a target node determining module 1301, a transaction request forwarding module 1302, a database update message receiving module 1303, and a relational data obtaining module 1304, wherein:
a target node determining module 1301, configured to determine, when receiving a transaction request sent by a target application, a target node matching the transaction request in a blockchain network;
a transaction request forwarding module 1302, configured to forward a transaction request to a target node, so that the target node executes the transaction request to obtain status data, and generate a transaction event of the status data based on the intelligent contract; the transaction event is used for indicating the verification node corresponding to the target node to determine the relational data corresponding to the state data and updating the relational data in the relational database;
the database update message receiving module 1303 is configured to receive a database update message sent by the verification node after updating the relational database;
the relational data acquisition module 1304 is configured to read relational data from the relational database based on the database update message and return the relational data to the target application.
In some embodiments, the target node determining module 1301 is further configured to obtain a service identifier included in the transaction request; searching a network address corresponding to the service identifier in the database management information; a target node matching the transaction request is determined from the network address.
In some embodiments, the data processing apparatus of the blockchain further includes: the target relational data query module is used for receiving a data query request comprising a service identifier sent by a target application; determining a verification node corresponding to the service identifier according to the database management information; forwarding a data query request to a verification node corresponding to the service identifier so that the verification node obtains target relational data corresponding to the data query request from a relational database; receiving target relation data returned by the verification node corresponding to the service identifier; and sending the target relational data to the target application.
In some embodiments, the data processing apparatus of the blockchain further includes: the first information synchronization module is used for sending a first information synchronization request to a core consensus node in the blockchain network; receiving database management information returned by the core consensus node in response to the first information synchronization request; the first information synchronization module is deployed in the target gateway.
In some embodiments, the data processing apparatus of the blockchain further includes: the relational data acquisition module 1304 is further configured to forward a database update message to the target application; receiving a data acquisition request returned by a target application, and forwarding the data acquisition request to a verification node; receiving relation data returned by the verification node according to the data acquisition request; and sending the relational data to the target application.
In some embodiments, the target nodes include a target traffic node, a proxy node, and a target consensus node; the transaction request forwarding module 1302 is further configured to send a transaction request to the target service node, so that the target service node sends the transaction request to the proxy node, broadcasts the transaction request to the target consensus node through the proxy node, instructs the target consensus node to consensus the transaction request, and determines, according to an execution result corresponding to the transaction request, state data for updating the on-link state under the condition that consensus is achieved.
In some embodiments, the data processing apparatus of the blockchain further includes: the relational data determining module is used for acquiring transaction sentences and authority identifiers contained in the transaction events; executing a transaction statement when the permission identification meets the transaction condition according to the permission table to obtain the relational data corresponding to the state data; updating the relational data in a relational database; the relational data determination module may be deployed in the validation node.
Based on the same inventive concept, the embodiment of the application also provides a data processing device of the blockchain for realizing the data processing method of the blockchain. The implementation of the solution provided by the apparatus is similar to the implementation described in the above method, so the specific limitation in the embodiments of the data processing apparatus for one or more blockchains provided below may refer to the limitation of the data processing method for a blockchain hereinabove, and will not be repeated herein.
In some embodiments, as shown in FIG. 14, there is provided a data processing apparatus of a blockchain, comprising: a transaction request receiving module 1401, a transaction request executing module 1402, and a transaction event generating module 1403, wherein:
a transaction request receiving module 1401, configured to receive a transaction request forwarded by a target gateway and originating from a target application;
a transaction request execution module 1402, configured to execute a transaction request to obtain status data;
a transaction event generation module 1403 for generating a transaction event of the status data based on the smart contract; the transaction event is used for indicating the verification node corresponding to the target node to determine the relational data corresponding to the state data, updating the relational data in a relational database and sending a database updating message to the target gateway; the database update message is used to instruct the target gateway to read the relational data from the relational database and return the relational data to the target application.
In some embodiments, the target nodes include a target traffic node, a proxy node, and a target consensus node; the transaction request receiving module 1401 also receives a transaction request forwarded by the target gateway and originating from the target application, including: receiving a transaction request which is forwarded by a target gateway and is derived from a target application through a target service node; the transaction request is sent to the proxy node by the target service node such that the proxy node broadcasts the transaction request to the target consensus node.
In some embodiments, the transaction request execution module 1402 is further configured to obtain, through the intelligent contract of the target consensus node, a permission identifier included in the transaction request; under the condition that the permission identification meets the transaction condition, sending an execution message to the business contract through the intelligent contract; executing the transaction request through the business contract to obtain an execution result; state data for updating the state on the chain is determined from the execution result.
In some embodiments, the transaction event generation module 1403 is further configured to obtain a transaction statement included in the transaction request when the smart contract receives status data returned by the business contract; invoking a registry contract through the intelligent contract; determining relational database information corresponding to the transaction request according to the sub-database management information of the registry contract; when the relational database information characterizes that a relational database matched with the transaction request exists, generating transaction events of state data according to the transaction statement and the permission identification.
In some embodiments, the data processing apparatus of the blockchain further includes: the second information synchronization module is used for sending a second information synchronization request to a core consensus node in the blockchain network; receiving sub-database management information sent by the core consensus node in response to the second information synchronization request; and the second information synchronization module is deployed in the target consensus node.
The various modules in the data processing apparatus of the blockchain described above may be implemented in whole or in part in software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a server, and the internal structure of which may be as shown in fig. 15. The computer device includes a processor, a memory, an Input/Output interface (I/O) and a communication interface. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface is connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is used for storing intelligent contracts, state data and relation data. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for communicating with an external terminal through a network connection. The computer program, when executed by a processor, implements a data processing method for a blockchain.
It will be appreciated by those skilled in the art that the structure shown in fig. 15 is merely a block diagram of a portion of the structure associated with the present inventive arrangements and is not limiting of the computer device to which the present inventive arrangements are applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided comprising a memory and a processor, the memory having stored therein a computer program, the processor when executing the computer program performing the steps of:
when a transaction request sent by a target application is received, determining a target node matched with the transaction request in a blockchain network; forwarding the transaction request to the target node so that the target node executes the transaction request to obtain state data, and generating a transaction event of the state data based on the intelligent contract; the transaction event is used for indicating the verification node corresponding to the target node to determine the relational data corresponding to the state data and updating the relational data in the relational database; receiving a database update message sent by a verification node after updating a relational database; reading the relational data from the relational database based on the database update message and returning the relational data to the target application; or alternatively, the process may be performed,
Receiving a transaction request which is forwarded by a target gateway and is derived from a target application; executing the transaction request to obtain state data; generating transaction events of the status data based on the smart contracts; the transaction event is used for indicating the verification node corresponding to the target node to determine the relational data corresponding to the state data, updating the relational data in a relational database and sending a database updating message to the target gateway; the database update message is used to instruct the target gateway to read the relational data from the relational database and return the relational data to the target application.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of:
when a transaction request sent by a target application is received, determining a target node matched with the transaction request in a blockchain network; forwarding the transaction request to the target node so that the target node executes the transaction request to obtain state data, and generating a transaction event of the state data based on the intelligent contract; the transaction event is used for indicating the verification node corresponding to the target node to determine the relational data corresponding to the state data and updating the relational data in the relational database; receiving a database update message sent by a verification node after updating a relational database; reading the relational data from the relational database based on the database update message and returning the relational data to the target application; or alternatively, the process may be performed,
Receiving a transaction request which is forwarded by a target gateway and is derived from a target application; executing the transaction request to obtain state data; generating transaction events of the status data based on the smart contracts; the transaction event is used for indicating the verification node corresponding to the target node to determine the relational data corresponding to the state data, updating the relational data in a relational database and sending a database updating message to the target gateway; the database update message is used to instruct the target gateway to read the relational data from the relational database and return the relational data to the target application.
In one embodiment, a computer program product is provided comprising a computer program which, when executed by a processor, performs the steps of:
when a transaction request sent by a target application is received, determining a target node matched with the transaction request in a blockchain network; forwarding the transaction request to the target node so that the target node executes the transaction request to obtain state data, and generating a transaction event of the state data based on the intelligent contract; the transaction event is used for indicating the verification node corresponding to the target node to determine the relational data corresponding to the state data and updating the relational data in the relational database; receiving a database update message sent by a verification node after updating a relational database; reading the relational data from the relational database based on the database update message and returning the relational data to the target application; or alternatively, the process may be performed,
Receiving a transaction request which is forwarded by a target gateway and is derived from a target application; executing the transaction request to obtain state data; generating transaction events of the status data based on the smart contracts; the transaction event is used for indicating the verification node corresponding to the target node to determine the relational data corresponding to the state data, updating the relational data in a relational database and sending a database updating message to the target gateway; the database update message is used to instruct the target gateway to read the relational data from the relational database and return the relational data to the target application.
It should be noted that, the user information (including but not limited to user equipment information, user personal information, etc.) and the data (including but not limited to data for analysis, stored data, presented data, etc.) related to the present application are information and data authorized by the user or sufficiently authorized by each party, and the collection, use and processing of the related data need to comply with the related laws and regulations and standards of the related country and region.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (FerroelectricRandom Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (DynamicRandom Access Memory, DRAM), and the like. The databases referred to in the embodiments provided herein may include at least one of a relational database and a non-relational database. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processor referred to in the embodiments provided in the present application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, or the like, but is not limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples illustrate only a few embodiments of the application and are described in detail herein without thereby limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of the application should be assessed as that of the appended claims.

Claims (19)

1. A method of data processing for a blockchain, the method comprising:
when a transaction request sent by a target application is received, determining a target node matched with the transaction request in a blockchain network;
forwarding the transaction request to the target node so that the target node executes the transaction request to obtain state data, and generating a transaction event of the state data based on an intelligent contract; the transaction event is used for indicating a verification node corresponding to the target node to determine the relational data corresponding to the state data and updating the relational data in a relational database;
Receiving a database update message sent by the verification node after updating the relational database;
and reading the relational data from the relational database based on the database update message and returning the relational data to the target application.
2. The method of claim 1, wherein the determining a target node in a blockchain network that matches the transaction request comprises:
acquiring a service identifier contained in the transaction request;
searching a network address corresponding to the service identifier in the database management information;
and determining a target node matched with the transaction request according to the network address.
3. The method according to claim 1, wherein the method further comprises:
receiving a data query request comprising a service identifier sent by the target application;
determining a verification node corresponding to the service identifier according to the database management information;
forwarding the data query request to the verification node so that the verification node obtains target relational data corresponding to the data query request from the relational database;
receiving the target relational data returned by the verification node;
And sending the target relational data to the target application.
4. A method according to claim 2 or 3, characterized in that the method further comprises:
sending a first information synchronization request to a core consensus node in the blockchain network;
and receiving the database management information returned by the core consensus node in response to the first information synchronization request.
5. The method of claim 1, wherein the reading the relational data from the relational database based on the database update message and returning the relational data to the target application comprises:
forwarding the database update message to the target application;
when receiving a data acquisition request returned by the target application, forwarding the data acquisition request to the verification node;
receiving the relation data returned by the verification node according to the data acquisition request;
and sending the relation type data to the target application.
6. The method of claim 1, wherein the target node comprises a target traffic node, a proxy node, and a target consensus node; the forwarding the transaction request to the target node, so that the target node executes the transaction request to obtain state data, includes:
And sending the transaction request to the target service node, so that the target service node sends the transaction request to the proxy node, broadcasting the transaction request to the target consensus node through the proxy node, indicating the target consensus node to consensus the transaction request, and determining state data for updating the on-chain state according to an execution result corresponding to the transaction request under the condition of consensus.
7. The method of any one of claims 1, 2, 3, 5, or 6, wherein determining the relational data corresponding to the status data and updating the relational database comprises:
acquiring a transaction statement and a permission identifier contained in the transaction event;
when the permission identification meets the transaction condition according to the permission table, executing the transaction statement to obtain the relational data corresponding to the state data;
and updating the relational data in a relational database.
8. A method of data processing for a blockchain, the method comprising:
receiving a transaction request which is forwarded by a target gateway and is derived from a target application;
executing the transaction request to obtain state data;
Generating a transaction event for the status data based on the smart contract; the transaction event is used for indicating a verification node corresponding to a target node to determine the relational data corresponding to the state data, updating the relational data in a relational database and sending a database update message to the target gateway; the database update message is used for indicating the target gateway to read the relational data from the relational database and returning the relational data to the target application.
9. The method of claim 8, wherein the target node comprises a target traffic node, a proxy node, and a target consensus node;
the receiving the transaction request forwarded by the target gateway and originating from the target application comprises the following steps:
receiving a transaction request from a target application forwarded by a target gateway through the target service node;
the method further comprises the steps of: and transmitting the transaction request to the proxy node through the target service node so that the proxy node broadcasts the transaction request to the target consensus node.
10. The method of claim 8, wherein the target node comprises a target consensus node; said executing said transaction request to obtain status data comprising:
Acquiring a permission identifier contained in the transaction request through the intelligent contract of the target consensus node;
sending an execution message to a business contract through the intelligent contract under the condition that the permission identification meets the transaction condition;
executing the transaction request through the business contract to obtain an execution result;
and determining state data for updating the state on the chain according to the execution result.
11. The method of claim 10, wherein the smart contract-based transaction event that generates the status data comprises:
acquiring a transaction statement contained in the transaction request under the condition that the intelligent contract receives the state data returned by the business contract;
invoking a registry contract through the smart contract;
determining relational database information corresponding to the transaction request according to the sub-database management information of the registry contract;
and when the relational database information characterizes that a relational database matched with the transaction request exists, generating a transaction event of the state data according to the transaction statement and the authority identification.
12. The method of claim 11, wherein the method further comprises:
Sending a second information synchronization request to a core consensus node in the blockchain network;
and receiving the sub-database management information sent by the core consensus node in response to the second information synchronization request.
13. A data processing system for a blockchain, the system comprising:
the target gateway is used for determining a target node matched with the transaction request in the blockchain network when the transaction request sent by the target application is received, and forwarding the transaction request to the target node;
the target node is used for executing the transaction request to obtain state data, and generating transaction events of the state data based on intelligent contracts;
the verification node is used for determining the relational data corresponding to the state data and updating the relational data in a relational database; the verification node is a node corresponding to the target node;
the target gateway is further configured to receive a database update message sent by the verification node after updating the relational database; and reading the relational data from the relational database based on the database update message and returning the relational data to the target application.
14. The system of claim 13, wherein the target node comprises a target traffic node, a proxy node, and a target consensus node;
the target service node is configured to receive the transaction request forwarded by the target gateway, and send the transaction request to the proxy node;
the proxy node is used for broadcasting the transaction request to the target consensus node;
the target consensus node is configured to perform consensus on the transaction request, determine, according to an execution result corresponding to the transaction request, state data for updating an on-chain state, and generate a transaction event of the state data based on an intelligent contract under the condition of consensus.
15. A data processing apparatus of a blockchain, the apparatus comprising:
the target node determining module is used for determining a target node matched with a transaction request in a blockchain network when the transaction request sent by a target application is received;
a transaction request forwarding module, configured to forward the transaction request to the target node, so that the target node executes the transaction request to obtain state data, and generate a transaction event of the state data based on an intelligent contract; the transaction event is used for indicating a verification node corresponding to the target node to determine the relational data corresponding to the state data and updating the relational data in a relational database;
The database update message receiving module is used for receiving a database update message sent by the verification node after updating the relational database;
and the relational data acquisition module is used for reading the relational data from the relational database based on the database update message and returning the relational data to the target application.
16. A data processing apparatus of a blockchain, the apparatus comprising:
the transaction request receiving module is used for receiving the transaction request which is forwarded by the target gateway and is sourced from the target application;
the transaction request execution module is used for executing the transaction request to obtain state data;
a transaction event generation module for generating a transaction event of the status data based on the smart contract; the transaction event is used for indicating a verification node corresponding to a target node to determine the relational data corresponding to the state data, updating the relational data in a relational database and sending a database update message to the target gateway; the database update message is used for indicating the target gateway to read the relational data from the relational database and returning the relational data to the target application.
17. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any one of claims 1 to 12 when the computer program is executed.
18. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 12.
19. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any one of claims 1 to 12.
CN202310939637.6A 2023-07-28 2023-07-28 Block chain data processing method, system, device and computer equipment Active CN116684425B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310939637.6A CN116684425B (en) 2023-07-28 2023-07-28 Block chain data processing method, system, device and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310939637.6A CN116684425B (en) 2023-07-28 2023-07-28 Block chain data processing method, system, device and computer equipment

Publications (2)

Publication Number Publication Date
CN116684425A true CN116684425A (en) 2023-09-01
CN116684425B CN116684425B (en) 2023-10-27

Family

ID=87787641

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310939637.6A Active CN116684425B (en) 2023-07-28 2023-07-28 Block chain data processing method, system, device and computer equipment

Country Status (1)

Country Link
CN (1) CN116684425B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110543788A (en) * 2019-09-11 2019-12-06 腾讯科技(深圳)有限公司 Data storage method, data storage device, computer-readable storage medium and computer equipment
WO2020108289A1 (en) * 2018-11-29 2020-06-04 华为技术有限公司 Database system, node and method
CN112685505A (en) * 2021-01-07 2021-04-20 腾讯科技(深圳)有限公司 Transaction data processing method and device, computer equipment and storage medium
CN113421097A (en) * 2021-08-23 2021-09-21 腾讯科技(深圳)有限公司 Data processing method and device, computer equipment and storage medium
CN114219490A (en) * 2022-01-13 2022-03-22 平安普惠企业管理有限公司 Transaction behavior data updating method, device, equipment and storage medium
CN114782016A (en) * 2022-04-24 2022-07-22 蚂蚁金服(杭州)网络技术有限公司 Creditor data processing method and device based on intelligent contract and block chain system
CN115114372A (en) * 2022-05-31 2022-09-27 腾讯科技(深圳)有限公司 Data processing method, device and equipment based on block chain and readable storage medium
WO2023020233A1 (en) * 2021-08-18 2023-02-23 腾讯科技(深圳)有限公司 Blockchain-based data processing method, apparatus and device, and storage medium
CN116366666A (en) * 2022-12-30 2023-06-30 蚂蚁区块链科技(上海)有限公司 Chain state updating method and block link point in block chain system

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020108289A1 (en) * 2018-11-29 2020-06-04 华为技术有限公司 Database system, node and method
CN110543788A (en) * 2019-09-11 2019-12-06 腾讯科技(深圳)有限公司 Data storage method, data storage device, computer-readable storage medium and computer equipment
CN112685505A (en) * 2021-01-07 2021-04-20 腾讯科技(深圳)有限公司 Transaction data processing method and device, computer equipment and storage medium
WO2023020233A1 (en) * 2021-08-18 2023-02-23 腾讯科技(深圳)有限公司 Blockchain-based data processing method, apparatus and device, and storage medium
CN113421097A (en) * 2021-08-23 2021-09-21 腾讯科技(深圳)有限公司 Data processing method and device, computer equipment and storage medium
CN114219490A (en) * 2022-01-13 2022-03-22 平安普惠企业管理有限公司 Transaction behavior data updating method, device, equipment and storage medium
CN114782016A (en) * 2022-04-24 2022-07-22 蚂蚁金服(杭州)网络技术有限公司 Creditor data processing method and device based on intelligent contract and block chain system
CN115114372A (en) * 2022-05-31 2022-09-27 腾讯科技(深圳)有限公司 Data processing method, device and equipment based on block chain and readable storage medium
CN116366666A (en) * 2022-12-30 2023-06-30 蚂蚁区块链科技(上海)有限公司 Chain state updating method and block link point in block chain system

Also Published As

Publication number Publication date
CN116684425B (en) 2023-10-27

Similar Documents

Publication Publication Date Title
AU2019203850B2 (en) Constructing blockchain world state merkle patricia trie subtree
AU2019203849B2 (en) Updating blockchain world state merkle patricia trie subtree
CN108389130B (en) Method for generating multi-transaction mode alliance chain
CN109522330B (en) Cloud platform data processing method, device, equipment and medium based on block chain
CN109495592B (en) Data collaboration method and electronic equipment
CN112235420B (en) Data synchronization method, system and related equipment based on block chain
CN109040337A (en) A kind of information query method, Edge Server and information query system
CN101442558A (en) Method and system for providing index service for P2SP network
TWI706283B (en) Block chain-based traffic statistics method, device and equipment
CN113505260A (en) Face recognition method and device, computer readable medium and electronic equipment
CN113765675A (en) Transaction data processing method, device, equipment and medium
US20240097879A1 (en) Blockchain-based data management of distributed binary objects
WO2022057525A1 (en) Method and device for data retrieval, electronic device, and storage medium
Gao et al. BFR‐SE: A Blockchain‐Based Fair and Reliable Searchable Encryption Scheme for IoT with Fine‐Grained Access Control in Cloud Environment
CN116684425B (en) Block chain data processing method, system, device and computer equipment
CN117010889A (en) Data processing method, device, equipment, medium and product
Zhao et al. Blockchain-based UDDI data replication and sharing
Qing et al. Blockchain interoperability mechanism
CN117527902A (en) Data processing method, device, equipment and storage medium
WO2024037117A1 (en) Blockchain-based data processing method and device, medium, and program product
CN110933155B (en) Novel block chain network
EP4375850A1 (en) Multi-blockchain data processing method and apparatus, and device, system and medium
CN116506294A (en) Consensus network optimization method, device, computer equipment and storage medium
CN117131079A (en) Data processing method, device, equipment and medium based on block chain
CN118101203A (en) Block chain bottom layer chain data processing method, device, system and computer equipment

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
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40094956

Country of ref document: HK