Movatterモバイル変換


[0]ホーム

URL:


CN118897855B - A high-performance blockchain system supporting distributed parallel processing and bidirectional retrieval - Google Patents

A high-performance blockchain system supporting distributed parallel processing and bidirectional retrieval
Download PDF

Info

Publication number
CN118897855B
CN118897855BCN202411391230.5ACN202411391230ACN118897855BCN 118897855 BCN118897855 BCN 118897855BCN 202411391230 ACN202411391230 ACN 202411391230ACN 118897855 BCN118897855 BCN 118897855B
Authority
CN
China
Prior art keywords
data
transaction
parallel processing
contract
module
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202411391230.5A
Other languages
Chinese (zh)
Other versions
CN118897855A (en
Inventor
张文帅
王岳赣
李京
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
University of Science and Technology of China USTC
Original Assignee
University of Science and Technology of China USTC
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by University of Science and Technology of China USTCfiledCriticalUniversity of Science and Technology of China USTC
Priority to CN202411391230.5ApriorityCriticalpatent/CN118897855B/en
Publication of CN118897855ApublicationCriticalpatent/CN118897855A/en
Application grantedgrantedCritical
Publication of CN118897855BpublicationCriticalpatent/CN118897855B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Classifications

Landscapes

Abstract

The invention discloses a high-performance blockchain system supporting distributed parallel processing and bidirectional retrieval, which relates to the crossing field of blockchain technology and parallel computation and comprises an initialization and resource scheduling module, a network data receiving and transmitting module, a retrieval service module and a parallel processing module, wherein the parallel processing module comprises a blockdata parallel processing module, a transaction data parallel processing module and a contract data parallel processing module, and the retrieval service module comprises a transaction query component and a contract query component.

Description

High-performance blockchain system supporting distributed parallel processing and bidirectional retrieval
Technical Field
The invention relates to the crossing field of block chain technology and parallel computing, in particular to a high-performance block chain system supporting distributed parallel processing and bidirectional retrieval.
Background
In the existing blockchain technology, a blockchain ledger network has thousands of blockchain nodes, each blockchain node is usually operated and supported by a single computer device, such as an widely adopted ethernet blockchain system, and the same transaction and block are repeatedly verified, although thousands of computer devices exist in the network, the blockchain systems are difficult to process and bear large-scale high-throughput transaction data, so the blockchain network is also an inefficient mirror computer network, and in order to improve the performance, a consensus node system in one blockchain node is usually required to be operated in a distributed manner in a cluster of a plurality of computer devices;
In a blockchain network based on an account model, the state associated with an account address needs to be sequentially updated, the final result of the state is influenced by the change of the updating sequence, and the result of the previous updating operation is often required by the next updating operation, so that the previous and next state updating is often required to be processed in series, and the state updating instruction is triggered by sending a blockchain transaction, so that each transaction is difficult to be processed in parallel completely by a blockchain system based on the account model, and the parallelizable task of the whole system is low in occupation;
In a blockchain network based on the unconsumed transaction output Unspent Transaction Output, UTXO, and a model, each transaction output Transaction Output, TXO is independent status data, each TXO is uniquely specified by the identification number TXID of the transaction in which it is located and the position of the output serial number VOUT in the transaction, the two data are called "output pointers", i.e. the data sets { TXID, VOUT }, are called "TXO pointers", and different UTXOs can perform independent verification when spending, so that massive parallelism can be supported, but massive parallel transaction processing can be accompanied by a large number of UTXO fragments, resulting in retrieval difficulties;
the blockchain system based on the account model and the UTXO model respectively have the characteristics of efficient retrieval and efficient parallelism, and both are difficult to consider.
Therefore, the scheme discloses a novel parallel processing scheme, and provides a high-performance blockchain system supporting distributed parallel processing and bidirectional retrieval to solve the problems.
Disclosure of Invention
The invention aims to provide a high-performance blockchain system supporting distributed parallel processing and bidirectional retrieval, which utilizes a hash table technology to store TXO pointers and token quantity data with the same locking script contract data in the same storage position so as to provide the retrieval service which is as concise and efficient as an account model and solve the problem that efficient parallel and efficient retrieval are difficult to be compatible.
In order to achieve the above-mentioned purpose, the present invention provides a high performance blockchain system supporting distributed parallel processing and bidirectional retrieval, which comprises an initialization and resource scheduling module, a network data transceiver module, a retrieval service module and a parallel processing module, wherein the parallel processing module comprises a blockdata parallel processing module, a transaction data parallel processing module and a contract data parallel processing module, and the retrieval service module comprises a transaction inquiry component and a contract inquiry component;
the processing process of the network data transceiver module for data specifically comprises the following steps:
S1, receiving block data and transaction data of a block chain network node and a user terminal, judging a corresponding processing unit based on a parallel task-processing unit mapping table constructed in an initialization and resource scheduling module, if the received data is the block data, sending the data to the corresponding processing unit of the block parallel processing module, and if the received data is the transaction data, sending the data to the corresponding parallel processing unit of the transaction parallel processing module;
And S2, receiving the block data of the block parallel processing module and the transaction data of the transaction parallel processing module, and transmitting the block data and the transaction data to the corresponding block chain network node and the user terminal.
Preferably, in step S1, the initialization and resource scheduling module is responsible for processing the starting and initialization of parallel task-processing units, the parallel task-processing units are set to be single-threaded or multithread, the initialization and resource scheduling module manages the allocation and scheduling of computing tasks, and the number of processing units required to be started by the block parallel processing module and the transaction parallel processing module, the mapping relation and the topology structure of the parallel processing units and the single computing device in the computer cluster are determined by reading configuration files or using an empirical algorithm, so as to construct and manage a mapping table of parallel task-processing units in three layers of block data verification, transaction data verification and contract data verification.
Preferably, in step S1, the processing procedure of the block data parallel processing module on the node data specifically includes:
S11, analyzing the block data received by the network data receiving and transmitting module, analyzing and checking the validity of the block header data, analyzing the transaction data contained in the block header data, and transmitting the transaction data to the transaction parallel processing module;
S12, receiving a processing and verifying result sent back by the transaction parallel processing module, summarizing the processing and verifying result, marking a corresponding block as legal if both the block head data and the internal block transaction are legal, and marking the corresponding block as illegal if the block head data or the internal block transaction are illegal;
and S13, if the node where the block data is located bears the block propagation task, the corresponding block marked as legal is sent to the network data receiving and transmitting module.
Preferably, for a low load scenario with a small amount of block data, the block data parallel processing module sets the number of parallel tasks to 1, and starts and uses a single processing unit.
Preferably, in step S1, the processing procedure of the transaction data parallel processing module on the node data specifically includes:
The method comprises the steps of firstly, receiving transaction data of a network data transceiver module, analyzing the transaction data, calculating and constructing a transaction data reduced set, wherein the transaction data reduced set comprises hash value data of contract data of an unlocking script and a locking script or derivative data of the hash value data based on the contract data of the unlocking script and the locking script, and does not contain complete contract data of the unlocking script and the locking script;
Sequentially processing transaction input data, positioning TXO of a father transaction through an output pointer, acquiring locking script contract data corresponding to the TXO, determining the position or label of a parallel processing unit of the locking script contract data based on initializing a parallel task-processing unit mapping table of a contract data verification layer constructed in a resource scheduling module, and transmitting unlocking dependent data input by the current transaction to a parallel processing unit corresponding to the contract for verification, wherein the unlocking dependent data comprises unlocking script contract data input by the current transaction and a transaction data reduced set of the current transaction;
Sequentially processing transaction output data, analyzing and acquiring TXO data comprising 'locking script' contract data, acquiring a hash value of the 'locking script' contract data according to a hash function, acquiring a position or a label of a corresponding parallel processing unit based on a 'parallel task-processing unit' mapping table of a contract data verification layer constructed in an initialization and resource scheduling module, defining a dataset comprising the TXO data and TXO pointers as 'locking data' according to the position or the label of the parallel processing unit, and transmitting the 'locking data' to the corresponding parallel processing unit of a contract data parallel processing module;
Checking the legal requirement of the transaction except for unlocking verification of single transaction input, and calculating the lowest transaction fee specified by the current blockchain network consensus according to the transaction data and the transaction rate, wherein amount paid in transaction fee is higher than the lowest transaction fee;
Step five, aiming at the transaction input data processed in the step two, receiving a verification result sent back by a contract parallel processing unit, and marking the whole transaction as illegal transaction if the verification result contains 'failed';
And step six, integrating the verification results from the step one to the step five to obtain an overall validity verification result of the transaction data, and sending the overall validity verification result of the transaction data back to the block data parallel processing module.
Preferably, in the third step, the processing procedure of the contract data parallel processing module on the unlocking dependent data and the locking data specifically includes:
Step 3-1, receiving locking data and unlocking dependent data of a transaction data parallel processing module, and analyzing the locking data and the unlocking dependent data;
Step 3-2, when the received data is 'locking data', determining the position of a data table corresponding to the contract according to the hash value of the TXO locking script in the 'locking data', storing the TXO pointer in the 'locking data' in the data table, and marking the TXO pointer in the 'locking data' as an unexpired transaction output UTXO;
step 3-3, when the received data is unlocking dependent data, acquiring a data table position of the UTXO to be unlocked, checking whether the corresponding TXO pointer is UTXO, if the corresponding TXO pointer is UTXO, the corresponding TXO is not spent, and if the corresponding TXO pointer is not UTXO, the corresponding TXO is spent;
Step 3-4, if the corresponding TXO is spent, the verification is failed, and a result of the verification error is returned to the transaction parallel processing unit;
Step 3-5, if the corresponding TXO is not spent, splicing the unlocking script in the unlocking dependent data and the locking script of the corresponding contract in turn to obtain a new script, executing the new script in the contract computing virtual machine, and sending the verification result after execution back to the transaction parallel processing unit;
and 3-6, if the verification execution passes, marking a TXO pointer at a data table position corresponding to the UTXO as the spent TXO, and adding a transaction number TXID for unlocking and spending the transaction of the UTXO.
Preferably, in step 3-1 to step 3-6, if the received "unlock dependent data" belongs to a transaction in a packaged block, the block height and the block hash value of the corresponding block are added to the position of the data table where the corresponding UTXO is located, so as to increase the information amount of contract inquiry.
Preferably, the search service module comprises a distributed block query component, a transaction query component, a contract query component and a query forwarding component, wherein the query forwarding component provides distributed bidirectional search and query service and unified external query interface service, acquires storage positions of transaction data and contract data in the equipment based on a parallel task-processing unit mapping table of a transaction data verification layer and a parallel task-processing unit mapping table of a contract data verification layer constructed in the initialization and resource scheduling module, receives a query request, and forwards the query request to the transaction query component or the contract query component where the data to be queried are located.
Preferably, if the "locked script" of the contract to be queried is the same, the collection and calculation of the query are completed locally.
Preferably, when all modules communicate data, infiniband or RoCE lossless network, RDMA technology or message passing interface technology on lossless network is used, and non-blocking sending and receiving functions are used to increase parallel processing performance between modules.
Therefore, the invention adopts the high-performance blockchain system supporting distributed parallel processing and bidirectional retrieval, and has the following beneficial effects:
(1) The verification speed is high, a multi-layer parallel processing model aiming at the UTXO model blockchain node is provided, the fineness of parallel tasks is enhanced, the calculation task duty ratio of distributable parallel processing is improved, the large-scale expansion capacity of transaction verification is improved, the transaction processing performance is enhanced, and the blockchain system can be used as a high-flux low-cost infrastructure platform;
(2) The retrieval efficiency is high, the transaction list of the same contract script (analog fund account) is stored locally or in a neighboring way, so that the localization or neighboring processing is realized by the aggregation operation, the communication requirement between nodes is reduced, the retrieval delay and the retrieval cost are reduced, the user experience of the blockchain application is improved, and the blockchain application software is helped to improve the competitiveness;
(3) The method realizes the two-way searching capability of searching and trading to obtain contracts on the bottom layer 'node software' level of the blockchain, and facilitates the development of application software;
(4) Because the verification calculation of the same contract script is distributed to run on the same computing equipment, the method provides an implementation basis for hardware customization of contract script verification, can support a low-cost high-efficiency hardware platform, and helps to further reduce service cost.
The technical scheme of the invention is further described in detail through the drawings and the embodiments.
Drawings
FIG. 1 is a system architecture diagram of one embodiment of a high performance blockchain system that supports distributed parallel processing and bi-directional retrieval in accordance with the present invention;
FIG. 2 is a diagram of a transaction data transfer, parallel processing, storage and retrieval model of an embodiment of a high performance blockchain system supporting distributed parallel processing and bi-directional retrieval in accordance with the present invention;
FIG. 3 is a block chain system embodiment 1 with a distributed parallel processing and bi-directional retrieval supporting high performance module and processing unit distribution topology in accordance with the present invention;
FIG. 4 is a block-chain system embodiment 2 with a distributed topology of modules and processing units supporting distributed parallel processing and bi-directional retrieval.
Detailed Description
The technical scheme of the invention is further described below through the attached drawings and the embodiments.
Unless defined otherwise, technical or scientific terms used herein should be given the ordinary meaning as understood by one of ordinary skill in the art to which this invention belongs.
As used herein, the word "comprising" or "comprises" and the like means that elements preceding the word encompass the elements recited after the word, and not exclude the possibility of also encompassing other elements. The terms "inner," "outer," "upper," "lower," and the like are used for convenience in describing and simplifying the description based on the orientation or positional relationship shown in the drawings, and do not denote or imply that the devices or elements referred to must have a specific orientation, be constructed and operated in a specific orientation, and thus should not be construed as limiting the invention, but the relative positional relationship may be changed when the absolute position of the object to be described is changed accordingly. In the present invention, unless explicitly specified and limited otherwise, the term "attached" and the like should be construed broadly, and may be fixedly connected, detachably connected, or integrally formed, directly connected, indirectly connected through an intermediate medium, or in communication between two elements or in interaction with each other. The specific meaning of the above terms in the present invention can be understood by those of ordinary skill in the art according to the specific circumstances.
As shown in fig. 1, the present invention provides a high performance blockchain system supporting distributed parallel processing and bidirectional retrieval, which comprises an initialization and resource scheduling module, a network data transceiver module, a retrieval service module and a parallel processing module, wherein the parallel processing module comprises a blockdata parallel processing module, a transaction data parallel processing module and a contract data parallel processing module, and the retrieval service module comprises a transaction inquiry component and a contract inquiry component;
as shown in fig. 2, the processing procedure of the network data transceiver module for data specifically includes the following steps:
S1, receiving block data and transaction data of a block chain network node and a user terminal, judging a corresponding processing unit based on a parallel task-processing unit mapping table constructed in an initialization and resource scheduling module, if the received data is the block data, sending the data to the corresponding processing unit of the block parallel processing module, and if the received data is the transaction data, sending the data to the corresponding parallel processing unit of the transaction parallel processing module;
And S2, receiving the block data of the block parallel processing module and the transaction data of the transaction parallel processing module, and transmitting the block data and the transaction data to the corresponding block chain network node and the user terminal.
In step S1, the initialization and resource scheduling module is responsible for processing the starting and initialization of parallel task-processing units, the parallel task-processing units are set to be single-threaded or multithread, the initialization and resource scheduling module manages the allocation and scheduling of computing tasks, and the number of processing units required to be started by the block parallel processing module and the transaction parallel processing module, the mapping relation and the topology structure of the parallel processing units and single computing devices in the computer cluster are determined by reading configuration files or using an empirical algorithm, so as to construct and manage a parallel task-processing unit mapping table of three levels of block data verification, transaction data verification and contract data verification.
In step S1, the processing procedure of the block data parallel processing module on the node data specifically includes:
S11, analyzing and checking the block data of the network data receiving and transmitting module, analyzing and checking the validity of the block header data, analyzing the contained transaction data, checking the format validity of the transaction data, and transmitting the analyzed legal transaction data to the transaction parallel processing module;
S12, receiving a processing and verifying result sent back by the transaction parallel processing module, summarizing the processing and verifying result, marking a corresponding block as legal if both the block head data and the internal block transaction are legal, and marking the corresponding block as illegal if the block head data or the internal block transaction are illegal;
And S13, if the node where the block data is located bears the block transmission task, the corresponding block marked as legal is sent to the network data receiving and transmitting module, and if the node where the block data is located bears the block production task, a legal transaction list is created, the transaction legal list is assembled into a candidate block, and the candidate block is sent to a self-built or remote mine pool.
For low-load scenarios with small amounts of transaction data, the block data parallel processing module sets the number of parallel tasks to 1, starting and using a single processing unit.
In step S1, the processing procedure of the transaction data parallel processing module on the node data specifically includes:
The method comprises the steps of firstly, receiving transaction data of a network data transceiver module, analyzing the transaction data, calculating and constructing a transaction data reduced set, wherein the transaction data reduced set comprises hash value data of contract data of an unlocking script and a locking script or derivative data of the hash value data based on the contract data of the unlocking script and the locking script, and does not contain complete contract data of the unlocking script and the locking script;
Sequentially processing transaction input data, positioning TXO of a father transaction through an output pointer, acquiring locking script contract data corresponding to the TXO, determining the position or label of a parallel processing unit of the locking script contract data based on initializing a parallel task-processing unit mapping table of a contract data verification layer constructed in a resource scheduling module, and transmitting unlocking dependent data input by the current transaction to a parallel processing unit corresponding to the contract for verification, wherein the unlocking dependent data comprises unlocking script contract data input by the current transaction and a transaction data reduced set of the current transaction;
Sequentially processing transaction output data, acquiring corresponding 'locking script' contract data and Token Value as TXO data, acquiring a hash Value of the 'locking script' contract data according to a hash function, acquiring a position or a label of a corresponding parallel processing unit based on a 'parallel task-processing unit' mapping table of a contract data verification layer constructed in an initialization and resource scheduling module, defining a dataset comprising the TXO data and a TXO pointer as 'locking data' according to the position or the label of the parallel processing unit, and transmitting the 'locking data' to the corresponding parallel processing unit of the contract data parallel processing module;
In the third step, the contract data parallel processing module and the transaction data parallel processing module use the same computer, and the processing procedure of the contract data parallel processing module for unlocking dependent data and locking data specifically comprises the following steps:
Step 3-1, receiving locking data and unlocking dependent data of a transaction data parallel processing module, and analyzing the locking data and the unlocking dependent data;
step 3-2, if the received data is the 'locking data', determining the position of a data table corresponding to the contract according to the hash value of the TXO locking script in the 'locking data', storing the TXO pointer in the 'locking data' in the data table, and marking the TXO pointer in the 'locking data' as an unexpired transaction output UTXO;
Step 3-3, if the received data is unlocking dependent data, acquiring a data table position of the UTXO corresponding to the to-be-unlocked data table, checking whether the corresponding TXO pointer is the UTXO, if the corresponding TXO pointer is the UTXO, the corresponding TXO is not spent, and if the corresponding TXO pointer is not the UTXO, the corresponding TXO is spent;
Step 3-4, if the corresponding TXO is spent, the verification is failed, and a result of the verification error is returned to the transaction parallel processing unit;
Step 3-5, if the corresponding TXO is not spent, splicing the unlocking script in the unlocking dependent data and the locking script of the corresponding contract in turn to obtain a new script, executing the new script in the contract computing virtual machine, and sending the verification result after execution back to the transaction parallel processing unit;
and 3-6, if the verification execution passes, marking a TXO pointer at a data table position corresponding to the UTXO as the spent TXO, and adding a transaction number TXID for unlocking and spending the transaction of the UTXO.
In step 3-1 to step 3-6, if the received "unlock dependent data" belongs to a transaction in the packaged block, the block height and the block hash value of the corresponding block are added to the position of the data table where the corresponding UTXO is located, and the amount of information of contract query is increased.
Checking the legal requirement of the transaction except for single transaction input, and calculating the lowest transaction fee specified by the current blockchain network consensus according to the volume and the transaction rate of the transaction data, wherein amount paid in transaction fee is higher than the lowest transaction fee;
Step five, acquiring the transaction input data processed in the step two, receiving a verification result sent back by the contract parallel processing unit, and marking the whole transaction as illegal transaction if the verification result contains 'failed';
And step six, integrating the verification results from the step one to the step five to obtain an overall validity verification result of the transaction data, and sending the overall validity verification result of the transaction data back to the block data parallel processing module.
The search service module comprises a distributed block query component, a transaction query component, a contract query component and a query forwarding component, wherein the query forwarding component provides distributed bidirectional search and query service and unified external query interface service, acquires storage positions of transaction data and contract data in equipment based on a parallel task-processing unit mapping table of a transaction data verification layer and a parallel task-processing unit mapping table of a contract data verification layer constructed in the initialization and resource scheduling module, receives a query request and forwards the query request to the transaction query component or the contract query component where the data to be queried are located.
If the "locking script" of the contract to be queried is the same, the collection and calculation of the query are completed locally.
When all the modules communicate data, infiniband or RoCE network lossless network, RDMA technology or message transfer interface technology on lossless network is used, and non-blocking sending and receiving functions are used to increase parallel processing performance between the modules.
When the transaction parallel processing unit processes each transaction output in turn, when the locking script of the processed transaction output is encoded and designed as a non-spendable transaction output, or when the transaction output of the specific type is set as non-affordable in the blockchain consensus protocol, the transaction output cannot be marked as a non-spendable transaction output UTXO, and at this time, the transaction output is not sent to the contract parallel processing unit for distributed storage.
Example 1
In this embodiment, taking a blockchain using a UTXO model as an example, a model for segmentation and distributed verification and storage of blockchain transaction data is disclosed, the embodiment does not limit the hardware type of a computer cluster, a computer based on a processor of an X86 or ARM instruction set or a hardware device designed for the scheme can be used as a device in the computer cluster, in order to reduce communication delay time and avoid packet loss possibility of network data, data communication between all modules is designed using an Infiniband-based lossless network, if other lossy networks are used, reception confirmation and packet loss detection need to be added in implementation, and when packet loss occurs, a network data transceiver module can perform retransmission and reception;
In the initialization and resource scheduling module, an MPI function library and tools are utilized to start and manage processes in a distributed manner on the computer cluster equipment, computation tasks on each process are distributed and inter-process communication is carried out, an open source library OpenMPI meeting MPI specifications is selected, and the specific initialization and resource scheduling process in the initialization and resource scheduling module is as follows:
first, a process and device mapping table text document, hots, is compiled, in which text is populated as follows:
Host1 slots=2
Host2 slots=10
Host3 slots=10
Host4 slots=10
Host5 slots=10
The Secure Shell protocol can be used on the computer device Host0 to log in Host1, host2, host3, host4 and Host5 devices, mpiexec-hostfile hosts program exec can be executed on the Host0 system terminal, at this time, a process will be started on the Host1, 10 processes are respectively started on the Host2-Host5, 42 processes are total, and meanwhile, the program exec program is run, and in the execution process of any program exec process, the number of all processes and the number of the current process can be detected by using the MPI function library, and the specific MPI function library is as follows:
MPI_Comm_size(MPI_COMM_WORLD,&procSum);
MPI_Comm_rank(MPI_COMM_WORLD,&procIndex)。
At this time procIndex stores the number of the current process, procSum stores the total number of all processes, the total number of all processes is 42,42 processes are numbered according to the node list and the number of processes in the hosts file in sequence, procIndex values are respectively 0 to 41, if the program detects that the current process number procIndex is 0, the corresponding process executes the network data transceiver module and the block data processing module, if the program detects that the current process number procIndex is 1, the corresponding process executes the bidirectional retrieval service module;
If the program detects that the current process number is greater than 1 and mod (procIndex-2, 10) belongs to {0, & gt, 3}, the corresponding program executes a transaction processing module, so that 16 processes distributed in 4 computing devices host2-host5 are respectively used as 16 transaction processing units, if the program detects that the current process number is greater than 1 and mod (procIndex-2, 10) belongs to {4, & gt, 7}, the corresponding program executes a contract processing module, so that 16 processes distributed in 4 computing devices are respectively used as 16 contract processing units, if the program detects that the current process mod (procIndex-2, 10) is 8, the corresponding program provides a transaction query service local to the device, if the program detects that the current process mod (procIndex-2, 10) is 9, the corresponding program provides a contract query service local to the device, wherein the function mod is a remainder function, and mod (A, B) represents the remainder of dividing A by B;
The distribution topological structure of the modules and the processing units is shown in figure 3;
If the program obtains a transaction data when executing the network data transceiver module or executes step S11 in the block data processing module, the corresponding program calculates a transaction identification number TXID of the transaction data, obtains a processing process number of the corresponding transaction according to the transaction identification number TXID, if the first 4bit data of the binary data of the transaction identification number TXID is taken to express 0-15 total 16 numbers, the 16 numbers respectively correspond to 16 transaction processing units, a mapping table of transaction ID-processing unit is established, the processing unit of the current transaction and the processing process number of the corresponding transaction are determined according to the mapping table of transaction ID-processing unit, and the transaction data is sent to a remote processing unit through a non-blocking MPI point-to-point process communication function, and because TXID calculation is based on a hash algorithm, the first 4bit data of TXID values has good uniformly distributed characteristics, so that the 16 transaction processing units can obtain relatively uniform processing task numbers;
The transaction parallel processing unit receives transaction data and performs examination and verification except contract script verification, and when the transaction parallel processing unit sequentially processes contract script verification of single transaction input data, unlocking dependent data is required to be sent to the contract parallel processing unit where the corresponding locking script contract is located;
As shown in the example of transaction data, the reduced transaction data set can be set as any intermediate transaction data set when hierarchical clipping is performed by using a hierarchical hash algorithm;
TABLE 1 transaction data instance examples
;
In this embodiment, all locking script data in the transaction data set is replaced by a locking script hash value, and all unlocking script data which is not currently input in the transaction data set is deleted to obtain a simplified transaction data set, and the selection mode of the simplified transaction data set is not limited, so that the data transmission amount is reduced as much as possible on the premise that the contract is verifiable;
Taking the first input of the transaction processing as an example, version number (Version), transaction freeze time (LockTime), input count (InputsCount), output count (OutputsCount), output Sequence number (Vout), sequence (Sequence), unlock script contract data (UnlockingScript), lock script contract data (LockingScript), amount (TokenValue), lock script Hash value (LockingScriptHash), lock script Hash value (LockingScriptHash) is defined as Hash (Output: lockingScript), unlock dependency data is defined as {Version,LockTime,InputsCount,OutputsCount,Input1:TXID,Input1:Vout,Input1:Sequence,Input1:UnlockingScript,Input2:TXID,Input2:Vout,Input2:Sequence,Input3…,Output1:TokenValue,Output1:LockingScriptHash,Output2:TokenValue,Output2:LockingScriptHash,Output3…};
The position of the locking script to be unlocked is positioned through an output pointer { TXID, VOUT }, wherein a mapping table of a transaction ID-processing unit which is established through a transaction identification number TXID is used, the hash value of the locking script is queried through an MPI point-to-point communication function, or the hash value of the locking script is queried firstly and obtained through hash calculation, a mapping table of the transaction ID-processing unit is established through a transaction identification number TXID, a mapping table of the locking script hash value-contract processing unit is established through the locking script hash value, the establishment modes of the mapping table of the transaction ID-processing unit and the mapping table of the locking script hash value-contract processing unit are not limited, the position starting point of 4bit data which is used can be changed, and technical advantages and application effects of the mapping table are not influenced;
According to the established mapping table of the locking script hash value and the contract processing unit, a contract parallel processing unit where a locking script contract of the UTXO to be unlocked is located is obtained, unlocking dependent data is sent to a corresponding processing process for contract verification through an MPI point-to-point communication function, meanwhile, contract verification results under corresponding transaction input numbers are obtained through the MPI point-to-point communication function, after the transaction processing unit obtains all input verification results of one transaction, the unlocking script and the locking script of the transaction data are deleted, and the hash values of the unlocking script and the locking script of the transaction data are replaced so as to relieve data storage pressure;
When the transaction parallel processing unit processes single transaction output data in turn, according to the hash value of the locking script output by the current transaction, inquiring a mapping table of the locking script hash value-contract processing unit to obtain a contract processing unit corresponding to the newly generated UTXO and a process number thereof, and sending an output pointer of the output, namely the transaction TXID number and the output serial number VOUT, and the output TokenValue and the locking script to the inquired contract parallel processing unit for processing and saving;
when the contract parallel processing unit receives a new UTXO, the UTXO is stored in a local data table, a Key (Key) in a Key value pair of stored data is a hash value of a locking script of the UTXO, the hash value is changed to be added with a spendable data bar, as shown in a UTXO information column in a contract data table, and if and only if the transaction where the UTXO is located is effectively packed into a block and has a block hash value, the block hash value is filled in a < block > -column;
If the contract parallel processing unit receives the unlocking data, positioning the data strip of the UTXO, splicing an unlocking script in the unlocking data with a locking script of the current UTXO data strip to form a complete contract unlocking instruction, taking other unlocking data as context data for instruction operation, executing the instruction, obtaining an instruction execution result as a contract verification result, and updating the UTXO data strip according to the execution result, as shown in a cost information column in a contract data table, if and only if the transaction where the unlocking data is located is effectively packed into a block and has a block hash value, filling the block hash value in a < cost block > column;
TABLE 2 contract data sheet
;
The transaction data table and the contract data table are respectively stored in four devices distributed by 16 processing units, wherein the processes of mod (procIndex-2, 10) are respectively 8 and 9, respectively process transaction inquiry service and contract inquiry service of the device, and are also distributed in the same four devices;
The specific service flow is that when the bidirectional search service module with the number of 1 receives a transaction query request, the device position of the processing unit is obtained according to TXID of the requested transaction and a transaction ID-processing unit mapping table, the process number of the transaction query service process of the same device position is obtained, the request is sent to the process number through MPI point-to-point communication, a return result is received, finally the result is returned to a requester, when the bidirectional search service module with the number of 1 receives a contract query request, the bidirectional search service module also obtains the device position of the processing unit of the locking script according to a locking script hash value-contract processing unit mapping table, the request is forwarded to the contract query service process at the device through MPI point-to-point communication, the contract query service process can process all related transactions related to the contract locally, then the complete result is returned to the bidirectional search service module, and the bidirectional search service module returns the result to the requester after receiving the return result.
In this embodiment, after the transaction parallel processing unit receives the contract verification result of the contract parallel processing unit, the locking script and the unlocking script in the transaction data stored in the transaction parallel processing unit may be replaced with hash values of the locking script and the unlocking script, and finally the transaction data stored in the transaction parallel processing unit is :{Version,LockTime,InputsCount,OutputsCount,Input1:TXID,Input1:Vout,Input1:Sequence,Hash(Input1:UnlockingScript),Input2:TXID,Input2:Vout,Input2:Sequence,Hash(Input2:UnlockingScript),Input3…,Output1:TokenValue,Hash(Output1:LockingScript),Output2:TokenValue,Hash(Output2:LockingScript),Output3…};
In this embodiment, the method for hierarchically clipping the data in the transaction is used, the transaction data reserved in the transaction parallel processing unit is used, the locking script and the unlocking script are not used, the hash value of the locking script and the hash value of the unlocking script are used for replacing, and the transaction number TXID of the transaction can be recalculated, so that the reserved transaction data has the capability of verifying the authenticity, can be identified when the reserved transaction data is wrong, the security of the data is increased, and the transaction data which can be safely verified and clipped is provided for the transaction inquiry assembly.
In this embodiment, the non-expendable transaction output may originate from a consensus protocol or from a specific Script program written, such as a Script that may be set by the consensus protocol to have a structure of "Op_Return < Other Script/Data >", a locking Script that is set by the consensus protocol to have zero TokenValue amount, written such that there is no unlock Script that can be validated (e.g., "Op_FalsOp_Return < OtherScript/Data >").
Example 2
The present embodiment is adjusted based on embodiment 1, and the present solution provides for the ability and superiority of the implementation of the migration under different transaction types or distributed topologies of different processing units.
In this embodiment, the mapping table hosts text document of the compiled process and device is as follows:
Host1 slots=1
Host2 slots=1
Host3 slots=1
Host4 slots=9
Host5 slots=9
Host6 slots=9
Host7 slots=9
Wherein the number of devices and processes in the hosts file may select other configurations.
The system of the embodiment operates in a cluster formed by 7 computers, the 7 computers respectively start 1-9 processes according to the mapping relation of the hosts document, the 39 processes are started in a distributed mode, the 39 processes are numbered 0-38 in sequence, and a network data transceiver module, a block parallel processing module, a search service module, 8 transaction parallel processing units and 1 transaction query service assembly, 8 contract parallel processing units and 1 contract query service assembly are operated in sequence;
the distribution topological structure of the modules and the processing units is shown in figure 4;
In this embodiment, the transaction parallel processing unit and the contract parallel processing unit operate in different computer devices, and at this time, the computing and communication characteristics of the different types of processing units are different, so that customized computer devices can be conveniently designed and used respectively, but the distributed data processing capability is not affected, and the application effect and advantage of the scheme are not affected.
In this embodiment, for a transaction with isolated witness area data and payment to script hash value output, such as a P2WSH transaction or a P2TR transaction, a difference implementation needs to be made between the transaction and the contract processing layer, and the specific implementation is as follows:
As shown in table 3, in a transaction with isolated witness zone data and payment to script hash value output, the present transaction is marked as an isolated witness transaction using an isolated witness tag WitnessLabel, WITNESSFLAG data generally includes two parts, marker and Flag, this type of transaction is in the input data space of the current transaction, the unlock script may be blank, and the unlock script required for contract validation is moved to the witness zone, referred to as witness zone unlock data WITNESSDATA.
TABLE 3 transaction data sheet with isolated witness zone data and Payment to script hash value output
;
In the transaction output data space, the locking script hash value LockingScriptHash is used for replacing the corresponding locking script, and the original text data of the locking script can be moved to the witness area of the child transaction ChildTX created when the UTXO is spent and is called as a witness area locking script WITNESSSCRIPT, so that the witness area of the current transaction also stores WITNESSSCRIPT data of the parent transaction UTXO of the current transaction;
In this embodiment, the transaction parallel processing unit processes each transaction output in turn, sends UTXO data of the transaction output to the corresponding contract parallel processing unit for distributed storage, first, the transaction parallel processing unit parses the transaction output to obtain LockingScriptHash of the transaction output UTXO, which is used to create a mapping table of "locking script hash value-contract processing unit", and in the process of constructing the mapping table, an integer format value of the tail end 4bit data is selected as a serial number of the contract parallel processing unit corresponding to the locking script, so that implementation benefits are not affected;
Then, the transaction parallel processing unit obtains a contract parallel processing unit corresponding to the newly generated UTXO and a process number thereof according to the mapping table of the locking script hash value and the contract processing unit, and sends an output pointer corresponding to the output, namely the transaction TXID number and the output serial number VOUT, and TokenValue of the output to a corresponding contract inquiry component for processing and storing, and the locking script original text is not transmitted at the moment because the transaction output of the embodiment has no locking script original text;
When receiving a new UTXO, the contract parallel processing unit stores the UTXO in a local data table, specifically expressed as adding a spendable UTXO data bar, the data table refers and inquires through a locking script hash value of the UTXO, as shown in a table 4:P2WSH contract data table and a table 5:P2TR contract data table, and when receiving a new UTXO, adding a row of records and filling a UTXO information column, and when a transaction where the UTXO is located is effectively packed into a block and has a block hash value, filling the block hash value in a < block > column, otherwise, leaving empty;
TABLE 4P 2WSH contract data Table
;
TABLE 5P 2TR contract data Table
;
In this embodiment, the transaction parallel processing unit processes each transaction input and the witness area data corresponding to each transaction input in turn, and first obtains the "output pointer" of the UTXO, that is TXID +vout, that is, the UTXO that the current transaction input is verifying the cost, so as to obtain LockingScriptHash of the UTXO;
For a P2WSH type transaction, lockingScriptHash is denoted as:
Input UTXO:LockingScriptHash=Hash(WitnessScript)。
LockingScriptHash defines that the unlocking script is WITNESSSCRIPT data of a witness area, lockingScriptHash and WITNESSDATA are combined and marked as WitnessTotal, and the locking script and the unlocking script which are necessary for contract verification are formed together;
thus, the "unlock dependent data" may be constructed as {Version,WitnessLabel,LockTime,InputsCount,OutputsCount,CurrentInputIndex=1,Input1:WitnessTotal,Input1:TXID,Input1:Vout,Input1:Sequence,Input2:TXID,Input2:Vout,Input2:Sequence,Input3…,Output1:TokenValue,Output1:LockingScriptHash,Output2:TokenValue,Output2:LockingScriptHash,Output3…};
Wherein CurrentInputIndex denotes the number of the transaction input currently processed, currentInputIndex may be set according to the actual situation, and CurrentInputIndex is set to 1 in this embodiment;
And finally, according to the mapping table of the locking script hash value and the contract processing unit, sending the unlocking dependent data to the corresponding contract parallel processing unit, executing the verification contract after the contract parallel processing unit receives the unlocking dependent data, sending an execution result back to the corresponding transaction parallel processing unit, and filling the spending information column after the execution is passed.
For a transaction of the P2TR type LockingScriptHash is denoted as:
input UTXO: lockingScriptHash = TAGGEDHASHTREE (WITNESSSCRIPTLEAF, WITNESSSCRIPTLEAF..) any WITNESSSCRIPTLEAF may be referred to as a valid script branch by path verification, and all valid scripts need not be revealed, so that the same LockingScriptHash may have multiple valid WITNESSSCRIPT, and a fixed unlock script cannot be determined.
When implementing distributed storage and verification for contracts in P2TR transaction, under the precondition of keeping LockingScriptHash used as hash table keywords to perform distributed contract storage, verification and query, as shown in a P2TR contract data table, common LockingScript or WITNESSSCRIPT fields are removed from the P2TR contract data table, and complete contract verification data including WITNESSDATA and WITNESSSCRIPT are used each time "unlocking dependent data" is sent;
In contrast, under other types of transactions, sharing use can be performed after first transmission and distributed storage LockingScript/WITNESSSCRIPT, so that repeated data transmission is reduced;
The other embodiments are the same as in example 1.
As described above, by the bidirectional retrieval service module, not only the service of searching for contracts through transactions, but also the service of searching for all transactions through contracts can be provided, and the unification of distributed verification and distributed query is realized by depending on the states of all UTXO data tables stored in the same device in the process of distributed unlocking and verifying contracts, so that all data for querying one UTXO contract is the same as global data for querying one contract under an account model, and only one storage position is required to be accessed.
Therefore, the invention adopts the high-performance blockchain system supporting distributed parallel processing and bidirectional retrieval, is applicable to the refined parallel processing of transaction data of the current mainstream type in the field of blockchain of UTXO model, can separate the contract data in the transaction independently, and performs distributed storage, verification and provides localized quick query service of contracts to all transaction lists, thereby realizing bidirectional retrieval or query capability from transaction to contract and contract to transaction in the aspects of blockchain point software and underlying facilities.
It should be noted that the above-mentioned embodiments are merely for illustrating the technical solution of the present invention and not for limiting the same, and although the present invention has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that the technical solution of the present invention may be modified or substituted by the same, and the modified or substituted technical solution may not deviate from the spirit and scope of the technical solution of the present invention.

Claims (8)

In step S1, the initialization and resource scheduling module is responsible for processing the starting and initialization of parallel task-processing units, the parallel task-processing units are set to be single-threaded or multithread, the initialization and resource scheduling module manages the allocation and scheduling of computing tasks, and the number of processing units, the mapping relation and the topology structure of the parallel processing units and the single computing devices in the computer cluster, which need to be started, of the block parallel processing module and the transaction parallel processing module are determined by reading configuration files or using an empirical algorithm, so as to construct and manage a parallel task-processing unit mapping table of three levels of block data verification, transaction data verification and contract data verification;
6. The system of claim 5, wherein the search service module comprises a distributed block query module, a transaction query module, a contract query module and a query forwarding module, the query forwarding module provides distributed bidirectional search and query service and unified external query interface service, and obtains the storage positions of transaction data and contract data in the device, receives a query request and forwards the query request to the transaction query module or the contract query module at the position of the data to be queried based on a parallel task-processing unit mapping table of a transaction data verification layer and a parallel task-processing unit mapping table of a contract data verification layer constructed in the initialization and resource scheduling module.
CN202411391230.5A2024-10-082024-10-08 A high-performance blockchain system supporting distributed parallel processing and bidirectional retrievalActiveCN118897855B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202411391230.5ACN118897855B (en)2024-10-082024-10-08 A high-performance blockchain system supporting distributed parallel processing and bidirectional retrieval

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202411391230.5ACN118897855B (en)2024-10-082024-10-08 A high-performance blockchain system supporting distributed parallel processing and bidirectional retrieval

Publications (2)

Publication NumberPublication Date
CN118897855A CN118897855A (en)2024-11-05
CN118897855Btrue CN118897855B (en)2025-03-18

Family

ID=93267987

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202411391230.5AActiveCN118897855B (en)2024-10-082024-10-08 A high-performance blockchain system supporting distributed parallel processing and bidirectional retrieval

Country Status (1)

CountryLink
CN (1)CN118897855B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN109325039A (en)*2018-06-072019-02-12海南新软软件有限公司A kind of block chain browser and block chain information browsing method
CN113065960A (en)*2021-03-222021-07-02江苏派智信息科技有限公司Transaction system based on block chain

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US20200349565A1 (en)*2017-08-292020-11-05nChain Holdings LimitedConstraints on inputs of an unlocking transaction in a blockchain
CN113888173B (en)*2021-12-072022-04-26深圳前海微众银行股份有限公司 Blockchain-based smart contract calling method, device and device
CN117151712B (en)*2023-10-262024-03-26腾讯科技(深圳)有限公司Blockchain transaction processing method, device, computer equipment and storage medium
CN117522581A (en)*2023-12-052024-02-06国网福建省电力有限公司营销服务中心Distributed resource transaction platform based on blockchain

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN109325039A (en)*2018-06-072019-02-12海南新软软件有限公司A kind of block chain browser and block chain information browsing method
CN113065960A (en)*2021-03-222021-07-02江苏派智信息科技有限公司Transaction system based on block chain

Also Published As

Publication numberPublication date
CN118897855A (en)2024-11-05

Similar Documents

PublicationPublication DateTitle
US9727590B2 (en)Data management and indexing across a distributed database
CN101661494B (en)Data interactive method for distributed middleware and database
CN111026511A (en)Block chain parallel system and method based on transaction data partition-inter-chain fusion
US20020035559A1 (en)System and method for a decision engine and architecture for providing high-performance data querying operations
EP3643046A1 (en)Methods and systems for a consistent distributed memory pool in a blockchain network
CN110036381B (en)In-memory data search technique
CN112261160B (en)Method and system for quitting cross-slice transaction in block chain system containing slices
CN114385756A (en) Method and blockchain node for executing transactions in blockchain
CN104392377A (en)Cloud transaction system
US20140052710A1 (en)Device and method of mass data storage based on tree structure
US11526516B2 (en)Method, apparatus, device and storage medium for generating and processing a distributed graph database
CN112579261A (en)Method and system for quitting cross-fragment transaction, main chain node and target fragment node
CN117785997A (en) Data processing methods and devices
CN112261162B (en)Method and system for executing cross-slice transaction, main chain node and target slicing node
CN106202364B (en) A MapReduce-Oriented XML Data Partitioning Optimization Method and Its System
CN118897855B (en) A high-performance blockchain system supporting distributed parallel processing and bidirectional retrieval
US12021926B1 (en)Lockless, leaderless protocol for scalable applications
CN113590348A (en)Parameter transmission method, device, equipment and medium based on tree structure
CN111708761A (en)Partitioned autonomous distributed heterogeneous database management system and method
Wang et al.A state sharding model on the blockchain
CN112261156A (en)Method and system for submitting cross-fragment transaction, main chain node and source fragment node
CN111581225A (en)Database reconciliation method, system, server and storage medium
CN120086207B (en) Database system, data transmission method, computing device and readable storage medium
CN116010521B (en)Data service method and related equipment
CN115292713B (en)Vulnerability query method, device, equipment and storage medium

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant
REGReference to a national code

Ref country code:HK

Ref legal event code:DE

Ref document number:40115198

Country of ref document:HK


[8]ページ先頭

©2009-2025 Movatter.jp