Blockchain-based data processing method, device, equipment and medium

By reading and verifying the attribute information of transaction data from the first cache area in the blockchain, the problem of waste of storage space caused by the incorrect data addition in the blockchain is solved, and data validity verification and storage space saving are achieved.

CN111488626BActive Publication Date: 2024-11-26TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 16 Cites 0 Cited by

Patent Information

Application Number
CN202010273718.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-04-09
Publication Date
2024-11-26
Estimated Expiration
2040-11-26

AI Technical Summary

Technical Problem

If the data recorded in the blockchain is incorrect before being added to the block, it will cause doubts about the authenticity of subsequent data, waste the block's storage space, and generate a large number of meaningless blocks.

Method used

By reading the target transaction data from the first buffer area, obtaining its attribute information, and verifying the validity of the data based on the attribute information. If the data is valid, it is stored in the block of the blockchain network; if it is not valid, it is rolled back and the relevant execution results are removed to save storage space.

Benefits of technology

It effectively avoids invalid data entering the blockchain, saves block storage space, and improves the authenticity and accuracy of data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111488626B_ABST
    Figure CN111488626B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a data processing method, device, equipment and readable storage medium based on blockchain, the method comprising: reading target transaction data from a first buffer area, obtaining attribute information of the target transaction data; verifying the validity of the target transaction data according to the attribute information of the target transaction data; if the target transaction data is valid, storing the target transaction data in a block of the blockchain network, the block is located in a second buffer area; if the target transaction data is not valid, rolling back the target transaction data. The present application can effectively avoid invalid data from being added to the blockchain, which is conducive to saving storage space of blocks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of blockchain technology, and in particular to a blockchain-based data processing method, device, equipment and medium. Background Art

[0002] Blockchain is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, and encryption algorithm. In a distributed node system, nodes compete for the power to process data and serve as block generation nodes; the generated blocks are then stored after verification and confirmation by other nodes. The above operating mechanism makes it almost impossible for the data recorded in the blocks in the blockchain to be tampered with; if the source data already has errors before being added to the blockchain, adding the wrong source data to the block will cause the authenticity of the subsequent data to be questionable, while wasting the storage space of the block and generating a large number of meaningless blocks. Summary of the invention

[0003] The embodiments of the present application provide a blockchain-based data processing method, device, equipment, and medium, which effectively prevent invalid data from being added to the blockchain, thereby saving storage space of the block.

[0004] The present application embodiment provides a data processing method based on blockchain, including:

[0005] Read the target transaction data from the first buffer area to obtain attribute information of the target transaction data;

[0006] Verifying the validity of the target transaction data according to the attribute information of the target transaction data;

[0007] If the target transaction data is valid, storing the target transaction data in a block of the blockchain network, wherein the block is located in a second cache area;

[0008] If the target transaction data is not valid, the target transaction data is rolled back.

[0009] The step of rolling back the target transaction data includes:

[0010] Querying the first cache area for an execution result corresponding to the target transaction data;

[0011] The execution result corresponding to the target transaction data and the target transaction data are removed from the first buffer area.

[0012] Wherein, the attribute information includes a first quantity of electronic resources required to predict execution of the target transaction data;

[0013] The verifying the validity of the target transaction data according to the attribute information of the target transaction data includes:

[0014] Acquire a second quantity of electronic resources required to actually execute the target transaction data;

[0015] comparing the first amount to the second amount;

[0016] If the first amount is greater than the second amount, determining that the target transaction data is valid;

[0017] If the first quantity is less than or equal to the second quantity, it is determined that the target transaction data is not valid.

[0018] Wherein, the attribute information includes the size of the target transaction data;

[0019] The verifying the validity of the target transaction data according to the attribute information of the target transaction data includes:

[0020] Comparing the size of the target transaction data with a threshold value corresponding to the size of the transaction data;

[0021] If the size of the target transaction data is greater than a threshold value corresponding to the size of the transaction data, determining that the target transaction data is not valid;

[0022] If the size of the target transaction data is less than or equal to a threshold value corresponding to the size of the transaction data, it is determined that the target transaction data is valid.

[0023] Wherein, the attribute information includes signature information;

[0024] The verifying the validity of the target transaction data according to the attribute information of the target transaction data includes:

[0025] Obtaining a public key corresponding to the target transaction data;

[0026] Verifying the signature information according to the public key corresponding to the target transaction data;

[0027] If the verification is successful, the target transaction data is determined to be valid;

[0028] If the verification fails, it is determined that the target transaction data is not valid.

[0029] Wherein, the method further comprises:

[0030] Obtaining the number of node devices in the blockchain network that determine that the target transaction data is valid;

[0031] If the acquired quantity is greater than the quantity threshold, it is determined that the target transaction data is legitimate;

[0032] If the acquired quantity is less than or equal to the quantity threshold, it is determined that the target transaction data is not legal.

[0033] The step of reading the target transaction data from the first buffer area and obtaining the attribute information of the target transaction data includes:

[0034] Receive transaction data to be uploaded to the chain, and store the transaction data to be uploaded to the chain in the first buffer area;

[0035] Acquire characteristic information of each transaction data in the first buffer area, wherein the characteristic information includes at least one of a transaction type, a time when the transaction is received, and an importance priority;

[0036] The transaction data is sequentially read from the first cache block according to the characteristic information, and the read transaction data is determined as the target transaction data.

[0037] The blockchain network includes a smart contract, and the smart contract declares a storage rule for transaction data in the blockchain network;

[0038] The smart contract is used to verify the validity of the target transaction data according to the attribute information of the target transaction data, and when the target transaction data is valid, store the target transaction data in the block of the blockchain network;

[0039] When the target transaction data is not valid, the target transaction data is rolled back.

[0040] The present application provides a blockchain-based data processing device, including:

[0041] A first acquisition module, configured to read target transaction data from a first buffer area and acquire attribute information of the target transaction data;

[0042] A verification module, used to verify the validity of the target transaction data according to the attribute information of the target transaction data;

[0043] A storage module, configured to store the target transaction data in a block of the blockchain network if the target transaction data is valid, wherein the block is located in a second cache area;

[0044] The rollback module is used to roll back the target transaction data if the target transaction data is not valid.

[0045] Wherein, the rollback module includes:

[0046] A query unit, configured to query the first buffer area for an execution result corresponding to the target transaction data;

[0047] A removing unit is used to remove the execution result corresponding to the target transaction data and the target transaction data from the first buffer area.

[0048] Wherein, the attribute information includes a first quantity of electronic resources required to predict execution of the target transaction data;

[0049] Wherein, the verification module includes:

[0050] A first acquisition unit, configured to acquire a second quantity of electronic resources required to actually execute the target transaction data;

[0051] a first comparing unit, configured to compare the first quantity with the second quantity;

[0052] a first determining unit, configured to determine that the target transaction data is valid if the first quantity is greater than the second quantity;

[0053] The second determining unit is configured to determine that the target transaction data is not valid if the first quantity is less than or equal to the second quantity.

[0054] Wherein, the attribute information includes the size of the target transaction data;

[0055] Wherein, the verification module also includes:

[0056] a second comparing unit, configured to compare the size of the target transaction data with a threshold value corresponding to the size of the transaction data;

[0057] a third determining unit, configured to determine that the target transaction data is not valid if the size of the target transaction data is greater than a threshold value corresponding to the size of the transaction data;

[0058] The fourth determining unit is configured to determine that the target transaction data is valid if the size of the target transaction data is less than or equal to a threshold value corresponding to the size of the transaction data.

[0059] Wherein, the attribute information includes signature information;

[0060] Wherein, the verification module also includes:

[0061] A second acquisition unit, used to acquire a public key corresponding to the target transaction data;

[0062] A verification unit, configured to verify the signature information according to a public key corresponding to the target transaction data;

[0063] a fifth determining unit, configured to determine that the target transaction data is valid if the verification is successful;

[0064] The sixth determination unit is configured to determine that the target transaction data is not valid if the verification fails.

[0065] Wherein, the device further comprises:

[0066] A second acquisition module is used to obtain the number of node devices in the blockchain network that determine that the target transaction data is valid;

[0067] A first determination module, configured to determine the legitimacy of the target transaction data if the acquired quantity is greater than a quantity threshold;

[0068] The second determination module is used to determine that the target transaction data is not legal if the acquired quantity is less than or equal to the quantity threshold.

[0069] Wherein, the first acquisition module includes:

[0070] A storage unit, used for receiving transaction data to be uploaded to the chain, and storing the transaction data to be uploaded to the chain in the first buffer area;

[0071] A third acquisition unit is used to acquire characteristic information of each transaction data in the first buffer area, where the characteristic information includes at least one of a transaction type, a received time, and an importance priority;

[0072] A seventh determination unit is used to read transaction data from the first cache block in sequence according to the characteristic information, and determine the read transaction data as the target transaction data.

[0073] The blockchain network includes a smart contract, and the smart contract declares a storage rule for transaction data in the blockchain network;

[0074] The smart contract is used to verify the validity of the target transaction data according to the attribute information of the target transaction data, and when the target transaction data is valid, store the target transaction data in the block of the blockchain network;

[0075] When the target transaction data is not valid, the target transaction data is rolled back.

[0076] The embodiment of the present application provides a computer device, including: a processor, a memory, and a network interface;

[0077] The above-mentioned processor is connected to the memory and the network interface, wherein the network interface is used to provide data communication function, the above-mentioned memory is used to store computer programs, and the above-mentioned processor is used to call the above-mentioned computer program to execute the above-mentioned method in the embodiment of the present application.

[0078] An embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the method in the embodiment of the present application is executed.

[0079] In an embodiment of the present application, the target transaction data is read from the first buffer area to obtain the attribute information of the target transaction data, and the validity of the target transaction data is verified according to the attribute information of the target transaction data. If the target transaction data is valid, it indicates that the target transaction data is accurate, or the target transaction data has not been tampered with, etc., then the target transaction data is stored in the block of the blockchain network, and the block is located in the second buffer area; if the target transaction data is not valid, it indicates that there is erroneous data in the target transaction, or the target transaction data has been tampered with, etc., then the target transaction data is rolled back. With this application, by verifying the validity of the target transaction data according to the attribute information of the target transaction data, invalid data can be effectively avoided from being added to the blockchain, which is conducive to saving the storage space of the block, thereby ensuring the validity of the data in the blockchain. In addition, by caching the target transaction data in the first buffer area, when the verification is passed, the target transaction data is recorded in the block of the second buffer area; that is, by double-layer caching of the target transaction data, it is conducive to orderly verifying the validity of the target transaction data and improving the accuracy of the verification. BRIEF DESCRIPTION OF THE DRAWINGS

[0080] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0081] Figure 1a is a schematic diagram of the architecture of a data processing system provided by an embodiment of the present invention;

[0082] Figure 1b is a schematic diagram of a data sharing system provided in an embodiment of the present application;

[0083] Figure 1c This is a schematic diagram of the structure of a block chain block provided in an embodiment of the present application;

[0084] Figure 1dis a schematic diagram of a new block generation process provided by an embodiment of the present application;

[0085] Figure 2 This is a schematic diagram of an application scenario of blockchain-based data processing provided by an embodiment of the present application;

[0086] Figure 3 It is a flowchart of a data processing method based on blockchain provided in an embodiment of the present application;

[0087] Figure 4 It is a flowchart of a data processing method based on blockchain provided in an embodiment of the present application;

[0088] Figure 5 It is a structural schematic diagram of a blockchain-based data processing device provided in an embodiment of the present application;

[0089] Figure 6 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0090] 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.

[0091] The blockchain involved in this application is a new application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm, etc. It is essentially a decentralized database, a string of data blocks generated by cryptographic methods, each of which contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. The blockchain can include the underlying blockchain platform, the platform product service layer, and the application service layer; the blockchain can be composed of multiple serial transaction records (also known as blocks) that are connected and protected by cryptography. The distributed ledger connected by the blockchain allows multiple parties to effectively record transactions and can permanently check this transaction (cannot be tampered with). Among them, the consensus mechanism refers to the mathematical algorithm that realizes the establishment of trust and the acquisition of rights and interests between different nodes in the blockchain network; that is, the consensus mechanism is a mathematical algorithm recognized by all network nodes of the blockchain.

[0092] First, the architecture of the data processing system used in this application is introduced. Figure 1a The system architecture diagram includes a blockchain network and multiple terminals. Figure 1aIn the example, three terminals are included, namely the first terminal, the second terminal and the third terminal. The first terminal, the second terminal and the third terminal can be used to obtain transaction data from the blockchain network or upload transaction data to the blockchain network.

[0093] Among them, the above blockchain network can be as follows Figure 1b The blockchain network 100 shown, the blockchain network 100 refers to a system for sharing data between node devices and node devices, and the blockchain network may include multiple node devices 101, and the multiple node devices 101 may refer to each client in the blockchain network. Each node device 101 can receive transaction data when performing normal work, and maintain the shared data in the blockchain network based on the received transaction data. In order to ensure the information intercommunication within the blockchain network, there can be an information connection between each node device in the blockchain network, and information can be transmitted between node devices through the above information connection. For example, when any node device in the blockchain network receives transaction data, other node devices in the blockchain network obtain the transaction data according to the consensus algorithm, and store the transaction data as data in the shared data, so that the data stored on all node devices in the blockchain network are consistent.

[0094] Each node device in the blockchain network has a corresponding node device identifier, and each node device in the blockchain network can store the node device identifiers of other node devices in the blockchain network, so that the generated blocks can be broadcast to other node devices in the blockchain network based on the node device identifiers of other node devices. Each node device can maintain a node device identifier list as shown in the following table, and store the node device name and node device identifier in the node device identifier list accordingly. Among them, the node device identifier can be an IP (Internet Protocol, a protocol for interconnection between networks) address and any other information that can be used to identify the node device. Table 1 only uses the IP address as an example for illustration.

[0095] Table 1:

[0096] Node device name Node device identification Node device 1 117.114.151.174 Node device 2 117.116.189.145 … … Node device N 119.123.789.258

[0097] Each node device in the blockchain network stores the same blockchain. The blockchain consists of multiple blocks, see Figure 1cThe blockchain consists of multiple blocks. The genesis block includes a block header and a block body. The block header stores transaction data feature values, version numbers, timestamps, and difficulty values, and the block body stores transaction data. The next block of the genesis block uses the genesis block as its parent block. The next block also includes a block header and a block body. The block header stores the transaction data feature values ​​of the current block, the block header feature values, version numbers, timestamps, and difficulty values ​​of the parent block, and so on. This ensures that the block data stored in each block in the blockchain is associated with the block data stored in the parent block, thereby ensuring the security of the transaction data in the block.

[0098] When generating each block in the blockchain, see Figure 1d When the node device where the blockchain is located receives the transaction data, it verifies the transaction data. After the verification is completed, the transaction data is stored in the memory pool and the hash tree used to record the transaction data is updated. After that, the update timestamp is updated to the time when the transaction data is received, and different random numbers are tried to calculate the eigenvalue multiple times so that the calculated eigenvalue can satisfy the following formula:

[0099] SHA256(SHA256(version+prev_hash+merkle_root+ntime+nbits+x)) <TARGET

[0100] Among them, SHA256 is the eigenvalue algorithm used to calculate the eigenvalue; version (version number) is the version information of the relevant block protocol in the blockchain; prev_hash is the block header eigenvalue of the parent block of the current block; merkle_root is the eigenvalue of the transaction data; ntime is the update time of the update timestamp; nbits is the current difficulty, which is a fixed value within a period of time and is determined again after exceeding the fixed time period; x is a random number; TARGET is the eigenvalue threshold, which can be determined based on nbits.

[0101] In this way, when the random number that satisfies the above formula is calculated, the information can be stored accordingly, the block header and block body can be generated, and the current block can be obtained. Subsequently, the node device where the blockchain is located sends the newly generated block to other node devices in the blockchain network according to the node device identification of other node devices in the blockchain network. Other node devices verify the newly generated block and add the newly generated block to the blockchain stored in them after completing the verification.

[0102] Furthermore, if Figure 2 As shown, in the process of implementing the data processing method based on blockchain, Figure 2As shown, each terminal device can upload transaction data to the blockchain network. The following takes the first terminal uploading transaction data to the blockchain network as an example. The first terminal can upload target transaction data to the blockchain network. Correspondingly, the node device 101 can receive the target transaction data sent by the first terminal, cache the target transaction data in the first cache area, obtain the attribute information of the target transaction data, and verify the validity of the target transaction data according to the attribute information of the target transaction data. When the node device 101 verifies that the target transaction data is valid, the target transaction data can be recorded in the block in the blockchain network. Figure 2 In the example, the node device 101 can store the target transaction data in the block 10001, which includes a block header and a block body. The block header includes 10000H, 10001H, 10001T, etc., wherein 10000H represents the block header hash value of the block 10000 in the blockchain, the hash value corresponding to the transaction data in the block body in the block 10001H, and 10001T represents the block generation timestamp of the block 10001. The block body includes the target transaction data, and of course, other transaction data may also be included. If the target transaction data is not valid, the target transaction data is rolled back in the first cache area.

[0103] Among them, the node device, the first terminal, the second terminal and the third terminal in the blockchain network can be computer devices, including mobile phones, tablet computers, laptops, PDAs, smart speakers, mobile Internet devices (MID, mobile internet device), POS (Point Of Sales, point of sale) machines, wearable devices (such as smart watches, smart bracelets, etc.), etc.; it can also refer to an independent server, or a server cluster composed of several servers, or a cloud computing center.

[0104] For further information, see Figure 3 , is a flowchart of a data processing method based on blockchain provided in an embodiment of the present application. The method can be executed by a computer device, which can be Figure 1b Node device 101 in. Figure 3 As shown, the above method may include:

[0105] S101, reading target transaction data from a first buffer area to obtain attribute information of the target transaction data.

[0106] The computer device can receive the transaction data sent by the terminal, determine the received transaction data as the transaction data to be uploaded to the chain, store the multiple transaction data to be uploaded to the chain in the first buffer area, and read the target transaction data from the first buffer area in a certain order. Among them, the target transaction data can refer to any transaction data among the above multiple transaction data. Here, the order may include the time sequence of the transaction data being cached in the first buffer area, the importance priority of the transaction data, etc.; the target transaction data includes but is not limited to the transaction data of the electronic resource transfer, equity transaction data, and fund transaction data. After reading the target transaction data, the attribute information of the target transaction data can be obtained, and the attribute information here includes the first number of electronic resources required for predicting the execution of the target transaction data, the size of the target transaction data, the signature information of the target transaction data, the generation time of the target transaction data, etc. That is, the first number can refer to the number of electronic resources that the user is willing to pay for the execution of the target transaction data. Among them, the electronic resources refer to the funds used to purchase digital assets, which may at least include legal currency, electronic currency, etc. The digital assets here may include but are not limited to: electronic tickets, game resources (such as game coins, game equipment, etc.), and so on.

[0107] Optionally, step S101 may include: receiving transaction data to be uploaded to the chain, and storing the transaction data to be uploaded to the chain in the first cache area; obtaining characteristic information of each transaction data in the first cache area, the characteristic information including at least one of the transaction type, the time received, and the importance priority; reading the transaction data in sequence from the first cache block according to the characteristic information, and determining the read transaction data as the target transaction data.

[0108] The node device can read the transaction data in the first buffer area in sequence. Specifically, the node device can receive the transaction data to be uploaded to the chain sent by each terminal, store the transaction data to be uploaded to the chain in the first buffer area, obtain the characteristic information of each transaction data in the first buffer area, read the transaction data in sequence from the first buffer block according to the characteristic information, and determine the read transaction data as the target transaction data. This is conducive to the orderly verification of each transaction data and improves the flexibility and accuracy of verification.

[0109] Optionally, the characteristic information includes a transaction type, which may include a real-time transaction type and a non-real-time transaction type. The real-time transaction type may include electronic resource transfer (real-time account arrival), on-chain electronic certificates, etc.; the non-real-time transaction type may include on-chain news data, user registration data, etc. Therefore, the computer device may read the transaction data of the real-time transaction type first, and then read the transaction data of the non-real-time transaction type; this ensures that the transaction data of the real-time transaction type can be processed in real time.

[0110] Optionally, the characteristic information may include an importance priority, which may be determined according to the institution to which the transaction data belongs. For example, if the transaction data belongs to the Ministry of Civil Affairs, the importance priority of the transaction data is relatively high; however, if the transaction data belongs to an enterprise or an individual, the importance priority of the transaction data is relatively low. The importance priority is used to indicate the importance, privacy, etc. of the transaction data, that is, the higher the importance priority, the higher the importance and privacy of the transaction data; the lower the importance priority, the lower the importance and privacy of the transaction data. Therefore, the computer device can read the transaction data with high importance priority first, and then read the transaction data with low importance priority; this ensures that the transaction data with high importance priority can be processed in real time, which can effectively improve the security of the transaction data and prevent the transaction data with high importance priority from being leaked.

[0111] Optionally, the characteristic information may include the time of receipt, and the computer device may read each transaction data in the first cache area in order from the time when the transaction data was received to the time when it was received, thereby improving the fairness of processing each transaction data.

[0112] S102: Verify the validity of the target transaction data according to the attribute information of the target transaction data.

[0113] The computer device may verify the validity of the target transaction data based on the attribute information of the target transaction data. Specifically, verifying the validity of the target transaction data may refer to: verifying whether the target transaction data can be successfully executed; if it can be successfully executed, determining that the target transaction data is valid; if it cannot be successfully executed, determining that the target transaction data is not valid; optionally, verifying whether the target transaction data is valid may refer to: verifying the authenticity and integrity of the target transaction data (i.e., whether it has been tampered with); if the target transaction data is authentic and complete (i.e., has not been tampered with), determining that the target transaction data is valid; if the target transaction data is unauthentic and incomplete (i.e., has been tampered with), determining that the target transaction data is not valid.

[0114] Among them, the first quantity of electronic resources required to predict the execution of the target transaction data and the generation time of the target transaction data in the attribute information can be used to verify whether the target transaction data can be successfully executed; the size of the target transaction data and the signature information of the target transaction data in the attribute information are used to verify the authenticity and integrity of the target transaction data (that is, whether it has been tampered with).

[0115] S103: If the target transaction data is valid, the target transaction data is stored in a block of the blockchain network, and the block is located in the second cache area.

[0116] If the target transaction data is valid, it indicates that the target transaction data has integrity, authenticity, or can be successfully executed. Therefore, the computer device can store the target transaction data in the block of the blockchain network, and the block is located in the second cache area. Among them, the validity of the target transaction data is verified in the first cache area, and the transaction data with validity is sent to the second cache area. There is an information connection between the first cache area and the second cache area, and information is transmitted through the information connection. Therefore, the first cache area will verify the target transaction data in real time, and store the target transaction data in the second cache area according to the verification result, and obtain the target transaction number that is not valid for rollback. Therefore, the storage space of the first cache area is small, and the storage space of the second cache area is large.

[0117] It should be noted that if the transaction data in the first cache is read, the read transaction data can be deleted from the first cache area to save storage space and effectively store more new transaction data; that is, the transaction data in the first cache only needs to be stored temporarily, so the first cache area can be located in the solid-state hard disk of the computer device. Similarly, the transaction data in the blockchain network needs to be stored for a long time and will be queried and read by the terminal many times, so the second cache area can be located in the mechanical hard disk of the computer device; it can ensure that the transaction data is securely cached.

[0118] S104: If the target transaction data is not valid, roll back the target transaction data.

[0119] If the target transaction data is not valid, it indicates that the target transaction data is not complete, authentic or cannot be successfully executed. Therefore, the computer device can roll back the target transaction data; it can avoid storing invalid transaction data in the block, which is conducive to saving block storage space.

[0120] In an embodiment of the present application, the target transaction data is read from the first buffer area to obtain the attribute information of the target transaction data, and the validity of the target transaction data is verified according to the attribute information of the target transaction data. If the target transaction data is valid, it indicates that the target transaction data is accurate, or the target transaction data has not been tampered with, etc., then the target transaction data is stored in the block of the blockchain network, and the block is located in the second buffer area; if the target transaction data is not valid, it indicates that there is erroneous data in the target transaction, or the target transaction data has been tampered with, etc., then the target transaction data is rolled back. With this application, by verifying the validity of the target transaction data according to the attribute information of the target transaction data, invalid data can be effectively avoided from being added to the blockchain, which is conducive to saving the storage space of the block, thereby ensuring the validity of the data in the blockchain. In addition, by caching the target transaction data in the first buffer area, when the verification is passed, the target transaction data is recorded in the block of the second buffer area; that is, by double-layer caching of the target transaction data, it is conducive to orderly verifying the validity of the target transaction data and improving the accuracy of the verification.

[0121] See also Figure 4 , is a flowchart of a data processing method based on blockchain provided in an embodiment of the present application. The method can be executed by a computer device, which can be Figure 1b Node device 101 in. Figure 4 As shown, the above method may include:

[0122] S201, reading target transaction data from a first buffer area to obtain attribute information of the target transaction data;

[0123] S202, verifying the validity of the target transaction data according to the attribute information of the target transaction data;

[0124] Optionally, the attribute information includes a first quantity of electronic resources required to predict the execution of the target transaction data; step S202 may include: obtaining a second quantity of electronic resources required to actually execute the target transaction data, comparing the first quantity with the second quantity, if the first quantity is greater than the second quantity, determining that the target transaction data is valid; if the first quantity is less than or equal to the second quantity, determining that the target transaction data is not valid.

[0125] After reading the target transaction data from the first buffer area, the first quantity of electronic resources required by the user for predicting the execution of the target transaction data is obtained, and then the second quantity of electronic resources required for actually executing the above target transaction data is obtained, and the first quantity is compared with the second quantity. If the first quantity is greater than the second quantity, it is determined that the above target transaction data is valid, that is, it means that the currency required by the user to predict the execution of the target transaction data is greater than the currency required for actually executing the target transaction data, and the transaction execution can be successful. If the first quantity is less than or equal to the second quantity, it is determined that the target transaction data is not valid, that is, it means that the currency required by the user to predict the execution of the target transaction data is less than or equal to the currency required for actually executing the target transaction data, and the currency required for the transaction execution is insufficient, and the transaction cannot be successful. For example, if the first quantity of electronic resources required by the user to predict the execution of the target transaction data is 100 RMB, and the second quantity of electronic resources required for actually executing the target transaction data is 190 RMB, the first quantity is less than the second quantity, indicating that the electronic resources required by the user to predict the execution of the target transaction data are insufficient to the electronic resources required for actually executing the target transaction data, and the transaction will fail to execute, and it is determined that the target transaction data is not valid.

[0126] Optionally, the attribute information includes the size of the target transaction data, and the above step S202 includes: comparing the size of the target transaction data with a threshold value corresponding to the size of the transaction data; if the size of the target transaction data is larger than the threshold value corresponding to the size of the transaction data, determining that the target transaction data is not valid; if the size of the target transaction data is less than or equal to the threshold value corresponding to the size of the transaction data, determining that the target transaction data is valid.

[0127] The attribute information also includes the size of the target transaction data. Similarly, after reading the target transaction data from the first buffer area, the size of the target transaction data is obtained and compared with the size of the pre-set transaction data. If the size of the target transaction data is greater than the threshold corresponding to the pre-set size of the transaction data, it indicates that there is redundant data in the target transaction data, and the size of the target transaction data does not meet the conditions, then it is determined that the target transaction data is not valid; if the size of the target transaction data is less than or equal to the threshold corresponding to the pre-set size of the transaction data, it indicates that there is no redundant data in the target transaction data, then it is determined that the target transaction data is valid. For example, if the size of the target transaction data read from the first buffer area is 50mb, and the pre-set threshold corresponding to the size of the transaction data is 30mb, then the size of the target transaction data is greater than the threshold corresponding to the size of the transaction data, indicating that the size of the target transaction data is too large and therefore not valid.

[0128] Optionally, the attribute information includes signature information, and the above step S202 includes: obtaining a public key corresponding to the target transaction data; verifying the signature information according to the public key corresponding to the target transaction data; if the verification passes, determining that the target transaction data is valid; if the verification fails, determining that the target transaction data is not valid.

[0129] The above-mentioned attribute information also includes signature information. The computer device can obtain the public key corresponding to the target transaction data; the public key corresponding to the target transaction data may refer to the public key of the terminal that uploaded the target transaction data. The signature information can be verified according to the public key corresponding to the target transaction data. If the verification is successful, it indicates that the target transaction data has not been tampered with and has integrity, and the target transaction data is determined to be valid; if the verification fails, it indicates that the target transaction has been tampered with and has no integrity, and the target transaction data is determined to be invalid.

[0130] Specifically, when the target transaction data has not been uploaded to the node device, the terminal can perform a hash operation on the target transaction data to obtain a hash value of the target transaction data, encrypt the hash value of the target transaction data using a private key, and obtain the target transaction data carrying the signature of the terminal, and send the target transaction data and the target transaction data carrying the signature of the terminal to the node device of the blockchain network.

[0131] Correspondingly, the node device (i.e., computer device) can receive the target transaction data sent by the terminal and the target transaction data carrying the signature of the terminal. The node device can obtain the public key of the terminal device and use the public key as the public key corresponding to the target transaction data. Perform a hash operation on the target transaction data to obtain a first hash value, and use the public key to decrypt the target transaction data signed by the terminal to obtain a second hash value. Compare the first hash value with the second hash value. If the first hash value is different from the second hash value, it indicates that the target transaction data does not have integrity, that is, the target transaction data has been tampered with, and it is determined that the target transaction data has not been verified; if the first hash value is the same as the second hash value, it indicates that the target transaction data does not have integrity, or the target transaction data has been tampered with, etc., and it is determined that the target transaction data has been verified. For example, when a user submits a transaction, the first buffer reads the target transaction data submitted by the user, and immediately obtains the signature information of the target transaction data. The node device can obtain the public key in the terminal that sends the target transaction data, use the public key as the public key corresponding to the target transaction data, and verify the target transaction data according to the public key corresponding to the target transaction data. If the verification is successful, the transaction submitted by the user can be successfully executed, and the target transaction data corresponding to the transaction submitted by the user is determined to be valid. If the verification fails, the transaction submitted by the user fails to be executed, and the target transaction data corresponding to the transaction submitted by the user is determined to be invalid.

[0132] Among them, the number of node devices in the blockchain network that determine the validity of the target transaction data can be obtained; if the obtained number is greater than the number threshold, the target transaction data is determined to be legal; if the obtained number is less than or equal to the number threshold, the target transaction data is determined to be illegal.

[0133] Each terminal device can upload transaction data to the blockchain network. Correspondingly, each node device receives the target transaction data sent by each terminal device, caches the target transaction data in the first cache area, obtains the attribute information of the target transaction data, and verifies the validity of the target transaction data according to the attribute information of the target transaction data. When each node device verifies that the target transaction data is valid, the target transaction data can be recorded in the block in the blockchain network. Therefore, the number of node devices in the blockchain network that determine that the target transaction data is valid can be obtained. If the obtained number is greater than the number threshold, the target transaction data is determined to be legitimate. If the obtained number is less than or equal to the number threshold, the target transaction data is determined to be illegitimate.

[0134] S203. If the target transaction data is valid, the target transaction data is stored in a block of the blockchain network, and the block is located in the second cache area;

[0135] S204: If the target transaction data is not valid, query the first buffer area for an execution result corresponding to the target transaction data;

[0136] S205: Remove the execution result corresponding to the target transaction data and the target transaction data from the first buffer area.

[0137] After verifying the validity of the target transaction data through the above steps, if the target transaction data is valid, it indicates that the target transaction data has integrity, authenticity, or can be successfully executed. Therefore, the computer device can store the target transaction data in the block of the blockchain network, and the block is located in the second cache area. Among them, the validity of the target transaction data is verified in the first cache area, and the transaction data with validity is sent to the second cache area. There is an information connection between the first cache area and the second cache area, and information is transmitted through the information connection. If the target transaction data is not valid, it indicates that the target transaction data is not complete, authentic, or cannot be successfully executed. Therefore, the computer device can query the execution result corresponding to the target transaction data in the first cache area, and remove the execution result corresponding to the target transaction data and the target transaction data from the first cache area, which can avoid storing invalid transaction data in the block, which is beneficial to saving the storage space of the block. The target transaction data is stored in the block of the blockchain network, and the block is located in the second cache area. In this way, at least one transaction data in the first cache area is verified, and the transaction data with validity is stored in the second cache area. Among them, after verifying at least one transaction data in the first buffer area, valid target transaction data in at least one transaction data can be submitted at one time, because some transaction data may be submitted deferred, thereby reducing the operation of submitting transaction data.

[0138] Among them, the blockchain network includes smart contracts. Smart contracts refer to computerized protocols that can execute the terms of a contract. They are implemented by deploying codes on a shared ledger for execution when certain conditions are met. According to actual business needs, the codes are used to complete automated transactions, such as querying the logistics status of the goods purchased by the buyer, and transferring the buyer's electronic currency to the merchant's address after the buyer signs for the goods. Of course, smart contracts are not limited to executing contracts for transactions, but can also execute contracts for processing received information. The smart contract declares the storage rules for transaction data in the blockchain network. The smart contract is used to verify the validity of the target transaction data based on the attribute information of the target transaction data. When the target transaction data is valid, the target transaction data is stored in the block of the blockchain network. When the target transaction data is not valid, the target transaction data is rolled back.

[0139] In an embodiment of the present application, the target transaction data is read from the first buffer area to obtain the attribute information of the target transaction data, and the validity of the target transaction data is verified according to the attribute information of the target transaction data. If the target transaction data is valid, it indicates that the target transaction data is accurate, or the target transaction data has not been tampered with, etc., then the target transaction data is stored in the block of the blockchain network, and the block is located in the second buffer area; if the target transaction data is not valid, it indicates that there is erroneous data in the target transaction, or the target transaction data has been tampered with, etc., then the target transaction data is rolled back. With this application, by verifying the validity of the target transaction data according to the attribute information of the target transaction data, invalid data can be effectively avoided from being added to the blockchain, which is conducive to saving the storage space of the block, thereby ensuring the validity of the data in the blockchain. In addition, by caching the target transaction data in the first buffer area, when the verification is passed, the target transaction data is recorded in the block of the second buffer area; that is, by double-layer caching of the target transaction data, it is conducive to orderly verifying the validity of the target transaction data and improving the accuracy of the verification.

[0140] The embodiment of the present invention also provides a data processing device based on blockchain, such as Figure 5 The above is a schematic diagram of the structure of a blockchain-based data processing device provided in an embodiment of the present application. The blockchain data processing device can be a computer program (including program code) running in a computer device, for example, the blockchain data processing device is an application software; the device can be used to execute the corresponding steps of the method provided in the embodiment of the present application. Figure 5 As shown, the data processing device may include: a first acquisition module 11, a verification module 12, a storage module 13, a rollback module 14, a second acquisition module 15, a first determination module 16, and a second determination module 17.

[0141] A first acquisition module 11 is used to read target transaction data from the first buffer area to acquire attribute information of the target transaction data;

[0142] A verification module 12, used to verify the validity of the target transaction data according to the attribute information of the target transaction data;

[0143] The storage module 13 is used to store the target transaction data in a block of the blockchain network if the target transaction data is valid, and the block is located in the second cache area;

[0144] The rollback module 14 is used to roll back the target transaction data if the target transaction data is not valid.

[0145] The specific functional implementation of the request acquisition module 11, the generation and addition module 12, the parameter acquisition module 13, and the verification module 14 can be found in the above Figure 3 Steps S101 to S104 in the corresponding embodiment will not be described in detail here.

[0146] The first acquisition module may include a storage unit, a third acquisition unit, and a seventh determination unit.

[0147] A storage unit, used for receiving transaction data to be uploaded to the chain, and storing the transaction data to be uploaded to the chain in a first buffer area;

[0148] A third acquisition unit is used to acquire characteristic information of each transaction data in the first buffer area, where the characteristic information includes at least one of a transaction type, a time when it is received, and an importance priority;

[0149] The seventh determination unit is used to read the transaction data from the first cache block in sequence according to the characteristic information, and determine the read transaction data as the target transaction data.

[0150] See also Figure 5 The verification module 12 may include a first acquisition unit 1201, a first comparison unit 1202, a first determination unit 1203, a second determination unit 1204, a second comparison unit 1205, a third determination unit 1206, a fourth determination unit 1207, a second acquisition unit 1208, a verification unit 1209, a fifth determination unit 1210, and a sixth determination unit 1211.

[0151] The first acquisition unit 1201 is used to acquire a second quantity of electronic resources required to actually execute the target transaction data;

[0152] A first comparison unit 1202, configured to compare the first quantity with the second quantity;

[0153] A first determining unit 1203, configured to determine that the target transaction data is valid if the first quantity is greater than the second quantity;

[0154] A second determining unit 1204, configured to determine that the target transaction data is not valid if the first quantity is less than or equal to the second quantity;

[0155] A second comparing unit 1205 is used to compare the size of the target transaction data with a threshold value corresponding to the size of the transaction data;

[0156] The third determining unit 1206 is configured to determine that the target transaction data is not valid if the size of the target transaction data is greater than a threshold value corresponding to the size of the transaction data;

[0157] The fourth determining unit 1207 is configured to determine that the target transaction data is valid if the size of the target transaction data is less than or equal to a threshold value corresponding to the size of the transaction data;

[0158] The second acquisition unit 1208 is used to acquire the public key corresponding to the target transaction data;

[0159] Verification unit 1209, used to verify the signature information according to the public key corresponding to the target transaction data;

[0160] A fifth determining unit 1210, configured to determine that the target transaction data is valid if the verification is successful;

[0161] The sixth determining unit 1211 is configured to determine that the target transaction data is not valid if the verification fails.

[0162] See also Figure 5 The rollback module 14 may include a query unit 1401 and a removal unit 1402 .

[0163] A query unit 1401 is used to query the execution result corresponding to the target transaction data in the first buffer area;

[0164] A removing unit 142, configured to remove the execution result corresponding to the target transaction data and the target transaction data from the first buffer area;

[0165] The second acquisition module 15 is used to obtain the number of node devices in the blockchain network that determine that the target transaction data is valid;

[0166] A first determination module 16, configured to determine the legitimacy of the target transaction data if the acquired quantity is greater than a quantity threshold;

[0167] The second determination module 17 is configured to determine that the target transaction data is not legal if the acquired quantity is less than or equal to the quantity threshold.

[0168] The specific functional implementation of the second acquisition module 15, the first determination module 16, and the second determination module 17 can be found in the above Figure 4 The contents in the corresponding embodiments will not be repeated here.

[0169] The blockchain network includes a smart contract, and the smart contract declares a storage rule for transaction data in the blockchain network;

[0170] The smart contract is used to verify the validity of the target transaction data according to the attribute information of the target transaction data, and when the target transaction data is valid, store the target transaction data in the block of the blockchain network;

[0171] When the target transaction data is not valid, the target transaction data is rolled back.

[0172] In an embodiment of the present application, the target transaction data is read from the first buffer area to obtain the attribute information of the target transaction data, and the validity of the target transaction data is verified according to the attribute information of the target transaction data. If the target transaction data is valid, it indicates that the target transaction data is accurate, or the target transaction data has not been tampered with, etc., then the target transaction data is stored in the block of the blockchain network, and the block is located in the second buffer area; if the target transaction data is not valid, it indicates that there is erroneous data in the target transaction, or the target transaction data has been tampered with, etc., then the target transaction data is rolled back. With this application, by verifying the validity of the target transaction data according to the attribute information of the target transaction data, invalid data can be effectively avoided from being added to the blockchain, which is conducive to saving the storage space of the block, thereby ensuring the validity of the data in the blockchain. In addition, by caching the target transaction data in the first buffer area, when the verification is passed, the target transaction data is recorded in the block of the second buffer area; that is, by double-layer caching of the target transaction data, it is conducive to orderly verifying the validity of the target transaction data and improving the accuracy of the verification.

[0173] See also Figure 6 , is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. Figure 6 As shown, the above-mentioned computer device 1000 may include: a processor 1001, a network interface 1004 and a memory 1005. In addition, the above-mentioned computer device 1000 may also include: a user interface 1003, and at least one communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. Among them, the user interface 1003 may include a display screen (Display), a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or it may be a non-volatile memory (non-volatile memory), such as at least one disk storage. The memory 1005 may optionally also be at least one storage device located away from the aforementioned processor 1001. As Figure 6 As shown, the memory 1005 as a computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a device control application program.

[0174] exist Figure 6In the computer device 1000 shown, the network interface 1004 can provide a network communication function; the user interface 1003 is mainly used to provide an input interface for the user; and the processor 1001 can be used to call the device control application stored in the memory 1005 to achieve:

[0175] Read the target transaction data from the first buffer area to obtain attribute information of the target transaction data;

[0176] Verifying the validity of the target transaction data according to the attribute information of the target transaction data;

[0177] If the target transaction data is valid, storing the target transaction data in a block, wherein the block is located in a second buffer area;

[0178] If the target transaction data is not valid, the target transaction data is rolled back.

[0179] The step of rolling back the target transaction data includes:

[0180] Querying the first cache area for an execution result corresponding to the target transaction data;

[0181] The execution result corresponding to the target transaction data and the target transaction data are removed from the first buffer area.

[0182] Wherein, the attribute information includes a first quantity of electronic resources required to predict execution of the target transaction data;

[0183] The verifying the validity of the target transaction data according to the attribute information of the target transaction data includes:

[0184] Acquire a second quantity of electronic resources required to actually execute the target transaction data;

[0185] comparing the first amount to the second amount;

[0186] If the first amount is greater than the second amount, determining that the target transaction data is valid;

[0187] If the first quantity is less than or equal to the second quantity, it is determined that the target transaction data is not valid.

[0188] Wherein, the attribute information includes the size of the target transaction data;

[0189] The verifying the validity of the target transaction data according to the attribute information of the target transaction data includes:

[0190] Comparing the size of the target transaction data with a threshold value corresponding to the size of the transaction data;

[0191] If the size of the target transaction data is greater than a threshold value corresponding to the size of the transaction data, determining that the target transaction data is not valid;

[0192] If the size of the target transaction data is less than or equal to a threshold value corresponding to the size of the transaction data, it is determined that the target transaction data is valid.

[0193] Wherein, the attribute information includes signature information;

[0194] The verifying the validity of the target transaction data according to the attribute information of the target transaction data includes:

[0195] Obtaining a public key corresponding to the target transaction data;

[0196] Verifying the signature information according to the public key corresponding to the target transaction data;

[0197] If the verification is successful, the target transaction data is determined to be valid;

[0198] If the verification fails, it is determined that the target transaction data is not valid.

[0199] Wherein, the method further comprises:

[0200] Obtaining the number of node devices in the blockchain network that determine that the target transaction data is valid;

[0201] If the acquired quantity is greater than the quantity threshold, it is determined that the target transaction data is legitimate;

[0202] If the acquired quantity is less than or equal to the quantity threshold, it is determined that the target transaction data is not legal.

[0203] The step of reading the target transaction data from the first buffer area and obtaining the attribute information of the target transaction data includes:

[0204] Receive transaction data to be uploaded to the chain, and store the transaction data to be uploaded to the chain in the first buffer area;

[0205] Acquire characteristic information of each transaction data in the first buffer area, wherein the characteristic information includes at least one of a transaction type, a time when the transaction is received, and an importance priority;

[0206] The transaction data is sequentially read from the first cache block according to the characteristic information, and the read transaction data is determined as the target transaction data.

[0207] The blockchain network includes a smart contract, and the smart contract declares a storage rule for transaction data in the blockchain network;

[0208] The smart contract is used to verify the validity of the target transaction data according to the attribute information of the target transaction data, and when the target transaction data is valid, the target transaction data is stored in the block;

[0209] When the target transaction data is not valid, the target transaction data is rolled back.

[0210] In an embodiment of the present application, the target transaction data is read from the first buffer area to obtain the attribute information of the target transaction data, and the validity of the target transaction data is verified according to the attribute information of the target transaction data. If the target transaction data is valid, it indicates that the target transaction data is accurate, or the target transaction data has not been tampered with, etc., then the target transaction data is stored in the block of the blockchain network, and the block is located in the second buffer area; if the target transaction data is not valid, it indicates that there is erroneous data in the target transaction, or the target transaction data has been tampered with, etc., then the target transaction data is rolled back. With this application, by verifying the validity of the target transaction data according to the attribute information of the target transaction data, invalid data can be effectively avoided from being added to the blockchain, which is conducive to saving the storage space of the block, thereby ensuring the validity of the data in the blockchain. In addition, by caching the target transaction data in the first buffer area, when the verification is passed, the target transaction data is recorded in the block of the second buffer area; that is, by double-layer caching of the target transaction data, it is conducive to orderly verifying the validity of the target transaction data and improving the accuracy of the verification.

[0211] 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 blockchain-based data processing device 1 mentioned above, and the computer program includes program instructions. When the processor executes the program instructions, it can execute the above Figure 3 or Figure 4 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. As an example, the program instructions can be deployed on a computer device for execution, or deployed on multiple computer devices located at one location for execution, or, on multiple computer devices distributed at multiple locations and interconnected by a communication network, and multiple computer devices distributed at multiple locations and interconnected by a communication network can form a blockchain network.

[0212] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the above-mentioned program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The above-mentioned storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

[0213] 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, applied to a node device in a blockchain network, characterized in that: include: Read the target transaction data from the first buffer area to obtain attribute information of the target transaction data; The first cache area is located in the solid state hard disk of the node device; The target transaction data is transaction data with a high priority in the first cache area, or the target transaction data is transaction data with a real-time transaction type in the first cache area, or the target transaction data is transaction data with the first received time in the first cache area; the attribute information includes a first quantity of electronic resources required for predicting the execution of the target transaction data, a size of the target transaction data, and signature information of the target transaction data; the first quantity is the quantity of electronic resources that the user is willing to pay for executing the target transaction data; Acquire a second quantity of electronic resources required for actually executing the target transaction data, compare the first quantity with the second quantity, compare the size of the target transaction data with a preset threshold value corresponding to the size of the transaction data, and verify the signature information according to the public key corresponding to the target transaction data; if the first quantity is greater than the second quantity, and the size of the target transaction data is less than or equal to the threshold value corresponding to the size of the transaction data, and the signature information is verified, then the target transaction data is determined to be valid; if the first quantity is less than or equal to the second quantity, then the target transaction data is determined to be invalid; or, if the size of the target transaction data is greater than the threshold value corresponding to the size of the transaction data, then the target transaction data is determined to be invalid; or, if the signature information is not verified, then the target transaction data is determined to be invalid; If the target transaction data is valid, the target transaction data is stored in a block of the blockchain network, and the block is located in a second cache area; the second cache area is located in a mechanical hard disk of the node device; If the target transaction data is not valid, the target transaction data is rolled back.

2. The method according to claim 1, characterized in that The rolling back the target transaction data includes: Querying the first cache area for an execution result corresponding to the target transaction data; The execution result corresponding to the target transaction data and the target transaction data are removed from the first buffer area.

3. The method according to claim 1, characterized in that The method further comprises: Obtaining the number of node devices in the blockchain network that determine that the target transaction data is valid; If the acquired quantity is greater than the quantity threshold, it is determined that the target transaction data is legitimate; If the acquired quantity is less than or equal to the quantity threshold, it is determined that the target transaction data is not legal.

4. The method according to claim 1, characterized in that The step of reading the target transaction data from the first buffer area and acquiring the attribute information of the target transaction data includes: Receive transaction data to be uploaded to the chain, and store the transaction data to be uploaded to the chain in the first buffer area; Acquire characteristic information of each transaction data in the first buffer area, wherein the characteristic information includes at least one of a transaction type, a time when the transaction is received, and an importance priority; The transaction data is sequentially read from the first cache block according to the characteristic information, and the read transaction data is determined as the target transaction data.

5. The method according to claim 1, characterized in that The blockchain network includes a smart contract, and the smart contract declares a storage rule for transaction data in the blockchain network; The smart contract is used to verify the validity of the target transaction data according to the attribute information of the target transaction data, and when the target transaction data is valid, store the target transaction data in the block of the blockchain network; When the target transaction data is not valid, the target transaction data is rolled back.

6. A data processing device based on blockchain, applied to a node device in a blockchain network, characterized in that: include: A first acquisition module, configured to read target transaction data from a first buffer area and acquire attribute information of the target transaction data; The first cache area is located in the solid state hard disk of the node device; The target transaction data is transaction data with a high priority in the first cache area, or the target transaction data is transaction data of a real-time transaction type in the first cache area, or the target transaction data is transaction data with the earliest received time in the first cache area; the attribute information includes a first quantity of electronic resources required for predicting the execution of the target transaction data, a size of the target transaction data, and signature information of the target transaction data; the first quantity is the quantity of electronic resources that the user is willing to pay for executing the target transaction data; a verification module, used for obtaining a second quantity of electronic resources required for actually executing the target transaction data, comparing the first quantity with the second quantity, comparing the size of the target transaction data with a preset threshold value corresponding to the size of the transaction data, and verifying the signature information according to the public key corresponding to the target transaction data; if the first quantity is greater than the second quantity, and the size of the target transaction data is less than or equal to the threshold value corresponding to the size of the transaction data, and the signature information is verified, it is determined that the target transaction data is valid; if the first quantity is less than or equal to the second quantity, it is determined that the target transaction data is not valid; or, if the size of the target transaction data is greater than the threshold value corresponding to the size of the transaction data, it is determined that the target transaction data is not valid; or, if the verification of the target transaction data fails, it is determined that the target transaction data is not valid; A storage module, configured to store the target transaction data in a block of the blockchain network if the target transaction data is valid, wherein the block is located in a second cache area; and the second cache area is located in a mechanical hard disk of the node device; The rollback module is used to roll back the target transaction data if the target transaction data is not valid.

7. A computer device, characterized in that: include: Processor, memory, and network interface; The processor is connected to a memory and a network interface, wherein the network interface is used to provide a data communication function, the memory is used to store program codes, and the processor is used to call the program codes to execute the method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the steps of the method according to any one of claims 1 to 5 are executed.

Citation Information

Patent Citations

  • IO (input / output) data reading and writing method and device

    CN107273051A

  • Data processing method and apparatus, server

    CN107632779A

  • Data processing method and system, electronic equipment

    CN108009008A

  • Transaction processing method used for block chain and transaction processing network node used for block chain

    CN108269072A

  • Cached data transmission method, system and related components

    CN109343797A