Data processing method and device based on block chain and readable storage medium
By creating contract services for smart contracts in the cluster resource management system and allocating work nodes to be executed transactions to be put on, the problem of low resource utilization rate of blockchain nodes is solved and the efficiency of transactions to be turned on is improved.
Patent Information
- Application Number
- CN202311231922.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-21
- Publication Date
- 2025-03-21
AI Technical Summary
In the prior art, the resource utilization rate of blockchain nodes is low, resulting in a reduced efficiency of transactions on-chain, especially when there is insufficient idle computing resources for block-producing nodes or consensus nodes.
By creating contract services for smart contracts in the cluster resource management system, including scheduling components and execution components, and allocating work nodes to execute transactions to be put on, thereby improving resource utilization.
It improves the resource utilization rate of all blockchain nodes, improves the efficiency of transactions being chained, and ensures transaction execution and chaining speed.
Smart Images

Figure CN119668771A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of Internet technology, and in particular to a data processing method, device, and readable storage medium based on blockchain. Background Art
[0002] A smart contract is an automated program based on blockchain technology that can execute transactions and agreements without an intermediary. It has the characteristics of decentralization, transparency, security, and programmability.
[0003] In the prior art, the execution calculation of smart contracts is performed on local nodes. Usually, the block-producing node first executes the transaction through the smart contract, then generates the block and sends the block to other consensus nodes, and other consensus nodes call the smart contract to execute the transaction again. Obviously, in the prior art, when the block-producing node calls the smart contract to execute the transaction, the computing resources of other consensus nodes are idle. Similarly, when other consensus nodes call the smart contract to execute the transaction, the computing resources of the block-producing node are idle. Therefore, using the prior art, the resource utilization rate of all blockchain nodes is low; in addition, if the idle computing resources of the block-producing node or other consensus nodes are insufficient, the execution of the transaction will be reduced, and then the speed of the transaction on the chain will be reduced. Summary of the invention
[0004] The embodiments of the present application provide a blockchain-based data processing method, device, and readable storage medium, which can improve the resource utilization of all blockchain nodes and thus improve the efficiency of transaction on-chain.
[0005] On the one hand, an embodiment of the present application provides a data processing method based on blockchain, which is executed by a block producing node and includes:
[0006] Obtaining a first transaction to be uploaded to the chain from the transaction pool. If the first transaction to be uploaded to the chain is a transaction for installing a smart contract, encoding the first transaction to be uploaded to the chain to obtain an encoded file;
[0007] Send the encoded file to the master node in the cluster resource management system, so that the master node creates a contract service for the smart contract in the cluster resource management system according to the encoded file; the contract service includes a scheduling component and A execution components running on A working nodes; A is a positive integer; wherein one working node is used to run one execution component; the master node and the A working nodes different from the master node are all blockchain nodes in the blockchain;
[0008] The first transaction to be on-chain is sent to the scheduling component, so that the scheduling component allocates a first working node for the first transaction to be on-chain among A working nodes; the first working node is used to execute the first transaction to be on-chain in the first execution component; the first execution component refers to the execution component running on the first working node.
[0009] On the one hand, an embodiment of the present application provides a data processing method based on blockchain, which is executed by a master node in a cluster resource management system, and the cluster resource management system is jointly maintained by all blockchain nodes in the blockchain, and the method includes:
[0010] Obtain the encoded file sent by the block-producing node in the blockchain; the encoded file is generated by the block-producing node when the transaction to be on-chain is a transaction for installing a smart contract, by encoding the transaction to be on-chain;
[0011] According to the coding file, a contract service is created for the smart contract in the cluster resource management system; the contract service includes a scheduling component and A execution components running on A working nodes; A is a positive integer; wherein, one working node is used to run one execution component; the master node and A working nodes different from the master node all belong to the blockchain nodes in the blockchain; the scheduling component is used to allocate working node z to the transaction to be chained in the A working nodes when obtaining the transaction to be chained sent by the block-producing node; the working node z is used to execute the transaction to be chained in the execution component x; the execution component x refers to the execution component running on the working node z.
[0012] On the one hand, an embodiment of the present application provides a data processing method based on blockchain, which is executed by a blockchain node having a scheduling component in a contract service, and the method includes:
[0013] The first transaction to be on-chain sent by the block-producing node in the blockchain is obtained through the scheduling component; the contract service is created by the master node in the cluster resource management system according to the first transaction to be on-chain;
[0014] According to the first transaction to be on-chain, a first working node is determined among A working nodes; the A working nodes are respectively used to run A execution components in the contract service; wherein one working node is used to run one execution component;
[0015] According to the first transaction to be on-chain, the first execution component in the first working node is started, so that the first working node executes the first transaction to be on-chain in the first execution component; the first execution component refers to the execution component running on the first working node.
[0016] On the one hand, an embodiment of the present application provides a data processing device based on blockchain, which runs on a block-producing node, and includes:
[0017] A first acquisition module is used to acquire a first transaction to be uploaded to the chain from the transaction pool. If the first transaction to be uploaded to the chain is a transaction for installing a smart contract, the first transaction to be uploaded to the chain is encoded to obtain an encoded file;
[0018] The first sending module is used to send the encoded file to the master node in the cluster resource management system, so that the master node creates a contract service for the smart contract in the cluster resource management system according to the encoded file; the contract service includes a scheduling component and A execution components running on A working nodes; A is a positive integer; wherein one working node is used to run one execution component; the master node and the A working nodes different from the master node are all blockchain nodes in the blockchain;
[0019] The second sending module is used to send the first transaction to be on-chain to the scheduling component, so that the scheduling component allocates a first working node for the first transaction to be on-chain among A working nodes; the first working node is used to execute the first transaction to be on-chain in the first execution component; the first execution component refers to the execution component running on the first working node.
[0020] The data processing device further includes:
[0021] The second acquisition module is used to obtain the historical reputation value of the first working node. If the first transaction execution result generated by the first working node executing the first transaction to be on-chain is obtained, the reputation reward value is obtained according to the first transaction execution result; the first transaction to be on-chain and the first transaction execution result are used to generate the first block to be agreed upon;
[0022] A first adding module, used to add the reputation reward value to the historical reputation value to obtain an updated reputation value of the first working node;
[0023] A second adding module is used to obtain a reputation penalty value if the first working node fails to execute the first transaction to be on-chain, and add the reputation penalty value to the historical reputation value to obtain an updated reputation value of the first working node;
[0024] Among them, the updated reputation value of the first working node is used to instruct the scheduling component to determine the working component for executing the transaction to be on-chain among A working nodes.
[0025] The data processing device further includes:
[0026] A reputation comparison module, used to compare the updated reputation value of the first working node with the reputation threshold;
[0027] A node deletion module, configured to delete the first working node from the blockchain if the update threshold of the first working node is less than or equal to the reputation threshold;
[0028] The node reservation module is used to reserve the first working node in the blockchain if the update threshold of the first working node is greater than the reputation threshold.
[0029] The data processing device further includes:
[0030] The first acquisition module is further used to acquire a second transaction to be uploaded to the chain from the transaction pool; the second transaction to be uploaded to the chain includes a contract identifier;
[0031] The third sending module is used for sending the second transaction to be on-chain to the scheduling component if the contract identifier is the identifier of the smart contract, so that the scheduling component allocates a second working node for the second transaction to be on-chain in A working nodes according to the transaction execution resources corresponding to the second transaction to be on-chain and the node idle resources corresponding to the first working node; the second working node is used to execute the second transaction to be on-chain according to the smart contract in the second execution component; the second execution component refers to the execution component running on the second working node;
[0032] The block generation module is used to generate a second block to be agreed upon according to the second transaction to be on-chain and the second transaction execution result if the second transaction execution result generated by the second working node after executing the second transaction to be on-chain is obtained.
[0033] Wherein, the first acquisition module includes:
[0034] A first acquisition unit is used to acquire a contract file corresponding to the smart contract in the first transaction to be on-chain if the first transaction to be on-chain is a transaction for installing a smart contract; the contract file is generated by encoding the source code corresponding to the smart contract by the business device initiating the first transaction to be on-chain;
[0035] The first processing unit is used to detect and process the contract file to obtain a file detection result. If the file detection result indicates that the contract file is of an abnormal type, a file detection abnormality message is returned to the business device;
[0036] The second processing unit is used to encode the contract file to obtain an encoded file if the file detection result indicates that the contract file is of a normal type.
[0037] The data processing device further includes:
[0038] The third acquisition module is used to obtain the first transaction to be on-chain with a signature message sent by the contract installation account; the signature message is obtained by the contract installation account signing the first transaction to be on-chain using the business private key;
[0039] The first processing module is used to verify the signature of the signed message through the business public key corresponding to the contract installation account to obtain the signature verification result;
[0040] The message return module is used to return a signature verification failure message to the contract installation account if the signature verification result indicates that the signature message verification failed;
[0041] The second processing module is used to perform permission verification on the contract installation account to obtain a permission verification result if the signature verification result indicates that the signature message verification is successful;
[0042] The third adding module is used to add the first transaction to be on-chain to the transaction pool according to the permission verification result.
[0043] Wherein, the second processing module includes:
[0044] The second acquisition unit is used to obtain a list of illegal accounts in the blockchain, and compare the contract installation account with the illegal accounts in the illegal account list;
[0045] A first determination unit, configured to determine the illegal account verification result as the authority verification result when there is an illegal account that is the same as the contract installation account in the illegal account list;
[0046] The third processing unit is used to verify the contract installation function call permission of the contract installation account when there is no illegal account identical to the contract installation account in the illegal account list;
[0047] A second determination unit is used to determine the contract installation prohibition result as the permission verification result if the contract installation account does not have the permission to call the contract installation function;
[0048] A third determination unit is used to determine the permission verification result as the permission verification result if the contract installation account has the permission to call the contract installation function;
[0049] The third added module includes:
[0050] A message return unit, used to return a permission verification failure message to the contract installation account if the permission verification result is an illegal account verification result or a contract installation prohibited result;
[0051] The transaction adding unit is used to add the first transaction to be on-chain to the transaction pool if the permission verification result is a permission verification passed result.
[0052] On the one hand, an embodiment of the present application provides a data processing device based on blockchain, which runs on a master node in a cluster resource management system. The cluster resource management system is jointly maintained by all blockchain nodes in the blockchain. The device includes:
[0053] The first acquisition module is used to acquire the encoding file sent by the block-producing node in the blockchain; the encoding file is generated by the block-producing node when the transaction to be on-chain is a transaction for installing a smart contract, by encoding the transaction to be on-chain;
[0054] The service creation module is used to create a contract service for the smart contract in the cluster resource management system according to the coding file; the contract service includes a scheduling component and A execution components running on A working nodes; A is a positive integer; wherein, one working node is used to run one execution component; the master node and the A working nodes different from the master node are all blockchain nodes in the blockchain; the scheduling component is used to allocate a working node z to the transaction to be chained in the A working nodes when obtaining the transaction to be chained sent by the block-producing node; the working node z is used to execute the transaction to be chained in the execution component x; the execution component x refers to the execution component running on the working node z.
[0055] Wherein, the total number of blockchain nodes in the blockchain excluding the master node is D; D is a positive integer greater than 1;
[0056] The data processing device further comprises:
[0057] The second acquisition module is used to obtain the node idle resources sent by D blockchain nodes respectively, and the reputation values corresponding to the D blockchain nodes respectively; the D blockchain nodes include blockchain node B c , c is a positive integer, and c is less than or equal to D;
[0058] Weighted sum module, used to calculate the weight of blockchain node B c The node idle resources and blockchain node B c The reputation value of blockchain node B is weighted and summed up to get c The corresponding assigned value;
[0059] The node determination module is used to determine A working nodes among the D blockchain nodes according to the allocation values corresponding to the D blockchain nodes respectively.
[0060] On the one hand, an embodiment of the present application provides a data processing device based on blockchain, which runs on a blockchain node having a scheduling component in a contract service, and the device includes:
[0061] The first acquisition module is used to acquire the first transaction to be on-chain sent by the block-producing node in the blockchain through the scheduling component; the contract service is created by the master node in the cluster resource management system according to the first transaction to be on-chain;
[0062] A first determination module is used to determine a first working node among A working nodes according to the first transaction to be on-chain; the A working nodes are respectively used to run A execution components in the contract service; wherein one working node is used to run one execution component;
[0063] The first startup module starts the first execution component in the first working node according to the first transaction to be on-chain, so that the first working node executes the first transaction to be on-chain in the first execution component; the first execution component refers to the execution component running on the first working node.
[0064] Wherein, the first determination module includes:
[0065] The first acquisition unit is used to acquire the node idle resources corresponding to the A working nodes and the reputation values corresponding to the A working nodes; the A working nodes include working nodes E f , f is a positive integer, and f is less than or equal to A;
[0066] Weighted summation unit, used to calculate the working node E f The idle resources of nodes and working nodes E f The reputation values of the working node E are weighted and summed to obtain f The corresponding assigned value;
[0067] The second acquisition unit is used to acquire a maximum allocation value among the allocation values corresponding to the A working nodes, and determine the working node corresponding to the maximum allocation value among the A working nodes as the first working node.
[0068] The data processing device further includes:
[0069] A second acquisition module is used to acquire the second transaction to be uploaded to the chain sent by the block generation node through the scheduling component;
[0070] A second determination module is used to determine a second working node from the A working nodes according to the transaction execution resources corresponding to the second transaction to be on-chain and the node idle resources corresponding to the first working node;
[0071] The second startup module is used to start the second execution component in the second working node according to the second transaction to be on the chain, so that the second working node executes the second transaction to be on the chain in the second execution component; the second execution component refers to the execution component running on the second working node.
[0072] Wherein, the second determination module includes:
[0073] A resource comparison unit, used to compare the transaction execution resources corresponding to the second transaction to be on-chain with the node idle resources corresponding to the first working node;
[0074] A first determining unit is configured to determine the first working node as the second working node if the transaction execution resources corresponding to the second transaction to be on-chain are less than or equal to the node idle resources corresponding to the first working node;
[0075] A second determining unit is used to determine the resource difference between the transaction execution resources corresponding to the second transaction to be on-chain and the node idle resources corresponding to the first working node if the transaction execution resources corresponding to the second transaction to be on-chain are greater than the node idle resources corresponding to the first working node;
[0076] The third determination unit is used to determine the first working node and the third working node as the second working node if the node idle resources corresponding to the third working node among the A working nodes are equal to or greater than the resource difference; the third working node refers to the working node other than the first working node among the A working nodes.
[0077] Wherein, the second determination module further includes:
[0078] A request generating unit, configured to generate a resource reallocation request according to the second resource to be uploaded, if the node idle resources corresponding to the remaining working nodes among the A working nodes except the first working node are less than the resource difference;
[0079] A request sending unit is used to send a resource reallocation request to the master node, so that the master node reallocates G working nodes for the contract service in the cluster resource management system according to the resource reallocation request; G is a positive integer; the node idle resources corresponding to the G working nodes are equal to or greater than the transaction execution resources corresponding to the second transaction to be on-chain.
[0080] On one hand, the present application provides a computer device, including: a processor, a memory, and a network interface;
[0081] The above-mentioned processor is connected to the above-mentioned memory and the above-mentioned network interface, wherein the above-mentioned network interface is used to provide a data communication function, the above-mentioned memory is used to store a computer program, and the above-mentioned processor is used to call the above-mentioned computer program so that the computer device executes the method in the embodiment of the present application.
[0082] On one hand, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. The computer program is suitable for being loaded by a processor and executing the method in the embodiment of the present application.
[0083] On the one hand, an embodiment of the present application provides a computer program product, which includes a computer program stored in a computer-readable storage medium; a processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the method in the embodiment of the present application.
[0084] In an embodiment of the present application, a block-producing node may obtain a first transaction to be on-chain from a transaction pool. If the first transaction to be on-chain is a transaction for installing a smart contract, the first transaction to be on-chain is encoded to obtain an encoded file. Further, the block-producing node sends the encoded file to a master node in a cluster resource management system, so that the master node creates a contract service for the smart contract in the cluster resource management system according to the encoded file. The contract service includes a scheduling component and A execution components running on A working nodes. The master node and the A working nodes different from the master node are all blockchain nodes in the blockchain. Further, the block-producing node sends the first transaction to be on-chain to the scheduling component, so that the scheduling component allocates a first working node to the first transaction to be on-chain among the A working nodes. The first working node is used to execute the first transaction to be on-chain in the first execution component. From the above, it can be seen that the embodiment of the present application can create a contract service for the smart contract in the cluster resource management system, and then the execution task corresponding to the first transaction to be on the chain can be transferred from the block producing node to the contract service, that is, the first transaction to be on the chain is executed by the first working node running the first execution component. Therefore, by adopting the present application, the resource utilization rate of all blockchain nodes can be improved, and then the efficiency of transaction on the chain can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0085] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0086] Figure 1 It is a schematic diagram of a system architecture provided by an embodiment of the present application;
[0087] Figure 2 This is a flowchart of a data processing method based on blockchain provided in an embodiment of the present application. Figure 1 ;
[0088] Figure 3 This is a schematic diagram of a data processing scenario based on blockchain provided by an embodiment of the present application. Figure 1 ;
[0089] Figure 4This is a schematic diagram of a data processing scenario based on blockchain provided by an embodiment of the present application. Figure 2 ;
[0090] Figure 5 This is a schematic diagram of a data processing scenario based on blockchain provided by an embodiment of the present application. Figure 3 ;
[0091] Figure 6 This is a flowchart of a data processing method based on blockchain provided in an embodiment of the present application. Figure 2 ;
[0092] Figure 7 This is a flowchart of a data processing method based on blockchain provided in an embodiment of the present application. Figure 3 ;
[0093] Figure 8 This is a blockchain shared computing system architecture based on Apache Mesos provided by an embodiment of the present application;
[0094] Fig. 9 This is a flowchart of a data processing method based on blockchain provided in an embodiment of the present application. Figure 4 ;
[0095] Fig.10 This is a flowchart of a data processing method based on blockchain provided in an embodiment of the present application. Figure 5 ;
[0096] Fig.11 This is a schematic diagram of a data processing device based on blockchain provided in an embodiment of the present application. Figure 1 ;
[0097] Fig.12 This is a schematic diagram of a data processing device based on blockchain provided in an embodiment of the present application. Figure 2 ;
[0098] Fig.13 This is a schematic diagram of a data processing device based on blockchain provided in an embodiment of the present application. Figure 3 ;
[0099] Fig.14 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0100] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0101] To facilitate understanding, some nouns are briefly explained as follows:
[0102] 1. Blockchain: In a narrow sense, blockchain is a chain data structure with blocks as the basic unit. The digital summary is used in the block to verify the transaction history previously obtained, which is suitable for the needs of tamper-proof and scalability in the distributed accounting scenario; in a broad sense, blockchain also refers to the distributed accounting technology implemented by the blockchain structure, including distributed consensus, privacy and security protection, peer-to-peer communication technology, network protocols, smart contracts, etc. The goal of the blockchain is to realize a distributed data record book, which only allows additions but not deletions. The basic structure of the underlying ledger is a linear linked list. The linked list is composed of "blocks" connected in series, and the hash value of the previous block is recorded in the subsequent block. Whether each block (and the transactions in the block) is legal can be quickly verified by calculating the hash value. If a node in the network proposes to add a new block, it must reach a consensus on the block through the consensus mechanism.
[0103] 2. Blockchain nodes: The blockchain network divides nodes into consensus nodes (also called core nodes) and synchronization nodes (which may include data nodes and light nodes). Among them, the consensus node is responsible for the consensus business of the entire blockchain network; the embodiment of the present application refers to the consensus node with the authority to generate blocks (i.e., generate blocks to be agreed upon) as the block node. The synchronization node is responsible for synchronizing the ledger information of the consensus node, that is, synchronizing the latest block data. Whether it is a consensus node or a synchronization node, its internal structure includes a network communication component, because the blockchain network is essentially a peer-to-peer network, and it needs to communicate with other nodes in the blockchain network through peer-to-peer components. The resources and services in the blockchain network are scattered on each node, and the transmission of information and the implementation of services are carried out directly between nodes without the intervention of intermediate links or centralized servers (third parties).
[0104] 3. Block: It is a data packet that carries transaction data on the blockchain network. It is a data structure marked with a timestamp and the hash value corresponding to the previous block. The block is verified and confirmed by the consensus mechanism of the network. The block includes a block header and a block body. The block header can record the meta information of the current block, including the current version number, the hash value corresponding to the previous block, the timestamp, the random number, the hash value of the MerkleRoot, and other data. The block body can record the detailed data generated within a period of time, including all transaction records or other information generated during the block creation process that have been verified by the current block, which can be understood as a form of account book. In addition, the detailed data of the block body can include the unique Merkle Root generated through the hash process of the Merkle Tree and recorded in the block header.
[0105] 4. Hash value: Also known as information characteristic value or characteristic value, the hash value is generated by converting input data of any length into a password and performing a fixed output through a hash algorithm. The original input data cannot be retrieved by decrypting the hash value. It is a one-way encryption function. In the blockchain, each block (except the initial block) contains the hash value of the previous block. The hash value is the potential core foundation and the most important aspect of blockchain technology. It retains the authenticity of the recorded and viewed data, as well as the integrity of the blockchain as a whole.
[0106] 5. Public key and private key: Public key and private key are a key pair obtained through an algorithm. The public key is the public part of the key pair, and the private key is the non-public part. The public key is usually used to encrypt data, verify digital signatures, etc. This algorithm can ensure that the key pair obtained is unique. When using this key pair, if one of the keys is used to encrypt a piece of data, the other key must be used to decrypt it. For example, if the data is encrypted with the public key, it must be decrypted with the private key. If it is encrypted with the private key, it must also be decrypted with the public key, otherwise the decryption will not be successful.
[0107] 6. Asymmetric signature: The signature algorithm includes two keys, a public key (public key for short) and a private key (private key for short). The public key and the private key are a pair. If the private key is used to sign data, the signature can only be verified with the corresponding public key. Because the signing process and the verification process use two different keys, this algorithm is called an asymmetric signature. The basic process of asymmetric signature to achieve confidential information exchange can be: Party A generates a pair of keys and makes the public key public. When Party A needs to send a message to another role (Party B), it uses its own private key to sign the confidential message and then sends it to Party B; Party B then uses Party A's public key to verify the signed message.
[0108] 7. Smart Contract: A computer protocol designed to disseminate, verify or execute contracts in an information-based manner. In a blockchain system, a smart contract (contract for short) is a code that can be understood and executed by each node of the blockchain, which can execute any logic and obtain results. In actual applications, smart contracts are managed and tried through transactions on the blockchain. Each transaction is equivalent to a remote procedure call (RPC) request to the blockchain system. If a smart contract is equivalent to an executable program, the blockchain is equivalent to an operating system that provides an operating environment. A blockchain can contain multiple contracts, distinguished by a contract account (Identity, ID), identification number or name.
[0109] 8. Cluster Resource Management System (Apache Mesos): It is an open source cluster manager that provides effective resource isolation and sharing, and can deploy multiple applications in a cluster. It has a highly modular design and can be easily expanded and integrated with other components. The core idea of Mesos is to regard the entire data center or cloud environment as a large computing resource pool and realize multi-task scheduling and load balancing by dynamically allocating resources. Mesos can be used in scenarios such as big data processing, container orchestration, and microservice management.
[0110] 9. Mesos Framework: It is an application or service running on Mesos, which is responsible for communicating with the Mesos cluster to schedule and execute tasks in the cluster. A Framework usually consists of two components: Scheduler (scheduling) and Executor (execution). Scheduler is responsible for interacting with MesosMaster (master node), receiving resource quotations, issuing (Resource Offer) and deciding whether to accept; Executor is responsible for executing tasks on Mesos Slave (worker node). Common Mesos Frameworks include Marathon (for long-running services), Chronos (distributed timed task scheduler) and Apache Spark (big data processing framework).
[0111] It can be understood that the cluster resource management system in the embodiment of the present application is jointly maintained by all blockchain nodes, so the Framework in the embodiment of the present application is deployed on multiple blockchain nodes, including the contract service proposed in this application.
[0112] 10. Mesos Scheduler: It is a key component of the Framework, used to manage and schedule tasks in a Mesos cluster. It is the core part of a framework, responsible for communicating with the Mesos master node, receiving resource slices (ResourceOffers) and deciding how to allocate tasks to these resources. The main responsibilities of Mesos Scheduler include: communicating with the Mesos master node, receiving resource slices, managing task queues, allocating tasks, monitoring task status and implementing custom scheduling strategies. Mesos Scheduler can implement custom scheduling strategies based on specific application scenarios and requirements to optimize task execution performance and resource utilization. This application refers to Mesos Scheduler as a scheduling component.
[0113] 11. Mesos Executor: It is part of the Framework and is responsible for executing tasks on Mesos Slave nodes. When the Framework's Scheduler accepts a resource quotation, it sends the task to the corresponding Executor for execution. The Executor can be general or specific to an application. In some cases, the Executor can also be responsible for monitoring the running status of the task and reporting to the Scheduler. This application refers to the Mesos Executor as the execution component.
[0114] 12. Master: It is the core component of the Mesos cluster and is responsible for managing all resources and tasks in the cluster. The Master communicates with the Framework's Scheduler and each Slave node, and is responsible for resource allocation and task scheduling. The Master is also responsible for observing the state of the cluster, including the health of the nodes, resource usage, etc. In order to ensure high availability, Mesos usually deploys multiple Master nodes, which are elected through the ZooKeeper coordination service to select a leader to handle tasks in the cluster.
[0115] 13. Worker node (Slave, also called Agent): Responsible for executing tasks assigned by the Framework. Each Slave node runs a Mesos Agent process, which is responsible for communicating with the Master, reporting resource usage and receiving tasks. Resource isolation and management on Slave nodes are usually implemented through container technology (such as Docker) or Mesos's own container runtime (such as Mesos Containerizer).
[0116] In the embodiment of the present application, all blockchain nodes in the blockchain can be regarded as a node cluster, which jointly maintains a Mesos, that is, the present application deploys a cluster resource management system in the blockchain network, and regards all resources of all blockchain nodes as a large computing resource pool. From the consensus dimension, blockchain nodes can be divided into consensus nodes and synchronization nodes. In the cluster resource management dimension, blockchain nodes can be divided into master nodes and working nodes. Therefore, a blockchain node is a consensus node when it has consensus authority, and a master node when it has cluster resource management. In layman's terms, a blockchain node can be both a consensus node and a master node, but a consensus node and a synchronization node are not the same blockchain node, and a master node and a working node are not the same blockchain node.
[0117] See also Figure 1 , Figure 1 Schematic diagram of a system architecture provided by an embodiment of the present application. Figure 1 As shown, the system architecture may include a business server 101, a terminal device cluster and a blockchain node cluster 10.
[0118] The blockchain node cluster 10 may include one or more blockchain nodes, and the embodiment of the present application does not limit the number of blockchain nodes in the blockchain node cluster 10. Figure 1 As shown, the blockchain node cluster 10 may include a blockchain node 10a, a blockchain node 10b, a blockchain node 10c, and a blockchain node 10d.
[0119] It can be understood that when each blockchain node is performing normal work, it can receive data to be uploaded to the chain (such as the first transaction to be uploaded to the chain and the second transaction to be uploaded to the chain in the embodiment of the present application) sent by off-chain devices (referred to as business devices in this application, such as the business server 101 in the embodiment of the present application and the terminal devices in the terminal device cluster), and generate blocks based on the received data to be uploaded to the chain, and then process the blocks on the chain.
[0120] It is understandable that in the specific implementation of the present application, related data such as user information (such as the first transaction to be on-chain and the second transaction to be on-chain) is involved. When the embodiment of the present application is applied to a specific product or technology, it is necessary to obtain user permission or consent, and the collection, use and processing of the relevant data need to comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0121] In order to ensure data intercommunication between various blockchain nodes, there may be a data connection between each blockchain node, for example, there is a data connection between blockchain node 10a and blockchain node 10c, there is a data connection between blockchain node 10a and blockchain node 10d, there is a data connection between blockchain node 10b and blockchain node 10c, and so on. It is understandable that data or blocks can be transmitted between blockchain nodes through the above data connection. The data connection between the above blockchain nodes can be based on node identification. For each blockchain node in the blockchain network, there is a node identification corresponding to it, and each of the above blockchain nodes can store the node identification of other blockchain nodes that are connected to itself, so that the acquired data or generated blocks can be broadcast to other blockchain nodes according to the node identification of other blockchain nodes. For example, blockchain node 10a can maintain a node identification list, which stores the node names and node identifications of other blockchain nodes, as shown in Table 1.
[0122] Table 1
[0123] Node Name Node ID Blockchain Node 10b AAAAA Blockchain Node 10c BBBBB … … Blockchain Node 10d CCCCC
[0124] Among them, the node identifier can be the Internet Protocol (IP) address for interconnecting networks, or any other information that can be used to identify a node in a blockchain network. Table 1 only uses the IP address as an example for explanation.
[0125] Assuming that the node identifier of blockchain node 10a is FFFFFF, blockchain node 10a can send transaction data to blockchain node 10d through node identifier CCCCC, and blockchain node 10d can determine that the transaction data is sent by blockchain node 10a through node identifier FFFFFF; similarly, blockchain node 10d can send a block to be agreed upon to blockchain node 10c through node identifier BBBBBB, and blockchain node 10c can determine that the block to be agreed upon is sent by blockchain node 10d through node identifier CCCCCC, and the same is true for data transmission between other nodes, so they will not be elaborated one by one.
[0126] It is understandable that the above-mentioned data connection does not limit the connection method, and can be directly or indirectly connected through wired communication, directly or indirectly connected through wireless communication, or through other connection methods, which are not limited in this application.
[0127] Among them, it is understandable that Figure 1 The blockchain nodes 10a, 10b, 10c, and 10d shown may have a one-to-one correspondence with the corresponding roles (i.e., entity objects in the corresponding business scenarios) that need to be connected to the blockchain network. The business scenarios here may specifically include electronic bill scenarios, resource issuance scenarios, resource transfer scenarios, payment scenarios, etc. At this time, the business data information in the corresponding business scenarios may specifically include electronic bill information in the electronic bill scenario, resource issuance information in the resource issuance scenario, resource transfer information in the resource transfer scenario, asset transfer records in the payment scenario, etc. The specific contents of the business data information in the corresponding business scenarios will not be listed one by one here.
[0128] It is understandable that the terminal device cluster may include one or more terminal devices, and the embodiment of the present application does not limit the number of terminal devices in the terminal device cluster. Figure 1As shown, the terminal device cluster may include terminal device 100a, terminal device 100b, terminal device 100c, ..., terminal device 100d. Among them, there may be a network connection between the terminal device clusters, for example, there is a network connection between terminal device 100a and terminal device 100b. At the same time, any terminal device in the terminal device cluster may have a network connection with the business server 101, for example, there is a network connection between terminal device 100d and business server 101. At the same time, any terminal device in the terminal device cluster may have a network connection with the blockchain network, for example, there is a network connection between terminal device 100b and blockchain node 10c in the blockchain network. Among them, the above-mentioned network connection does not limit the connection method, and can be directly or indirectly connected through a wired network, or directly or indirectly connected through a wireless network, or through other methods, and this application is not limited here.
[0129] It should be understood that Figure 1 Each terminal device in the terminal device cluster shown in FIG. 1 may be installed with an application client. When the application client runs in each terminal device, it may be respectively connected to the above-mentioned Figure 1 The business servers 101 shown in the figure can exchange data with each other, that is, the above-mentioned network connection; Figure 1 The blockchain network shown in the figure is used for data interaction. The application client can be a video application, a digital resource application, an office software application, a navigation application, a shopping application, a financial management application, a business application, a browser, and other application clients that have the function of sending data to be uploaded. The application client can be an independent client or an embedded sub-client integrated in a client (for example, an education client and a multimedia client, etc.), which is not limited here.
[0130] Taking digital resource application as an example, the business server 101 may be a collection of multiple servers including a background server corresponding to the digital resource application, a data processing server, etc. Therefore, each terminal device can transmit data with the business server 101 through the application client corresponding to the digital resource application. For example, each terminal device can upload a smart contract creation request to the business server 101 through the application client of the digital resource application, and then the business server 101 can transmit the smart contract creation request to the blockchain network.
[0131] The service server 101 may be a background server corresponding to the application client installed in the terminal device in the terminal device cluster. It is understandable that the above system may include one or more service servers, and the number of service servers is not limited here. Figure 1The business server 101 shown can be connected to the blockchain network so as to facilitate data interaction through the network connection with the blockchain network.
[0132] The service equipment in the embodiment of the present application may include Figure 1 Any terminal device in the terminal device cluster shown and the service server 101. To facilitate subsequent understanding and description, the embodiment of the present application can be Figure 1 A device is selected as a business device in the terminal device cluster or business server 101 shown, for example, terminal device 100c is used as a business device. When a transaction chain instruction for the first transaction to be chained is obtained in the application client bound to account a, the business device (such as terminal device 100c) can send the first transaction to be chained to the blockchain network through the application client.
[0133] For ease of description and understanding, the following description is based on an example of any blockchain node in the blockchain network, for example Figure 1 The blockchain node 10a in. When the first transaction to be on the chain is obtained, the blockchain node 10a verifies the legitimacy of the first transaction to be on the chain. If the first transaction to be on the chain is legitimate, the first transaction to be on the chain is added to the local transaction pool. When it has the authority to generate blocks, the blockchain node 10a (the blockchain node 10a is a block generating node at this time) obtains the first transaction to be on the chain from the transaction pool. If the first transaction to be on the chain is a transaction for installing a smart contract, the blockchain node 10a encodes the first transaction to be on the chain to obtain an encoded file; further, the encoded file is sent to the master node in the cluster resource management system, wherein the cluster resource management system is jointly maintained by all blockchain nodes in the blockchain network, and it can manage all computing resources and storage resources of all blockchain nodes.
[0134] The master node is a node in the cluster resource management system that is responsible for managing all resources and tasks in the cluster (this application refers to the blockchain node cluster). In layman's terms, the master node is one or more blockchain nodes in the blockchain node cluster. Therefore, one scenario is that the block-producing node (such as the above-mentioned blockchain node 10a with block-producing authority) and the master node can be different blockchain nodes. At this time, the block-producing node sends the encoded file to the master node; therefore, another scenario is that the block-producing node and the master node can be the same blockchain node. At this time, the block-producing node can create a contract service for the smart contract in the cluster resource management system based on the encoded file.
[0135] Further, the master node creates a contract service for the smart contract in the cluster resource management system according to the coding file; the contract service includes a scheduling component and A execution components running on A working nodes; A is a positive integer; wherein one working node is used to run one execution component; the master node and the A working nodes different from the master node are all blockchain nodes in the blockchain. The scheduling component can run on the master node or on the working node, which is not limited in the embodiment of the present application.
[0136] Further, the blockchain node 10a sends the first transaction to be on-chain to the scheduling component, so that the scheduling component allocates a first working node for the first transaction to be on-chain among A working nodes; the first working node is used to execute the first transaction to be on-chain in the first execution component; the first execution component refers to the execution component running on the first working node.
[0137] From the above, it can be seen that the embodiment of the present application can create a contract service for the smart contract in the cluster resource management system, and then the execution task corresponding to the first transaction to be on the chain can be transferred from the block producing node to the contract service, that is, the first transaction to be on the chain is executed by the first working node running the first execution component. Therefore, by adopting the present application, the resource utilization rate of all blockchain nodes can be improved, and then the efficiency of transaction on the chain can be improved.
[0138] The method provided in the embodiment of the present application can be executed by a computer device, which includes but is not limited to a terminal device or a business server. The business server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud database, cloud service, cloud computing, cloud function, cloud storage, network service, cloud communication, middleware service, domain name service, security service, CDN, and big data and artificial intelligence platform. Terminal devices include but are not limited to mobile phones, computers, intelligent voice interaction devices, smart home appliances, vehicle terminals, aircraft, etc.
[0139] For further information, see Figure 2 , Figure 2 This is a flowchart of a data processing method based on blockchain provided in an embodiment of the present application. Figure 1 The implementation process of the data processing method can be carried out in a blockchain node with block generation authority (hereinafter referred to as a block generation node), in a master node, in a blockchain node with a scheduling component in a contract service (hereinafter referred to as a scheduling node), or interactively in a block generation node, a master node, and a scheduling node, without limitation. The block generation node, the master node, and the scheduling node can be the above Figure 1 Any blockchain node in the blockchain node cluster of the corresponding embodiment. Figure 2The embodiments of the present application are described by taking a block node as an example. The embodiments of the present application can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, assisted driving, etc. Figure 2 As shown, the data processing method may at least include the following steps S101 to S103.
[0140] Step S101, obtaining the first transaction to be on-chain from the transaction pool. If the first transaction to be on-chain is a transaction for installing a smart contract, the first transaction to be on-chain is encoded to obtain an encoded file.
[0141] Specifically, the first transaction to be on-chain carrying the signature message sent by the contract installation account is obtained; the signature message is obtained by the contract installation account signing the first transaction to be on-chain through the business private key; the signature message is verified through the business public key corresponding to the contract installation account to obtain the signature verification result; if the signature verification result indicates that the signature message verification fails, a signature verification failure message is returned to the contract installation account; if the signature verification result indicates that the signature message verification succeeds, the contract installation account is subjected to permission verification to obtain the permission verification result; according to the permission verification result, the first transaction to be on-chain is added to the transaction pool.
[0142] Among them, the specific process of performing permission verification on the contract installation account and obtaining the permission verification result may include: obtaining a list of illegal accounts in the blockchain, and comparing the contract installation account with the illegal accounts in the illegal account list; when there is an illegal account identical to the contract installation account in the illegal account list, determining the account verification illegal result as the permission verification result; when there is no illegal account identical to the contract installation account in the illegal account list, performing contract installation function call permission verification on the contract installation account; if the contract installation account does not have the permission to call the contract installation function, determining the contract installation prohibited result as the permission verification result; if the contract installation account has the permission to call the contract installation function, determining the permission verification passed result as the permission verification result.
[0143] Among them, according to the permission verification result, the specific process of adding the first transaction to be on-chain to the transaction pool may include: if the permission verification result is an illegal account verification result or a contract installation prohibited result, then returning a permission verification failure message to the contract installation account; if the permission verification result is a permission verification passed result, then adding the first transaction to be on-chain to the transaction pool.
[0144] Specifically, if the first transaction to be on-chain is a transaction for installing a smart contract, the contract file corresponding to the smart contract is obtained in the first transaction to be on-chain; the contract file is generated by encoding the source code corresponding to the smart contract by the business device that initiates the first transaction to be on-chain; the contract file is detected and processed to obtain a file detection result. If the file detection result indicates that the contract file is of an abnormal type, a file detection exception message is returned to the business device; if the file detection result indicates that the contract file is of a normal type, the contract file is encoded and processed to obtain an encoded file.
[0145] Please also see Figure 3 , Figure 3 This is a schematic diagram of a data processing scenario based on blockchain provided by an embodiment of the present application. Figure 1 .like Figure 3 As shown, the service device 30a may be a terminal device, for example Figure 1 Any terminal device in the terminal device cluster in. Business device 30a is bound to a blockchain account (i.e., blockchain address, which is described as contract installation account 301a in this embodiment of the application), such as Figure 3 The example account is 222222. The business device 30a obtains the source code 301b corresponding to the smart contract. Figure 3 Taking the transfer contract as an example of a smart contract, the source code 301b may include the transfer-out account, the transfer-in account, and the transferred resource value. Further, the business device 30a encodes the source code 301b to obtain the contract file 302b corresponding to the smart contract, such as Figure 3 The example shown is 00…01…11.
[0146] It should be noted that the contract file, source code and the coded file described below are all used to indicate smart contracts, which can be understood as different expressions of smart contracts. For example, source code 301b is a code written by a technician using a computer programming language (such as C / C++ language), contract file 302b is a code obtained by encoding source code 301b by business device 30a, and the coded file mentioned below is a code obtained by encoding contract file 302b by a block node. Among them, the coding method includes but is not limited to compilation and packaging, and compilation can convert high-level languages into binary languages that can be recognized by computers.
[0147] Obviously, the contract file 302b is used to install the smart contract (such as Figure 3 Therefore, the business device 30a needs to obtain the parameters that define the smart contract initialization method, such as Figure 3 The illustrated initial method parameters 303b, which correspond to the source code 301b, may include the transfer account number (i.e. Figure 3Transfer out: 222222), transfer to account (ie Figure 3 333333), transfer resource value (i.e. Figure 3 Further, the business device 30a determines the contract file 302b and the initial method parameter 303b as the first transaction to be on-chain, and installs the contract account 301a (such as Figure 3 The business public key 301c corresponding to the example account 222222) signs the first transaction to be on the chain to obtain the signed message 302c; through the contract installation account 301a, the business device 30a sends the first transaction to be on the chain carrying the signed message 302c to the blockchain network 10.
[0148] It is understandable that each blockchain node in the blockchain network 10 will add the first transaction to be on-chain to its own transaction pool, that is, each blockchain node will perform the same steps and then add the first transaction to be on-chain to its own transaction pool. The transaction pool of the blockchain refers to a collection of transactions that are not packaged into the block and are waiting to be written into the block. In the blockchain network, each node maintains a transaction pool to store new transactions generated by business objects. When a business object initiates a transaction, the transaction will be broadcast to the entire blockchain network; if the transaction complies with the transaction rules and verification rules of the blockchain network, it will be added to the transaction pool of the blockchain node. Transactions in the transaction pool need to wait for verification and confirmation before waiting to be packaged into the block. The transaction pool is one of the important components of the blockchain network. While ensuring that transactions are processed smoothly, it can also improve the efficiency and performance of the blockchain.
[0149] The present application embodiment is described by taking the blockchain node 10a in the blockchain network 10 as an example. Figure 3 As shown, the blockchain node 10a obtains the first transaction to be on-chain that carries the signature message 302c, and verifies the signature message 302c through the business public key 303c corresponding to the contract installation account 301a to obtain the signature verification result. If the signature verification result indicates that the signature message 302c fails to be verified, the blockchain node 10a returns a signature verification failure message to the business device 30a bound to the contract installation account 301a; if the signature verification result indicates that the signature message 302c is successfully verified, the illegal account list 30d is obtained in the blockchain. Among them, the illegal account list 30d includes blockchain accounts with illegal attributes, such as Figure 3 As shown, the illegal account list 30d includes illegal accounts 222220, ..., illegal account 222221.
[0150] Further, blockchain node 10a installs the contract account 301a (such as Figure 3The example account 222222) is compared with the illegal account in the illegal account list 30d; when there is an illegal account identical to the contract installation account 301a in the illegal account list 30d, the blockchain node 10a determines the account verification illegal result as the authority verification result; when there is no illegal account identical to the contract installation account 301a in the illegal account list 30d, the contract installation account 301a is subjected to the contract installation function 30e calling authority verification processing, that is, verifying whether the contract installation account 301a has the authority to call the contract installation function 30e (i.e., the method of creating a contract). If the contract installation account 301a does not have the authority to call the contract installation function 30e, the blockchain node 10a determines the contract installation prohibition result as the authority verification result; if the contract installation account 301a has the authority to call the contract installation function 30e, the authority verification pass result is determined as the authority verification result.
[0151] Please see again Figure 3 If the permission verification result is an illegal account verification result or a contract installation prohibition result, the blockchain node 10a returns a permission verification failure message to the business device 30a; if the permission verification result is a permission verification pass result, the first transaction to be on-chain is added to the transaction pool 30g, such as Figure 4 As shown, Figure 4 This is a schematic diagram of a data processing scenario based on blockchain provided by an embodiment of the present application. Figure 2 .
[0152] When the blockchain node 10a has the authority to generate blocks, the blockchain node 10a, as a block generating node, obtains a batch of transactions to be uploaded from the transaction pool 30g. It is assumed that the batch of transactions to be uploaded includes the first transaction to be uploaded. The blockchain node 10a detects the transaction type of the first transaction to be uploaded. If the transaction type is determined to be a contract installation transaction type, that is, the first transaction to be uploaded is detected to be a transaction for installing a smart contract, the blockchain node 10a obtains the contract file 302b in the first transaction to be uploaded. Figure 4 As shown, the blockchain node 10a detects and processes the contract file 302b, specifically, detects whether the contract file 302b can be started normally, and whether there are loopholes and security issues.
[0153] If the file detection result indicates that the contract file 302b is of an abnormal type, for example, the contract file 302b cannot be started normally or has a vulnerability, the blockchain node 10a returns a file detection exception message to the business device 30a; if the file detection result indicates that the contract file 302b is of a normal type, the contract file is encoded to obtain an encoded file 30h. The encoding process is to obtain a file that can be run in the cluster resource management system, that is, the encoded file 30h. The encoded file 30h can be a compressed package file, that is, a tar file.
[0154] Step S102, sending the encoded file to the master node in the cluster resource management system, so that the master node creates a contract service for the smart contract in the cluster resource management system according to the encoded file; the contract service includes a scheduling component and A execution components running on A working nodes; A is a positive integer; wherein one working node is used to run one execution component; the master node and the A working nodes different from the master node all belong to blockchain nodes in the blockchain.
[0155] For details, please refer to Figure 4 The blockchain node 10a with block-generating authority (referred to as the block-generating node) sends the encoded file 30h to the master node in the cluster resource management system 30i. The cluster resource management system 30i is jointly maintained by all blockchain nodes in the blockchain network. The embodiment of the present application does not limit the number of master nodes, which can be one or more. Figure 4 The example cluster resource management system 30i includes two master nodes, namely, blockchain node 10d and blockchain node 10a. It can be understood that the master node refers to the blockchain node in the cluster resource management system 30i, which is used to manage all resources and tasks in the blockchain node cluster. If there are multiple master nodes (Master), the multiple master nodes are elected through the distributed application (ZooKeeper) coordination service to select a leader (Leader) to handle the tasks in the cluster. The embodiment of the present application uses the blockchain node 10d as an example of the Leader node, which can be understood as the master node that is truly used to manage the blockchain node cluster. The relationship between the Leader node and multiple master nodes can be equivalent to the block node and multiple consensus nodes, that is, the block node is a consensus node with block authority among the consensus nodes. Among them, according to whether it has consensus authority, the blockchain node can be divided into a consensus node and a synchronization node, and according to whether it has the authority to manage the cluster, the blockchain node can be divided into a master node and a working node. It can be understood that the consensus authority and the management cluster authority are two different division criteria.
[0156] Please see again Figure 4 , the master node (such as Figure 4 The blockchain node 10d of the embodiment creates a contract service 30j for the smart contract in the cluster resource management system 30i according to the encoding file 30h. It can be understood that the contract service 30j (Framework) is an application running on Mesos, which can implement resource allocation and elastic expansion algorithms, including a scheduling (Scheduler) component and A execution (Executor) components. The embodiment of the present application does not limit the value of A, which can be a positive integer. Figure 4Example A is equal to 2, that is, the contract service 30j includes two execution components, namely, execution component 1 and execution component 2. Among them, execution component 1 runs on blockchain node 10b (a working node different from the master node), and execution component 2 runs on blockchain node 10c (another working node different from the master node).
[0157] Step S103, sending the first transaction to be on-chain to the scheduling component, so that the scheduling component allocates a first working node for the first transaction to be on-chain among A working nodes; the first working node is used to execute the first transaction to be on-chain in the first execution component; the first execution component refers to the execution component running on the first working node.
[0158] Specifically, the embodiment of the present application does not limit the node where the scheduling component is installed. The scheduling component in the contract service can be run by the master node or by the working node. The embodiment of the present application uses the working node to run the scheduling component. Please refer to Figure 5 , Figure 5 This is a schematic diagram of a data processing scenario based on blockchain provided by an embodiment of the present application. Figure 3 .like Figure 5 As shown, the block node (i.e. Figure 5 The blockchain node 10a in the example sends the first transaction to be uploaded to the blockchain to the working node (i.e. Figure 5 Example blockchain node 10b). Through the scheduling component, the blockchain node 10b as a working node can be in two working nodes (i.e. Figure 4 In the example blockchain node 10b and blockchain node 10c), the first working node is assigned to the first transaction to be on-chain. The first working node in the example of the embodiment of the present application is blockchain node 10b. Further, blockchain node 10b as the first working node executes the first transaction to be on-chain through the first execution component (i.e., the above-mentioned execution component 1).
[0159] As can be seen from the above, load balancing can be achieved by using the embodiments of the present application. Load balancing is a method of distributing workloads between multiple computing resources (such as servers, network connections, or other devices) so as to balance processing tasks on different resources. The main purpose of load balancing is to optimize resource utilization, maximize throughput, minimize response time, avoid resource overload, and ensure the availability and reliability of the system. Load balancing can be applied to different systems and scenarios, such as network load balancing, server load balancing, and database load balancing. Load balancing can be achieved through hardware devices (load balancers) or software solutions (such as proxy servers or applications).
[0160] From the above, it can be seen that the embodiment of the present application can create a contract service for the smart contract in the cluster resource management system, and then the execution task corresponding to the first transaction to be on the chain can be transferred from the block producing node to the contract service, that is, the first transaction to be on the chain is executed by the first working node running the first execution component. Therefore, by adopting the present application, the resource utilization rate of all blockchain nodes can be improved, and then the efficiency of transaction on the chain can be improved.
[0161] For further information, see Figure 6 , Figure 6 This is a flow diagram of a data processing method provided in an embodiment of the present application. Figure 2 The implementation process of the data processing method can be performed in the block node, the master node, the scheduling node, or interactively in the block node, the master node, and the scheduling node, which is not limited here. Figure 1 Any blockchain node in the blockchain node cluster of the corresponding embodiment. Figure 6 The embodiment of the present application is described by taking a block-producing node as an example. Figure 6 As shown, the data processing method may at least include the following steps S201 to S206.
[0162] Step S201, obtaining the first transaction to be on-chain from the transaction pool. If the first transaction to be on-chain is a transaction for installing a smart contract, the first transaction to be on-chain is encoded to obtain an encoded file.
[0163] Step S202, sending the encoded file to the master node in the cluster resource management system, so that the master node creates a contract service for the smart contract in the cluster resource management system according to the encoded file; the contract service includes a scheduling component and A execution components running on A working nodes; A is a positive integer; wherein one working node is used to run one execution component; the master node and the A working nodes different from the master node all belong to blockchain nodes in the blockchain.
[0164] For the specific implementation process of step S201-step S202, please refer to the above Figure 2 The description of step S101 - step S102 in the corresponding embodiment is not repeated here.
[0165] Step S203, sending the first transaction to be on-chain to the scheduling component, so that the scheduling component allocates a first working node for the first transaction to be on-chain among A working nodes; the first working node is used to execute the first transaction to be on-chain in the first execution component; the first execution component refers to the execution component running on the first working node.
[0166] Specifically, the historical reputation value of the first working node is obtained. If the first transaction execution result generated by the first working node after executing the first transaction to be on-chain is obtained, the reputation reward value is obtained according to the first transaction execution result; the first transaction to be on-chain and the first transaction execution result are used to generate a first block to be agreed upon; the reputation reward value is added to the historical reputation value to obtain an updated reputation value of the first working node; if the first working node fails to successfully execute the first transaction to be on-chain, the reputation penalty value is obtained, and the reputation penalty value is added to the historical reputation value to obtain an updated reputation value of the first working node; wherein the updated reputation value of the first working node is used to instruct the scheduling component to determine the working component for executing the transaction to be on-chain among A working nodes.
[0167] This step may also include: comparing the updated reputation value of the first working node with the reputation threshold; if the update threshold of the first working node is less than or equal to the reputation threshold, deleting the first working node in the blockchain; if the update threshold of the first working node is greater than the reputation threshold, retaining the first working node in the blockchain.
[0168] Please see again Figure 5 , through the first execution component (such as Figure 5 In the example execution component 1), the blockchain node 10b as the first working node can execute the first transaction to be on-chain, specifically Figure 3 The example initial method parameters 303b are input to Figure 3 The exemplary contract file 302b is executed.
[0169] If the first transaction to be on-chain is successfully executed through the first execution component and the first transaction execution result is obtained, the first working node (i.e. Figure 5 The blockchain node 10b in returns the first transaction execution result to the block producing node (i.e. Figure 5 At this time, the blockchain node 10a obtains the historical reputation value of the first working node, Figure 5 The example historical reputation value is 2. Further, according to the first transaction execution result, the blockchain node 10a obtains the reputation reward value. Figure 5 The example reputation reward value is 1; the reputation reward value is added to the historical reputation value, for example 2+1, so the blockchain node 10a can obtain the updated reputation value of the first working node, such as Figure 5 3 shown.
[0170] If the first working node fails to successfully execute the first transaction to be uploaded, the block generating node (such as Figure 5 The blockchain node 10a) obtains the reputation penalty value, Figure 5The example reputation penalty value is -1, and the reputation penalty value is added to the historical reputation value, for example 2-1. The blockchain node 10a can obtain the updated reputation value of the first working node, such as Figure 5 1 shown. Among them, the updated reputation value of the first working node is used to instruct the scheduling component to determine the working component for executing the transaction to be on-chain among the A working nodes.
[0171] In addition, after obtaining the first transaction execution result, the blockchain node 10a as a block-producing node can generate a first block to be agreed upon based on the first transaction to be on-chain and the first transaction execution result; further, the first block is broadcast to the remaining consensus nodes in the blockchain network, and the remaining consensus nodes perform consensus processing on the first block to obtain a consensus result. If the consensus node is a consensus passing result, the blockchain node 10a stores the first block and updates the data in the state database. If the consensus result is a consensus failure result, the first block is deleted.
[0172] This step proposes an intelligent scheduling strategy based on the reputation of blockchain nodes. Some blockchain nodes may have poor stability or malicious behavior. For these blockchain nodes, they are evaluated by reputation. When allocating Mesos resource slices, tasks are assigned to nodes with high reputation scores, and nodes with extremely low reputation scores can be kicked out to maintain the stability of the blockchain network.
[0173] Through the above scheme, the present application can ensure that multiple computing nodes reuse computing resources, avoiding the problem of insufficient resources of a single blockchain node, resulting in slow computing; in addition, by ensuring that the number of Executors can be expanded horizontally, the present application can adapt when the number of contract tasks changes; in addition, the present application can ensure that nodes with high reputation scores execute tasks first, and nodes with low reputation scores can be kicked out, so the embodiments of the present application can be widely reused in the industry.
[0174] Step S204, obtaining a second transaction to be uploaded to the chain from the transaction pool; the second transaction to be uploaded to the chain includes a contract identifier.
[0175] Specifically, the off-chain device (ie, the business device) may send the second transaction to be on-chain to the blockchain node. Assuming that the second transaction to be on-chain is a resource transfer transaction, the second transaction to be on-chain includes a contract identifier for indicating the transfer contract.
[0176] Step S205, if the contract identifier is the identifier of a smart contract, the second transaction to be on-chain is sent to the scheduling component, so that the scheduling component allocates a second working node for the second transaction to be on-chain among A working nodes according to the transaction execution resources corresponding to the second transaction to be on-chain and the node idle resources corresponding to the first working node; the second working node is used to execute the second transaction to be on-chain according to the smart contract in the second execution component; the second execution component refers to the execution component running on the second working node.
[0177] Specifically, assuming that the smart contract described in steps S201 and S202 above is a transfer contract, through steps S201 and S202, a contract service of the transfer contract can be constructed in the cluster resource management system.
[0178] If the contract identifier is the identifier of the transfer contract, the block node can send the second transaction to be on-chain to the scheduling component in the contract service. It can be understood that the scheduling component has started the first working node to run the first execution component, so according to the transaction execution resources corresponding to the second transaction to be on-chain and the node idle resources corresponding to the first working node, the scheduling component can allocate the second working node for the second transaction to be on-chain from A working nodes. For the specific implementation process of this process, please refer to the following Fig.10 The description in the corresponding embodiment will not be elaborated here.
[0179] Step S206: If the second transaction execution result generated by the second working node after executing the second transaction to be on-chain is obtained, a second block to be agreed upon is generated according to the second transaction to be on-chain and the second transaction execution result.
[0180] From the above, it can be seen that the embodiment of the present application can create a contract service for the smart contract in the cluster resource management system, and then the execution task corresponding to the first transaction to be on the chain can be transferred from the block producing node to the contract service, that is, the first transaction to be on the chain is executed by the first working node running the first execution component. Therefore, by adopting the present application, the resource utilization rate of all blockchain nodes can be improved, and then the efficiency of transaction on the chain can be improved.
[0181] For further information, see Figure 7 , Figure 7 This is a flow diagram of a data processing method provided in an embodiment of the present application. Figure 3 The implementation process of the data processing method can be performed in the block node, the master node, the scheduling node, or interactively in the block node, the master node, and the scheduling node, which is not limited here. Figure 1 Any blockchain node in the blockchain node cluster of the corresponding embodiment. Figure 7The present application embodiment is described using the master node as an example. Figure 7 As shown, the data processing method may at least include the following steps S301-S302.
[0182] Step S301, obtaining the encoded file sent by the block-producing node in the blockchain; the encoded file is generated by the block-producing node when the transaction to be on-chain is a transaction for installing a smart contract, by encoding the transaction to be on-chain.
[0183] For the specific implementation process of step S301, please refer to the above Figure 2 The description of step S101 - step S102 in the corresponding embodiment is not repeated here.
[0184] Step S302, according to the encoding file, create a contract service for the smart contract in the cluster resource management system; the contract service includes a scheduling component and A execution components running on A working nodes; A is a positive integer; wherein one working node is used to run one execution component; the master node and the A working nodes different from the master node all belong to the blockchain nodes in the blockchain; the scheduling component is used to allocate a working node z to the transaction to be chained in the A working nodes when obtaining the transaction to be chained sent by the block-producing node; the working node z is used to execute the transaction to be chained in the execution component x; the execution component x refers to the execution component running on the working node z.
[0185] Specifically, the total number of blockchain nodes in the blockchain other than the master node is D; D is a positive integer greater than 1; the node idle resources sent by the D blockchain nodes are obtained, and the reputation values corresponding to the D blockchain nodes are obtained; the D blockchain nodes include blockchain node B c , c is a positive integer, and c is less than or equal to D; for blockchain node B c The node idle resources and blockchain node B c The reputation value of blockchain node B is weighted and summed up to get c Corresponding allocation values; according to the allocation values corresponding to the D blockchain nodes, A working nodes are determined among the D blockchain nodes.
[0186] Please also see Figure 8 , Figure 8 This is a blockchain shared computing system architecture based on Apache Mesos provided by the embodiment of the present application. Figure 8 As shown in Figure 1, the Apache Mesos-based blockchain shared computing system architecture specifically describes the internal implementation of the service and the interaction between various modules. The Framework (i.e., the contract service for smart contract 1) is described in detail as follows:
[0187] 1. Scheduler: It is used to manage and schedule tasks in the Mesos cluster. It is responsible for communicating with the master node, receiving resource slices, managing task queues, assigning tasks, detecting task status, and implementing custom scheduling strategies.
[0188] a) Resource allocation, receiving and allocating resource slices;
[0189] b) Elastic expansion: elastically expand the number of executors of contract services according to the idle computing resources of blockchain nodes;
[0190] 2. Executor cluster: A contract service may have multiple executors for calculation. Multiple executors form an execution component cluster to jointly support the calculation of the contract service.
[0191] a) Executor instance, executing contract tasks
[0192] i. Contract main project, smart contract code written by business objects;
[0193] ii. Contract Software Development Kit (SDK), the SDK called by the smart contract;
[0194] iii. Log module, the module for printing contract logs;
[0195] 3. Monitoring module, which monitors the central processing unit (CPU), memory, storage and other resources of the contract Executor;
[0196] a) Indicator collection, responsible for regularly collecting various indicators of the contract Executor;
[0197] b) Monitoring and display: display the collected indicators.
[0198] The embodiments of the present application are mainly used to share the contract computing resources of the blockchain among multiple blockchain nodes, make full use of the computing resources of each blockchain node, and reuse or kick out the blockchain node in the blockchain network according to the reputation of the blockchain node.
[0199] It can be understood that the allocation values corresponding to the D blockchain nodes are sorted in order from large to small, that is, the allocation values with large values are arranged in the front order, and the allocation values with small values are arranged in the back order. Further, according to the sorted D allocation values, the master node determines A working nodes among the D blockchain nodes, specifically obtaining the A working nodes with the allocation values in the front order, that is, the allocation values corresponding to the A working nodes are the first A among the sorted D allocation values.
[0200] The above process enables blockchain contract services to be executed on multiple blockchain nodes (i.e., A working nodes), so computing resources can be shared. Fine-grained resource management can be achieved through the resource slice mechanism of Mesos, so the degree of participation of blockchain nodes can be controlled according to credibility.
[0201] From the above, it can be seen that the embodiment of the present application can create a contract service for the smart contract in the cluster resource management system, and then the execution task corresponding to the first transaction to be on the chain can be transferred from the block producing node to the contract service, that is, the first transaction to be on the chain is executed by the first working node running the first execution component. Therefore, by adopting the present application, the resource utilization rate of all blockchain nodes can be improved, and then the efficiency of transaction on the chain can be improved.
[0202] For further information, see Fig. 9 , Fig. 9 This is a flow diagram of a data processing method provided in an embodiment of the present application. Figure 4 The implementation process of the data processing method can be performed in the block node, the master node, the scheduling node, or interactively in the block node, the master node, and the scheduling node, which is not limited here. Figure 1 Any blockchain node in the blockchain node cluster of the corresponding embodiment. Fig. 9 The present application embodiment is described by taking a scheduling node as an example. Fig. 9 As shown, the data processing method may at least include the following steps S401 to S403.
[0203] Step S401, through the scheduling component, obtain the first transaction to be on-chain sent by the block-producing node in the blockchain; the contract service is created by the master node in the cluster resource management system according to the first transaction to be on-chain.
[0204] For the specific implementation process of step S401, please refer to the above Figure 2 The description of steps S101 to S103 in the corresponding embodiment will not be repeated here.
[0205] Step S402: Determine a first working node among A working nodes according to the first transaction to be on-chain; the A working nodes are respectively used to run A execution components in the contract service; wherein one working node is used to run one execution component.
[0206] Specifically, obtain the node idle resources corresponding to A working nodes and the reputation values corresponding to A working nodes; A working nodes include working nodes E f, f is a positive integer, and f is less than or equal to A; for working node E f The idle resources of nodes and working nodes E f The reputation values of the working node E are weighted and summed to obtain f Corresponding allocation value; among the allocation values corresponding to the A working nodes respectively, obtain the maximum allocation value, and among the A working nodes, determine the working node corresponding to the maximum allocation value as the first working node.
[0207] Step S403, according to the first transaction to be on-chain, start the first execution component in the first working node, so that the first working node executes the first transaction to be on-chain in the first execution component; the first execution component refers to the execution component running on the first working node.
[0208] For the specific implementation process of step S403, please refer to the above Figure 2 The description of step S103 in the corresponding embodiment is not repeated here.
[0209] From the above, it can be seen that the embodiment of the present application can create a contract service for the smart contract in the cluster resource management system, and then the execution task corresponding to the first transaction to be on the chain can be transferred from the block producing node to the contract service, that is, the first transaction to be on the chain is executed by the first working node running the first execution component. Therefore, by adopting the present application, the resource utilization rate of all blockchain nodes can be improved, and then the efficiency of transaction on the chain can be improved.
[0210] For further information, see Fig.10 , Fig.10 This is a flow diagram of a data processing method provided in an embodiment of the present application. Figure 5 The implementation process of the data processing method can be performed in the block node, the master node, the scheduling node, or interactively in the block node, the master node, and the scheduling node, which is not limited here. Figure 1 Any blockchain node in the blockchain node cluster of the corresponding embodiment. Fig.10 The embodiment of the present application is described by taking a block-producing node as an example. Fig.10 As shown, the data processing method may at least include the following steps S501 to S506.
[0211] Step S501, through the scheduling component, obtain the first transaction to be on-chain sent by the block-producing node in the blockchain; the contract service is created by the master node in the cluster resource management system according to the first transaction to be on-chain.
[0212] Step S502: Determine a first working node among A working nodes according to the first transaction to be on-chain; the A working nodes are respectively used to run A execution components in the contract service; wherein one working node is used to run one execution component.
[0213] Step S503, according to the first transaction to be on-chain, start the first execution component in the first working node, so that the first working node executes the first transaction to be on-chain in the first execution component; the first execution component refers to the execution component running on the first working node.
[0214] For the specific implementation process of steps S501 to S503, please refer to the above Fig. 9 The description of steps S401 to S403 in the corresponding embodiment will not be repeated here.
[0215] Step S504: Obtain the second transaction to be uploaded to the chain sent by the block producing node through the scheduling component.
[0216] Specifically, Mesos's two-layer scheduling architecture and fine-grained resource management enable it to have stronger optimization capabilities in resource allocation and utilization, especially when dealing with large data centers and complex task scenarios, Mesos may have higher resource utilization. Therefore, this application proposes a blockchain shared computing solution based on Apache Mesos, which focuses on solving the above problems. The embodiment of this application automatically schedules the contract computing task to the appropriate blockchain node for execution through the resource allocation algorithm of the Mesos Framework, without the need to execute it on only one blockchain node.
[0217] Step S505: Determine the second working node from the A working nodes according to the transaction execution resources corresponding to the second transaction to be on-chain and the node idle resources corresponding to the first working node.
[0218] Specifically, the transaction execution resources corresponding to the second transaction to be on the chain are compared with the node idle resources corresponding to the first working node; if the transaction execution resources corresponding to the second transaction to be on the chain are less than or equal to the node idle resources corresponding to the first working node, the first working node is determined as the second working node; if the transaction execution resources corresponding to the second transaction to be on the chain are greater than the node idle resources corresponding to the first working node, the resource difference between the transaction execution resources corresponding to the second transaction to be on the chain and the node idle resources corresponding to the first working node is determined; if the node idle resources corresponding to the third working node among A working nodes are equal to or greater than the resource difference, the first working node and the third working node are determined as the second working node; the third working node refers to a working node among the A working nodes except the first working node.
[0219] This step may also include: if the node idle resources corresponding to the remaining working nodes among A working nodes except the first working node are less than the resource difference, a resource reallocation request is generated according to the second resource to be on the chain; the resource reallocation request is sent to the master node, so that the master node reallocates G working nodes for the contract service in the cluster resource management system according to the resource reallocation request; G is a positive integer; the node idle resources corresponding to the G working nodes are equal to or greater than the transaction execution resources corresponding to the second transaction to be on the chain.
[0220] Since the number of tasks for different contracts may be different, at a certain point in time, the number of tasks for some contracts will be relatively high. At this time, the contract requires more Executors to support its calculation. The embodiment of the present application is based on the elastic expansion algorithm of the Mesos Framework to perform dynamic changes in the number of Executors.
[0221] Step S506, according to the second transaction to be on-chain, start the second execution component in the second working node, so that the second working node executes the second transaction to be on-chain in the second execution component; the second execution component refers to the execution component running on the second working node.
[0222] Specifically, the application structure is as follows:
[0223] 1. This paper describes the system architecture of the blockchain shared computing solution based on Apache Mesos, including the Scheduler, Executor cluster and monitoring module of the cross-node contract virtual machine service. The above system architecture is the operating basis of the entire environment. The above solution and system architecture ensure the efficient and stable operation of the system.
[0224] 2. Designed the full life cycle process of the blockchain shared computing solution based on Apache Mesos, including the contract installation process based on Apache Mesos (the business object writes the smart contract and compiles it into binary and other contract files and sends them to the blockchain node, the blockchain node is packaged into an image, the Framework and Executor are started in Apache Mesos, and then the contract initialization method is executed), the contract transaction execution process based on Apache Mesos (the blockchain node sends the transaction to the Apache Mesos Master to execute the task), and the intelligent scheduling strategy based on the reputation of the blockchain node (the reputation score is revised based on the results of the transaction execution of each blockchain node, and resources are allocated or the blockchain node is punished according to the reputation score).
[0225] From the above, it can be seen that the embodiment of the present application can create a contract service for the smart contract in the cluster resource management system, and then the execution task corresponding to the first transaction to be on the chain can be transferred from the block producing node to the contract service, that is, the first transaction to be on the chain is executed by the first working node running the first execution component. Therefore, by adopting the present application, the resource utilization rate of all blockchain nodes can be improved, and then the efficiency of transaction on the chain can be improved.
[0226] For further information, see Fig.11 , Fig.11 This is a schematic diagram of a data processing device based on blockchain provided in an embodiment of the present application. Figure 1 .like Fig.11 As shown, the blockchain-based data processing device 1 can be run on a block-producing node. The blockchain-based data processing device 1 can be a computer program (including program code) running in a computer device, for example, the data processing device is an application software; the data processing device can be used to execute the corresponding steps of the method provided in the embodiment of the present application. Fig.11 As shown, the blockchain-based data processing device 1 may include: a first acquisition module 11, a first sending module 12 and a second sending module 13.
[0227] The first acquisition module 11 is used to acquire the first transaction to be uploaded to the chain from the transaction pool. If the first transaction to be uploaded to the chain is a transaction for installing a smart contract, the first transaction to be uploaded to the chain is encoded to obtain an encoded file;
[0228] The first sending module 12 is used to send the encoded file to the master node in the cluster resource management system, so that the master node creates a contract service for the smart contract in the cluster resource management system according to the encoded file; the contract service includes a scheduling component and A execution components running on A working nodes; A is a positive integer; wherein one working node is used to run one execution component; the master node and the A working nodes different from the master node are all blockchain nodes in the blockchain;
[0229] The second sending module 13 is used to send the first transaction to be on-chain to the scheduling component, so that the scheduling component allocates a first working node for the first transaction to be on-chain among A working nodes; the first working node is used to execute the first transaction to be on-chain in the first execution component; the first execution component refers to the execution component running on the first working node.
[0230] The specific functional implementation of the first acquisition module 11, the first sending module 12 and the second sending module 13 can be found in the above Figure 2 Steps S101 to S103 in the corresponding embodiment will not be described in detail here.
[0231] See also Fig.11The blockchain-based data processing device 1 may further include: a second acquisition module 14, a first adding module 15 and a second adding module 16.
[0232] The second acquisition module 14 is used to obtain the historical reputation value of the first working node. If the first transaction execution result generated by the first working node executing the first transaction to be on-chain is obtained, the reputation reward value is obtained according to the first transaction execution result; the first transaction to be on-chain and the first transaction execution result are used to generate the first block to be agreed upon;
[0233] A first adding module 15, configured to add the reputation reward value to the historical reputation value to obtain an updated reputation value of the first working node;
[0234] A second adding module 16 is used to obtain a reputation penalty value if the first working node fails to execute the first transaction to be on-chain, and add the reputation penalty value to the historical reputation value to obtain an updated reputation value of the first working node;
[0235] Among them, the updated reputation value of the first working node is used to instruct the scheduling component to determine the working component for executing the transaction to be on-chain among A working nodes.
[0236] The specific functional implementation of the second acquisition module 14, the first adding module 15 and the second adding module 16 can be found in the above Figure 6 The step S203 in the corresponding embodiment will not be described in detail here.
[0237] See also Fig.11 The blockchain-based data processing device 1 may also include: a reputation comparison module 17, a node deletion module 18 and a node retention module 19.
[0238] A reputation comparison module 17, used to compare the updated reputation value of the first working node with the reputation threshold;
[0239] A node deletion module 18, configured to delete the first working node from the blockchain if the update threshold of the first working node is less than or equal to the reputation threshold;
[0240] The node reservation module 19 is used to reserve the first working node in the blockchain if the update threshold of the first working node is greater than the reputation threshold.
[0241] The specific functional implementation of the reputation comparison module 17, the node deletion module 18 and the node retention module 19 can be found in the above Figure 6 The step S203 in the corresponding embodiment will not be described in detail here.
[0242] See also Fig.11The blockchain-based data processing device 1 may further include: a third sending module 20 and a block generation module 21.
[0243] The first acquisition module 11 is further used to acquire a second transaction to be uploaded to the chain from the transaction pool; the second transaction to be uploaded to the chain includes a contract identifier;
[0244] The third sending module 20 is used for sending the second transaction to be on-chain to the scheduling component if the contract identifier is the identifier of the smart contract, so that the scheduling component allocates a second working node for the second transaction to be on-chain in A working nodes according to the transaction execution resources corresponding to the second transaction to be on-chain and the node idle resources corresponding to the first working node; the second working node is used to execute the second transaction to be on-chain in the second execution component according to the smart contract; the second execution component refers to the execution component running on the second working node;
[0245] The block generation module 21 is used to generate a second block to be agreed upon according to the second transaction to be on-chain and the second transaction execution result if the second transaction execution result generated by the second working node after executing the second transaction to be on-chain is obtained.
[0246] The specific functional implementation of the first acquisition module 11, the third sending module 20 and the block generation module 21 can be found in the above Figure 6 Steps S204 to S206 in the corresponding embodiment will not be described in detail here.
[0247] See also Fig.11 The first acquisition module 11 may include: a first acquisition unit 111, a first processing unit 112 and a second processing unit 113.
[0248] The first acquisition unit 111 is used to acquire a contract file corresponding to the smart contract in the first transaction to be on-chain if the first transaction to be on-chain is a transaction for installing a smart contract; the contract file is generated by encoding the source code corresponding to the smart contract by the business device initiating the first transaction to be on-chain;
[0249] The first processing unit 112 is used to detect and process the contract file to obtain a file detection result. If the file detection result indicates that the contract file is of an abnormal type, a file detection abnormality message is returned to the business device;
[0250] The second processing unit 113 is configured to encode the contract file to obtain an encoded file if the file detection result indicates that the contract file is of a normal type.
[0251] The specific functional implementation of the first acquisition unit 111, the first processing unit 112 and the second processing unit 113 can be found in the above Figure 2The step S101 in the corresponding embodiment will not be described in detail here.
[0252] See also Fig.11 The blockchain-based data processing device 1 may also include: a third acquisition module 22, a first processing module 23, a message return module 24, a second processing module 25 and a third adding module 26.
[0253] The third acquisition module 22 is used to obtain the first transaction to be on-chain with a signature message sent by the contract installation account; the signature message is obtained by the contract installation account signing the first transaction to be on-chain using the business private key;
[0254] The first processing module 23 is used to verify the signature of the signed message through the business public key corresponding to the contract installation account to obtain the signature verification result;
[0255] The message return module 24 is used to return a signature verification failure message to the contract installation account if the signature verification result indicates that the signature message verification fails;
[0256] The second processing module 25 is used to perform permission verification processing on the contract installation account to obtain a permission verification result if the signature verification result indicates that the signature message verification is successful;
[0257] The third adding module 26 is used to add the first transaction to be on-chain to the transaction pool according to the permission verification result.
[0258] The specific functional implementation of the third acquisition module 22, the first processing module 23, the message return module 24, the second processing module 25 and the third adding module 26 can be found in the above Figure 2 The step S101 in the corresponding embodiment will not be described in detail here.
[0259] See also Fig.11 The second processing module 25 may include: a second acquiring unit 251 , a first determining unit 252 , a third processing unit 253 , a second determining unit 254 and a third determining unit 255 .
[0260] The second acquisition unit 251 is used to obtain an illegal account list in the blockchain, and compare the contract installation account with the illegal accounts in the illegal account list;
[0261] The first determining unit 252 is used to determine the illegal account verification result as the authority verification result when there is an illegal account that is the same as the contract installation account in the illegal account list;
[0262] The third processing unit 253 is used to perform a contract installation function call permission verification process on the contract installation account when there is no illegal account identical to the contract installation account in the illegal account list;
[0263] The second determining unit 254 is used to determine the contract installation prohibition result as the permission verification result if the contract installation account does not have the permission to call the contract installation function;
[0264] The third determining unit 255 is used to determine the permission verification result as the permission verification result if the contract installation account has the permission to call the contract installation function;
[0265] The third adding module 26 may include: a message returning unit 261 and a transaction adding unit 262 .
[0266] The message return unit 261 is used to return a permission verification failure message to the contract installation account if the permission verification result is an account verification illegal result or a contract installation prohibited result;
[0267] The transaction adding unit 262 is used to add the first transaction to be on-chain to the transaction pool if the authority verification result is a permission verification pass result.
[0268] The specific functional implementation of the second acquisition unit 251, the first determination unit 252, the third processing unit 253, the second determination unit 254, the third determination unit 255, the message return unit 261 and the transaction adding unit 262 can be found in the above Figure 2 The step S101 in the corresponding embodiment will not be described in detail here.
[0269] From the above, it can be seen that the embodiment of the present application can create a contract service for the smart contract in the cluster resource management system, and then the execution task corresponding to the first transaction to be on the chain can be transferred from the block producing node to the contract service, that is, the first transaction to be on the chain is executed by the first working node running the first execution component. Therefore, by adopting the present application, the resource utilization rate of all blockchain nodes can be improved, and then the efficiency of transaction on the chain can be improved.
[0270] For further information, see Fig.12 , Fig.12 This is a schematic diagram of a data processing device based on blockchain provided in an embodiment of the present application. Figure 2 .like Fig.12 As shown, the blockchain-based data processing device 3 can be run on the master node. The above-mentioned blockchain-based data processing device 3 can be a computer program (including program code) running in a computer device, for example, the data processing device is an application software; the data processing device can be used to execute the corresponding steps of the method provided in the embodiment of the present application. Fig.12As shown, the blockchain-based data processing device 3 may include: a first acquisition module 31 and a service creation module 32.
[0271] The first acquisition module 31 is used to acquire the encoding file sent by the block-producing node in the blockchain; the encoding file is generated by the block-producing node when the transaction to be on-chain is a transaction for installing a smart contract, by encoding the transaction to be on-chain;
[0272] The service creation module 32 is used to create a contract service for the smart contract in the cluster resource management system according to the encoding file; the contract service includes a scheduling component and A execution components running on A working nodes; A is a positive integer; wherein one working node is used to run one execution component; the master node and the A working nodes different from the master node all belong to the blockchain nodes in the blockchain; the scheduling component is used to allocate a working node z to the transaction to be chained among the A working nodes when obtaining the transaction to be chained sent by the block-producing node; the working node z is used to execute the transaction to be chained in the execution component x; the execution component x refers to the execution component running on the working node z.
[0273] The specific functional implementation of the first acquisition module 31 and the service creation module 32 can be found in the above Figure 7 The steps S301 and S302 in the corresponding embodiment will not be described in detail here.
[0274] See also Fig.12 , the total number of blockchain nodes in the blockchain except the master node is D; D is a positive integer greater than 1;
[0275] The blockchain-based data processing device 3 may further include: a second acquisition module 33 , a weighted summation module 34 and a node determination module 35 .
[0276] The second acquisition module 33 is used to obtain the node idle resources sent by D blockchain nodes respectively, and the reputation values corresponding to the D blockchain nodes respectively; the D blockchain nodes include blockchain node B c , c is a positive integer, and c is less than or equal to D;
[0277] Weighted sum module 34, used for blockchain node B c The node idle resources and blockchain node B c The reputation value of blockchain node B is weighted and summed up to get c The corresponding assigned value;
[0278] The node determination module 35 is used to determine A working nodes among the D blockchain nodes according to the allocation values corresponding to the D blockchain nodes respectively.
[0279] The specific functional implementation of the second acquisition module 33, the weighted sum module 34 and the node determination module 35 can be found in the above Figure 7 The step S302 in the corresponding embodiment will not be described in detail here.
[0280] From the above, it can be seen that the embodiment of the present application can create a contract service for the smart contract in the cluster resource management system, and then the execution task corresponding to the first transaction to be on the chain can be transferred from the block producing node to the contract service, that is, the first transaction to be on the chain is executed by the first working node running the first execution component. Therefore, by adopting the present application, the resource utilization rate of all blockchain nodes can be improved, and then the efficiency of transaction on the chain can be improved.
[0281] For further information, see Fig.13 , Fig.13 This is a schematic diagram of a data processing device based on blockchain provided in an embodiment of the present application. Figure 3 .like Fig.13 As shown, the blockchain-based data processing device 4 can be run on the scheduling node. The above-mentioned blockchain-based data processing device 4 can be a computer program (including program code) running in a computer device, for example, the data processing device is an application software; the data processing device can be used to execute the corresponding steps of the method provided in the embodiment of the present application. Fig.13 As shown, the blockchain-based data processing device 4 may include: a first acquisition module 41, a first determination module 42 and a first starting module 43.
[0282] The first acquisition module 41 is used to acquire the first transaction to be on-chain sent by the block-producing node in the blockchain through the scheduling component; the contract service is created by the master node in the cluster resource management system according to the first transaction to be on-chain;
[0283] The first determination module 42 is used to determine the first working node among the A working nodes according to the first transaction to be on-chain; the A working nodes are respectively used to run the A execution components in the contract service; wherein one working node is used to run one execution component;
[0284] The first startup module 43 starts the first execution component in the first working node according to the first transaction to be on-chain, so that the first working node executes the first transaction to be on-chain in the first execution component; the first execution component refers to the execution component running on the first working node.
[0285] The specific functional implementation of the first acquisition module 41, the first determination module 42 and the first start module 43 can be found in the above Fig. 9 Steps S401 to S403 in the corresponding embodiment are not described in detail here.
[0286] See also Fig.13 The first determining module 42 may include: a first acquiring unit 421 , a weighted summing unit 422 , and a second acquiring unit 423 .
[0287] The first acquisition unit 421 is used to acquire the node idle resources corresponding to A working nodes and the reputation values corresponding to A working nodes; the A working nodes include working nodes E f , f is a positive integer, and f is less than or equal to A;
[0288] The weighted summing unit 422 is used to calculate the weight of the working node E. f The idle resources of nodes and working nodes E f The reputation values of the working node E are weighted and summed to obtain f The corresponding assigned value;
[0289] The second acquisition unit 423 is used to acquire a maximum allocation value among the allocation values corresponding to the A working nodes, and determine the working node corresponding to the maximum allocation value among the A working nodes as the first working node.
[0290] The specific functional implementation of the first acquisition unit 421, the weighted summation unit 422 and the second acquisition unit 423 can be found in the above Fig. 9 The step S402 in the corresponding embodiment will not be described in detail here.
[0291] See also Fig.13 The blockchain-based data processing device 4 may further include: a second acquisition module 44, a second determination module 45 and a second start-up module 46.
[0292] The second acquisition module 44 is used to acquire the second transaction to be uploaded to the chain sent by the block generation node through the scheduling component;
[0293] A second determination module 45 is used to determine a second working node from the A working nodes according to the transaction execution resources corresponding to the second transaction to be on-chain and the node idle resources corresponding to the first working node;
[0294] The second startup module 46 is used to start the second execution component in the second working node according to the second transaction to be on-chain, so that the second working node executes the second transaction to be on-chain in the second execution component; the second execution component refers to the execution component running on the second working node.
[0295] The specific functional implementation of the second acquisition module 44, the second determination module 45 and the second start module 46 can be found in the above Fig.10 Steps S504 to S506 in the corresponding embodiment will not be described in detail here.
[0296] See also Fig.13 The second determination module 45 may include: a resource comparison unit 451 , a first determination unit 452 , a second determination unit 453 and a third determination unit 454 .
[0297] The resource comparison unit 451 is used to compare the transaction execution resources corresponding to the second transaction to be on-chain with the node idle resources corresponding to the first working node;
[0298] The first determining unit 452 is configured to determine the first working node as the second working node if the transaction execution resources corresponding to the second transaction to be on-chain are less than or equal to the node idle resources corresponding to the first working node;
[0299] The second determining unit 453 is used to determine the resource difference between the transaction execution resources corresponding to the second transaction to be on-chain and the node idle resources corresponding to the first working node if the transaction execution resources corresponding to the second transaction to be on-chain are greater than the node idle resources corresponding to the first working node;
[0300] The third determination unit 454 is used to determine the first working node and the third working node as the second working node if the node idle resources corresponding to the third working node among the A working nodes are equal to or greater than the resource difference; the third working node refers to the working node other than the first working node among the A working nodes.
[0301] The specific functional implementation of the resource comparison unit 451, the first determination unit 452, the second determination unit 453 and the third determination unit 454 can be referred to above. Fig.10 The step S505 in the corresponding embodiment will not be described in detail here.
[0302] See also Fig.13 The second determining module 45 may further include: a request generating unit 455 and a request sending unit 456 .
[0303] The request generating unit 455 is configured to generate a resource reallocation request according to the second resource to be uploaded if the node idle resources corresponding to the remaining working nodes among the A working nodes except the first working node are less than the resource difference;
[0304] The request sending unit 456 is used to send a resource reallocation request to the master node, so that the master node reallocates G working nodes for the contract service in the cluster resource management system according to the resource reallocation request; G is a positive integer; the node idle resources corresponding to the G working nodes are equal to or greater than the transaction execution resources corresponding to the second transaction to be on the chain.
[0305] The specific functional implementation of the request generation unit 455 and the request sending unit 456 can be found in the above Fig.10 The step S505 in the corresponding embodiment will not be described in detail here.
[0306] From the above, it can be seen that the embodiment of the present application can create a contract service for the smart contract in the cluster resource management system, and then the execution task corresponding to the first transaction to be on the chain can be transferred from the block producing node to the contract service, that is, the first transaction to be on the chain is executed by the first working node running the first execution component. Therefore, by adopting the present application, the resource utilization rate of all blockchain nodes can be improved, and then the efficiency of transaction on the chain can be improved.
[0307] For further information, see Fig.14 , Fig.14 Schematic diagram of the structure of a computer device provided in an embodiment of the present application. Fig.14 As shown, the computer device 1000 may include: at least one processor 1001, such as a CPU, at least one network interface 1004, a user interface 1003, a memory 1005, and at least one communication bus 1002. The communication bus 1002 is used to realize the connection and communication between these components. In some embodiments, the user interface 1003 may include a display screen (Display) and a keyboard (Keyboard), and the network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as at least one disk storage. The memory 1005 may optionally also be at least one storage device located away from the aforementioned processor 1001. As shown in FIG. Fig.14 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a device control application.
[0308] exist Fig.14 In the computer device 1000 shown, the network interface 1004 can provide a network communication function; the user interface 1003 is mainly used to provide an input interface for the user; and the processor 1001 can be used to call the device control application stored in the memory 1005 to achieve:
[0309] Obtaining a first transaction to be uploaded to the chain from the transaction pool. If the first transaction to be uploaded to the chain is a transaction for installing a smart contract, encoding the first transaction to be uploaded to the chain to obtain an encoded file;
[0310] Send the encoded file to the master node in the cluster resource management system, so that the master node creates a contract service for the smart contract in the cluster resource management system according to the encoded file; the contract service includes a scheduling component and A execution components running on A working nodes; A is a positive integer; wherein one working node is used to run one execution component; the master node and the A working nodes different from the master node are all blockchain nodes in the blockchain;
[0311] The first transaction to be on-chain is sent to the scheduling component, so that the scheduling component allocates a first working node for the first transaction to be on-chain among A working nodes; the first working node is used to execute the first transaction to be on-chain in the first execution component; the first execution component refers to the execution component running on the first working node.
[0312] Alternatively, the processor 1001 may be configured to call a device control application stored in the memory 1005 to implement:
[0313] Obtain the encoded file sent by the block-producing node in the blockchain; the encoded file is generated by the block-producing node when the transaction to be on-chain is a transaction for installing a smart contract, by encoding the transaction to be on-chain;
[0314] According to the coding file, a contract service is created for the smart contract in the cluster resource management system; the contract service includes a scheduling component and A execution components running on A working nodes; A is a positive integer; wherein, one working node is used to run one execution component; the master node and A working nodes different from the master node all belong to the blockchain nodes in the blockchain; the scheduling component is used to allocate working node z to the transaction to be chained in the A working nodes when obtaining the transaction to be chained sent by the block-producing node; the working node z is used to execute the transaction to be chained in the execution component x; the execution component x refers to the execution component running on the working node z.
[0315] Alternatively, the processor 1001 may be configured to call a device control application stored in the memory 1005 to implement:
[0316] The first transaction to be on-chain sent by the block-producing node in the blockchain is obtained through the scheduling component; the contract service is created by the master node in the cluster resource management system according to the first transaction to be on-chain;
[0317] According to the first transaction to be on-chain, a first working node is determined among A working nodes; the A working nodes are respectively used to run A execution components in the contract service; wherein one working node is used to run one execution component;
[0318] According to the first transaction to be on-chain, the first execution component in the first working node is started, so that the first working node executes the first transaction to be on-chain in the first execution component; the first execution component refers to the execution component running on the first working node.
[0319] It should be understood that the computer device 1000 described in the embodiment of the present application can execute the description of the data processing method or device in the above embodiments, which will not be repeated here. In addition, the description of the beneficial effects of adopting the same method will not be repeated.
[0320] The present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the description of the data processing method or device in the above embodiments is implemented, which will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated.
[0321] The computer-readable storage medium may be the data processing device provided in any of the aforementioned embodiments or the internal storage unit of the computer device, such as the hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (smart media card, SMC), a secure digital (secure digital, SD) card, a flash card (flash card), etc. equipped on the computer device. Further, the computer-readable storage medium may also include both the internal storage unit of the computer device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
[0322] The present application also provides a computer program product, which includes a computer program stored in a computer-readable storage medium. The processor of the computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device can execute the description of the data processing method or device in the above embodiments, which will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated.
[0323] The terms "first", "second", etc. in the description, claims, and drawings of the embodiments of the present application are used to distinguish different objects, rather than to describe a specific order. In addition, the term "comprising" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, device, product, or equipment that includes a series of steps or units is not limited to the listed steps or modules, but optionally includes steps or modules that are not listed, or optionally includes other step units inherent to these processes, methods, devices, products, or equipment.
[0324] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0325] The above disclosure is only the preferred embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A data processing method based on blockchain, characterized in that: The method is performed by a block-producing node, and the method includes: Obtaining a first transaction to be uploaded to the chain from the transaction pool. If the first transaction to be uploaded to the chain is a transaction for installing a smart contract, encoding the first transaction to be uploaded to the chain to obtain an encoded file; Send the encoded file to a master node in a cluster resource management system, so that the master node creates a contract service for the smart contract in the cluster resource management system according to the encoded file; the contract service includes a scheduling component and A execution components running on A working nodes; A is a positive integer; wherein one working node is used to run one execution component; the master node and the A working nodes other than the master node are all blockchain nodes in the blockchain; The first transaction to be on-chain is sent to the scheduling component, so that the scheduling component allocates a first working node for the first transaction to be on-chain among the A working nodes; the first working node is used to execute the first transaction to be on-chain in a first execution component; the first execution component refers to an execution component running on the first working node.
2. The method according to claim 1, characterized in that: The method further comprises: Obtaining the historical reputation value of the first working node, and if the first transaction execution result generated by the first working node executing the first transaction to be on-chain is obtained, obtaining the reputation reward value according to the first transaction execution result; the first transaction to be on-chain and the first transaction execution result are used to generate a first block to be agreed upon; Adding the reputation reward value to the historical reputation value to obtain an updated reputation value of the first working node; If the first working node fails to execute the first transaction to be on-chain successfully, obtaining a reputation penalty value, and adding the reputation penalty value to the historical reputation value to obtain an updated reputation value of the first working node; The updated reputation value of the first working node is used to instruct the scheduling component to determine a working component for executing the transaction to be on-chain among the A working nodes.
3. The method according to claim 2, characterized in that Also includes: Comparing the updated reputation value of the first working node with the reputation threshold; If the update threshold of the first working node is less than or equal to the reputation threshold, deleting the first working node in the blockchain; If the update threshold of the first working node is greater than the reputation threshold, the first working node is retained in the blockchain.
4. The method according to claim 1, characterized in that: The method further comprises: Acquire a second transaction to be uploaded to the chain from the transaction pool; the second transaction to be uploaded to the chain includes a contract identifier; If the contract identifier is the identifier of the smart contract, the second transaction to be on-chain is sent to the scheduling component, so that the scheduling component allocates a second working node for the second transaction to be on-chain among the A working nodes according to the transaction execution resources corresponding to the second transaction to be on-chain and the node idle resources corresponding to the first working node; the second working node is used to execute the second transaction to be on-chain in the second execution component according to the smart contract; the second execution component refers to the execution component running on the second working node; If the second transaction execution result generated by the second working node executing the second transaction to be on-chain is obtained, a second block to be agreed upon is generated according to the second transaction to be on-chain and the second transaction execution result.
5. The method according to claim 1, characterized in that If the first transaction to be on-chain is a transaction for installing a smart contract, the first transaction to be on-chain is encoded to obtain an encoded file, including: If the first transaction to be on-chain is a transaction for installing a smart contract, a contract file corresponding to the smart contract is obtained in the first transaction to be on-chain; the contract file is generated by encoding the source code corresponding to the smart contract by the business device initiating the first transaction to be on-chain; Performing detection processing on the contract file to obtain a file detection result, and if the file detection result indicates that the contract file is of an abnormal type, returning a file detection abnormality message to the business device; If the file detection result indicates that the contract file is of a normal type, the contract file is encoded to obtain an encoded file.
6. The method according to claim 1, characterized in that The method further comprises: Obtaining the first transaction to be on-chain that carries a signature message sent by the contract installation account; the signature message is obtained by the contract installation account signing the first transaction to be on-chain using a business private key; The signed message is verified using the business public key corresponding to the contract installation account to obtain the signature verification result; If the signature verification result indicates that the signature message verification failed, a signature verification failure message is returned to the contract installation account; If the signature verification result indicates that the signature message verification is successful, the contract installation account is subjected to permission verification to obtain a permission verification result; According to the permission verification result, the first transaction to be on-chain is added to the transaction pool.
7. The method according to claim 6, characterized in that The performing of permission verification processing on the contract installation account to obtain a permission verification result includes: Obtaining a list of illegal accounts in the blockchain, and comparing the contract installation account with the illegal accounts in the list of illegal accounts; When there is an illegal account in the illegal account list that is the same as the contract installation account, the account verification illegality result is determined as the authority verification result; When there is no illegal account identical to the contract installation account in the illegal account list, the contract installation function call permission verification process is performed on the contract installation account; If the contract installation account does not have the authority to call the contract installation function, the contract installation prohibition result is determined as the authority verification result; If the contract installation account has the permission to call the contract installation function, the permission verification result is determined as the permission verification result; Then, according to the permission verification result, adding the first transaction to be on-chain to the transaction pool includes: If the permission verification result is an illegal result of the account verification or a prohibited result of the contract installation, a permission verification failure message is returned to the contract installation account; If the permission verification result is the permission verification passed result, the first transaction to be on-chain is added to the transaction pool.
8. A data processing method based on blockchain, characterized in that: The method is executed by a master node in a cluster resource management system, and the cluster resource management system is jointly maintained by all blockchain nodes in the blockchain. The method includes: Obtaining an encoding file sent by a block producing node in the blockchain; the encoding file is generated by the block producing node encoding the transaction to be put on the chain when the transaction to be put on the chain is a transaction for installing a smart contract; According to the encoding file, a contract service is created for the smart contract in the cluster resource management system; the contract service includes a scheduling component and A execution components running on A working nodes; A is a positive integer; wherein one working node is used to run one execution component; the master node and the A working nodes different from the master node all belong to blockchain nodes in the blockchain; the scheduling component is used to allocate a working node z to the transaction to be chained among the A working nodes when the transaction to be chained sent by the block-producing node is obtained; the working node z is used to execute the transaction to be chained in the execution component x; the execution component x refers to the execution component running on the working node z.
9. The method according to claim 8, characterized in that The total number of blockchain nodes in the blockchain excluding the master node is D; D is a positive integer greater than 1; The method further comprises: Obtain the node idle resources sent by the D blockchain nodes respectively, and the reputation values corresponding to the D blockchain nodes respectively; the D blockchain nodes include blockchain node B c , c is a positive integer, and c is less than or equal to D; For the blockchain node B c The node idle resources and the blockchain node B c The reputation value of the blockchain node B is weighted and summed to obtain c The corresponding assigned value; According to the allocation values respectively corresponding to the D blockchain nodes, the A working nodes are determined among the D blockchain nodes.
10. A data processing method based on blockchain, characterized in that: The method is performed by a blockchain node having a scheduling component in a contract service, and the method includes: The scheduling component obtains a first transaction to be on-chain sent by a block-producing node in the blockchain; the contract service is created by a master node in the cluster resource management system according to the first transaction to be on-chain; According to the first transaction to be on-chain, determine a first working node among A working nodes; the A working nodes are respectively used to run A execution components in the contract service; wherein one working node is used to run one execution component; According to the first transaction to be on-chain, the first execution component in the first working node is started, so that the first working node executes the first transaction to be on-chain in the first execution component; the first execution component refers to the execution component running on the first working node.
11. The method according to claim 10, characterized in that The determining, according to the first transaction to be on-chain, a first working node from A working nodes comprises: Obtain the node idle resources corresponding to the A working nodes and the reputation values corresponding to the A working nodes; the A working nodes include working node E f , f is a positive integer, and f is less than or equal to A; For the working node E f The node idle resources and the working node E f The reputation values of the working node E are weighted and summed to obtain f The corresponding assigned value; The maximum allocated value is obtained among the allocated values respectively corresponding to the A working nodes, and the working node corresponding to the maximum allocated value is determined as the first working node among the A working nodes.
12. The method according to claim 10, characterized in that The method further comprises: Obtaining, through the scheduling component, a second transaction to be on-chain sent by the block producing node; Determine a second working node from the A working nodes according to the transaction execution resources corresponding to the second transaction to be on-chain and the node idle resources corresponding to the first working node; According to the second transaction to be on-chain, the second execution component in the second working node is started so that the second working node executes the second transaction to be on-chain in the second execution component; the second execution component refers to the execution component running on the second working node.
13. The method according to claim 12, characterized in that The determining the second working node from the A working nodes according to the transaction execution resources corresponding to the second transaction to be on-chain and the node idle resources corresponding to the first working node includes: Compare the transaction execution resources corresponding to the second transaction to be on-chain with the node idle resources corresponding to the first working node; If the transaction execution resources corresponding to the second transaction to be on-chain are less than or equal to the node idle resources corresponding to the first working node, the first working node is determined as the second working node; If the transaction execution resources corresponding to the second transaction to be on-chain are greater than the node idle resources corresponding to the first working node, determine the resource difference between the transaction execution resources corresponding to the second transaction to be on-chain and the node idle resources corresponding to the first working node; If the node idle resources corresponding to the third working node among the A working nodes are equal to or greater than the resource difference, the first working node and the third working node are determined as the second working node; the third working node refers to the working node among the A working nodes other than the first working node.
14. The method according to claim 13, characterized in that Also includes: If the node idle resources corresponding to the remaining working nodes among the A working nodes except the first working node are less than the resource difference, generating a resource reallocation request according to the second resource to be uploaded; The resource reallocation request is sent to the master node, so that the master node reallocates G working nodes for the contract service in the cluster resource management system according to the resource reallocation request; G is a positive integer; the node idle resources corresponding to the G working nodes are equal to or greater than the transaction execution resources corresponding to the second transaction to be on-chain.
15. A data processing device based on blockchain, characterized in that: The device runs on a block-producing node, and includes: A first acquisition module, used to acquire a first transaction to be uploaded to the chain from the transaction pool, and if the first transaction to be uploaded to the chain is a transaction for installing a smart contract, encode the first transaction to be uploaded to the chain to obtain an encoded file; A first sending module is used to send the encoded file to a master node in a cluster resource management system, so that the master node creates a contract service for the smart contract in the cluster resource management system according to the encoded file; the contract service includes a scheduling component and A execution components running on A working nodes; A is a positive integer; wherein one working node is used to run one execution component; the master node and the A working nodes different from the master node are all blockchain nodes in the blockchain; The second sending module is used to send the first transaction to be on-chain to the scheduling component, so that the scheduling component allocates a first working node for the first transaction to be on-chain among the A working nodes; the first working node is used to execute the first transaction to be on-chain in the first execution component; the first execution component refers to the execution component running on the first working node.
16. A data processing device based on blockchain, characterized in that: The device runs on a master node in a cluster resource management system, and the cluster resource management system is jointly maintained by all blockchain nodes in the blockchain. The device includes: A first acquisition module is used to acquire a coding file sent by a block-producing node in the blockchain; the coding file is generated by the block-producing node encoding the transaction to be put on the chain when the transaction to be put on the chain is a transaction for installing a smart contract; A service creation module, used to create a contract service for the smart contract in the cluster resource management system according to the encoding file; the contract service includes a scheduling component and A execution components running on A working nodes; A is a positive integer; wherein one working node is used to run one execution component; the master node and the A working nodes different from the master node all belong to blockchain nodes in the blockchain; the scheduling component is used to allocate a working node z to the transaction to be on the chain among the A working nodes when the transaction to be on the chain sent by the block-producing node is obtained; the working node z is used to execute the transaction to be on the chain in the execution component x; the execution component x refers to the execution component running on the working node z.
17. A data processing device based on blockchain, characterized in that: The device runs on a blockchain node having a scheduling component in a contract service, and the device includes: A first acquisition module is used to acquire, through the scheduling component, a first transaction to be on-chain sent by a block-producing node in the blockchain; the contract service is created by a master node in the cluster resource management system according to the first transaction to be on-chain; A first determination module, configured to determine a first working node among A working nodes according to the first transaction to be on-chain; the A working nodes are respectively used to run A execution components in the contract service; wherein one working node is used to run one execution component; The first startup module is used to start the first execution component in the first working node according to the first transaction to be on-chain, so that the first working node executes the first transaction to be on-chain in the first execution component; the first execution component refers to the execution component running on the first working node.
18. A computer device, characterized in that: include: Processor, memory, and network interface; The processor is connected to the memory and the network interface, wherein the network interface is used to provide a data communication function, the memory is used to store a computer program, and the processor is used to call the computer program so that the computer device executes the method described in any one of claims 1 to 14.
19. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded and executed by a processor, so that a computer device having the processor executes the method according to any one of claims 1 to 14.
20. A computer program product, characterized in that The computer program product comprises a computer program, which is stored in a computer-readable storage medium. The computer program is suitable for being read and executed by a processor, so that a computer device having the processor executes the method according to any one of claims 1 to 14.