A method and device for parallel decoding of blockchain transaction data

By extracting the function ID and parameter offset tables in blockchain transaction data and creating parallel decoding tasks for each parameter, the problem of inefficient sequential decoding in the existing technology is solved, and more efficient transaction data decoding is achieved.

CN111738858BActive Publication Date: 2025-04-25WEBANK (CHINA)
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202010601244.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-28
Publication Date
2025-04-25
Estimated Expiration
2040-06-28

AI Technical Summary

Technical Problem

In the prior art, decoding transaction data according to the order of parameters is low efficiency, resulting in poor performance when processing large segments of transaction data.

Method used

By obtaining transaction data of blockchain smart contracts, the function ID is extracted to determine the parameter offset table, and the table and ABI are used to create a decoding task for each parameter, and decoding is performed in parallel.

Benefits of technology

The efficiency of transaction data decoding is improved and the problem of low performance caused by sequential decoding in the prior art is solved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111738858B_ABST
    Figure CN111738858B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and device for parallel decoding of blockchain transaction data, the method comprising obtaining transaction data obtained by a smart contract of a blockchain, extracting a function ID in the transaction data, determining a parameter offset table corresponding to the function ID, parsing the transaction data using the parameter offset table and the ABI of the smart contract, creating a decoding task for each parameter in the function corresponding to the function ID, executing the decoding task of each parameter in parallel, and obtaining a decoding result of the transaction data. After creating a decoding task for each parameter in the transaction data using the parameter offset table corresponding to the function ID and the ABI, executing all decoding tasks in parallel can improve the efficiency of decoding, and solve the problem of low efficiency in decoding transaction data according to the order of parameters in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of financial technology (Fintech), and in particular to a method and device for parallel decoding of blockchain (Block Chain) transaction data. Background Art

[0002] With the development of computer technology, more and more technologies are being applied in the financial field. Traditional finance is gradually transforming into financial technology. However, due to the security and real-time requirements of the financial industry, higher requirements are also placed on technology. In the blockchain technology in the financial field, transaction data decoding is an important issue.

[0003] The current transaction data decoding is to parse the transaction data in sequence according to the order of parameters. For example, the ABI (Application Binary Interface) defines the metadata information of the two parameters of the set function (uint256, u; bool, b), and the transaction input data is the parameter (0x123, true). When decoding, the ABI data will be read sequentially, parsed while reading, to restore the value of the original parameter (0x123, true). The process is as follows: According to the function ID (0x62f46d56), find the parameter metadata information of the corresponding function in the ABI. Decode parameter u first: first read the type information of the first parameter from the ABI, and know that it is uint256 type, which is 256 bits long, so after skipping the function ID, read 32 bytes in the transaction input data and decode it into an integer data. Then decode parameter b: After decoding parameter u, read the type information of the second parameter from the ABI, and know that it is bool type, which is also 256 bits, so start reading from the previous parameter u data, read 32 bytes, and decode it into Boolean type.

[0004] Since this decoding process is completely sequential, the decoding performance is relatively low for large segments of transaction data. Summary of the invention

[0005] The embodiments of the present invention provide a method and device for parallel decoding of blockchain transaction data, so as to solve the problem of low efficiency in decoding transaction data according to parameter sequence in the prior art.

[0006] In a first aspect, an embodiment of the present invention provides a method for parallel decoding of blockchain transaction data, comprising:

[0007] Get transaction data from smart contracts on the blockchain;

[0008] Extracting a function ID from the transaction data, and determining a parameter offset table corresponding to the function ID;

[0009] Parsing the transaction data using the parameter offset table and the ABI of the smart contract, and creating a decoding task for each parameter in the function corresponding to the function ID;

[0010] The decoding task of each parameter is executed in parallel to obtain the decoding result of the transaction data.

[0011] In the above technical solution, after creating a decoding task for each parameter in the transaction data using the parameter offset table corresponding to the function ID and the ABI, all decoding tasks are executed in parallel, which can improve the decoding efficiency and solve the problem of low efficiency in decoding transaction data according to the order of parameters in the prior art.

[0012] Optionally, the using the parameter offset table and the ABI of the smart contract to parse the transaction data and create a decoding task for each parameter in the function corresponding to the function ID includes:

[0013] Determining a parameter type of each parameter in the transaction data according to the metadata in the ABI;

[0014] According to the parameter length, parameter offset and parameter type of each parameter in the parameter offset table, data corresponding to each parameter in the transaction data is read, and a decoding task for each parameter is created.

[0015] In the above technical solution, different decoding tasks can be created for different parameter types according to the parameter types obtained from the metadata information of the ABI.

[0016] Optionally, reading data corresponding to each parameter in the transaction data according to the parameter length, parameter offset and parameter type of each parameter in the parameter offset table, and creating a decoding task for each parameter includes:

[0017] If the parameter type of each parameter is a variable-length type, a pointer of the variable-length parameter is determined according to the parameter offset, and data of the variable-length parameter is read from the position indicated by the pointer according to the parameter length, to create a decoding task of the variable-length parameter;

[0018] If the parameter type of each parameter is a non-variable-length type, the data corresponding to each parameter is directly read from the position corresponding to the parameter offset according to the parameter length of each parameter, and a decoding task for each parameter is created.

[0019] In the above technical solution, different decoding tasks can be created for different parameter types, thereby improving decoding efficiency.

[0020] Optionally, the method further includes:

[0021] If the parameter type of the non-variable-length parameter is an array, then based on the length of the array and the offset of the array type parameter, the offset of each element in the array is parsed, and the data corresponding to each element is read based on the offset of each element, and a decoding task is created for each element in the array.

[0022] In the above technical solution, when it is determined that the parameter type is an array, a decoding task is created for each element in the array, which can further improve the decoding efficiency.

[0023] Optionally, executing the decoding task of each parameter in parallel to obtain the decoding result of the transaction data includes:

[0024] A plurality of threads are used to execute the decoding task of each parameter in parallel to obtain the decoding result of the transaction data, wherein one thread executes one decoding task.

[0025] In the above technical solution, multiple threads execute decoding tasks in parallel, which can further improve decoding efficiency.

[0026] Optionally, before obtaining the transaction data obtained by the smart contract of the blockchain, the method further includes:

[0027] Parse each function recorded in the ABI of the smart contract;

[0028] Determine the function ID of each function according to the function name and parameter type list of each function;

[0029] Determine the parameter offset of each parameter according to the parameter order and parameter length of each parameter in each function;

[0030] A parameter offset table is constructed for each function according to the parameter type, parameter offset, parameter length of each parameter in each function and the function ID of each function.

[0031] In a second aspect, an embodiment of the present invention provides a device for parallel decoding of blockchain transaction data, comprising:

[0032] An acquisition unit, used to acquire transaction data obtained by a smart contract of a blockchain;

[0033] A processing unit is used to extract a function ID from the transaction data, determine a parameter offset table corresponding to the function ID; parse the transaction data using the parameter offset table and the ABI of the smart contract, and create a decoding task for each parameter in the function corresponding to the function ID; and execute the decoding task of each parameter in parallel to obtain a decoding result of the transaction data.

[0034] Optionally, the processing unit is specifically used for:

[0035] Determining a parameter type of each parameter in the transaction data according to the metadata in the ABI;

[0036] According to the parameter length, parameter offset and parameter type of each parameter in the parameter offset table, data corresponding to each parameter in the transaction data is read, and a decoding task for each parameter is created.

[0037] Optionally, the processing unit is specifically used for:

[0038] If the parameter type of each parameter is a variable-length type, a pointer of the variable-length parameter is determined according to the parameter offset, and data of the variable-length parameter is read from the position indicated by the pointer according to the parameter length, to create a decoding task of the variable-length parameter;

[0039] If the parameter type of each parameter is a non-variable-length type, the data corresponding to each parameter is directly read from the position corresponding to the parameter offset according to the parameter length of each parameter, and a decoding task for each parameter is created.

[0040] Optionally, the processing unit is further used for:

[0041] If the parameter type of the non-variable-length parameter is an array, then based on the length of the array and the offset of the array type parameter, the offset of each element in the array is parsed, and the data corresponding to each element is read based on the offset of each element, and a decoding task is created for each element in the array.

[0042] Optionally, the processing unit is specifically used for:

[0043] A plurality of threads are used to execute the decoding task of each parameter in parallel to obtain the decoding result of the transaction data, wherein one thread executes one decoding task.

[0044] Optionally, the processing unit is further used for:

[0045] Before obtaining the transaction data obtained by the smart contract of the blockchain, parsing each function recorded in the ABI of the smart contract;

[0046] Determine the function ID of each function according to the function name and parameter type list of each function;

[0047] Determine the parameter offset of each parameter according to the parameter order and parameter length of each parameter in each function;

[0048] A parameter offset table is constructed for each function according to the parameter type, parameter offset, parameter length of each parameter in each function and the function ID of each function.

[0049] In a third aspect, an embodiment of the present invention further provides a computing device, including:

[0050] A memory for storing program instructions;

[0051] The processor is used to call the program instructions stored in the memory and execute the above-mentioned method for parallel decoding of blockchain transaction data according to the obtained program.

[0052] In a fourth aspect, an embodiment of the present invention further provides a computer-readable non-volatile storage medium, comprising computer-readable instructions. When a computer reads and executes the computer-readable instructions, the computer executes the above-mentioned method of parallel decoding of blockchain transaction data. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments 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.

[0054] Figure 1 A schematic diagram of a system architecture provided for an embodiment of the present invention;

[0055] Figure 2 A flowchart of a method for parallel decoding of blockchain transaction data provided by an embodiment of the present invention;

[0056] Figure 3 A schematic diagram of transaction data provided by an embodiment of the present invention;

[0057] Figure 4 A schematic diagram of the structure of a device for parallel decoding of blockchain transaction data provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0058] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0059] Figure 1 A system architecture is provided for an embodiment of the present invention. Figure 1 As shown, the system architecture may include a blockchain system 100 and a client 200;

[0060] Among them, the client 200 can be a client 200 used by different institutions. The client 200 mainly sends transaction data to the blockchain system 100 and receives transaction result information fed back by the blockchain system 100.

[0061] The blockchain system 100 includes multiple blockchain nodes, each of which can maintain a blockchain. The blockchain is a chain composed of a series of blocks. In addition to recording the data of the current block, each block also records the hash value of the previous block, forming a chain in this way. Through cryptographic technology and decentralized thinking, it can be ensured that the historical information on the blockchain cannot be tampered with. The block is the basic unit of the blockchain, which consists of a block header containing metadata and a block body containing transaction data. The block header mainly includes the hash of the parent block.

[0062] Among them, smart contracts are also deployed on the blockchain. Smart contracts are programs deployed on the blockchain platform. Because they are deployed on the blockchain, they have the advantages of being tamper-proof. Similar to ordinary programs, they also have input parameters and return values.

[0063] In the embodiment of the present invention, the transaction is used to call the smart contract, which contains the necessary information for the smart contract call, including the contract to be called and the call input parameters. The input parameters are encoded binary data. After the transaction call is completed, the transaction result information will be obtained, including whether the call is successful and the contract return value, where the contract return value is encoded binary data.

[0064] It should be noted that the above Figure 1 The structure shown is only an example and is not limited to this embodiment of the present invention.

[0065] Based on the above description, Figure 2 The process of a method for parallel decoding of blockchain transaction data provided by an embodiment of the present invention is shown in detail, and the process can be executed by a device for parallel decoding of blockchain transaction data.

[0066] like Figure 2As shown in the figure, the process specifically includes:

[0067] Step 201, obtaining transaction data obtained by the smart contract of the blockchain.

[0068] In the embodiment of the present invention, when the client needs to store transaction data on the blockchain, it needs to call the smart contract on the blockchain. At this time, the smart contract can obtain the transaction data, which is encoded binary data. Figure 3 The transaction data shown in FIG. 1 shows a transaction data, wherein the first 4 bytes of the transaction data represent the function ID of the function used. The transaction data can be divided into transaction input data and transaction output data, both of which need to be decoded.

[0069] It should be noted that before obtaining the transaction data, a parameter offset table needs to be constructed. Specifically, each function recorded in the ABI of the smart contract can be parsed first, and then the function ID of each function can be determined based on the function name and parameter type list of each function. The function ID is generally a parameter hash algorithm, such as taking the first 4 bytes of the hash algorithm. The parameter offset of each parameter is then determined based on the parameter order and parameter length of each parameter in each function. Finally, a parameter offset table can be constructed for each function based on the parameter type, parameter offset, parameter length of each parameter in each function and the function ID of each function.

[0070] Among them, ABI is the metadata file of the smart contract, which can be obtained when compiling the smart contract. ABI defines the input parameters and return values ​​of the smart contract, their order, their parameter types, etc. Since the input and output parameters of the transaction do not contain parameter type information, in order to decode them, they must be interpreted by ABI.

[0071] Function ID is a unique identifier of a function. When obtaining a piece of binary data, you need to use the function ID in the data to determine which function the binary data belongs to.

[0072] Before decoding the transaction data, the program initialization phase needs to build a function ID and offset table for each function based on the function information in the ABI.

[0073] For example, during the program initialization phase, a function ID is constructed for each function recorded in the smart contract ABI as a unique identifier of the function. The function ID is calculated by taking the first 4 bytes of the hash result: sha3 (function name + parameter type list); in the blockchain field, sha3 usually uses the keccak256 function. Figure 3The identifier of the set function used in the transaction data shown is 0Xdb0075DF. The metadata of the set function in the ABI is set(uint256 var1, string var2, uint256[3]var3).

[0074] Then, an offset table is constructed for each function recorded in the smart contract ABI. Since all parameters only need to be accumulated according to the parameter order and parameter length, the parameter offset table can be constructed. For example, the structure of the parameter offset table of the above set function can be shown in Table 1.

[0075] Table 1

[0076]

[0077] When the parameter offset table is stored, it is stored together with the corresponding function ID. By finding the function ID, the corresponding parameter offset table can be found.

[0078] Step 202: extract the function ID in the transaction data and determine the parameter offset table corresponding to the function ID.

[0079] After obtaining the transaction data, find the corresponding parameter offset table based on the function ID in the transaction.

[0080] like Figure 3 The transaction data shown, after calling the set function in the smart contract and obtaining the transaction data, extract the first 4 bytes 0B0075DF to match the corresponding parameter offset table.

[0081] Step 203: parse the transaction data using the parameter offset table and the application binary interface ABI of the smart contract, and create a decoding task for each parameter in the function corresponding to the function ID.

[0082] When creating a decoding task, it is necessary to determine the parameter type of each parameter in the transaction data based on the metadata in the ABI, and then read the data corresponding to each parameter in the transaction data based on the parameter length, parameter offset and parameter type of each parameter in the parameter offset table, and create a decoding task for each parameter. The specific cases can be divided into the following:

[0083] First case:

[0084] If the parameter type of each parameter is a variable-length type, the pointer of the variable-length parameter is determined according to the parameter offset, and the data of the variable-length parameter is read from the position indicated by the pointer according to the parameter length, and a decoding task of the variable-length parameter is created.

[0085] This is a variable-length parameter. When decoding the parameter, you need to parse the pointer first, get the specific data, and then decode it.

[0086] Second case:

[0087] If the parameter type of each parameter is a non-variable-length type, the data corresponding to each parameter is directly read from the position corresponding to the parameter offset according to the parameter length of each parameter, and a decoding task for each parameter is created.

[0088] In this case, the parameters can be decoded directly. Since there is no pointer, there is no need to perform pointer parsing, and the data corresponding to the parameters can be directly obtained.

[0089] The third case:

[0090] If the parameter type of the non-variable-length parameter is an array, the offset of each element in the array is parsed based on the length of the array and the offset of the array type parameter, and the data corresponding to each element is read based on the offset of each element, creating a decoding task for each element in the array.

[0091] In this case, the parameter is of array type. Here, a subtask needs to be created for each element in the array, which can further improve the efficiency of transaction data decoding. It should be noted that a decoding task can also be created for the array type parameter. This is the second case mentioned above, so that each element in the array is decoded in order.

[0092] For example, if Figure 3 The transaction data shown has parameters var1, var2, and var3, which create decoding tasks respectively. Each decoding task is processed by a thread. These threads can run concurrently.

[0093] When creating the decoding task for var1, we know from the ABI that it is Uint256 and the offset is 0, so we can directly decode this part of the data, that is, create a pair Figure 3 The decoding task is to decode the content of the first data segment in .

[0094] When creating the decoding task for var2, we know it is a string according to the ABI, and start parsing from offset 32. It is a variable-length type, and its value 0xa0 is a pointer, which means that the real content starts reading at the 160th byte, and this part of the data can be decoded to get a string. Figure 3 The decoding task is to decode the content of the fourth data segment.

[0095] When creating the decoding task for var3, we know from the ABI that it is an array with a length of 3, so starting from offset 64, we calculate the offsets of the three elements (64, 96, 128), and create the corresponding decoding tasks for these three elements.

[0096] Step 204, executing the decoding task of each parameter in parallel to obtain the decoding result of the transaction data.

[0097] Use multiple threads to execute the decoding task of each parameter in parallel to obtain the decoding result of the transaction data, where one thread executes one decoding task.

[0098] When multiple decoding tasks are obtained, threads can be used to execute decoding tasks, with one thread executing one decoding task. Figure 3 The final decoding result of the transaction data shown can be shown in Table 2.

[0099] Table 2

[0100] Parameter name Decoding results var1 0x123 var2 "abc" var3 [1,2,3]

[0101] Through the above technical solution, parallel decoding of transaction data can be achieved to improve decoding efficiency.

[0102] In an embodiment of the present invention, the transaction data obtained by the smart contract of the blockchain is obtained, the function ID in the transaction data is extracted, the parameter offset table corresponding to the function ID is determined, the transaction data is parsed using the parameter offset table and the ABI of the smart contract, a decoding task is created for each parameter in the function corresponding to the function ID, and the decoding task of each parameter is executed in parallel to obtain the decoding result of the transaction data. After creating a decoding task for each parameter in the transaction data using the parameter offset table corresponding to the function ID and the ABI, all decoding tasks are executed in parallel, which can improve the efficiency of decoding and solve the problem of low efficiency in decoding transaction data according to the order of parameters in the prior art.

[0103] Based on the same technical concept, Figure 4 The structure of a device for parallel decoding of blockchain transaction data provided by an embodiment of the present invention is exemplarily shown, and the device can execute the process of parallel decoding of blockchain transaction data.

[0104] like Figure 4 As shown, the device specifically includes:

[0105] An acquisition unit 401 is used to acquire transaction data obtained by a smart contract of a blockchain;

[0106] The processing unit 402 is used to extract the function ID in the transaction data, determine the parameter offset table corresponding to the function ID; use the parameter offset table and the application binary interface ABI of the smart contract to parse the transaction data, and create a decoding task for each parameter in the function corresponding to the function ID; execute the decoding task of each parameter in parallel to obtain the decoding result of the transaction data.

[0107] Optionally, the processing unit 402 is specifically configured to:

[0108] Determining a parameter type of each parameter in the transaction data according to the metadata in the ABI;

[0109] According to the parameter length, parameter offset and parameter type of each parameter in the parameter offset table, data corresponding to each parameter in the transaction data is read, and a decoding task for each parameter is created.

[0110] Optionally, the processing unit 402 is specifically configured to:

[0111] If the parameter type of each parameter is a variable-length type, a pointer of the variable-length parameter is determined according to the parameter offset, and data of the variable-length parameter is read from the position indicated by the pointer according to the parameter length, to create a decoding task of the variable-length parameter;

[0112] If the parameter type of each parameter is a non-variable-length type, the data corresponding to each parameter is directly read from the position corresponding to the parameter offset according to the parameter length of each parameter, and a decoding task for each parameter is created.

[0113] Optionally, the processing unit 402 is further configured to:

[0114] If the parameter type of the non-variable-length parameter is an array, then based on the length of the array and the offset of the array type parameter, the offset of each element in the array is parsed, and the data corresponding to each element is read based on the offset of each element, and a decoding task is created for each element in the array.

[0115] Optionally, the processing unit 402 is specifically configured to:

[0116] A plurality of threads are used to execute the decoding task of each parameter in parallel to obtain the decoding result of the transaction data, wherein one thread executes one decoding task.

[0117] Optionally, the processing unit 402 is further configured to:

[0118] Before obtaining the transaction data obtained by the smart contract of the blockchain, parsing each function recorded in the ABI of the smart contract;

[0119] Determine the function ID of each function according to the function name and parameter type list of each function;

[0120] Determine the parameter offset of each parameter according to the parameter order and parameter length of each parameter in each function;

[0121] A parameter offset table is constructed for each function according to the parameter type, parameter offset, parameter length of each parameter in each function and the function ID of each function.

[0122] Based on the same technical concept, an embodiment of the present invention further provides a computing device, including:

[0123] A memory for storing program instructions;

[0124] The processor is used to call the program instructions stored in the memory and execute the above-mentioned method for parallel decoding of blockchain transaction data according to the obtained program.

[0125] Based on the same technical concept, an embodiment of the present invention also provides a computer-readable non-volatile storage medium, including computer-readable instructions. When a computer reads and executes the computer-readable instructions, the computer executes the above-mentioned method for parallel decoding of blockchain transaction data.

[0126] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart 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 produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0127] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0128] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0129] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.

[0130] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.

Claims

1. A method for parallel decoding of blockchain transaction data, characterized in that: include: Get transaction data from smart contracts on the blockchain; Extracting a function ID from the transaction data, and determining a parameter offset table corresponding to the function ID; Parsing the transaction data using the parameter offset table and the application binary interface ABI of the smart contract, and creating a decoding task for each parameter in the function corresponding to the function ID; A plurality of threads are used to execute the decoding task of each parameter in parallel to obtain the decoding result of the transaction data, wherein one thread executes one decoding task.

2. The method according to claim 1, characterized in that The using the parameter offset table and the ABI of the smart contract to parse the transaction data and create a decoding task for each parameter in the function corresponding to the function ID includes: Determining a parameter type of each parameter in the transaction data according to the metadata in the ABI; According to the parameter length, parameter offset and parameter type of each parameter in the parameter offset table, data corresponding to each parameter in the transaction data is read, and a decoding task for each parameter is created.

3. The method according to claim 2, characterized in that The step of reading data corresponding to each parameter in the transaction data according to the parameter length, parameter offset and parameter type of each parameter in the parameter offset table, and creating a decoding task for each parameter includes: If the parameter type of each parameter is a variable-length type, a pointer of the variable-length parameter is determined according to the parameter offset, and data of the variable-length parameter is read from the position indicated by the pointer according to the parameter length, to create a decoding task of the variable-length parameter; If the parameter type of each parameter is a non-variable-length type, the data corresponding to each parameter is directly read from the position corresponding to the parameter offset according to the parameter length of each parameter, and a decoding task for each parameter is created.

4. The method according to claim 3, characterized in that The method further comprises: If the parameter type of the non-variable-length parameter is an array, then based on the length of the array and the offset of the array type parameter, the offset of each element in the array is parsed, and the data corresponding to each element is read based on the offset of each element, and a decoding task is created for each element in the array.

5. The method according to any one of claims 1 to 4, characterized in that: Before obtaining the transaction data obtained by the smart contract of the blockchain, it also includes: Parse each function recorded in the ABI of the smart contract; Determine the function ID of each function according to the function name and parameter type list of each function; Determine the parameter offset of each parameter according to the parameter order and parameter length of each parameter in each function; A parameter offset table is constructed for each function according to the parameter type, parameter offset, parameter length of each parameter in each function and the function ID of each function.

6. A device for parallel decoding of blockchain transaction data, characterized in that: include: An acquisition unit, used to acquire transaction data obtained by a smart contract of a blockchain; A processing unit, configured to extract a function ID from the transaction data and determine a parameter offset table corresponding to the function ID; Parsing the transaction data using the parameter offset table and the application binary interface ABI of the smart contract, and creating a decoding task for each parameter in the function corresponding to the function ID; A plurality of threads are used to execute the decoding task of each parameter in parallel to obtain the decoding result of the transaction data, wherein one thread executes one decoding task.

7. The device according to claim 6, characterized in that The processing unit is specifically used for: Determining a parameter type of each parameter in the transaction data according to the metadata in the ABI; According to the parameter length, parameter offset and parameter type of each parameter in the parameter offset table, data corresponding to each parameter in the transaction data is read, and a decoding task for each parameter is created.

8. A computing device, characterized in that include: A memory for storing program instructions; A processor, configured to call the program instructions stored in the memory, and execute the method according to any one of claims 1 to 5 according to the obtained program.

9. A computer-readable non-volatile storage medium, characterized in that: The method comprises computer-readable instructions, and when a computer reads and executes the computer-readable instructions, the computer is caused to execute the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Self-adaptive data storage management method and system based on data block

    CN103345518A

  • Business data analysis method for block chain global intelligent contract

    CN107038242A

  • Operation data processing method and device for ship power system

    CN110532612A