Data processing method, device and equipment based on block chain and readable storage medium
By using hierarchical calculation contracts in the blockchain to process according to the hierarchical order of transaction data, the problem that blockchain is difficult to ensure fairness and timeliness when processing transaction data is solved, and efficient and timely processing of transaction data is achieved.
Patent Information
- Application Number
- CN202311102765.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-29
- Publication Date
- 2025-02-28
AI Technical Summary
When blockchain processes transaction data, it is difficult for existing technology to meet the urgent processing needs of transaction data in a timely manner while ensuring fairness.
By calling the level calculation contract in the blockchain, packaging and on-chain processing is carried out according to the hierarchical order of the transaction data, ensuring that emergency transaction data is processed in a timely manner while maintaining fairness.
It has achieved a balance between fairness and emergency processing needs in blockchain transaction data processing business, and improved the timeliness and fairness of transaction data processing.
Smart Images

Figure CN119539946A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a blockchain-based data processing method, device, equipment, and readable storage medium. Background Art
[0002] Blockchain is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. It is mainly used to organize data in chronological order and encrypt it into a ledger to make it impossible to be tampered with or forged. At the same time, it can verify, store and update data. Blockchain can also perform data encryption transmission, node identification and secure access, and is an advanced distributed infrastructure. At present, due to the immutability and authenticity of blockchain, more and more blockchain applications are being used. Many institutions (such as banks, certain enterprises, etc.) use blockchain to store relevant business data and perform related business operations.
[0003] In the related technology, when blockchain processes transaction data, it usually processes it in the order of the submission time of the transaction data. That is to say, the earlier the submission time of the transaction data, the faster the blockchain will process the transaction data. Although this transaction data processing method has a certain degree of fairness, some special transaction data that needs to be processed as soon as possible may not be processed in time, which will also cause the business related to the transaction data to not receive a timely response. Therefore, for the scenario of blockchain processing transaction data, how to ensure fairness while meeting the urgent processing needs of transaction data in a timely manner is an urgent problem to be solved. Summary of the invention
[0004] The embodiments of the present application provide a blockchain-based data processing method, apparatus, device, and readable storage medium, which can achieve fairness in the transaction data processing business of the blockchain while promptly meeting the urgent processing needs of transaction data.
[0005] On the one hand, an embodiment of the present application provides a data processing method based on blockchain, including:
[0006] After receiving the set of transaction data to be uploaded to the chain, the level calculation contract is called. Through the calculation logic indicated by the level calculation contract, each transaction data to be uploaded to the chain in the set of transaction data to be uploaded to the chain is graded and processed to obtain the transaction level of each transaction data to be uploaded to the chain. The level calculation contract is created and deployed by the level calculation factory contract.
[0007] When the transaction packaging time is reached, the packaged transaction data at the transaction packaging time is determined in the transaction data set to be uploaded according to the level order between the transaction levels of each transaction data to be uploaded;
[0008] The packaged transaction data is packaged and uploaded to the chain.
[0009] On the one hand, an embodiment of the present application provides a data processing device based on blockchain, including:
[0010] The contract calling module is used to call the level calculation contract after receiving the transaction data set to be uploaded to the chain;
[0011] The level calculation module is used to perform level calculation processing on each transaction data to be put on the chain in the transaction data set to be put on the chain through the calculation logic indicated by the level calculation contract, and obtain the transaction level of each transaction data to be put on the chain; the level calculation contract is created and deployed by the level calculation factory contract;
[0012] A data determination module is used to determine the packaged transaction data at the transaction packaging time in the transaction data set to be uploaded to the chain according to the level order between the transaction levels of each transaction data to be uploaded to the chain when the transaction packaging time is reached;
[0013] The packaging and chain-uploading module is used to package the transaction data and upload it to the chain.
[0014] In one embodiment, the blockchain-based data processing device may further include:
[0015] The request sending module is used to generate a contract on-chain request for the level calculation contract, and send the contract on-chain request to N organization sub-objects belonging to the decentralized governance organization; N is a positive integer;
[0016] An information receiving module is used to receive voting information returned by N organization sub-objects to obtain N voting information;
[0017] The valid voting acquisition module is used to acquire the valid voting information from N voting information;
[0018] A contract attribute determination module, used to determine the contract attributes of the grade calculation contract based on the valid voting information;
[0019] The step execution module is used to execute the calling level calculation contract if it is determined that the contract attribute of the level calculation contract is a contract feasible attribute. Through the calculation logic indicated by the level calculation contract, each transaction data to be put on the chain in the set of transaction data to be put on the chain is level calculated to obtain the transaction level of each transaction data to be put on the chain.
[0020] In one embodiment, the N organization sub-objects include an organization sub-object S i , N voting information includes the organization sub-object S i Returned voting information T i ; i is a positive integer;
[0021] The specific method of obtaining valid voting information from the N voting information by the valid voting acquisition module includes:
[0022] In voting information i Get the organization sub-object S i The signature information is the signature information of the organization sub-object S i The private key of the voting information T i The information obtained after signing;
[0023] Get the organization sub-object S i The public key of the organization sub-object S i The public key of the voting information T i Perform attribute classification processing to obtain voting information T i Voting attributes;
[0024] When the voting attribute of each piece of voting information in the N pieces of voting information is determined, the voting information whose voting attribute is a valid attribute is determined as valid voting information.
[0025] In one embodiment, the effective vote acquisition module is based on the organization sub-object S i The public key of the voting information T i Perform attribute classification processing to obtain voting information T i The specific methods of voting attributes include:
[0026] Based on the organization sub-object S i The public key of the signature is used to verify the signature information and obtain the verification result;
[0027] If the signature verification result is a passing result, the voting information T is determined. i The voting attributes of are valid attributes;
[0028] If the signature verification result is a failure, the voting information T is determined. i The voting attribute is invalid.
[0029] In one embodiment, the specific manner in which the contract attribute determination module determines the contract attribute of the grade calculation contract based on the valid voting information includes:
[0030] Count the number of votes that have passed in the valid voting information, and the total number of valid voting information;
[0031] Determine the quantitative ratio between the number of passes and the total number;
[0032] If the quantity ratio is greater than the ratio threshold, the contract attribute of the level calculation contract is determined to be a feasible contract attribute;
[0033] If the quantity ratio is less than the ratio threshold, the contract attribute of the level calculation contract is determined to be a contract infeasible attribute.
[0034] In one embodiment, the hierarchical computing contract includes a first hierarchical computing contract; the transaction data set to be uploaded includes the transaction data D to be uploaded a ; a is a positive integer;
[0035] The level calculation module performs level calculation processing on each transaction data to be on-chain in the set of transaction data to be on-chain through the calculation logic indicated by the level calculation contract, and obtains the specific method of the transaction level of each transaction data to be on-chain, including:
[0036] According to the calculation logic of the first-level calculation contract, obtain the transaction data D to be uploaded to the chain a The transaction execution contract to which it belongs;
[0037] According to the contract type of the transaction execution contract, determine the transaction data D to be uploaded to the chain a The urgency of the transaction;
[0038] Based on the mapping relationship between the configuration urgency interval set and the first configuration level set in the first level mapping table, the transaction data D to be uploaded to the chain is determined in the first configuration level set. a transaction level; in the first level mapping table, a mapping relationship exists between a configuration urgency interval in the configuration urgency interval set and a first configuration level in the first configuration level set.
[0039] In one embodiment, the hierarchical computing contract includes a second hierarchical computing contract; the transaction data set to be uploaded includes the transaction data D to be uploaded a ; a is a positive integer;
[0040] The level calculation module performs level calculation processing on each transaction data to be on-chain in the set of transaction data to be on-chain through the calculation logic indicated by the level calculation contract, and obtains the specific method of the transaction level of each transaction data to be on-chain, including:
[0041] According to the calculation logic indicated by the second-level calculation contract, obtain the transaction data D to be uploaded to the chain a Reward resources refer to the resources that can be obtained by calculating the transaction data to be uploaded to the chain;
[0042] Based on the mapping relationship between the configuration resource interval set and the second configuration level set in the second level mapping table, the transaction data D to be uploaded to the chain is determined in the second configuration level set. a in the second level mapping table, a mapping relationship exists between a configuration resource interval in the configuration resource interval set and a second configuration level in the second configuration level set.
[0043] In one embodiment, the transaction data set to be uploaded to the chain includes the transaction data D to be uploaded to the chain a ; a is a positive integer;
[0044] After the level calculation module obtains the transaction level of each transaction data to be uploaded to the blockchain, the blockchain-based data processing device may further include:
[0045] The queue determination module is used to determine the transaction data D to be uploaded to the chain. a The transaction level of the transaction is determined in the transaction queue sequence to determine the transaction data D to be uploaded to the chain a The transaction queue to which it belongs; the transaction queue sequence is the sequence obtained by sorting the M transaction queues according to the queue level order between the M transaction queues; M is a positive integer;
[0046] Data adding module, used to add transaction data D to be uploaded to the chain a Add to the transaction data to be uploaded to the chain D a The transaction queue to which it belongs.
[0047] In one embodiment, the transaction queue sequence includes a transaction queue K u , u is a positive integer;
[0048] When the transaction packaging time is reached, the data determination module determines the specific method of packaging the transaction data at the transaction packaging time in the transaction data set to be uploaded according to the level order between the transaction levels of each transaction data to be uploaded, including:
[0049] According to the transaction queue K u The transaction queue K is the order of the transaction levels between the transaction data to be uploaded to the chain. u Sort the transaction data to be uploaded to the chain contained in the sorted transaction queue K u Determined as transaction queue K u the indicated ordered transaction queue;
[0050] After determining the sorted transaction queue indicated by each transaction queue in the transaction queue sequence, the transaction packaging quantity at the transaction packaging time is obtained;
[0051] According to the order of the transaction data to be uploaded to the chain contained in each sorted transaction queue, the order of the transaction queue sequence, and the number of transaction packages, R transaction data to be uploaded to the chain are obtained in sequence; R is a positive integer;
[0052] The R transaction data to be uploaded to the chain are all determined as the packaged transaction data at the transaction packaging time.
[0053] In one embodiment, the data determination module sequentially obtains R transaction data to be uploaded according to the arrangement order of the transaction data to be uploaded contained in each sorted transaction queue, the arrangement order of the transaction queue sequence, and the number of transaction packages, including:
[0054] Determine the queue attribute of each transaction queue in the transaction queue sequence, and determine the transaction queues whose queue attributes are non-empty attributes in the transaction queue sequence as candidate transaction queues at the transaction packaging moment;
[0055] Sort the candidate transaction queues according to the arrangement order of the transaction queue sequences to obtain a candidate transaction queue sequence;
[0056] According to the arrangement order of the transaction data to be put on the chain contained in each candidate transaction queue in the candidate transaction queue sequence, and the number of transaction packages, R transaction data to be put on the chain are obtained in sequence.
[0057] In one embodiment, the data determination module sequentially obtains R transaction data to be uploaded according to the arrangement order of the transaction data to be uploaded contained in each candidate transaction queue in the candidate transaction queue sequence and the number of transaction packages, including:
[0058] Determine the first candidate transaction queue in the candidate transaction queue sequence as the transaction packaging start queue;
[0059] Count the amount of transaction data to be uploaded to the chain contained in the transaction packaging start queue;
[0060] If the data volume is greater than or equal to the transaction package quantity, then R transaction data to be uploaded to the chain are obtained in the transaction package start queue in sequence according to the order of transaction levels among the transaction data to be uploaded to the chain contained in the transaction package start queue; R is the transaction package quantity;
[0061] If the data volume is less than the transaction package quantity, the quantity difference between the transaction package quantity and the data volume is determined, and the W transaction data to be put on the chain indicated by the quantity difference are obtained in turn in the remaining candidate transaction queues according to the order of transaction levels between the transaction data to be put on the chain contained in the remaining candidate transaction queues, and the transaction data to be put on the chain contained in the transaction package starting queue and the W transaction data to be put on the chain are jointly determined as R transaction data to be put on the chain; W is a positive integer; the remaining candidate transaction queues refer to the candidate transaction queues in the candidate transaction queue sequence, except the transaction package starting queue.
[0062] An embodiment of the present application provides a computer device, including: a processor and a memory;
[0063] The memory stores a computer program, and when the computer program is executed by the processor, the processor executes the method in the embodiment of the present application.
[0064] On the one hand, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. The computer program includes program instructions. When the program instructions are executed by a processor, the method in the embodiment of the present application is executed.
[0065] In one aspect of the present application, a computer program product is provided, the computer program product comprising a computer program, the computer program being 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 provided in one aspect of the embodiments of the present application.
[0066] In an embodiment of the present application, a level calculation contract for performing level calculation on transaction data can be flexibly created and deployed in the blockchain through a level calculation factory contract. The calculation logic indicated by the level calculation contract can be flexibly configured. Therefore, after receiving the set of transaction data to be uploaded to the chain, the transaction level of each transaction data to be uploaded to the chain can be calculated through the level calculation contract; then, when the transaction packaging time is reached, the packaged transaction data at the transaction packaging time can be determined in the set of transaction data to be uploaded to the chain according to the level order between the transaction levels of each transaction data to be uploaded to the chain, and then these packaged transaction data can be packaged and uploaded to the chain for processing. It should be understood that through the level calculation factory contract, a level calculation contract with different calculation logics can be created and deployed in the blockchain based on the scenario business requirements. Then, through the level calculation contract, the level calculation of the on-chain transaction data can be performed according to the scenario business requirements. For example, the level of the transaction data that is expected to be processed first can be calculated as a higher value according to the scenario business requirements. Thus, the transaction data that is expected to be processed first can be prioritized according to the level order between the transaction levels, thereby greatly improving the timeliness of processing urgent transaction data; at the same time, for other transaction data that do not need to be processed first, the levels calculated by the level calculation contract will be closer, so the processing time of these transaction data will not differ too much, which can well ensure the fairness of the processing of these transaction data. In summary, the present application proposes a method of processing transaction data according to the transaction level of the transaction data, which can achieve fairness in the transaction data processing business of the blockchain while meeting the urgent processing needs of the transaction data in a timely manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] In order to more clearly illustrate the embodiments of the present invention 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 invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0068] Figure 1 This is a network architecture diagram provided by an embodiment of the present application;
[0069] Figure 2 This is a schematic diagram of a scenario in which transaction data is packaged and uploaded to a chain, provided in an embodiment of the present application;
[0070] Figure 3 It is a flowchart of a data processing method based on blockchain provided in an embodiment of the present application;
[0071] Figure 4 It is a flowchart of calling a level calculation contract provided by an embodiment of the present application;
[0072] Figure 5 It is a system logic flow chart provided by an embodiment of the present application;
[0073] Figure 6 It is a structural schematic diagram of a blockchain-based data processing device provided in an embodiment of the present application;
[0074] Figure 7 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0075] 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.
[0076] The method provided in the embodiment of the present application involves blockchain and other related technologies. For ease of understanding, the following will give priority to blockchain and its related technologies:
[0077] 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.
[0078] 2. Blockchain nodes: The blockchain network divides nodes into consensus nodes (also called core nodes), data nodes or light nodes. Among them, the consensus node is responsible for the consensus business of the entire blockchain network; the data node or light 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 data node (or light node), its internal structure includes network communication components, because the blockchain network is essentially a point-to-point network, and it needs to communicate with other nodes in the blockchain network through related 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 directly carried out between nodes, without the intervention of intermediate links or centralized servers (third parties).
[0079] 3. Public key and private key: Public key and private key are a key pair (i.e., a public key and a private key) 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.
[0080] 4. Hash value: Also known as information characteristic value or characteristic value, hash value is generated by converting input data of any length into a password and performing 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, which is called the parent block of the current block. Hash value is the potential core foundation and the most important aspect of blockchain technology. It preserves the authenticity of recorded and viewed data, as well as the integrity of the blockchain as a whole.
[0081] 5. Smart Contract: It is a computer protocol designed to disseminate, verify or execute contracts in an information-based manner. In the blockchain system, a smart contract (referred to as a contract) is a code that can be understood and executed by each node of the blockchain, which can execute any logic and obtain results. In practical 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. The blockchain can contain multiple contracts, which are distinguished by contract accounts (Identity, ID), identification numbers or names. For example, a smart contract can include a governance consensus committee contract, which is mainly used to manage consensus nodes, and can include recording the node status of consensus nodes, dynamically adding consensus nodes, and removing abnormal consensus nodes.
[0082] See also Figure 1 , Figure 1 This is a network architecture diagram provided by an embodiment of the present application. Figure 1 As shown, the network architecture may include a terminal device cluster 10 and a blockchain network, and the blockchain network may include a core node (consensus node) cluster 1000 and a data node or light node cluster 100. The core node cluster 1000 may include at least two core nodes, and the data node cluster 100 may include at least two data nodes. Figure 1 As shown, the core node cluster 1000 may include core node 1000a, core node 1000b, ..., core node 1000n, the data node cluster 100 may specifically include data node 100a, data node 100b, ..., data node 100n, and the terminal device cluster 10 may specifically include terminal device 10a, terminal device 10b, ..., terminal device 10n.
[0083] like Figure 1As shown, terminal device 10a, terminal device 10b, ..., terminal device 10n can respectively establish network connection with data node 100a, data node 100b, ..., data node 100n, so that the terminal device can exchange data with the data node through the network connection; data node 100a, data node 100b, ..., data node 100n can respectively establish network connection with core node 1000a, core node 1000b, ..., core node 1000n, so that the data node can exchange data with the core node through the network connection; data node 100a, data node 100b, ..., data node 100n are connected to each other, so that data nodes can exchange data with each other, and core node 1000a, core node 1000b, ..., core node 1000n are connected to each other, so that core nodes can exchange data with each other.
[0084] Taking the terminal device 10a, the data node 100a and the core node 1000a as an example, the data node 100a can receive a transaction service request sent by the terminal device 10a (the transaction service request carries the ID or name of the smart contract), and then the data node 100a can send the transaction service request to the core node 1000a through the data node cluster 100; the core node 1000a can run the smart contract and execute the transaction service through the smart contract. After obtaining the execution result, the execution result can be stored in the memory pool (such as the transaction pool), and a new block can be generated according to the execution result; then, the core node 1000a can send the newly generated blocks to other core nodes in the blockchain network where it is located according to the node identifiers of other core nodes (i.e., consensus nodes) in the blockchain network, and other core nodes will verify the newly generated blocks (i.e., reach consensus), and add the newly generated blocks to the blockchain stored thereafter (that is, the execution results are stored in the blockchain after the consensus is passed). Among them, each core node in the blockchain network has a corresponding node identifier, and each core node in the blockchain network can store the node identifiers of other core nodes in the blockchain network, so that the generated blocks can be broadcast to other core nodes in the blockchain network according to the node identifiers of other core nodes, so that the data stored on all core nodes in the blockchain network are consistent.
[0085] Among them, Figure 1The terminal device shown can be a desktop terminal or mobile terminal used by the business party that generates transaction information, and can be a smart terminal with data processing functions such as a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart TV, a smart speaker, a desktop computer, a smart watch, a smart car terminal, etc., but is not limited to this. The transaction information (transaction data) generated by the terminal device can be transmitted to the consensus node via a data node or a light node after user authorization, and the consensus node can record the transaction information (transaction data) generated by the terminal device on the blockchain. Any data node in the data node cluster 100 can be implemented with an independent server or a server cluster composed of multiple servers, and any core node in the core node cluster 1000 can be implemented with an independent server or a server cluster composed of multiple servers.
[0086] It can be understood that the transaction business of the terminal device can be understood as transaction data, and the main form of storing transaction data for the blockchain is to store the transaction data in the block of the blockchain. In other words, the blockchain is mainly used to verify, store and update transaction data. For the business of blockchain processing transaction data, this application proposes a method of processing transaction data according to the transaction level, so as to improve the timeliness and fairness of the processing of transaction data. Specifically, this application can create and deploy a level calculation contract for level calculation of transaction data in the blockchain through a level calculation factory contract, wherein, when creating and deploying a level calculation contract, the calculation logic of the level calculation contract can be configured according to the business scenario requirements. For example, the business scenario requirement is to give priority to transaction data related to the blockchain system (for example, transactions for changing blockchain system parameters, configuration transactions for blockchain systems, etc.), then the calculation logic of the level calculation contract can be configured according to the requirement to calculate the level of transaction data related to the blockchain system as a higher level logic. Furthermore, after successfully creating and deploying the level calculation contract, if a set of transaction data to be uploaded to the chain is received, the level calculation contract can be called, and through the calculation logic indicated by the level calculation contract, each transaction data to be uploaded to the chain in the set of transaction data to be uploaded to the chain is subjected to level calculation processing, thereby obtaining the transaction level of each transaction data to be uploaded to the chain; subsequently, when the transaction packaging time is reached, the packaged transaction data at the transaction packaging time can be determined in the set of transaction data to be uploaded to the chain according to the level order between the transaction levels of each transaction data to be uploaded to the chain, and these packaged transaction data can be packaged and uploaded to the chain.
[0087] It should be understood that the level calculation factory contract here can refer to a smart contract used to create other smart contracts. By using functions and calls, a new smart contract can be created, which can be used to implement complex logic. The specific steps for the level calculation factory contract can include at least the following 5 steps:
[0088] 1) Define a structure that can be used to store the relevant data of the smart contract to be created;
[0089] 2) Define a mapping that can be used to store the contract addresses of all created smart contracts;
[0090] 3) Define an event that is used to notify other objects (such as users, smart robots, etc.) that a new smart contract has been created;
[0091] 4) Define a function to create a new contract, which can be used to instantiate the contract and store it in the above mapping;
[0092] 5) Define a function so that other objects can access the created smart contract by calling the function.
[0093] It can be understood that through the above steps, a new smart contract can be created in the blockchain through the factory contract, and the smart contract created by the factory contract in this application is mainly used to perform hierarchical calculation processing on transaction data. Then this application can call the factory contract a hierarchical calculation factory contract, and call the smart contract created by the hierarchical calculation factory contract a hierarchical calculation contract. The hierarchical calculation contract should be configured with hierarchical calculation logic for transaction data. The hierarchical calculation logic of the hierarchical calculation contract can be artificially configured with a hierarchical calculation contract with different calculation logic based on different business scenario requirements. For example, if the business scenario requirement is to give priority to the transaction data executed by hot contracts (which may refer to smart contracts with higher popularity), then a level calculation contract with this calculation logic can be created through the level calculation factory contract. The calculation logic of the level calculation contract can be: the transaction execution contract to which each transaction data belongs will be obtained. If the transaction execution contract is a hot contract, the transaction level of the transaction data can be calculated as a higher level; for another example, if the business scenario requirement is to give priority to the transaction data related to the blockchain system (such as transaction data for updating parameters of the blockchain), then a level calculation contract with this calculation logic can be created through the level calculation factory contract. The calculation logic of the level calculation contract can be: whether each transaction data is transaction data related to the blockchain system will be obtained. If the transaction data is transaction data related to the blockchain system, the transaction level of the transaction data can be calculated as a higher level, and if the transaction data is not transaction data related to the blockchain system (such as transaction data related to user transfers), the transaction level of the transaction data can be calculated as a lower level.
[0094] It should be understood that, from the above, the present application can flexibly configure level calculation contracts with different calculation logics in the blockchain through the level calculation factory contract based on different business scenario requirements, so that the blockchain can select different level calculation contracts to calculate the transaction level of transaction data according to different business scenario requirements (the transaction level of transaction data that meets the priority processing requirements will also be correspondingly higher). Therefore, these transaction data can be packaged and processed on the chain in sequence according to the level order between the transaction levels of the transaction data. In this way, the blockchain can give priority to the transaction data that needs to be prioritized, and other transaction data that does not need to be prioritized can be processed later.
[0095] Specifically, taking a batch of transaction data to be packaged and uploaded to the chain as an example, the present application may call a batch of transaction data to be packaged and uploaded to the chain a set of transaction data to be uploaded to the chain. After receiving the set of transaction data to be uploaded to the chain, the level calculation contract whose calculation logic meets the business scenario requirements may be called according to the business scenario requirements. Through the calculation logic indicated by the level calculation contract, each transaction data to be uploaded to the chain may be level calculated and processed, thereby obtaining the transaction level of each transaction data to be uploaded to the chain; subsequently, when the transaction packaging time is reached, the packaged transaction data at the transaction packaging time may be determined in the set of transaction data to be uploaded to the chain according to the level order between the transaction levels of each transaction data to be uploaded to the chain; subsequently, these packaged transaction data may be packaged and uploaded to the chain for processing.
[0096] It is understandable that the terminal device of the present application may be installed with a target application (ie, an application client). When the application client runs in the terminal device, it may be compatible with the above-mentioned Figure 1 Data is exchanged between other blockchain nodes in the blockchain network shown (for example, the transaction data generated in the terminal device can be sent to the blockchain node, and the blockchain node will package it on the chain). Among them, the application client may include multimedia clients (for example, video clients), entertainment clients (for example, game clients), education clients, live broadcast clients and other application clients. Among them, the application client can be an independent client, or it can be an embedded sub-client integrated in a client (for example, an education client and a multimedia client, etc.), which is not limited here. The blockchain node in this application can refer to a server, which can exchange data with the terminal device through the application in the terminal device. The server here can be an independent physical server, or it can be a server cluster or distributed system composed of multiple physical servers, or it can be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and basic cloud computing services such as big data and artificial intelligence platforms.
[0097] It is understandable that the method provided in the embodiment of the present invention can be executed by a computer device, including but not limited to a terminal device or a server (such as a business server). The blockchain node in the embodiment of the present invention can be a computer device.
[0098] It should be noted that in the specific implementation of the present application, data related to user information, user data (such as transaction information initiated by users), etc., all require manual authorization and permission from the user (i.e., consent from the user) before they can be obtained. In other words, when the above embodiments of the present application are applied to specific products or technologies, the methods and related functions provided by the embodiments of the present application are operated with the permission or consent of the user (the functions provided by the embodiments of the present application can be actively enabled by the user), and the collection, use and processing of relevant data need to comply with the relevant laws, regulations and standards of the relevant regions and areas.
[0099] The embodiments of the present application can be applied to various scenarios, including but not limited to gaming scenarios, financial scenarios, cloud technology, artificial intelligence, smart transportation, assisted driving, etc. For ease of understanding, please refer to Figure 2 , Figure 2 is a schematic diagram of a scenario in which transaction data is packaged and uploaded to a chain, provided in an embodiment of the present application. Figure 2 The server 2000 shown may refer to a transaction controller in a blockchain, and the transaction controller may specifically refer to a blockchain node in the blockchain (the blockchain node may be as described above). Figure 1 A core node in the corresponding embodiment).
[0100] like Figure 2 As shown, assuming that the transaction data set to be uploaded is as follows Figure 2 The set 200 shown, the transaction data set 200 to be put on the chain may include transaction data 2001 to be put on the chain, transaction data 2002 to be put on the chain, ..., transaction data 200n to be put on the chain. After the server 2000 receives the transaction data set 200 to be put on the chain, the level calculation contract can be called. Through the calculation logic indicated by the level calculation contract, the transaction level of each transaction data to be put on the chain can be determined. Among them, the level calculation contract here is configured and created according to a certain business scenario requirement. Assuming that the business scenario requirement is to package the transaction data executed by the hot contract for priority on the chain, then the calculation logic indicated by the level calculation contract can be: the transaction level of the transaction data executed by the hot contract is calculated as a higher level. Based on this, the transaction level of the transaction data 2001 to be put on the chain, the transaction level of the transaction data 2002 to be put on the chain, ..., the transaction level of the transaction data 200n to be put on the chain can be obtained through the level calculation contract.
[0101] Furthermore, the server 200 can divide each transaction data to be put on the chain into different transaction queues based on the transaction level of each transaction data to be put on the chain. Among them, the transaction queues of the present application can have different queue levels, and the queue levels include but are not limited to the highest queue level, the second highest queue level, the medium queue level and the ordinary queue level. When packaging transactions, the transaction data can be obtained from each transaction queue in order from high to low in order of the queue level for packaging and chaining. Based on this, it can be seen that for transaction data with higher transaction levels, they will be divided into transaction queues with higher queue levels. When packaging transactions, transaction data will be obtained from transaction queues with higher levels for packaging and chaining, so that transaction data with higher transaction levels can be given priority (that is, transaction data that meets the needs of business scenarios can be given priority for packaging and chaining). In order to reduce the waiting time for transaction data with lower transaction levels to be packaged and uploaded to the chain, the present application can limit the number of transaction data that can be contained in the transaction queues with higher queue levels. For example, the number of transaction data that can be contained in the transaction queue with the highest queue level can be limited to 50, the number of transaction data that can be contained in the transaction queue with the second highest queue level can be limited to 40, and the number of transaction data that can be contained in the transaction queue with the medium queue level can be limited to 30. In this way, the number of transaction data for priority processing will be limited, so that the transaction data in the transaction queues of ordinary levels can also be processed accordingly in a fair and timely manner.
[0102] It can be understood that based on the above, the present application can obtain the transaction data to be packaged and uploaded to the chain each time according to the transaction queues of different queue levels. These transaction data to be uploaded to the chain can be called packaged transaction data. After obtaining them, they can be packaged and processed on the chain (that is, added to the block, and then the block is added to the blockchain).
[0103] It should be understood that the present application can flexibly configure level calculation contracts with different calculation logics in the blockchain through the level calculation factory contract based on different business scenario requirements. As a result, the blockchain can select different level calculation contracts to calculate the transaction level of transaction data according to different business scenario requirements (the transaction level of transaction data that meets the priority processing requirements will also be correspondingly higher). As a result, these transaction data can be packaged and processed on the chain in sequence according to the level order between the transaction levels of the transaction data. This allows the blockchain to give priority to transaction data that needs to be processed first, thereby improving the timeliness of transaction data processing; and for other transaction data that does not need to be processed as a priority, they can also be packaged and processed on the chain accordingly in the future.
[0104] For ease of understanding, the data processing method provided by the embodiment of the present application will be described in detail below with reference to the accompanying drawings. Figure 3, Figure 3 This is a flowchart of a data processing method based on blockchain provided by an embodiment of the present application. The process can be executed by a computer device, which can be Figure 1 The terminal device shown can also be any blockchain node (such as a core node) in the blockchain network. Figure 3 As shown, the process may include at least the following steps S101 to S103:
[0105] Step S101, after receiving the set of transaction data to be uploaded to the chain, call the level calculation contract, and perform level calculation processing on each transaction data to be uploaded to the chain in the set of transaction data to be uploaded to the chain through the calculation logic indicated by the level calculation contract to obtain the transaction level of each transaction data to be uploaded to the chain; the level calculation contract is created and deployed by the level calculation factory contract.
[0106] In this application, a factory contract refers to a smart contract in the blockchain used to create other smart contracts, and the smart contract created by the factory contract in this application is mainly used to perform hierarchical calculation processing on transaction data. Therefore, this application may refer to the factory contract as a hierarchical calculation factory contract, and the smart contract created by the hierarchical calculation factory contract as a hierarchical calculation contract. The hierarchical calculation contract should be configured with hierarchical calculation logic for transaction data. The hierarchical calculation logic of the hierarchical calculation contract can be artificially configured with a hierarchical calculation contract with different calculation logics based on different business scenario requirements. For example, if the business scenario requirement is to give priority to the transaction data executed by hot contracts (which may refer to smart contracts with higher popularity), then a level calculation contract with this calculation logic can be created through the level calculation factory contract. The calculation logic of the level calculation contract can be: the transaction execution contract to which each transaction data belongs will be obtained. If the transaction execution contract is a hot contract, the transaction level of the transaction data can be calculated as a higher level; for another example, if the business scenario requirement is to give priority to the transaction data related to the blockchain system (such as transaction data for updating parameters of the blockchain), then a level calculation contract with this calculation logic can be created through the level calculation factory contract. The calculation logic of the level calculation contract can be: whether each transaction data is transaction data related to the blockchain system will be obtained. If the transaction data is transaction data related to the blockchain system, the transaction level of the transaction data can be calculated as a higher level, and if the transaction data is not transaction data related to the blockchain system (such as transaction data related to user transfers), the transaction level of the transaction data can be calculated as a lower level.
[0107] It should be understood that, from the above, the present application can flexibly configure the level calculation contracts with different calculation logics in the blockchain through the level calculation factory contract based on different business scenario requirements, so that the blockchain can select different level calculation contracts to calculate the transaction level of transaction data according to different business scenario requirements. That is to say, different level calculation contracts can be deployed in the blockchain, and each deployed level calculation contract can be called a configuration calculation contract here, and a configuration calculation contract in the blockchain can correspond to a business scenario requirement, and in the received transaction data set to be on the chain, the corresponding configuration calculation contract can be called according to the current business scenario requirement. For example, the business scenario requirement of the transaction data set to be on the chain can be determined as the target business scenario requirement, and then, based on the target business scenario requirement, a configuration calculation contract that meets the target business scenario requirement can be selected in the configuration calculation contract as the level calculation contract for level calculation; of course, if there is no configuration calculation contract that meets the target business scenario requirement in the configuration calculation contract, then a level calculation contract that meets the target business scenario requirement can be pre-created and deployed through the level calculation factory contract, and then the level calculation contract can be used to perform level calculation processing on the transaction data to be on the chain. In other words, the level calculation contract used in this application to perform level calculation processing on the transaction data set to be uploaded to the chain has a calculation logic that meets the target business scenario requirements of the transaction data set to be uploaded to the chain.
[0108] For ease of understanding, the transaction data set to be uploaded to the chain includes the transaction data D to be uploaded to the chain a (a is a positive integer) as an example, assuming that the level calculation contract that meets the requirements of the target business scenario is the first-level calculation contract, then through the calculation logic indicated by the level calculation contract, each transaction data to be on-chain in the transaction data set to be on-chain is subjected to level calculation processing, and the specific method for obtaining the transaction level of each transaction data to be on-chain can be as follows: According to the calculation logic of the first-level calculation contract, the transaction data D to be on-chain can be obtained. a The transaction execution contract to which it belongs; then, according to the contract type to which the transaction execution contract belongs, the transaction data D to be uploaded to the chain can be determined a Based on the mapping relationship between the configuration urgency interval set and the first configuration level set in the first level mapping table, the transaction data D to be uploaded can be determined in the first configuration level set. a wherein, in the first level mapping table, a mapping relationship exists between a configuration urgency interval in the configuration urgency interval set and a first configuration level in the first configuration level set.
[0109] It can be understood that the present application can pre-configure the mapping relationship between different urgency intervals and different configuration levels, thereby obtaining a mapping table between an urgency interval set and a configuration level set, wherein, for the sake of convenience in distinguishing from the subsequent, the configuration level set can be referred to as a first configuration level set, and the mapping table containing the mapping relationship between the urgency interval set and the first configuration level set can be referred to as a first-level mapping table. The contract types here may include but are not limited to high-heat type, medium-heat type and normal heat type. Heat may refer to the popularity of the smart contract (equivalent to the frequency of use of the smart contract within a period of time. If the frequency of use is high, then it can be considered that the smart contract is more popular and has higher heat, so it can be considered as a high-heat type). The failed contract types may correspond to different transaction urgency. For example, if the execution contract of the transaction data is a high-heat contract, then the transaction data can be considered to be more urgent and need to be processed with priority, and its transaction urgency will be higher; if the execution contract of the transaction data is a normal heat type, then it can be considered that the transaction data is not urgent and does not need to be processed with priority, and its transaction urgency can be a lower value.
[0110] Based on the above, we can know that for the transaction data D to be uploaded to the chain a For example, after obtaining the transaction data D to be uploaded to the chain a After the transaction execution contract is determined, the transaction data D to be uploaded to the chain can be determined according to the contract type to which the transaction execution contract belongs. a Then, the urgency interval of the transaction urgency can be determined in the first level mapping table, and the first configuration level mapped to the urgency interval of the transaction urgency can be determined as the transaction data D to be uploaded to the chain a Transaction level.
[0111] For ease of understanding, the transaction data set to be uploaded to the chain includes the transaction data D to be uploaded to the chain. a (a is a positive integer) as an example, assuming that the level calculation contract that meets the requirements of the target business scenario is a second-level calculation contract, then through the calculation logic indicated by the level calculation contract, each transaction data to be on-chain in the transaction data set to be on-chain is subjected to level calculation processing, and the specific method for obtaining the transaction level of each transaction data to be on-chain can also be: According to the calculation logic indicated by the second-level calculation contract, the transaction data D to be on-chain can be obtained. a reward resources; wherein the reward resources refer to the resources that can be obtained by calculating the transaction data to be uploaded to the chain; then, based on the mapping relationship between the configuration resource interval set and the second configuration level set in the second level mapping table, the transaction data D to be uploaded to the chain can be determined in the second configuration level set. ain the second level mapping table, a mapping relationship exists between a configuration resource interval in the configuration resource interval set and a second configuration level in the second configuration level set.
[0112] The present application can pre-configure the mapping relationship between different resource intervals and different configuration levels, thereby obtaining a mapping table between a resource interval set and a configuration level set, wherein, for the sake of distinction from the previous text, the configuration level set can be referred to as a second configuration level set, and the mapping table containing the mapping relationship between the resource interval set and the second configuration level set can be referred to as a second level mapping table. The reward resources here can refer to virtual resources (such as virtual gold coins, virtual diamonds, virtual fireworks, etc.) that can be obtained by processing transaction data, and the configuration resource interval here can refer to an interval composed of two different virtual resource amounts, so when the transaction data D to be uploaded is obtained a After the reward resource is selected, the configuration resource interval where the reward resource is located can be determined in the configuration resource interval set, and the second configuration level mapped to the configuration resource interval where the reward resource is located can be determined as the transaction data D to be uploaded to the chain a Transaction level.
[0113] Step S102, when the transaction packaging time is reached, the packaged transaction data at the transaction packaging time is determined in the transaction data set to be uploaded according to the level order between the transaction levels of each transaction data to be uploaded.
[0114] In the present application, when the transaction packaging time is reached, the transaction packaging amount at the transaction packaging time can be obtained first, and then one or more (multiple means two or more) transaction data to be uploaded to the chain indicated by the transaction packaging amount can be selected in sequence according to the level order between the transaction levels of each transaction data to be uploaded to the chain (such as from high to low order) as the packaged transaction data.
[0115] Of course, based on the above, the present application can pre-configure transaction queues with different queue levels. After obtaining the transaction level of each transaction data to be uploaded to the chain, each transaction data to be uploaded to the chain can be divided into different transaction queues. When the transaction packaging time is reached, one or more transaction data to be uploaded to the chain can be obtained in each transaction queue as packaged transaction data.
[0116] Specifically, the transaction data set to be uploaded to the chain includes the transaction data D to be uploaded to the chain a For example, after obtaining the transaction level of each transaction data to be uploaded to the chain, according to the transaction data D to be uploaded to the chain a The transaction level can determine the transaction data D to be uploaded to the chain in the transaction queue sequence. aThe transaction queue to which it belongs; wherein the transaction queue sequence is a sequence obtained by sorting the M transaction queues according to the queue level order between the M transaction queues (M is a positive integer); further, the transaction data D to be uploaded to the chain can be a Add to the transaction data to be uploaded to the chain D a In the transaction queue to which it belongs. Use the method of adding transaction data to be uploaded to the chain D a Each transaction data D to be uploaded to the chain can be a Add to the corresponding transaction queue.
[0117] Among them, it can be understood that the queue levels of the transaction queues here may include high level, medium level and ordinary level. The present application can limit the maximum number of transaction data that can be contained in the high-level transaction queue and the medium-level transaction queue. For example, the maximum capacity of the high-level transaction queue can be limited to 50, and the maximum capacity of the medium-level transaction queue can be limited to 30. Then, after determining the transaction level of each transaction data to be uploaded to the chain, it can be added to the high-level transaction queue and the medium-level transaction queue in order from high to low. When the transaction data to be uploaded to the chain contained in the high-level transaction queue and the medium-level transaction queue reach the maximum capacity, the remaining transaction data can all be added to the ordinary-level transaction queue.
[0118] It should be understood that after each transaction data to be uploaded to the chain is added to the corresponding transaction queue, the transaction queue sequence includes the transaction queue K u (u is a positive integer) as an example, when the transaction packaging time is reached, according to the level order between the transaction levels of each transaction data to be uploaded, the specific method of determining the packaging transaction data at the transaction packaging time in the transaction data set to be uploaded can be: according to the transaction queue K u The transaction queue K can be u The transaction data to be uploaded to the chain is sorted, and the sorted transaction queue K u Determined as transaction queue K u The sorted transaction queue indicated by the transaction queue can be determined in the same way. After the sorted transaction queue indicated by each transaction queue in the transaction queue sequence is determined, the number of transaction packages at the transaction packaging time can be obtained. Further, according to the arrangement order of the transaction data to be chained contained in each sorted transaction queue, the arrangement order of the transaction queue sequence and the number of transaction packages, R (R is a positive integer) transaction data to be chained can be obtained in sequence. The R transaction data to be chained can be determined as the packaged transaction data at the transaction packaging time.
[0119] It can be understood that the specific method of obtaining R transaction data to be uploaded to the chain in sequence according to the arrangement order of the transaction data to be uploaded to the chain contained in each sorted transaction queue, the arrangement order of the transaction queue sequence, and the number of transaction packages can be: the queue attributes of each transaction queue in the transaction queue sequence can be determined, and the transaction queue with a non-empty queue attribute in the transaction queue sequence can be determined as the candidate transaction queue at the transaction packaging moment; further, the candidate transaction queues can be sorted according to the arrangement order of the transaction queue sequence, thereby obtaining the candidate transaction queue sequence; further, according to the arrangement order of the transaction data to be uploaded to the chain contained in each candidate transaction queue in the candidate transaction queue sequence, and the number of transaction packages, R transaction data to be uploaded to the chain can be obtained in sequence.
[0120] Among them, the specific method for sequentially obtaining R transaction data to be uploaded to the chain according to the arrangement order between the transaction data to be uploaded to the chain contained in each candidate transaction queue in the candidate transaction queue sequence and the number of transaction packages can be as follows: the first candidate transaction queue in the candidate transaction queue sequence can be determined as the transaction package starting queue; the amount of transaction data to be uploaded to the chain contained in the transaction package starting queue can be counted; further, the amount can be compared with the transaction package number, and if the amount of data is greater than or equal to the transaction package number, then the order of the transaction levels between the transaction data to be uploaded to the chain contained in the transaction package starting queue can be obtained in the transaction package starting queue in sequence. R (R is the number of transaction packages) transaction data to be uploaded to the chain; if the data volume is less than the number of transaction packages, the difference between the number of transaction packages and the data volume can be determined, and W (W is a positive integer) transaction data to be uploaded to the chain indicated by the difference can be obtained in sequence in the remaining candidate transaction queues according to the order of transaction levels between the transaction data to be uploaded to the chain contained in the remaining candidate transaction queues. Furthermore, the transaction data to be uploaded to the chain contained in the transaction package start queue and the W transaction data to be uploaded to the chain can be jointly determined as R transaction data to be uploaded to the chain; wherein the remaining candidate transaction queues refer to the candidate transaction queues in the candidate transaction queue sequence, except the transaction package start queue.
[0121] It is understandable that after adding each transaction data to be chained to the corresponding transaction queue, the transaction data to be chained contained in each transaction queue can be sorted according to the transaction level (for example, sorted in order from high to low according to the transaction level), and for the convenience of distinction, the sorted transaction queue can be referred to as a sorted transaction queue. When determining the packaged transaction data, R (i.e., the number of transaction packages) of transaction data to be chained can be obtained in sequence from the sorted transaction queue of the highest queue level in the order of the transaction level of the transaction data to be chained, as packaged transaction data. If the number of transaction data to be chained contained in the sorted transaction queue of the highest queue level is less than the number of transaction packages, then all the transaction data to be chained contained in the sorted transaction queue of the highest queue level can be used as packaged transaction data. At this time, the number of packaged transaction data obtained is not enough, so the remaining packaged transaction data can be obtained from the next sorted transaction queue of the sorted transaction queue at the highest queue level.
[0122] For ease of understanding, the following example describes the process of selecting R transaction data to be uploaded as packaged transaction data. It is assumed here that the transaction queues include transaction queue 1, transaction queue 2, and transaction queue 3, wherein the queue level of transaction queue 1 is higher than the queue level of transaction queue 2, and the queue level of transaction queue 2 is higher than the queue level of transaction queue 3. According to the queue levels of transaction queue 1, transaction queue 2, and transaction queue 3, the transaction queue sequence obtained after sorting transaction queue 1, transaction queue 2, and transaction queue 3 is {transaction queue 1, transaction queue 2, transaction queue 3}, wherein it is assumed here that the maximum capacity of transaction queue 1 is 20, and the maximum capacity of transaction queue 2 is 10. Further, taking the set of transaction data to be on the chain as {transaction data to be on the chain 1, transaction data to be on the chain 2, transaction data to be on the chain 3, …, transaction data to be on the chain 100} as an example, according to the transaction level of each transaction data to be on the chain, each transaction data to be on the chain can be divided into a corresponding transaction queue. For the sake of ease of understanding, it is assumed that the transaction data to be on the chain contained in transaction queue 1 is {transaction data to be on the chain 1, transaction data to be on the chain 2, transaction data to be on the chain 3, …, transaction data to be on the chain 20}, the transaction data to be on the chain contained in transaction queue 2 is {transaction data to be on the chain 21, transaction data to be on the chain 22, transaction data to be on the chain 23, …, transaction data to be on the chain 30}, and the transaction data to be on the chain contained in transaction queue 3 is {transaction data to be on the chain 31, transaction data to be on the chain 32, transaction data to be on the chain 33, …, transaction data 100}.
[0123] Further, the transaction data to be put on the chain contained in each transaction queue can be sorted in order from high to low according to the transaction level, thereby obtaining the sorted transaction queues indicated by each transaction queue. It is assumed here that the sorted transaction queue indicated by each transaction queue is itself, that is, the sorted transaction queue 1 indicated by transaction queue 1 is {transaction data to be put on the chain 1, transaction data to be put on the chain 2, transaction data to be put on the chain 3, ..., transaction data to be put on the chain 20}, the sorted transaction queue 2 indicated by transaction queue 2 is {transaction data to be put on the chain 21, transaction data to be put on the chain 22, transaction data to be put on the chain 23, ..., transaction data to be put on the chain 30}, and the sorted transaction queue 3 indicated by transaction queue 3 is {transaction data to be put on the chain 31, transaction data to be put on the chain 32, transaction data to be put on the chain 33, ..., transaction data to be put on the chain 100}. Further, taking the number of packaged transactions as 35 as an example, based on the number of packaged transactions, 20 transaction data to be put on the chain can be obtained from the sorted transaction queue 1 in sequence (i.e., all the transaction data to be put on the chain contained in the sorted transaction queue 1); then 10 transaction data to be put on the chain can be obtained from the sorted transaction queue 2 (i.e., all the transaction data to be put on the chain contained in the sorted transaction queue 2); and then 5 transaction data to be put on the chain can be obtained from the sorted transaction queue 3 in sequence (i.e., the first 5 transaction data to be put on the chain in the above-mentioned sorted transaction queue 3). The 35 transaction data to be put on the chain can be used as the final packaged transaction data.
[0124] It should be noted that at a certain transaction packaging moment, there may be multiple rounds of determining the packaged transaction data. For example, after a certain round of determining the packaged transaction data, the transaction data contained in the transaction queue with a higher queue level may have been selected. Based on this, when determining the packaged transaction data in the next round, you can first obtain a non-empty transaction queue, and then continue to obtain the packaged transaction data from the non-empty transaction queue. Specifically, taking the sorted transaction queue 1 indicated by the above-mentioned transaction queue 1 as {transaction data to be uploaded to the chain 1, transaction data to be uploaded to the chain 2, transaction data to be uploaded to the chain 3, …, transaction data to be uploaded to the chain 20}, the sorted transaction queue 2 indicated by transaction queue 2 as {transaction data to be uploaded to the chain 21, transaction data to be uploaded to the chain 22, transaction data to be uploaded to the chain 23, …, transaction data to be uploaded to the chain 30}, and the sorted transaction queue 3 indicated by transaction queue 3 as {transaction data to be uploaded to the chain 31, transaction data to be uploaded to the chain 32, transaction data to be uploaded to the chain 33, …, transaction data to be uploaded to the chain 100} as an example, assuming that 35 packaged transaction data are obtained when the transaction packaging data is determined in the first round, it can be seen that there is no transaction data to be uploaded to the chain in the sorted transaction queue 1 and the sorted transaction queue 2, and the queue attributes of the two sorted transaction queues are both null attributes, and only the queue attribute of the sorted transaction queue 3 is a non-null attribute, then the sorted transaction queue 3 can be determined as a candidate transaction queue. Subsequently, multiple transaction data to be uploaded to the chain indicated by the second round of transaction packaging quantity can be obtained from the sorted transaction queue 3, and these transaction data to be uploaded to the chain can be used as the second round of packaged transaction data. It should be noted that if there are two or more candidate transaction queues, then when determining the packaged transaction data in a certain round, the corresponding number of transaction data to be uploaded to the chain can be obtained from each candidate transaction queue in turn according to the order of queue level as the packaged transaction data.
[0125] It should also be noted that after adding each transaction data to be on the chain to the corresponding transaction queue, the transaction data to be on the chain contained in each transaction queue may not be sorted in the order of transaction level, but randomly sorted. Then, when determining the packaged transaction data, it is only necessary to first obtain the corresponding number of transaction data to be on the chain from the transaction queue with a higher queue level in the order of queue level as the packaged transaction data. This can also give priority to the high-level transaction data in the higher-level transaction queue. Of course, for the transaction data to be on the chain contained in each transaction queue, if it is not sorted in the order of transaction level, when determining the packaged transaction data, it is also possible to first obtain the corresponding number of transaction data to be on the chain from the transaction queue with a higher queue level in the order of the time of submission of the transaction data in the order of queue level as the packaged transaction data. This application does not limit the specific method for determining the specific packaged transaction data.
[0126] Step S103: Package the transaction data and upload it to the blockchain.
[0127] In this application, after obtaining the packaged transaction data, these packaged transaction data can be packaged and chained. The specific method can be that a block can be generated based on these packaged transaction data, and the block can be sent to each consensus node in the blockchain, and these consensus nodes will reach a consensus on the block. If the block passes the consensus, the block can be chained to the blockchain; if the block does not pass the consensus, the block cannot be chained to the blockchain. In other words, only when the block containing the packaged transaction data passes the consensus as a prerequisite, the packaged transaction data can be successfully added to the blockchain.
[0128] In an embodiment of the present application, a level calculation contract for performing level calculation on transaction data and meeting the needs of business scenarios can be flexibly created and deployed in the blockchain through a level calculation factory contract. The calculation logic indicated by the level calculation contract can be flexibly configured. Therefore, after receiving the set of transaction data to be uploaded to the chain, the transaction level of each transaction data to be uploaded to the chain can be calculated through the level calculation contract; when the transaction packaging time is reached, the packaged transaction data at the transaction packaging time can be determined in the set of transaction data to be uploaded to the chain according to the level order between the transaction levels of each transaction data to be uploaded to the chain, and then these packaged transaction data can be packaged and uploaded to the chain for processing. It should be understood that through the level calculation factory contract, a level calculation contract with different calculation logics can be created and deployed in the blockchain based on the scenario business requirements. Then, through the level calculation contract, the level calculation of the on-chain transaction data can be performed according to the scenario business requirements. For example, the level of the transaction data that is expected to be prioritized can be calculated as a higher value according to the scenario business requirements. In this way, the transaction data that is expected to be prioritized can be prioritized according to the level order between the transaction levels, thereby greatly improving the timeliness of processing urgent transaction data; at the same time, for other transaction data that do not need to be prioritized, the levels calculated by the level calculation contract will be closer, so the processing time of these transaction data will not differ too much, which can well ensure the fairness of the processing of these transaction data.
[0129] Furthermore, it can be understood that in order to improve the overall stability and security of the blockchain, for the level calculation contract created in the blockchain, a voting mechanism can be used to determine the feasibility of the level calculation contract. Only when the level calculation contract is determined to be feasible through voting can the level calculation contract be applied in the level calculation scenario of transaction data; similarly, for a level calculation contract that has been deployed and applied, a voting mechanism can also be used to decide whether it needs to be deleted. In other words, the present application can use a voting mechanism to realize the dynamic addition and deletion of contracts, thereby making the deployed level calculation contract more reliable and clearing useless level calculation contracts in the blockchain. Among them, the voting mechanism here may refer to a voting mechanism based on a decentralized governance organization (such as DAO). The decentralized governance organization has the characteristics of autonomy, transparency, decentralization and autonomy, and its voting process and results are open and transparent and have decision-making significance. For the members of the decentralized governance organization (i.e., the sub-objects of the organization), it may refer to an object that has passed the assessment (such as a user). For ease of understanding, please refer to Figure 4 , Figure 4 This is a schematic diagram of a process for calling a level calculation contract provided by an embodiment of the present application. Figure 3 In the corresponding embodiment, for calling the level calculation contract, the level calculation process is performed on each transaction data to be on-chain in the set of transaction data to be on-chain through the calculation logic indicated by the level calculation contract to obtain the transaction level of each transaction data to be on-chain. Figure 4 The process shown may include at least the following steps S401 to S404:
[0130] Step S401, generate a contract chain request for the level calculation contract, and send the contract chain request to N organization sub-objects belonging to the decentralized governance organization; N is a positive integer.
[0131] Specifically, the decentralized governance organization here can refer to an organization with autonomy, transparency, decentralization and self-governance (such as DAO). The decentralized governance organization can be composed of N organizational sub-objects, and each organizational sub-object needs to pass the assessment to be able to serve as a sub-object of the decentralized governance organization. For a certain level calculation contract, a contract chain request can be generated first, and the contract chain request can be sent to N organizational sub-objects, and the N organizational sub-objects vote on it to decide whether it can be added to the blockchain.
[0132] Step S402: receiving voting information returned by N organization sub-objects to obtain N voting information.
[0133] Specifically, each organization sub-object can return a voting information based on the contract chain request, thereby receiving N voting information.
[0134] Step S403, obtaining valid voting information from the N voting information, and determining the contract attributes of the grade calculation contract based on the valid voting information.
[0135] Specifically, in order to maintain the security of data in the blockchain, for each voting information, the organization sub-object can sign it. Then, after receiving the voting information, you can verify the signature based on the signature. Only after you pass it can it be considered as valid voting information. Here, N organization sub-objects include organization sub-object S i (i is a positive integer) as an example, then the N voting information will also include the organization sub-object S i Returned voting information T i , the specific method for obtaining valid voting information from N voting information is: in voting information T i In the example, you can get the organization sub-object S i The signature information is the signature information of the organization sub-object S i The private key of the voting information T i The information obtained after signing; further, the organization sub-object S can be obtained i The public key of the organization sub-object S i The public key can be used to vote on the voting information T i Perform attribute classification processing, and thus obtain voting information T i and when the voting attribute of each voting information in the N voting information is determined, the voting information whose voting attribute is a valid attribute can be determined as valid voting information.
[0136] Among them, for the organization sub-object S i The public key can be used to vote on the voting information T i Perform attribute classification processing to obtain voting information T i The specific method of voting attribute can be: based on the organization sub-object S i The public key can verify the signature information and obtain the verification result; if the verification result is a passing result, the voting information T can be determined i The voting attribute is a valid attribute; if the signature verification result is a signature verification failure result, the voting information T can be determined i The voting attribute is invalid.
[0137] It is understandable that for a certain voting information, the signature information obtained by signing the private key can be verified by the public key. If the verification result is a verification pass result, the voting attribute of the voting information can be determined to be a valid attribute; if the verification result is a verification failure result, the voting attribute of the voting information can be determined to be an invalid attribute. Thus, the voting attribute of each voting information can be determined one by one, and the voting information with a valid voting attribute can be determined as valid voting information. Further, the contract attributes of the grade calculation contract can be determined based on the valid voting information (the contract attributes can include the contract feasible attribute and the contract infeasible attribute).
[0138] The specific method for determining the contract attributes of the level calculation contract based on the valid voting information is as follows: the number of votes passed in the valid voting information and the total number of valid voting information can be counted; further, the quantity ratio between the number of passes and the total number can be determined; the number of passes can be compared with the total number, and if the quantity ratio is greater than the ratio threshold, then the contract attribute of the level calculation contract can be determined to be a feasible contract attribute; and if the quantity ratio is less than the ratio threshold, then the contract attribute of the level calculation contract is determined to be an infeasible contract attribute.
[0139] It is understandable that the voting information can be either a passing vote or a failing vote. In this case, the present application can determine the contract attributes based on the ratio of passing votes to the total number of valid voting information. The ratio threshold here can be a preset value (such as 2 / 3, 3 / 4, 80%, etc.).
[0140] Step S404, if it is determined that the contract attribute of the level calculation contract is a feasible contract attribute, the level calculation contract is called, and the level calculation processing is performed on each transaction data to be uploaded to the chain in the set of transaction data to be uploaded to the chain through the calculation logic indicated by the level calculation contract to obtain the transaction level of each transaction data to be uploaded to the chain.
[0141] Specifically, if it is determined that the contract attribute of the level calculation contract is a contract feasibility attribute, then it can be determined that the level calculation contract is feasible and can be applied to the business of calculating the transaction level of transaction data. Then the above-mentioned call to the level calculation contract can be executed, and the level calculation processing is performed on each transaction data to be uploaded to the chain in the set of transaction data to be uploaded to the chain through the calculation logic indicated by the level calculation contract, so as to obtain the transaction level of each transaction data to be uploaded to the chain.
[0142] In the embodiment of the present application, for the level calculation contract created in the blockchain, a voting mechanism can be used to determine the feasibility of the level calculation contract. Only when the level calculation contract is determined to be feasible through voting, can the level calculation contract be applied in the level calculation scenario of transaction data; similarly, for a level calculation contract that has been deployed and applied, a voting mechanism can also be used to decide whether it needs to be deleted. In other words, the present application can use a voting mechanism to realize the dynamic addition and deletion of contracts, thereby making the deployed level calculation contract more reliable, and also allowing the useless level calculation contracts in the blockchain to be cleaned up in a timely manner, thereby improving the stability, security and reliability of the blockchain system.
[0143] For further information, see Figure 5 , Figure 5 It is a system logic flow chart provided in an embodiment of the present application.
[0144] like Figure 5 As shown, the system logic flow may include at least the following steps S51-S54:
[0145] Step S51, the blockchain network receives transaction data.
[0146] Specifically, the blockchain network can receive transaction data from a terminal device or a data node. When the blockchain network receives the transaction data, it can add it to a transaction controller. The transaction controller here can be a blockchain node (such as a server).
[0147] Step S52: The transaction controller calculates the level of the transaction data.
[0148] Specifically, after receiving the transaction data, the transaction controller can call a certain level calculation contract in the level calculation factory contract to calculate the transaction level of the transaction data. Among them, it can be understood that the factory contract can refer to a smart contract used to create a new smart contract in the blockchain, and the smart contract created by the factory contract in this application is mainly used to perform level calculation processing on the transaction data. Then this application can refer to the factory contract as the level calculation factory contract, and the smart contract created by the level calculation factory contract as the level calculation contract. For the specific method of creating different level calculation contracts through the level calculation factory contract, please refer to the corresponding embodiment described in the previous text, and it will not be repeated here.
[0149] Step S53: The voting organization determines the feasibility of the grade calculation contract.
[0150] Specifically, for a certain grade calculation contract, it is necessary to vote through a voting organization (such as the above-mentioned decentralized governance organization) to determine its feasibility, that is, to determine the contract attributes of the grade calculation contract. Only when it is determined that the contract attribute of the grade calculation contract is a contract feasible attribute, can the grade calculation contract be applied to the transaction grade calculation business of transaction data. In other words, only when it is determined that the contract attribute of the grade calculation contract is a contract feasible attribute, can the transaction grade calculated by the grade calculation contract be determined as an accurate result. For the specific method of determining the feasibility of the grade calculation contract based on the voting organization, please refer to the relevant description in the previous embodiment, which will not be repeated here.
[0151] Step S54, the level calculation factory contract returns the level of the transaction data to the transaction controller.
[0152] Specifically, the transaction level of the transaction data can be returned to the transaction controller, and the transaction controller can add each transaction data to the corresponding transaction queue in the transaction pool based on the transaction level of each transaction data. Then, when the transaction packaging time is reached, each transaction data can be packaged into the block in sequence according to the order of the queue levels of each transaction queue and the order between the transaction levels of the transaction data in each transaction queue.
[0153] Among them, it should be noted that when calculating the transaction level of transaction data, the transaction controller can process multiple transaction data in parallel (i.e., calculate the transaction levels of multiple transaction data in parallel). If the transaction controller is busy and cannot calculate the transaction level, then this application can directly add these transaction data to the transaction queue of the ordinary queue level, and if a certain transaction data should be added to the transaction queue of the high queue level, if it is directly added to the transaction queue of the ordinary queue level, the transaction data will not be processed in time. In order to make the priority processing be processed as soon as possible, when the transaction controller is busy and cannot calculate the transaction level, these transaction data that cannot calculate the transaction level can be added to the queue starting position of the transaction queue of the ordinary queue level. Then, when packaging transactions, if it is your turn to select packaged transaction data from the transaction queue of the ordinary queue level, you can give priority to selecting these transaction data at the starting position as the packaged transaction data for packaging and chain processing.
[0154] In an embodiment of the present application, a level calculation contract for performing level calculation on transaction data and meeting the needs of business scenarios can be flexibly created and deployed in the blockchain through a level calculation factory contract. The calculation logic indicated by the level calculation contract can be flexibly configured. Therefore, after receiving the set of transaction data to be uploaded to the chain, the transaction level of each transaction data to be uploaded to the chain can be calculated through the level calculation contract; when the transaction packaging time is reached, the packaged transaction data at the transaction packaging time can be determined in the set of transaction data to be uploaded to the chain according to the level order between the transaction levels of each transaction data to be uploaded to the chain, and then these packaged transaction data can be packaged and uploaded to the chain for processing. It should be understood that through the level calculation factory contract, a level calculation contract with different calculation logics can be created and deployed in the blockchain based on the scenario business requirements. Then, through the level calculation contract, the level calculation of the on-chain transaction data can be performed according to the scenario business requirements. For example, the level of the transaction data that is expected to be prioritized can be calculated as a higher value according to the scenario business requirements. In this way, the transaction data that is expected to be prioritized can be prioritized according to the level order between the transaction levels, thereby greatly improving the timeliness of processing urgent transaction data; at the same time, for other transaction data that do not need to be prioritized, the levels calculated by the level calculation contract will be closer, so the processing time of these transaction data will not differ too much, which can well ensure the fairness of the processing of these transaction data.
[0155] For further information, see Figure 6 , Figure 6 : is a schematic diagram of the structure of a blockchain-based data processing device provided in an embodiment of the present application. The blockchain-based data processing device can be a computer program (including program code) running in a computer device, for example, the blockchain-based data processing device is an application software; the blockchain-based data processing device can be used to execute Figure 3 As shown in the method. Figure 6 As shown, the blockchain-based data processing device 1 may include: a contract calling module 11, a level calculation module 12, a data determination module 13 and a packaging and chaining module 14.
[0156] The contract calling module 11 is used to call the level calculation contract after receiving the transaction data set to be uploaded to the chain;
[0157] The level calculation module 12 is used to perform level calculation processing on each transaction data to be put on the chain in the transaction data set to be put on the chain through the calculation logic indicated by the level calculation contract, so as to obtain the transaction level of each transaction data to be put on the chain; the level calculation contract is created and deployed by the level calculation factory contract;
[0158] The data determination module 13 is used to determine the packaged transaction data at the transaction packaging time in the transaction data set to be uploaded according to the level order between the transaction levels of each transaction data to be uploaded when the transaction packaging time is reached;
[0159] The packaging and chaining module 14 is used to package the transaction data and process it on the chain.
[0160] The specific implementation methods of the contract calling module 11, the level calculation module 12, the data determination module 13 and the packaging and chaining module 14 can be found in the above Figure 3 The description of step S101 to step S103 in the corresponding embodiment will not be repeated here.
[0161] In one embodiment, the blockchain-based data processing device 1 may further include: a request sending module 15, an information receiving module 16, a valid voting acquisition module 17, a contract attribute determination module 18 and a step execution module 19.
[0162] The request sending module 15 is used to generate a contract on-chain request for the level calculation contract, and send the contract on-chain request to N organization sub-objects belonging to the decentralized governance organization; N is a positive integer;
[0163] The information receiving module 16 is used to receive the voting information returned by N organization sub-objects to obtain N voting information;
[0164] The valid voting acquisition module 17 is used to acquire the valid voting information from the N voting information;
[0165] A contract attribute determination module 18, for determining the contract attribute of the grade calculation contract based on the valid voting information;
[0166] The step execution module 19 is used to execute the call to the level calculation contract if it is determined that the contract attribute of the level calculation contract is a contract feasible attribute. Through the calculation logic indicated by the level calculation contract, each transaction data to be put on the chain in the set of transaction data to be put on the chain is subjected to level calculation processing to obtain the transaction level of each transaction data to be put on the chain.
[0167] The specific implementation methods of the request sending module 15, the information receiving module 16, the valid voting acquisition module 17, the contract attribute determination module 18 and the step execution module 19 can be found in the above Figure 4 The description of steps S401 to S404 in the corresponding embodiment will not be repeated here.
[0168] In one embodiment, the N organization sub-objects include an organization sub-object S i , N voting information includes the organization sub-object S iReturned voting information T i ; i is a positive integer;
[0169] The specific method of obtaining the valid voting information from the N voting information by the valid voting acquisition module 17 includes:
[0170] In voting information i Get the organization sub-object S i The signature information is the signature information of the organization sub-object S i The private key of the voting information T i The information obtained after signing;
[0171] Get the organization sub-object S i The public key of the organization sub-object S i The public key of the voting information T i Perform attribute classification processing to obtain voting information T i Voting attributes;
[0172] When the voting attribute of each piece of voting information in the N pieces of voting information is determined, the voting information whose voting attribute is a valid attribute is determined as valid voting information.
[0173] In one embodiment, the effective vote acquisition module 17 generates a vote based on the organization sub-object S i The public key of the voting information T i Perform attribute classification processing to obtain voting information T i The specific methods of voting attributes include:
[0174] Based on the organization sub-object S i The public key of the signature is used to verify the signature information and obtain the verification result;
[0175] If the signature verification result is a passing result, the voting information T is determined. i The voting attributes of are valid attributes;
[0176] If the signature verification result is a failure, the voting information T is determined. i The voting attribute is invalid.
[0177] In one embodiment, the specific manner in which the contract attribute determination module 18 determines the contract attribute of the grade calculation contract based on the valid voting information includes:
[0178] Count the number of votes that have passed in the valid voting information, and the total number of valid voting information;
[0179] Determine the quantitative ratio between the number of passes and the total number;
[0180] If the quantity ratio is greater than the ratio threshold, the contract attribute of the level calculation contract is determined to be a feasible contract attribute;
[0181] If the quantity ratio is less than the ratio threshold, the contract attribute of the level calculation contract is determined to be a contract infeasible attribute.
[0182] In one embodiment, the hierarchical computing contract includes a first hierarchical computing contract; the transaction data set to be uploaded includes the transaction data D to be uploaded a ; a is a positive integer;
[0183] The level calculation module 12 performs level calculation processing on each transaction data to be put on the chain in the transaction data set to be put on the chain through the calculation logic indicated by the level calculation contract, and obtains the specific method of the transaction level of each transaction data to be put on the chain, including:
[0184] According to the calculation logic of the first-level calculation contract, obtain the transaction data D to be uploaded to the chain a The transaction execution contract to which it belongs;
[0185] According to the contract type of the transaction execution contract, determine the transaction data D to be uploaded to the chain a The urgency of the transaction;
[0186] Based on the mapping relationship between the configuration urgency interval set and the first configuration level set in the first level mapping table, the transaction data D to be uploaded to the chain is determined in the first configuration level set. a transaction level; in the first level mapping table, a mapping relationship exists between a configuration urgency interval in the configuration urgency interval set and a first configuration level in the first configuration level set.
[0187] In one embodiment, the hierarchical computing contract includes a second hierarchical computing contract; the transaction data set to be uploaded includes the transaction data D to be uploaded a ; a is a positive integer;
[0188] The level calculation module 12 performs level calculation processing on each transaction data to be put on the chain in the transaction data set to be put on the chain through the calculation logic indicated by the level calculation contract, and obtains the specific method of the transaction level of each transaction data to be put on the chain, including:
[0189] According to the calculation logic indicated by the second-level calculation contract, obtain the transaction data D to be uploaded to the chain a Reward resources refer to the resources that can be obtained by calculating the transaction data to be uploaded to the chain;
[0190] Based on the mapping relationship between the configuration resource interval set and the second configuration level set in the second level mapping table, the transaction data D to be uploaded to the chain is determined in the second configuration level set. ain the second level mapping table, a mapping relationship exists between a configuration resource interval in the configuration resource interval set and a second configuration level in the second configuration level set.
[0191] In one embodiment, the transaction data set to be uploaded to the chain includes the transaction data D to be uploaded to the chain a ; a is a positive integer;
[0192] After the level calculation module 12 obtains the transaction level of each transaction data to be uploaded to the chain, the blockchain-based data processing device 1 may further include: a queue determination module 20 and a data adding module 21.
[0193] The queue determination module 20 is used to determine the transaction data D to be uploaded to the chain. a The transaction level of the transaction is determined in the transaction queue sequence to determine the transaction data D to be uploaded to the chain a The transaction queue to which it belongs; the transaction queue sequence is the sequence obtained by sorting the M transaction queues according to the queue level order between the M transaction queues; M is a positive integer;
[0194] Data adding module 21, used to add transaction data D to be uploaded to the chain a Add to the transaction data to be uploaded to the chain D a The transaction queue to which it belongs.
[0195] The specific implementation of the queue determination module 20 and the data adding module 21 can be found in the above Figure 3 The description of step S102 in the corresponding embodiment will not be repeated here.
[0196] In one embodiment, the transaction queue sequence includes a transaction queue K u , u is a positive integer;
[0197] When the transaction packaging time is reached, the data determination module 13 determines the specific method of packaging the transaction data at the transaction packaging time in the transaction data set to be uploaded according to the level order between the transaction levels of each transaction data to be uploaded, including:
[0198] According to the transaction queue K u The transaction queue K is the order of the transaction levels between the transaction data to be uploaded to the chain. u Sort the transaction data to be uploaded to the chain contained in the sorted transaction queue K u Determined as transaction queue K u the indicated ordered transaction queue;
[0199] After determining the sorted transaction queue indicated by each transaction queue in the transaction queue sequence, the transaction packaging quantity at the transaction packaging time is obtained;
[0200] According to the order of the transaction data to be uploaded to the chain contained in each sorted transaction queue, the order of the transaction queue sequence, and the number of transaction packages, R transaction data to be uploaded to the chain are obtained in sequence; R is a positive integer;
[0201] The R transaction data to be uploaded to the chain are all determined as the packaged transaction data at the transaction packaging time.
[0202] In one embodiment, the data determination module 13 sequentially obtains R transaction data to be uploaded according to the arrangement order of the transaction data to be uploaded contained in each sorted transaction queue, the arrangement order of the transaction queue sequence, and the number of transaction packages, including:
[0203] Determine the queue attribute of each transaction queue in the transaction queue sequence, and determine the transaction queues whose queue attributes are non-empty attributes in the transaction queue sequence as candidate transaction queues at the transaction packaging moment;
[0204] Sort the candidate transaction queues according to the arrangement order of the transaction queue sequences to obtain a candidate transaction queue sequence;
[0205] According to the arrangement order of the transaction data to be put on the chain contained in each candidate transaction queue in the candidate transaction queue sequence, and the number of transaction packages, R transaction data to be put on the chain are obtained in sequence.
[0206] In one embodiment, the data determination module 13 sequentially obtains R transaction data to be uploaded according to the arrangement order of the transaction data to be uploaded contained in each candidate transaction queue in the candidate transaction queue sequence and the number of transaction packages, including:
[0207] Determine the first candidate transaction queue in the candidate transaction queue sequence as the transaction packaging start queue;
[0208] Count the amount of transaction data to be uploaded to the chain contained in the transaction packaging start queue;
[0209] If the data volume is greater than or equal to the transaction package quantity, then R transaction data to be uploaded to the chain are obtained in the transaction package start queue in sequence according to the order of transaction levels among the transaction data to be uploaded to the chain contained in the transaction package start queue; R is the transaction package quantity;
[0210] If the data volume is less than the transaction package quantity, the quantity difference between the transaction package quantity and the data volume is determined, and the W transaction data to be put on the chain indicated by the quantity difference are obtained in turn in the remaining candidate transaction queues according to the order of transaction levels between the transaction data to be put on the chain contained in the remaining candidate transaction queues, and the transaction data to be put on the chain contained in the transaction package starting queue and the W transaction data to be put on the chain are jointly determined as R transaction data to be put on the chain; W is a positive integer; the remaining candidate transaction queues refer to the candidate transaction queues in the candidate transaction queue sequence, except the transaction package starting queue.
[0211] In an embodiment of the present application, a level calculation contract for performing level calculation on transaction data can be flexibly created and deployed in the blockchain through a level calculation factory contract. The calculation logic indicated by the level calculation contract can be flexibly configured. Therefore, after receiving the set of transaction data to be uploaded to the chain, the transaction level of each transaction data to be uploaded to the chain can be calculated through the level calculation contract; then, when the transaction packaging time is reached, the packaged transaction data at the transaction packaging time can be determined in the set of transaction data to be uploaded to the chain according to the level order between the transaction levels of each transaction data to be uploaded to the chain, and then these packaged transaction data can be packaged and uploaded to the chain for processing. It should be understood that through the level calculation factory contract, a level calculation contract with different calculation logics can be created and deployed in the blockchain based on the scenario business requirements. Then, through the level calculation contract, the level calculation of the on-chain transaction data can be performed according to the scenario business requirements. For example, the level of the transaction data that is expected to be processed first can be calculated as a higher value according to the scenario business requirements. Thus, the transaction data that is expected to be processed first can be prioritized according to the level order between the transaction levels, thereby greatly improving the timeliness of processing urgent transaction data; at the same time, for other transaction data that do not need to be processed first, the levels calculated by the level calculation contract will be closer, so the processing time of these transaction data will not differ too much, which can well ensure the fairness of the processing of these transaction data. In summary, the present application proposes a method of processing transaction data according to the transaction level of the transaction data, which can achieve fairness in the transaction data processing business of the blockchain while meeting the urgent processing needs of the transaction data in a timely manner.
[0212] For further information, see Figure 7 , Figure 7 Schematic diagram of the structure of a computer device provided in an embodiment of the present application. Figure 7As shown, the above-mentioned computer device 8000 may include: a processor 8001, a network interface 8004 and a memory 8005. In addition, the above-mentioned computer device 8000 also includes: a user interface 8003, and at least one communication bus 8002. Among them, the communication bus 8002 is used to realize the connection and communication between these components. Among them, the user interface 8003 may include a display screen (Display), a keyboard (Keyboard), and the optional user interface 8003 may also include a standard wired interface and a wireless interface. The network interface 8004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 8005 may be a high-speed RAM memory, or it may be a non-volatile memory (non-volatile memory), such as at least one disk storage. The memory 8005 may optionally also be at least one storage device located away from the aforementioned processor 8001. As Figure 7 As shown, the memory 8005 as a computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a device control application.
[0213] exist Figure 7 In the computer device 8000 shown, the network interface 8004 can provide a network communication function; the user interface 8003 is mainly used to provide an input interface for the user; and the processor 8001 can be used to call the device control application stored in the memory 8005 to achieve:
[0214] After receiving the set of transaction data to be uploaded to the chain, the level calculation contract is called. Through the calculation logic indicated by the level calculation contract, each transaction data to be uploaded to the chain in the set of transaction data to be uploaded to the chain is graded and processed to obtain the transaction level of each transaction data to be uploaded to the chain. The level calculation contract is created and deployed by the level calculation factory contract.
[0215] When the transaction packaging time is reached, the packaged transaction data at the transaction packaging time is determined in the transaction data set to be uploaded according to the level order between the transaction levels of each transaction data to be uploaded;
[0216] The packaged transaction data is packaged and uploaded to the chain.
[0217] It should be understood that the computer device 8000 described in the embodiment of the present application can execute the above Figures 3 to 5 The description of the data processing method based on blockchain in the corresponding embodiment can also be performed as described above. Figure 6 The description of the blockchain-based data processing device 1 in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of using the same method will not be repeated here.
[0218] In addition, it should be pointed out here that: the embodiment of the present application also provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program executed by the data processing computer device 8000 mentioned above, and the computer program includes program instructions. When the processor executes the program instructions, the computer program can execute the above-mentioned data processing computer device 8000. Figures 3 to 5 The description of the above-mentioned blockchain-based data processing method in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application.
[0219] The computer-readable storage medium may be a data processing device based on blockchain provided in any of the aforementioned embodiments or an internal storage unit of the computer device, such as a hard disk or memory of a 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. Furthermore, the computer-readable storage medium may also include both an 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.
[0220] In one aspect of the present application, a computer program product is provided, the computer program product comprising a computer program, the computer program being 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 provided in one aspect of the embodiments of the present application.
[0221] 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.
[0222] 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.
[0223] The method and related apparatus provided by the embodiment of the present application are described with reference to the method flow chart and / or structural diagram provided by the embodiment of the present application. Specifically, each process and / or box in the method flow chart and / or structural diagram, as well as the combination of the processes and / or boxes in the flow chart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the process in the process. Figure 1 Schematic diagram of one or more processes and / or structures Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 Schematic diagram of one or more processes and / or structures Figure 1 These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process in the process. Figure 1 A flow or multiple flows and / or structures illustrate the steps of the functions specified in one block or multiple blocks.
[0224] 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: include: After receiving the set of transaction data to be uploaded to the chain, the level calculation contract is called, and each transaction data to be uploaded to the chain in the set of transaction data to be uploaded to the chain is subjected to level calculation processing through the calculation logic indicated by the level calculation contract to obtain the transaction level of each transaction data to be uploaded to the chain; the level calculation contract is created and deployed by the level calculation factory contract; When the transaction packaging time is reached, the packaged transaction data at the transaction packaging time is determined in the transaction data set to be uploaded according to the level order between the transaction levels of each transaction data to be uploaded; The packaged transaction data is packaged and uploaded to the chain.
2. The method according to claim 1, characterized in that The method further comprises: Generate a contract on-chain request for the level calculation contract, and send the contract on-chain request to N organization sub-objects belonging to the decentralized governance organization; N is a positive integer; Receive the voting information returned by the N organization sub-objects to obtain N voting information; Obtain valid voting information from the N voting information, and determine the contract attributes of the grade calculation contract based on the valid voting information; If it is determined that the contract attribute of the level calculation contract is a contract feasible attribute, the calling level calculation contract is executed, and through the calculation logic indicated by the level calculation contract, each transaction data to be uploaded to the chain in the set of transaction data to be uploaded to the chain is subjected to level calculation processing to obtain the transaction level of each transaction data to be uploaded to the chain.
3. The method according to claim 2, characterized in that The N organization sub-objects include an organization sub-object S i The N voting information includes the organization sub-object S i Returned voting information T i ; i is a positive integer; The obtaining of valid voting information from the N voting information includes: In the voting information T i , obtain the organization sub-object S i The signature information is the signature information of the organization sub-object S i The private key of the voting information T i The information obtained after signing; Get the organization sub-object S i The public key of the organization sub-object S i The public key of the voting information T i Perform attribute classification processing to obtain the voting information T i Voting attributes; When the voting attribute of each piece of voting information in the N voting information is determined, the voting information whose voting attribute is a valid attribute is determined as valid voting information.
4. The method according to claim 3, characterized in that The organization sub-object S i The public key of the voting information T i Perform attribute classification processing to obtain the voting information T i Voting properties include: Based on the organization sub-object S i The signature information is verified using the public key to obtain a verification result; If the signature verification result is a passing result, the voting information T is determined. i The voting attributes of are valid attributes; If the verification result is a failure, the voting information T is determined. i The voting attribute is invalid.
5. The method according to claim 2, characterized in that: The determining the contract attribute of the grade calculation contract based on the valid voting information includes: Counting the number of passed voting information in the valid voting information and the total number of the valid voting information; determining a quantity ratio between the pass quantity and the total quantity; If the quantity ratio is greater than the ratio threshold, determining that the contract attribute of the level calculation contract is a contract feasible attribute; If the quantity ratio is less than the ratio threshold, it is determined that the contract attribute of the level calculation contract is a contract infeasible attribute.
6. The method according to claim 1, characterized in that The hierarchical computing contract includes a first-level computing contract; the transaction data set to be uploaded includes transaction data D to be uploaded a ; a is a positive integer; The step of performing a level calculation process on each transaction data to be put on the chain in the set of transaction data to be put on the chain by the calculation logic indicated by the level calculation contract to obtain the transaction level of each transaction data to be put on the chain includes: According to the calculation logic of the first-level calculation contract, obtain the transaction data D to be uploaded to the chain a The transaction execution contract to which it belongs; According to the contract type of the transaction execution contract, determine the transaction data D to be uploaded to the chain a The urgency of the transaction; Based on the mapping relationship between the configuration urgency interval set and the first configuration level set in the first level mapping table, the transaction data D to be uploaded to the chain is determined in the first configuration level set. a in the first level mapping table, there is a mapping relationship between a configuration urgency interval in the configuration urgency interval set and a first configuration level in the first configuration level set.
7. The method according to claim 1, characterized in that The hierarchical computing contract includes a second hierarchical computing contract; the transaction data set to be uploaded includes the transaction data D to be uploaded a ; a is a positive integer; The step of performing a level calculation process on each transaction data to be put on the chain in the set of transaction data to be put on the chain by the calculation logic indicated by the level calculation contract to obtain the transaction level of each transaction data to be put on the chain includes: According to the calculation logic indicated by the second-level calculation contract, the transaction data D to be uploaded to the chain is obtained. a The reward resources refer to the resources that can be obtained by calculating the transaction data to be uploaded to the chain; Based on the mapping relationship between the configuration resource interval set and the second configuration level set in the second level mapping table, the transaction data D to be uploaded to the chain is determined in the second configuration level set. a in the second level mapping table, there is a mapping relationship between a configuration resource interval in the configuration resource interval set and a second configuration level in the second configuration level set.
8. The method according to claim 1, characterized in that The transaction data set to be uploaded includes the transaction data D to be uploaded a ; a is a positive integer; After obtaining the transaction level of each transaction data to be uploaded to the chain, the method further includes: According to the transaction data D to be uploaded to the chain a The transaction level of the transaction is determined in the transaction queue sequence. a The transaction queue to which it belongs; the transaction queue sequence is a sequence obtained by sorting the M transaction queues according to the queue level order between the M transaction queues; M is a positive integer; The transaction data to be uploaded to the chain D a Add to the transaction data D to be uploaded to the chain a The transaction queue to which it belongs.
9. The method according to claim 8, characterized in that The transaction queue sequence includes a transaction queue K u , u is a positive integer; When the transaction packaging time is reached, the packaged transaction data at the transaction packaging time is determined in the transaction data set to be uploaded according to the level order between the transaction levels of each transaction data to be uploaded, including: According to the transaction queue K u The transaction queue K is u Sort the transaction data to be uploaded to the chain contained in the sorted transaction queue K u Determined as transaction queue K u the indicated ordered transaction queue; After determining the sorted transaction queue indicated by each transaction queue in the transaction queue sequence, obtaining the transaction packaging quantity at the transaction packaging time; According to the arrangement order of the transaction data to be uploaded to the chain contained in each sorted transaction queue, the arrangement order of the transaction queue sequence and the transaction packaging quantity, R transaction data to be uploaded to the chain are obtained in sequence; R is a positive integer; The R transaction data to be uploaded to the chain are all determined as the packaged transaction data at the transaction packaging moment.
10. The method according to claim 9, characterized in that The step of sequentially acquiring R transaction data to be uploaded to the chain according to the arrangement order of the transaction data to be uploaded to the chain contained in each sorted transaction queue, the arrangement order of the transaction queue sequence, and the transaction packaging quantity includes: Determine the queue attribute of each transaction queue in the transaction queue sequence, and determine the transaction queues in the transaction queue sequence whose queue attribute is a non-empty attribute as candidate transaction queues at the transaction packaging moment; Sorting the candidate transaction queues according to the arrangement order of the transaction queue sequence to obtain a candidate transaction queue sequence; According to the arrangement order of the transaction data to be uploaded to the chain contained in each candidate transaction queue in the candidate transaction queue sequence, and the transaction packaging quantity, R transaction data to be uploaded to the chain are obtained in sequence.
11. The method according to claim 10, characterized in that The step of sequentially acquiring R transaction data to be put on the chain according to the arrangement order of the transaction data to be put on the chain contained in each candidate transaction queue in the candidate transaction queue sequence and the transaction packaging quantity includes: Determine the first candidate transaction queue in the candidate transaction queue sequence as the transaction packaging start queue; Counting the amount of transaction data to be uploaded to the chain contained in the transaction packaging start queue; If the data volume is greater than or equal to the transaction package quantity, then R transaction data to be uploaded to the chain are obtained in sequence in the transaction package start queue according to the order of transaction levels among the transaction data to be uploaded to the chain contained in the transaction package start queue; R is the transaction package quantity; If the data volume is less than the transaction package quantity, the quantity difference between the transaction package quantity and the data volume is determined, and the W transaction data to be put on the chain indicated by the quantity difference are obtained in turn in the remaining candidate transaction queues according to the order of transaction levels between the transaction data to be put on the chain contained in the remaining candidate transaction queues, and the transaction data to be put on the chain contained in the transaction package starting queue and the W transaction data to be put on the chain are jointly determined as R transaction data to be put on the chain; W is a positive integer; the remaining candidate transaction queues refer to the candidate transaction queues in the candidate transaction queue sequence, except the transaction package starting queue.
12. A data processing device based on blockchain, characterized in that: include: The contract calling module is used to call the level calculation contract after receiving the transaction data set to be uploaded to the chain; A level calculation module, used to perform level calculation processing on each transaction data to be put on the chain in the set of transaction data to be put on the chain through the calculation logic indicated by the level calculation contract, so as to obtain the transaction level of each transaction data to be put on the chain; the level calculation contract is created and deployed by the level calculation factory contract; A data determination module, configured to determine, when the transaction packaging time is reached, in the transaction data set to be uploaded according to the order of the transaction levels of each transaction data to be uploaded, the packaged transaction data at the transaction packaging time; The packaging and chaining module is used to package the transaction data and process it on the chain.
13. 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 network 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-11.
14. 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 by a processor and executing the method according to any one of claims 1 to 11.
15. 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 11.