Data processing method, device, computer readable medium and electronic device
By configuring a registration center and service groups on the blockchain nodes, distributing business requests distributed, and using multiple service providers to jointly handle computing tasks, the problems of large resource consumption of blockchain network and low service processing efficiency are solved, and more efficient transaction processing and flexible network management are achieved.
Patent Information
- Application Number
- CN202111095188.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-17
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2041-09-17
AI Technical Summary
Due to the large resource consumption of blockchain networks, business processing efficiency is low, and due to the equipment performance of a single node, the overall transaction capability cannot be improved.
By configuring a registration center and service groups on the blockchain nodes, distributing business requests are distributed, and multiple service providers are used to jointly handle computing tasks, reducing the computing pressure of a single node.
It effectively reduces the resource consumption of blockchain nodes, improves business processing efficiency, supports processing of larger transaction volumes, and realizes flexible management of blockchain networks.
Smart Images

Figure CN115842866B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of blockchain technology, and specifically relates to a data processing method, a data processing device, a computer-readable medium, and an electronic device. Background Art
[0002] Blockchain is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database. As the underlying technology of Bitcoin, it is a string of data blocks generated by cryptography. Each data block is linked by random hashing (also known as hash algorithm), and the next block contains the hash value of the previous block. Blockchain technology is widely used in digital assets, smart contracts, logistics tracking, product protection and other scenarios.
[0003] The blockchain network that maintains the blockchain consists of multiple blockchain nodes. In order to realize the decentralized distributed storage function, each blockchain node needs to perform all blockchain services such as data verification, data storage, and consensus processing. This results in each blockchain node consuming a large amount of computing resources to process blockchain business operations. As the amount of transaction data continues to increase, the overall business processing efficiency of the blockchain network will continue to decline due to the device performance of a single blockchain node. Summary of the invention
[0004] The purpose of this application is to provide a data processing method, a data processing device, a computer-readable medium and an electronic device, which can at least to some extent overcome the technical problems existing in the related technologies such as large consumption of blockchain network resources and low business processing efficiency.
[0005] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by the practice of the present application.
[0006] According to one aspect of an embodiment of the present application, a data processing method is provided, including: in response to a business request triggered on a blockchain node, obtaining a business type of the business request; searching for one or more service providers matching the business type in a service group that is communicatively connected to the blockchain node; and sending the business request to the service provider, so that the service provider returns response data to the blockchain node after processing the business request.
[0007] According to one aspect of an embodiment of the present application, a data processing device is provided, including: an acquisition module, configured to obtain a business type of the business request in response to a business request triggered on a blockchain node; a search module, configured to search for one or more service providers matching the business type in a service group that is communicatively connected to the blockchain node; and a sending module, configured to send the business request to the service provider, so that the service provider returns response data to the blockchain node after processing the business request.
[0008] In some embodiments of the present application, based on the above technical solution, the sending module includes: a state data acquisition module, configured to acquire state data corresponding to the business request according to the business type, wherein the state data is used to represent the current state of the blockchain; a provider selection module, configured to select at least one target service provider from the one or more service providers, and acquire the identification information of the target service provider; a state data storage module, configured to save the state data and the identification information of the target service provider on the blockchain node; and a business request sending module, configured to send the business request to the target service provider based on the identification information of the target service provider.
[0009] In some embodiments of the present application, based on the above technical solution, the provider selection module includes: a performance information acquisition module, configured to respectively acquire the performance information of each service provider among the one or more service providers, the performance information including performance parameters used to represent the service performance of the service provider; a performance information mapping module, configured to map the performance information to obtain the selection weight of each of the service providers, the selection weight being used to represent the probability of the service provider being selected as the target service provider; a weight selection module, configured to select at least one target service provider according to the selection weight.
[0010] In some embodiments of the present application, based on the above technical solution, the weight selection module includes: a selection rule acquisition module, configured to obtain a selection rule corresponding to the business request, and the selection rule is used to determine the number of selected target service providers; a unilateral selection module, configured to select a target service provider according to the selection weight when the selection rule is a unilateral selection rule; a multi-party selection module, configured to select at least two target service providers according to the selection weight when the selection rule is a multi-party selection rule.
[0011] In some embodiments of the present application, based on the above technical solution, the performance information mapping module includes: an initial weight determination module, configured to map the performance information to obtain the initial selection weight of each of the service providers; a response information prediction module, configured to predict the real-time response information of the service provider based on the historical service data of the service provider, and the real-time response information is used to indicate the ability of the service provider to respond to the business request at the current moment; a weight adjustment module, configured to adjust the initial selection weight according to the real-time response information to obtain the real-time selection weight of each of the service providers.
[0012] In some embodiments of the present application, based on the above technical solution, the real-time response information includes at least one of the number of responses and the response duration; the number of responses is used to indicate the number of business requests to which the service provider responds within a unit time, and the response duration is used to indicate the duration for the service provider to respond to a single business request.
[0013] In some embodiments of the present application, based on the above technical solution, the device also includes: a request receiving module, configured to receive a service registration request sent by a service provider; a request parsing module, configured to parse the service registration request to obtain the configuration information of the service provider and the service function requested to be registered by the service provider; an authority verification module, configured to perform authority verification on the service provider according to the configuration information to determine whether the service provider meets the service requirements of the blockchain node; a function verification module, configured to perform function verification on the service provider according to the service function requested to be registered by the service provider if the verification result of the authority verification is passed to determine whether the service provider has the service capability corresponding to the service function; a connection establishment module, configured to establish a communication connection between the blockchain node and the service provider if the verification result of the function verification is passed to add the service provider to the service group of the blockchain node.
[0014] In some embodiments of the present application, based on the above technical solution, the connection establishment module is configured to: establish a full-duplex communication connection based on the transmission control protocol between the blockchain node and the service provider.
[0015] In some embodiments of the present application, based on the above technical solution, the configuration information includes at least one of the network address, network communication protocol and request data of the service provider; the authority verification module includes: an address verification module, configured to obtain the network address whitelist configured on the blockchain node, and match the network address of the service provider with the network address whitelist to determine whether the service provider is a whitelist member of the blockchain node; a protocol verification module, configured to send protocol verification information carrying a verification token to the service provider based on the network communication protocol, and receive response information returned by the service provider to determine whether the response information carries a valid verification token; a data verification module, configured to perform a legitimacy check on the request data to determine whether the request data conforms to the specified data format.
[0016] In some embodiments of the present application, based on the above technical solution, the device also includes: a demander configuration module, configured to configure one or more service demanders corresponding to different business types on the blockchain node, and the service demanders are used to respond to business requests with corresponding business types; a registration center configuration module, configured to configure a registration center on the blockchain node for processing service registration requests from service providers and communicating with the service providers; a mapping relationship saving module, configured to save the mapping relationship between the service demander and the service provider on the registration center according to the correspondence between the business type and the service function.
[0017] In some embodiments of the present application, based on the above technical solution, the search module includes: a demander search module, configured to search for a service demander corresponding to the business type on the blockchain node; a provider search module, configured to search for one or more service providers having a mapping relationship with the service demander through the registration center.
[0018] In some embodiments of the present application, based on the above technical solution, the device also includes: a status monitoring module, configured to monitor the connection status of the communication connection between the registration center and each service provider; a connection disconnection module, configured to send a disconnection notification to the service demander through the registration center when the connection status is disconnected, so that the service demander destroys the cached data related to the service provider.
[0019] According to one aspect of an embodiment of the present application, a computer-readable medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the data processing method in the above technical solution is implemented.
[0020] According to one aspect of an embodiment of the present application, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the data processing method in the above technical solution by executing the executable instructions.
[0021] According to one aspect of the embodiments of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the data processing method in the above technical solution.
[0022] In the technical solution provided in the embodiment of the present application, the business requests of a single blockchain node are distributed, and the multiple blockchain modules that consume energy of the blockchain are decomposed by using a new blockchain module function design, and the required computing amount is distributed to multiple other services to complete together, which effectively solves the problem of limited blockchain node capacity due to limited server resources and improves the business processing efficiency of blockchain nodes. At the same time, through the design of functional distribution, the embodiment of the present application can easily and quickly scale the processing capacity of blockchain nodes, making blockchain network management more flexible, and effectively solving the problem that the transaction capacity of the blockchain network cannot be improved due to insufficient server resources.
[0023] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present application, and together with the specification are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0025] Figure 1 The schematic diagram shows the composition of the blockchain system using the technical solution of the present application.
[0026] Figure 2 The component structure of the blockchain maintained on the blockchain network is schematically shown.
[0027] Figure 3 The structural block diagram schematically shows the distributed deployment of business functions of a single blockchain node in one embodiment of the present application.
[0028] Figure 4 The following is a flowchart schematically showing the steps of a data processing method in one embodiment of the present application.
[0029] Figure 5 A block diagram schematically shows the business type division of service functions provided by blockchain nodes in one embodiment of the present application.
[0030] Figure 6 The flowchart schematically shows the steps for distributed deployment of business functions in one embodiment of the present application.
[0031] Figure 7 The flowchart schematically shows the steps of forwarding a business request to a service provider in one embodiment of the present application.
[0032] Figure 8 The flowchart schematically shows the steps of selecting a target service provider in one embodiment of the present application.
[0033] Fig. 9 The interactive flow chart of service registration in an application scenario according to an embodiment of the present application is schematically shown.
[0034] Fig.10 The interactive flow chart of distributing service requests in an application scenario according to an embodiment of the present application is schematically shown.
[0035] Fig.11 The interactive flow chart of canceling the service of the service provider in one embodiment of the present application is schematically shown.
[0036] Fig.12 The structural block diagram of the data processing device provided in the embodiment of the present application is schematically shown.
[0037] Fig.13 The structure block diagram of a computer system suitable for implementing an electronic device according to an embodiment of the present application is schematically shown. DETAILED DESCRIPTION
[0038] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this application will be more comprehensive and complete and fully convey the concept of the example embodiments to those skilled in the art.
[0039] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present application. However, those skilled in the art will appreciate that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, known methods, devices, realizations or operations are not shown or described in detail to avoid blurring the various aspects of the application.
[0040] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0041] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0042] Blockchain is a shared digital ledger with a chained-block data structure that is anti-counterfeiting, anti-tampering and traceable, built through transparent and trusted rules in a peer-to-peer network environment. The block-chain data structure is a data structure that stores transactions that occur over a period of time in blocks and connects the blocks into a chain in chronological order using a cryptographic algorithm. The ledger is distributed to all member nodes in the network, and the history of asset transactions that occur between peer nodes in the network is permanently recorded in a sequential chain of blocks linked by a hash cryptographic algorithm. All confirmed and proven transactions are linked from the beginning of the chain to the latest block, hence the name blockchain. The blockchain can act as a single source of truth, and members in the blockchain network can only view transactions that are relevant to them.
[0043] Figure 1The schematic diagram of the composition of the blockchain system using the technical solution of the present application is schematically shown. The blockchain system 100 may include at least one client 110 and a blockchain network 120, and the blockchain network 120 includes at least one blockchain node 121. The client 110 may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart wearable device, a smart vehicle-mounted device, a smart payment terminal, a facial recognition terminal, and other electronic devices. By installing the corresponding client application, blockchain data services can be provided to users. For example, in a vehicle-mounted application scenario, the client application can be installed on a vehicle-mounted terminal or a vehicle-connected terminal to realize intelligent transportation applications or intelligent vehicle-road collaboration through blockchain data services. The blockchain node 121 may be a terminal device or a server. For example, the blockchain node 121 may be an independent physical server, a server cluster consisting of multiple physical servers, or a cloud server that provides cloud computing services.
[0044] In the blockchain network 120, each blockchain node 121 can receive input information when performing normal work, and maintain shared data in the blockchain network based on the received input information. In order to ensure information intercommunication, there can be information connections between the blockchain nodes 121, and the blockchain nodes 121 can transmit information to each other through the information connection. For example, when any blockchain node 121 in the blockchain network 120 receives input information and broadcasts the input information in the blockchain network 120, other node devices in the blockchain network 120 can obtain the input information according to the consensus algorithm and store the input information as shared data.
[0045] Each blockchain node 121 in the blockchain network 120 has a node identifier corresponding thereto, and each blockchain node 121 in the blockchain network 120 can store the node identifiers of other blockchain nodes in the same blockchain network, so that the generated blocks can be broadcast to other nodes in the blockchain network 120 according to the node identifiers of other blockchain nodes. A node identifier list as shown in Table 1 can be maintained in the blockchain node 121, and the node name and the node identifier are stored in the node identifier list accordingly. Among them, the node identifier can be an IP (Internet Protocol, a protocol for interconnecting networks) address and any other information that can be used to identify the node. Table 1 is a node identifier list taking an IP address as an example.
[0046] Table 1
[0047]
[0048]
[0049] Figure 2 The structure of the blockchain maintained on the blockchain network is schematically shown. Figure 2 As shown, the blockchain consists of a plurality of sequentially connected blocks. Whenever new data needs to be written into the blockchain, these data will be aggregated into a newly generated block, and the newly generated block will be linked to the end of the blockchain. The consensus algorithm can ensure that the newly added blocks on each node device 121 are exactly the same. The data of the current block is recorded in the block body of each block, and the hash value (Hash) of the previous block connected to it is saved in its block header. If the transaction data in the previous block changes, the hash value of the current block will also change accordingly. Therefore, the data uploaded to the blockchain network is difficult to be tampered with, which can improve the reliability of shared data.
[0050] In the related technologies of this application, a blockchain node generally implements all its business operations through a server, which places high demands on server resources. Especially when the amount of transaction data gradually increases, the server resources of a single blockchain node also become a bottleneck that limits the overall performance of the blockchain network to a certain extent. Moreover, since the blockchain node is affected by the server, the server's CPU, memory and other resources have their upper configuration limits, which results in the business functions of the blockchain node being restricted and the expansion range being limited.
[0051] In view of the problem of limited business functions of blockchain nodes in related technologies, the embodiments of the present application provide a solution for distributed deployment of business functions of a single blockchain node. Distributed deployment is to divide a problem that requires huge computing power to solve into many small parts, and then distribute these parts to multiple computers for processing, and finally combine these calculation results to obtain the final result.
[0052] Figure 3 The following schematically shows a block diagram of a distributed deployment of the business functions of a single blockchain node in one embodiment of the present application. Figure 3 As shown, on a blockchain node, a registration center 310 and multiple main function modules 320 can be configured. At the same time, the registration center 310 can establish a communication connection with multiple functional sub-modules 330.
[0053] The registration center 310 can provide a service registration function for each functional sub-module 330, and can also provide a sub-module search function for each main functional module 320 on the blockchain node.
[0054] The main function module 320 is used to implement a business function on the blockchain node. For example, according to different business types, it can include a transaction pool module for implementing a transaction pool maintenance business, a transaction verification module for verifying the legitimacy of a transaction, a consensus algorithm module for performing consensus verification, a block synchronization module for synchronizing blocks stored on each node, a block transaction storage module for persistent storage of blocks and transactions, and the like.
[0055] The functional submodule 330 can replace the main functional module 320 to perform specific business operations to achieve corresponding business functions by registering services with the registration center 310. For example, a transaction pool module can correspond to multiple transaction pool processing submodules. When it is necessary to move transactions generated on the blockchain network into or out of the transaction pool, the transaction pool module can first forward the demand to the corresponding one or more transaction pool processing submodules, and the transaction pool processing submodule performs specific data processing and returns response data to the transaction pool module after the execution is completed.
[0056] In the embodiment of the present application, by registering the service functions with large resource consumption on the blockchain node and distributing them to other servers in a balanced manner, the business functions of the blockchain node can be expanded horizontally to support the processing of larger transaction volumes, solving the problem that the transaction processing capacity of the blockchain cannot be improved due to server resource limitations. At the same time, it can also dynamically support capacity expansion and reduction, and can use resources with maximum efficiency.
[0057] The following describes in detail the technical solutions such as the data processing method, data processing device, computer-readable medium, and electronic device provided in the embodiments of the present application in combination with specific implementation methods.
[0058] Figure 4 The data processing method in one embodiment of the present application is schematically shown in the flowchart of steps. The data processing method can be Figure 1 The blockchain node shown is executed. Figure 4 As shown, the data processing method may mainly include the following steps S410 to S430.
[0059] In step S410, in response to a business request triggered on a blockchain node, a business type of the business request is obtained.
[0060] The service request triggered on the blockchain node may include a request sent by the user to the blockchain node through the terminal device, or may include a request forwarded and transmitted between various blockchain nodes. For example, when a user initiates a transaction through the client installed on the terminal device, the terminal device will send the service request corresponding to the transaction to a blockchain node communicating with it, and trigger the processing operation of the service request on the blockchain node. For another example, when a service request for synchronizing block data is initiated on a blockchain node, the service request can be transmitted to another blockchain node communicating with it, and the processing operation of block synchronization is triggered on the blockchain node that receives the service request.
[0061] Figure 5 The following schematically shows a block diagram of the business type division of service functions provided by blockchain nodes in one embodiment of the present application. Figure 5 As shown, the business types of business requests in the embodiments of the present application may include, for example, RPC interfaces, transaction pools, transaction scheduling, transaction verification, consensus algorithms, block transaction storage, block synchronization, smart contract processing, P2P networks, and the like.
[0062] In step S420, one or more service providers matching the business type are searched in the service group that is in communication connection with the blockchain node.
[0063] In an embodiment of the present application, a blockchain node can establish a communication connection with at least one service group. Based on the communication connection, the blockchain node can perform two-way data communication with the service group, thereby dispersing the service functions of the blockchain node into the service group.
[0064] A service group is a group composed of multiple service providers, each of which can provide corresponding service functions to blockchain nodes through registration.
[0065] In one embodiment of the present application, the service group can be divided into multiple subgroups corresponding to different business types according to the service functions. For example, all transaction pool processing submodules providing transaction pool services form one subgroup, and all transaction verification processing submodules providing transaction verification services form another subgroup.
[0066] In one embodiment of the present application, the service provider may be a separate physical server, such as a Web server, an FTP server, an enterprise key application server, or other mission-critical servers.
[0067] In one embodiment of the present application, the service provider may be a functional module on a physical server, such as Figure 3The functional submodule 330 shown can constitute a service provider, and multiple functional submodules 330 can also be distributed on the same physical server.
[0068] In one embodiment of the present application, the service provider may also be a server cluster consisting of multiple physical servers, or may be a cloud server that provides cloud computing services.
[0069] In step S430, the business request is sent to the service provider, so that the service provider processes the business request and returns response data to the blockchain node.
[0070] Based on the communication connection between the blockchain node and the service provider, the blockchain node can send a business request to the service provider, and the service provider will perform processing operations on the business request and return the corresponding response data to the blockchain node after the processing is completed.
[0071] In the data processing method provided in the embodiment of the present application, the business request of a single blockchain node is distributed, and the multiple blockchain modules that consume energy of the blockchain are decomposed by using a new blockchain module function design, and the required computing amount is distributed to other multiple services to complete together, which effectively solves the problem of limited blockchain node capacity due to limited server resources and improves the business processing efficiency of blockchain nodes. At the same time, the embodiment of the present application can easily and quickly scale the processing capacity of blockchain nodes through the design of functional distribution, and the blockchain network management is more flexible, which effectively solves the problem that the transaction capacity of the blockchain network cannot be improved due to insufficient server resources.
[0072] In one embodiment of the present application, remote procedure call (RPC) technology can be used to implement distributed deployment of business functions on blockchain nodes. Figure 6 The following schematically shows a flow chart of steps for distributed deployment of business functions in one embodiment of the present application. Figure 6 As shown, the method for distributed deployment of business functions for implementing blockchain network services on blockchain nodes includes the following steps S610 to S630.
[0073] Step S610: One or more service demanders corresponding to different business types are configured on the blockchain node, and the service demanders are used to respond to business requests with corresponding business types.
[0074] The service demander can be, for example, Figure 3The main functional module shown can be used by a service demander to respond to a business request of a business type, obtain corresponding response data after processing the business request to perform a business operation, and further return the corresponding response data to the sender of the business request by the service demander.
[0075] Step S620: A registration center is configured on the blockchain node to process the service registration request of the service provider and to establish a communication connection with the service provider.
[0076] In one embodiment of the present application, the registration center and the service provider can communicate based on the client-server model. Taking the WebSocket communication protocol as an example, the registration center can be a WebSocket server configured on the blockchain node, and the service provider can configure the WebSocket client to perform fast and efficient two-way data communication with the registration center. The registration center configured based on the WebSocket communication protocol can confirm the availability of the service provider in a timely manner, and can realize real-time forwarding and reception of data, ensuring the efficient availability of the blockchain node.
[0077] Step S630: According to the correspondence between the business type and the service function, the mapping relationship between the service demander and the service provider is saved in the registration center.
[0078] Based on the business type of the business request that the service demander is responsible for responding to and the service function that the service provider applies for registration, the mapping relationship between the service demander and the service provider can be saved in the registration center. Based on this mapping relationship, the service provider that can provide business processing services to the service demander can be quickly found.
[0079] In one embodiment of the present application, the registration center can be understood as a storage system that stores a mapping table between service demanders and service providers. In addition, the service demander can also save a certain amount of mapping data based on local cache to ensure the normal operation of distributed business processing of blockchain nodes when a temporary failure occurs in the registration center.
[0080] After the service provider registers the service with the registration center, the registration center can periodically initiate health checks to the service provider. When the service provider goes down, the registration center can discover it more quickly and remove the downed service provider from the service registration table and the corresponding mapping table.
[0081] When adding or reducing service providers, the registration center can not only update in time, but also proactively notify the service demanders so that they can quickly update the local cache and reduce the number of erroneous requests.
[0082] In one embodiment of the present application, corresponding service demanders can be configured for all business types on the blockchain node. Figure 5 For each of the business types shown, a service demander may be configured accordingly. The service demander may respond to the corresponding business request based on network communication with the service provider.
[0083] In one embodiment of the present application, the business type can be classified according to the resource consumption level, for example, it can be classified into high-consumption business type and low-consumption business type, the high-consumption business type is a business type with a resource consumption greater than a set threshold, and the low-consumption business type is a business type with a resource consumption less than or equal to the set threshold. Resource consumption may include at least one of memory usage and CPU occupancy. In an embodiment of the present application, the corresponding service demander can be configured only for high-consumption business types, so as to disperse its computing power to the service provider communicating with it, thereby reducing the resource consumption of the blockchain node itself. For low-consumption business types, the corresponding business operations can be performed by the blockchain node itself, so as to shorten the length of the communication link, reduce the consumption of network bandwidth, and improve business processing efficiency without much impact on resource consumption.
[0084] In one embodiment of the present application, high-consumption business types may include, for example, at least one of a transaction pool, transaction verification, a consensus algorithm, block synchronization, a smart contract, and block transaction storage. Various high-consumption business types are further described below.
[0085] Transaction pool: The transaction pool generally needs to perform corresponding transaction verification and transaction cache on the data requested by the remote procedure call (RPC) and the data transmitted by the P2P network. In order to pursue fast processing, the blockchain basically puts the unstored transactions in the transaction pool of the memory. Therefore, when the transaction volume is relatively large, the data cached by the transaction pool is relatively large. In general, the transaction pool will cache transactions several times the number of transactions per second (TPS) per unit time, so as to ensure the continuous generation of blocks and generate efficient TPS. If the server memory of the blockchain node itself is used to cache the unstored transactions, the memory consumption will be huge.
[0086] Transaction verification: Blockchain nodes need to perform corresponding transaction legitimacy verification for any transaction. For example, verify whether the signature of the transaction is the sender's signature, verify whether the hash value of the transaction has been stored, verify the correctness of the transaction parameters, and verify the compliance of the transaction data. Among them, the verification of the sender's signature requires the use of mathematical cryptography algorithms for signature verification, which consumes a lot of memory and CPU. If the compliance of the data needs to be verified, threads are usually used for asynchronous verification in order to quickly verify compliance, but this operation will also cause a lot of CPU and memory consumption.
[0087] Consensus algorithm: In order to ensure the authenticity and reliability of data, blockchains need to perform consensus verification. Consensus verification is the time it takes for multiple nodes to reach a consensus. In addition, before receiving a block, the node will verify the block and the transactions in the block. If there are many transactions in the block, if the verification is not fast enough, the consensus time will be even greater, which will inevitably lead to a decrease in TPS.
[0088] Block synchronization: Block synchronization is to synchronize node data that this node does not have from other nodes to ensure data consistency. During the synchronization process, each synchronized block also needs to undergo corresponding block verification and transaction verification in the block. If the order in which the blocks come is not in an ordered state, the node also needs to cache the blocks that came first. In this way, the block synchronization module also needs to use memory to cache data.
[0089] Smart contract: A smart contract is to execute a specified code, perform calculations through the specified code, and store the results of the calculation in the database. During the operation of the smart contract, it is necessary to obtain the data required by the contract from the database, which requires continuous access to the database, and the read and write capabilities of the database will affect the execution of the contract to a certain extent.
[0090] Block transaction storage: The final persistence of blocks and transactions will be stored in the database. The storage of the database will affect the overall transaction completion time. At present, most blockchain data storage uses the kv database, because the kv database is a local storage and can quickly complete the reading and writing capabilities. However, when the kv file data volume is large, its reading and writing capabilities will also decrease. In addition, the kv database consumes a lot of disk IO.
[0091] For the above high-consumption business types, by configuring service providers and adopting distributed computing, the resource consumption of blockchain nodes themselves can be reduced and the service performance of blockchain nodes can be improved.
[0092] In one embodiment of the present application, when searching for one or more service providers that match a business type, you can first search for a service demander corresponding to the business type on the blockchain node, and then search for one or more service providers that have a mapping relationship with the service demander through the registration center.
[0093] In one embodiment of the present application, one or more service providers having a mapping relationship with the service demander can also be found through the data related to the service provider cached by the service demander. For example, the communication address of the service provider can be found according to the historical communication records between the service demander and the service provider, and then the communication with the service provider can be directly carried out through the service demander.
[0094] Figure 7 The flowchart schematically shows the steps of forwarding a service request to a service provider in one embodiment of the present application. Figure 7 As shown, based on the above embodiment, sending the business request to the service provider in step S430 may include the following steps S710 to S740.
[0095] Step S710: According to the business type, obtain the status data corresponding to the business request, and the status data is used to represent the current state of the blockchain.
[0096] The status data of the blockchain may include, for example, the hash value of the transaction to be processed, the random number Nonce, the hash value of the block to be chained, the current block height block, etc. For different business types, one or more corresponding status data may be obtained to record the processing status of the business request.
[0097] Step S720: selecting at least one target service provider from one or more service providers, and acquiring identification information of the target service provider.
[0098] For a type of business, a selected service provider can perform the business operation alone, or multiple service providers can be selected to perform the business operation simultaneously. The embodiment of the present application selects at least one target service provider and obtains the identification information of each target service provider. The identification information is a unique identifier used to distinguish each service provider, for example, it can be represented by the communication address and interface provided by the service.
[0099] Step S730: Save the status data and the identification information of the target service provider on the blockchain node.
[0100] The status data is associated with the identification information of the target service provider, and the associated data is stored together on the blockchain node, thereby recording the processing status of the corresponding business request. When the response data returned by the target service provider is received, the corresponding status data can be quickly found and the processing status of the business request can be updated.
[0101] In one embodiment of the present application, the status data and the identification information of the target service provider can be associated and stored in the registration center, and can also be cached by the service demander so that when the registration center fails, the service request processing status within a certain time limit can be independently queried.
[0102] Step S740: Based on the identification information of the target service provider, the service request is sent to the target service provider.
[0103] The communication address and interface of the target service provider can be determined based on the identification information of the target service provider. Based on the network communication between the blockchain node and the target service provider, the business request can be sent to the target service provider, and the target service provider will perform the corresponding business operation.
[0104] Figure 8 The following is a schematic diagram showing the steps of selecting a target service provider in one embodiment of the present application. Figure 8 As shown, based on the above embodiment, selecting at least one target service provider from one or more service providers in step S720 may include the following steps S810 to S830.
[0105] Step S810: acquiring performance information of each service provider among one or more service providers respectively, where the performance information includes performance parameters for indicating service performance of the service provider.
[0106] In one embodiment of the present application, the performance information may include static performance parameters representing the service performance of the service provider, such as parameter information such as CPU model, memory capacity, disk capacity, etc. In addition, the performance information may also include dynamic performance parameters representing the service performance of the service provider, such as CPU occupancy, memory occupancy, disk occupancy, etc.
[0107] In one embodiment of the present application, when applying for registration service, the service provider can send its own static performance parameters to the blockchain node. The blockchain node can obtain the dynamic performance parameters of each service provider through real-time monitoring by the registration center.
[0108] Step S820: Mapping the performance information to obtain a selection weight of each service provider, where the selection weight is used to represent the probability of a service provider being selected as a target service provider.
[0109] In one embodiment of the present application, the performance information may first be mapped to obtain an initial selection weight for each service provider; then, the real-time response information of the service provider may be predicted based on the historical service data of the service provider, and the real-time response information is used to indicate the ability of the service provider to respond to the business request at the current moment; finally, the initial selection weight may be adjusted based on the real-time response information to obtain a real-time selection weight for each service provider.
[0110] In one embodiment of the present application, the real-time response information includes at least one of the number of responses and the response time; the number of responses is used to indicate the number of business requests to which the service provider responds within a unit time, and the response time is used to indicate the time it takes for the service provider to respond to a single business request.
[0111] Dynamically adjusting the initial selection weights based on real-time response information can improve the selection accuracy of the service provider.
[0112] Step S830: selecting at least one target service provider according to the selection weight.
[0113] In one embodiment of the present application, for different types of business requests, corresponding service provider selection rules can be configured, and the selection rules are used to determine the number of target service providers to be selected, such as selecting one or more target service providers. After obtaining the selection weight, the selection rule corresponding to the business request can be obtained first; when the selection rule is a unilateral selection rule, a target service provider is selected according to the selection weight; when the selection rule is a multi-party selection rule, at least two target service providers are selected according to the selection weight.
[0114] Based on the unilateral selection rule, one service provider only processes the business request of one blockchain node, and one business request only executes business operations through one service provider. The method of providing business request processing services for a single blockchain node based on a single service provider can save resource consumption.
[0115] Based on the multi-party selection rule, multiple service providers process a business request at the same time. For some business requests, such as transaction verification, consensus algorithm and other service functions, when any service provider completes the business operation, the processing result of its business operation can be used directly. Other service providers that have not completed the processing can cancel their processing flow or refuse to accept their processing results. For service functions such as transaction pools, data storage, and block synchronization, certain algorithm preset values must be reached to meet the completion standards. At this time, the status data on the blockchain node only stores the correct processing results returned by each service provider. The multi-party selection rule can improve the fault tolerance rate and ensure that data will not be lost when a service provider within the fault tolerance range fails.
[0116] The following describes the registration center configured on the blockchain node in the embodiment of the present application on the service demand side (such as Figure 3 The main functional module in the Figure 3 The business process of service registration, business distribution and service deregistration between functional sub-modules in the system.
[0117] Fig. 9 The following schematically shows an interactive flow chart of service registration in an application scenario in an embodiment of the present application. Fig. 9 As shown, the method for registering a service on a blockchain node may mainly include the following steps S901 to S908.
[0118] Step S901: Start the service demander on the blockchain node to apply to the registration center for registration of the main function service.
[0119] The service demander is the main function module used to implement various business functions on the blockchain. Multiple service demanders can be started simultaneously on a blockchain node, where each service demander can be used to respond to a business request of a business type, and obtain corresponding response data after processing the business request to perform the business operation, and the service demander can further return the corresponding response data to the sender of the business request. In order to realize the above service functions, the service demander can apply to the registration center to register the corresponding main function service, such as the transaction pool service for implementing the transaction pool maintenance business, the transaction verification service for transaction legitimacy verification, the consensus algorithm service for consensus verification, the block synchronization service for synchronizing the blocks stored on each node, and the block transaction storage service for persistent storage of blocks and transactions, etc. Step S902: After starting the service provider, configure the registration center address, the service function (such as the main function name) corresponding to the service provider, and the performance information in turn, and send a service registration request to the registration center based on the configuration information.
[0120] The service provider is a functional submodule used to replace the main function module to perform specific business operations to realize the corresponding business functions. After starting the service provider, the registration center address can be configured for the service provider first. The registration center address can be, for example, the network communication address of the blockchain node where the main function module is located. By configuring the registration center address, data communication can be realized between the service provider and the service demander. Then configure the corresponding service function and performance information for the service provider. The service function refers to the business function that the service provider can specifically implement. The business function corresponds to each main function module one by one, such as transaction pool, transaction verification, consensus algorithm, block synchronization, smart contract, and block transaction storage, etc. At the same time, the corresponding performance information can be configured for the service provider. The performance information may include static performance parameters representing the service performance of the service provider, such as CPU model, memory capacity, disk capacity and other parameter information. In addition, the performance information may also include dynamic performance parameters representing the service performance of the service provider, such as CPU occupancy, memory occupancy, disk occupancy, etc. The configuration information may include the network address of the service provider. After issuing a service registration request, the registration center may return response data to the service provider based on the network address corresponding to the configuration information.
[0121] Step S903: The registration center receives the service registration request sent by the service provider.
[0122] The service provider can send a service registration request to the registration center on one or more blockchain nodes point-to-point according to the registration center address, or can also send a service registration request on the blockchain network by broadcasting messages. When the point-to-point request method is adopted, the registration center on each blockchain node can receive the service registration request sent by the service provider. When the broadcast request method is adopted, the registration center on each blockchain node can listen to the broadcast message transmitted on the blockchain network, thereby receiving the service registration request broadcasted by the service provider.
[0123] Step S904: Parse the service registration request to obtain the configuration information of the service provider and the service function that the service provider requests to register.
[0124] The registration center parses the service registration request sent by the service provider and obtains the configuration information of the service provider and the service function requested by the service provider. The configuration information can be used to verify the network communication function and corresponding service authority of the service provider, and the service function can be used to verify the function of the service provider.
[0125] Step S905: Verify the authority of the service provider according to the configuration information to determine whether the service provider meets the service requirements of the blockchain node.
[0126] If the service registration of the service provider is completed, the blockchain node will distribute all business operations that need to be performed during the subsequent node operation to the service provider for execution. Therefore, the service provider connected to the blockchain node needs to be verified for authority to ensure the security of data processing.
[0127] In one embodiment of the present application, the content of the authority verification of the service provider may include, for example, at least one of a network address verification, a communication protocol verification, and a data legitimacy verification.
[0128] The method for verifying the network address may include: obtaining a network address whitelist configured on the blockchain node, and matching the network address of the service provider with the network address whitelist to determine whether the service provider is a whitelist member of the blockchain node. By configuring the network address whitelist, the network address range for providing business services to the blockchain node can be controlled. If the network address of the service provider successfully matches the network address whitelist, it means that the service provider is a whitelist member of the blockchain node, and the network address verification is successful; if the network address of the service provider fails to match the network address whitelist, it means that the service provider is not a whitelist member of the blockchain node, and the network address verification fails.
[0129] The method for communication protocol verification may include: sending protocol verification information carrying a verification token to a service provider based on a network communication protocol, and receiving response information returned by the service provider to determine whether the response information carries a valid verification token; based on the network address of the service provider, a registration center may send protocol verification information carrying a verification token to the service provider, and the service provider may return response information to the registration center based on the protocol verification information; if the response information carries a valid verification token, it may be determined that the service provider has passed the communication protocol verification; and if the response information does not carry a valid verification token, it may be determined that the service provider has not passed the communication protocol verification.
[0130] The method for verifying the validity of data may include: verifying the validity of the request data to determine whether the request data complies with a prescribed data format.
[0131] Step S906: If the result of the authority verification is that the verification is passed, a function verification is performed on the service provider according to the service function requested to be registered by the service provider to determine whether the service provider has the service capability corresponding to the service function.
[0132] After the service provider passes the authority verification of the registration center, the service demander can perform further functional verification on the service provider. In one embodiment of the present application, various test cases corresponding to the business functions of the blockchain node can be pre-written. When the service provider needs to be functionally verified, the service demander can call the corresponding test case according to the service function registered by the service provider. If the test case is executed successfully, it means that the verification result of the functional verification of the service provider is passed; if the test case fails to execute, it means that the verification result of the functional verification of the service provider is failed.
[0133] Step S907: If the result of the function verification is that the verification is passed, the service demander caches the configuration information of the service provider.
[0134] After the service provider passes the functional verification initiated by the service demander, the service demander can save the configuration information of the service provider in the cache. When the service demander processes a specific business request, it can select a service provider that can provide the corresponding service function based on the cached configuration information, thereby distributing the business request to the service provider for execution.
[0135] Step S908: Establish a communication connection between the blockchain node and the service provider to add the service provider to the service group of the blockchain node.
[0136] In one embodiment of the present application, the communication connection established between the blockchain node and the service provider can be a full-duplex communication connection WebSocket based on the transmission control protocol. WebSocket allows each service provider to have a long connection with the blockchain node, and also allows the blockchain node to clearly know which service providers are healthy and available. In addition, based on the long connection feature of WebSocket, business requests can be distributed to different service providers in a timely and fast manner.
[0137] Fig.10 The interactive flow chart of the embodiment of the present application for distributing service requests in an application scenario is schematically shown. Fig.10 As shown, the solution based on the service demander and the registration center distributing the business request to the service provider to execute the business operation includes the following steps S1001 to S1005.
[0138] Step S1001: The service demander receives a business request through a function processing entry.
[0139] The blockchain node opens a function processing entrance to the outside world. When the blockchain node itself triggers a business request or receives a business request transmitted on the blockchain network, the business request can be passed to the corresponding service demander through the function processing entrance. For example, when a business request for verifying the transaction content is generated, the business request can be passed to the transaction verification function module through the function processing entrance; when a business request for consensus verification of blocks and transactions in blocks is generated, the business request can be passed to the consensus algorithm function module through the function processing entrance.
[0140] Step S1002: According to the service type of the service request, corresponding status data is acquired and cached.
[0141] The status data of the blockchain may include, for example, the hash value of the transaction to be processed, the random number Nonce, the hash value of the block to be chained, the current block height block, etc. For different business types, one or more corresponding status data can be obtained to record the processing status of the business request. By caching the status data on the service demander, the corresponding status data can be quickly found when the response data returned by the service provider is received, and the processing status of the business request can be updated.
[0142] For example, when the business type is a transaction pool, the cached status data includes the hash value and random value Nonce of the transaction; when the business type is block synchronization, the cached status data includes the hash value and block height of the block.
[0143] Step S1003: the service demander distributes the service request to the service provider according to the selection rule corresponding to the service request.
[0144] For different types of business requests, corresponding service provider selection rules can be configured. The selection rules are used to determine the number of target service providers to be selected, such as selecting one or more target service providers. The corresponding selection weight can be determined based on the performance information of each service provider. The selection weight is used to indicate the probability of a service provider being selected as a target service provider. One or more target service providers can be selected according to the selection rules corresponding to the business request and the selection weights of each service provider, and the business request can be distributed to the target service provider; when the selection rule is a unilateral selection rule, one target service provider is selected according to the selection weight; when the selection rule is a multi-party selection rule, at least two target service providers are selected according to the selection weight.
[0145] Step S1004: the service provider performs corresponding business operations based on the received business request and obtains corresponding business processing results.
[0146] The service demander and the service provider who receives the business request form a client-server model. The service provider can perform the business operation corresponding to the request based on the received business request, thereby obtaining the corresponding business processing result. For example, when the business request is a consensus check, the service provider can call the consensus check algorithm to perform consensus authentication on the content that needs to be checked.
[0147] Step S1005: The service provider returns response data to the service demander so that the service demander can perform the next business process.
[0148] The service provider can return response data to the service demander based on the business processing results obtained by executing the business operation. The service demander can continue to execute subsequent business processing processes based on the response data. For example, when the service provider returns the consensus authentication result, the blockchain node where the service demander is located can broadcast the consensus authentication result on the blockchain network so that other blockchain nodes can reach a consensus on the verification result.
[0149] Based on the interaction between service demanders and service providers, the operation process of specific business functions can be distributed to service providers for execution, which greatly reduces the computing pressure of blockchain nodes and improves business processing efficiency.
[0150] In one embodiment of the present application, the service provider may first return corresponding response data to the registration center, and then the registration center distributes the business processing results to the service demander on the blockchain node based on the response data for the next step of business processing.
[0151] When the blockchain business volume is small and the service provider is idle, the embodiment of the present application can cancel the service of some service providers to save network resources.
[0152] Fig.11 The following schematically shows an interactive flow chart of a service provider deregistration service in one embodiment of the present application. Fig.11 As shown, the method for canceling the service based on the registration center on the blockchain node includes the following steps S1101 to S1103.
[0153] Step S1101: monitor the connection status of the communication connection between the registration center and each service provider.
[0154] The registration center can monitor and maintain the connection status of the communication connection with each service provider in real time. For example, it can send policy messages to the service provider at regular intervals, and the service provider returns the policy message via the original path. If the registration center does not receive the return message within the set time, after the retry mechanism, the connection status of the communication connection can be determined as disconnected.
[0155] Step S1102: When the connection state is disconnected, a disconnection notification is sent to the service demander through the registration center.
[0156] When it is determined that the service provider providing business services to the blockchain node is in a disconnected state, the registration center can send a disconnection notification to the service demander. The disconnection notification carries the identification information of the service provider, so that the service demander can be informed of the disconnected service provider and can then adjust the distribution strategy of the business request.
[0157] Step S1103: the service demander destroys the cache data related to the service provider according to the disconnection notification to disconnect the long connection with the service provider.
[0158] The service demander determines the disconnected service provider based on the received disconnection notification, and disconnects the long connection with the service provider by destroying the cached data related to the service provider cached by itself. It is ensured that the service providers cached by the service demander are all normally connected service providers, so that when receiving a business request, the distribution and processing can be carried out quickly and effectively to avoid the problem of business request processing failure due to the inability to send the business request. In one embodiment of the present application, the registration center can save the cached data related to the service provider for a certain period of time before destroying it, so that the blockchain node can quickly resume communication with the service provider within a certain time range.
[0159] The data processing method provided in the embodiment of the present application relates to a solution for distributed processing of single-node functions of a blockchain. By utilizing the method of distributing function processing by blockchain nodes, the effect of function load balancing can be achieved. By configuring a registration center on the blockchain node, the design of real-time function distribution processing between the service provider and the blockchain node can be realized. By maintaining a real-time long connection between the service provider and the blockchain node, the effect of real-time and rapid availability of functions can be ensured. In addition, the embodiment of the present application can realize the design of only saving blockchain status data on the blockchain node and saving business data by the service provider, which can ensure that the blockchain node is always executed efficiently and stably. The service provider can achieve the effect of balanced function distribution through dynamic scaling.
[0160] It should be noted that although the steps of the method in the present application are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.
[0161] The following introduces an apparatus embodiment of the present application, which can be used to execute the data processing method in the above-mentioned embodiment of the present application. Fig.12 The structure block diagram of the data processing device provided in the embodiment of the present application is schematically shown. Fig.12 As shown, the data processing device 1200 includes: an acquisition module 1210, configured to obtain the business type of the business request in response to a business request triggered on a blockchain node; a search module 1220, configured to search for one or more service providers matching the business type in a service group that is communicatively connected to the blockchain node; and a sending module 1230, configured to send the business request to the service provider, so that the service provider returns response data to the blockchain node after processing the business request.
[0162] In some embodiments of the present application, based on the above embodiments, the sending module 1230 includes: a state data acquisition module, configured to acquire state data corresponding to the business request according to the business type, wherein the state data is used to represent the current state of the blockchain; a provider selection module, configured to select at least one target service provider from the one or more service providers, and acquire identification information of the target service provider; a state data storage module, configured to save the state data and the identification information of the target service provider on the blockchain node; and a business request sending module, configured to send the business request to the target service provider based on the identification information of the target service provider.
[0163] In some embodiments of the present application, based on the above embodiments, the provider selection module includes: a performance information acquisition module, configured to respectively acquire the performance information of each service provider among the one or more service providers, the performance information including performance parameters for representing the service performance of the service provider; a performance information mapping module, configured to map the performance information to obtain a selection weight of each of the service providers, the selection weight being used to represent the probability of the service provider being selected as the target service provider; a weight selection module, configured to select at least one target service provider according to the selection weight.
[0164] In some embodiments of the present application, based on the above embodiments, the weight selection module includes: a selection rule acquisition module, configured to obtain a selection rule corresponding to the business request, the selection rule being used to determine the number of target service providers to be selected; a unilateral selection module, configured to select a target service provider according to the selection weight when the selection rule is a unilateral selection rule; and a multi-party selection module, configured to select at least two target service providers according to the selection weight when the selection rule is a multi-party selection rule.
[0165] In some embodiments of the present application, based on the above embodiments, the performance information mapping module includes: an initial weight determination module, configured to map the performance information to obtain the initial selection weight of each of the service providers; a response information prediction module, configured to predict the real-time response information of the service provider based on the historical service data of the service provider, and the real-time response information is used to indicate the ability of the service provider to respond to the business request at the current moment; a weight adjustment module, configured to adjust the initial selection weight according to the real-time response information to obtain the real-time selection weight of each of the service providers.
[0166] In some embodiments of the present application, based on the above embodiments, the real-time response information includes at least one of the number of responses and the response duration; the number of responses is used to indicate the number of business requests to which the service provider responds within a unit time, and the response duration is used to indicate the duration for the service provider to respond to a single business request.
[0167] In some embodiments of the present application, based on the above embodiments, the data processing device 1200 also includes: a request receiving module, configured to receive a service registration request sent by a service provider; a request parsing module, configured to parse the service registration request to obtain the configuration information of the service provider and the service function requested to be registered by the service provider; an authority verification module, configured to perform authority verification on the service provider according to the configuration information to determine whether the service provider meets the service requirements of the blockchain node; a function verification module, configured to perform function verification on the service provider according to the service function requested to be registered by the service provider if the verification result of the authority verification is passed to determine whether the service provider has the service capability corresponding to the service function; a connection establishment module, configured to establish a communication connection between the blockchain node and the service provider if the verification result of the function verification is passed to add the service provider to the service group of the blockchain node.
[0168] In some embodiments of the present application, based on the above embodiments, the connection establishment module is configured to: establish a full-duplex communication connection based on the transmission control protocol between the blockchain node and the service provider.
[0169] In some embodiments of the present application, based on the above embodiments, the configuration information includes at least one of the network address, network communication protocol and request data of the service provider; the authority verification module includes: an address verification module, configured to obtain the network address whitelist configured on the blockchain node, and match the network address of the service provider with the network address whitelist to determine whether the service provider is a whitelist member of the blockchain node; a protocol verification module, configured to send protocol verification information carrying a verification token to the service provider based on the network communication protocol, and receive response information returned by the service provider to determine whether the response information carries a valid verification token; a data verification module, configured to perform a legitimacy check on the request data to determine whether the request data conforms to a specified data format.
[0170] In some embodiments of the present application, based on the above embodiments, the data processing device 1200 also includes: a demander configuration module, configured to configure one or more service demanders corresponding to different business types on the blockchain node, and the service demanders are used to respond to business requests with corresponding business types; a registration center configuration module, configured to configure a registration center on the blockchain node for processing service registration requests from service providers and communicating with the service providers; a mapping relationship saving module, configured to save the mapping relationship between the service demander and the service provider on the registration center according to the correspondence between the business type and the service function.
[0171] In some embodiments of the present application, based on the above embodiments, the search module 1220 includes: a demander search module, configured to search for a service demander corresponding to the business type on the blockchain node; a provider search module, configured to search for one or more service providers having a mapping relationship with the service demander through the registration center.
[0172] In some embodiments of the present application, based on the above embodiments, the data processing device 1200 also includes: a status monitoring module, configured to monitor the connection status of the communication connection between the registration center and each service provider; a connection disconnection module, configured to send a disconnection notification to the service demander through the registration center when the connection status is disconnected, so that the service demander destroys the cached data related to the service provider.
[0173] The specific details of the data processing device provided in each embodiment of the present application have been described in detail in the corresponding method embodiments and will not be repeated here.
[0174] Fig.13The structure block diagram of a computer system for implementing an electronic device according to an embodiment of the present application is schematically shown.
[0175] It should be noted that Fig.13 The computer system 1300 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0176] like Fig.13 As shown, the computer system 1300 includes a central processing unit 1301 (CPU), which can perform various appropriate actions and processes according to the program stored in the read-only memory 1302 (ROM) or the program loaded from the storage part 1308 to the random access memory 1303 (RAM). Various programs and data required for system operation are also stored in the random access memory 1303. The central processing unit 1301, the read-only memory 1302 and the random access memory 1303 are connected to each other through a bus 1304. The input / output interface 1305 (Input / Output interface, i.e., I / O interface) is also connected to the bus 1304.
[0177] The following components are connected to the input / output interface 1305: an input section 1306 including a keyboard, a mouse, etc.; an output section 1307 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1308 including a hard disk, etc.; and a communication section 1309 including a network interface card such as a LAN card, a modem, etc. The communication section 1309 performs communication processing via a network such as the Internet. A drive 1310 is also connected to the input / output interface 1305 as needed. A removable medium 1311, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1310 as needed so that a computer program read therefrom is installed into the storage section 1308 as needed.
[0178] In particular, according to an embodiment of the present application, the process described in each method flow chart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer readable medium, and the computer program contains a program code for executing the method shown in the flow chart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 1309, and / or installed from the removable medium 1311. When the computer program is executed by the central processor 1301, various functions defined in the system of the present application are executed.
[0179] It should be noted that the computer-readable medium shown in the embodiment of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by an instruction execution system, device or device or used in combination with it. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer readable signal media may also be any computer readable medium other than computer readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0180] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0181] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.
[0182] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the implementation methods of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the implementation methods of the present application.
[0183] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary technical means in the art that are not disclosed in the present application.
[0184] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A data processing method, characterized in that: include: In response to a service request for a blockchain service triggered on a blockchain node, obtaining a service type of the service request; One or more main function modules corresponding to different business types are configured on the blockchain node, and the main function modules are used to respond to business requests with corresponding business types; A registration center is configured on the blockchain node, the registration center is used to process the registration request of the functional submodule for the service function and communicate with the functional submodule, and the functional submodule is used to replace the main functional module to realize the corresponding service function; According to the correspondence between the business type and the service function, the mapping relationship between the main function module and the function submodule is saved in the registration center; Searching for a main function module corresponding to the business type on the blockchain node; In a service group that is in communication connection with the blockchain node, searching through the registration center for one or more functional submodules that have a mapping relationship with the main functional module; The business request is sent to the functional sub-module, so that the functional sub-module processes the business request and returns response data to the blockchain node.
2. The data processing method according to claim 1, characterized in that: Sending the service request to the functional submodule includes: According to the business type, obtaining status data corresponding to the business request, wherein the status data is used to represent the current status of the blockchain; Selecting at least one target functional submodule from the one or more functional submodules, and acquiring identification information of the target functional submodule; Saving the state data and identification information of the target functional submodule on the blockchain node; Based on the identification information of the target functional submodule, the service request is sent to the target functional submodule.
3. The data processing method according to claim 2, characterized in that: Selecting at least one target functional submodule from the one or more functional submodules includes: Respectively acquiring performance information of each functional submodule in the one or more functional submodules, the performance information comprising a performance parameter for indicating a service performance of the functional submodule; Mapping the performance information to obtain a selection weight of each of the functional submodules, wherein the selection weight is used to indicate the probability of the functional submodule being selected as a target functional submodule; At least one target functional submodule is selected according to the selection weight.
4. The data processing method according to claim 3, characterized in that: Selecting at least one target function submodule according to the selection weight includes: Acquire a selection rule corresponding to the business request, wherein the selection rule is used to determine the number of target functional submodules to be selected; When the selection rule is a unilateral selection rule, a target functional submodule is selected according to the selection weight; When the selection rule is a multi-party selection rule, at least two target function sub-modules are selected according to the selection weights.
5. The data processing method according to claim 3, characterized in that: Mapping the performance information to obtain the selection weight of each functional submodule includes: Mapping the performance information to obtain initial selection weights of each functional submodule; Predicting real-time response information of the functional submodule according to the historical service data of the functional submodule, wherein the real-time response information is used to indicate the ability of the functional submodule to respond to the service request at the current moment; The initial selection weight is adjusted according to the real-time response information to obtain the real-time selection weight of each functional sub-module.
6. The data processing method according to claim 5, characterized in that: The real-time response information includes at least one of the response quantity and response duration; the response quantity is used to indicate the number of business requests to which the functional submodule responds within a unit time, and the response duration is used to indicate the duration for the functional submodule to respond to a single business request.
7. The data processing method according to claim 1, characterized in that: The method further comprises: Receive the service registration request sent by the functional sub-module; Parsing the service registration request to obtain configuration information of the functional submodule and the service function requested to be registered by the functional submodule; Performing authority verification on the functional submodule according to the configuration information to determine whether the functional submodule meets the service requirements of the blockchain node; If the result of the authority verification is that the verification is passed, performing a function verification on the function submodule according to the service function requested to be registered by the function submodule to determine whether the function submodule has a service capability corresponding to the service function; If the verification result of the functional verification is verification passed, a communication connection is established between the blockchain node and the functional sub-module to add the functional sub-module to the service group of the blockchain node.
8. The data processing method according to claim 7, characterized in that: Establishing a communication connection between the blockchain node and the functional submodule includes: A full-duplex communication connection based on the transmission control protocol is established between the blockchain node and the functional sub-module.
9. The data processing method according to claim 7, characterized in that: The configuration information includes at least one of a network address, a network communication protocol, and request data of the functional submodule; and performing permission verification on the functional submodule according to the configuration information includes: Obtaining a network address whitelist configured on the blockchain node, and matching the network address of the functional submodule with the network address whitelist to determine whether the functional submodule is a whitelist member of the blockchain node; Sending protocol verification information carrying a verification token to the functional submodule based on the network communication protocol, and receiving response information returned by the functional submodule to determine whether the response information carries a valid verification token; The request data is subjected to a legality check to determine whether the request data complies with a prescribed data format.
10. The data processing method according to claim 1, characterized in that: The method further comprises: Monitoring the connection status of the communication connection between the registration center and each functional submodule; When the connection state is disconnected, a disconnection notification is sent to the main function module through the registration center, so that the main function module destroys the cache data related to the functional sub-module.
11. A data processing device, characterized in that: include: An acquisition module is configured to, in response to a service request for a blockchain service triggered on a blockchain node, acquire a service type of the service request; A search module is configured to configure one or more main function modules corresponding to different business types on the blockchain node, wherein the main function module is used to respond to business requests with corresponding business types; A registration center is configured on the blockchain node, the registration center is used to process the registration request of the functional submodule for the service function and communicate with the functional submodule, and the functional submodule is used to replace the main functional module to implement the corresponding service function; according to the corresponding relationship between the business type and the service function, the mapping relationship between the main functional module and the functional submodule is saved on the registration center; Searching for a main function module corresponding to the business type on the blockchain node; searching for one or more service providers having a mapping relationship with the main function module through the registration center in a service group that is in communication connection with the blockchain node, wherein the service provider includes the function submodule; The sending module is configured to send the business request to the functional sub-module, so that the functional sub-module returns response data to the blockchain node after processing the business request.
12. A computer-readable medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the data processing method according to any one of claims 1 to 10 is implemented.
13. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to execute the data processing method according to any one of claims 1 to 10 by executing the executable instructions.
14. A computer program product comprising computer instructions, characterized in that When the computer instructions are executed by a processor, the data processing method according to any one of claims 1 to 10 is implemented.
Citation Information
Patent Citations
Data processing method and device based on block chain
CN110009339A
Node scheduling method and device of micro server, equipment and storage medium
CN110311987A