WO2020233086A1 - Block processing method and apparatus, computer device and storage medium - Google Patents
Block processing method and apparatus, computer device and storage medium Download PDFInfo
- Publication number
- WO2020233086A1 WO2020233086A1 PCT/CN2019/122676 CN2019122676W WO2020233086A1 WO 2020233086 A1 WO2020233086 A1 WO 2020233086A1 CN 2019122676 W CN2019122676 W CN 2019122676W WO 2020233086 A1 WO2020233086 A1 WO 2020233086A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- transaction
- block
- verification
- blocks
- sequence
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/21—Design, administration or maintenance of databases
- G06F16/219—Managing data history or versioning
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2455—Query execution
- G06F16/24552—Database cache management
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2455—Query execution
- G06F16/24553—Query execution of query operations
- G06F16/24554—Unary operations; Data partitioning operations
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
- G06F3/0604—Improving or facilitating administration, e.g. storage management
- G06F3/0607—Improving or facilitating administration, e.g. storage management by facilitating the process of upgrading existing storage systems, e.g. for improving compatibility between host and storage device
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0629—Configuration or reconfiguration of storage systems
- G06F3/0631—Configuration or reconfiguration of storage systems by allocating resources to storage systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0668—Interfaces specially adapted for storage systems adopting a particular infrastructure
- G06F3/067—Distributed or networked storage systems, e.g. storage area networks [SAN], network attached storage [NAS]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/32—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
- H04L9/3247—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures
Definitions
- This application relates to a block processing method, device, computer equipment and storage medium.
- Blockchain is usually understood as a distributed ledger, essentially a block-based distributed database.
- Blockchain includes consortium chains used between institutions.
- the privacy protection mechanism of consortium chains is usually realized based on signature encryption and verification and decoding in cryptography, so that only members of specific groups and limited third parties can view the area according to their authority.
- the block transaction submission process of the alliance chain includes three steps: signature verification, multi-version checking and transaction persistence.
- the data node usually executes the transaction commit process for the transactions in each block in sequence according to the block generation order through a single thread.
- the inventor realized that when a data node executes the transaction submission process of a block through a single thread, it can usually only process fewer transactions, which reduces the overall throughput of the blockchain system and wastes the computer resources of the server where the data node is located. .
- the block contains only a few transactions, the overall throughput of the blockchain system is further reduced, and the submission efficiency of block transactions is reduced, thereby reducing the efficiency of block processing.
- a block processing method, device, computer equipment, and storage medium are provided.
- a block processing method includes:
- the block sequence is divided into a configuration block and a transaction block sequence using the queried configuration block as a division reference point;
- a transaction commit operation is performed on the configuration block and the transaction block in the transaction block sequence respectively according to the sequence of the block sequence; transaction commit performed on multiple transaction blocks in the transaction block sequence
- the operations include: performing transaction signature verification on the plurality of transaction blocks in parallel; performing transaction multi-version checking on each of the transaction blocks serially; and simultaneously writing the plurality of transaction blocks to a disk.
- a block processing device includes:
- the query module is used to query the configuration block in the currently cached block sequence according to the transaction commit instruction
- the segmentation module is used to, when the configuration block is queried, use the queried configuration block as a splitting reference point to split the block sequence into a configuration block and a transaction block sequence;
- the commit module is configured to perform transaction commit operations on the configuration block and the transaction block in the transaction block sequence according to the sequence of the block sequence; for multiple transaction areas in the transaction block sequence
- the transaction commit operation performed by the block includes: performing transaction signature verification on the multiple transaction blocks in parallel; performing multi-version check on each transaction block serially; writing the multiple transaction blocks simultaneously Into the disk.
- a computer device includes a memory and one or more processors.
- the memory stores computer readable instructions.
- the computer readable instructions are executed by the one or more processors, the one or more Each processor implements the steps of the block processing method provided in any embodiment of the present application.
- One or more non-volatile computer-readable storage media storing computer-readable instructions.
- the computer-readable instructions When executed by one or more processors, the one or more processors implement any of the present application The steps of the block processing method provided in an embodiment.
- Fig. 1 is an application scenario diagram of a block processing method according to one or more embodiments.
- Fig. 2 is a schematic flowchart of a block processing method according to one or more embodiments.
- FIG. 3 is a schematic flowchart of a block processing method in another embodiment.
- FIG. 4 is a schematic flowchart of a transaction commit operation performed on multiple transaction blocks in a transaction block sequence according to one or more embodiments.
- Fig. 5 is a block diagram of a block processing device according to one or more embodiments.
- Figure 6 is a block diagram of a computer device according to one or more embodiments.
- the block processing method provided in this application can be applied to the application environment shown in FIG. 1.
- the data node 102 communicates with the consensus node 104 through the network.
- the data node 102 obtains the transaction commit instruction, and queries the configuration block in the currently cached block sequence according to the obtained transaction commit instruction; when the configuration block is queried, the queried configuration block is used as the dividing reference point, and the current
- the cached block sequence is divided into a configuration block and a transaction block sequence, and the transaction commit operation is performed on the configuration block and the transaction block in the transaction block sequence respectively according to the sequence of the block sequence.
- the transaction commit operation performed by the data node 102 for multiple transaction blocks in the transaction block sequence includes: performing transaction signature verification on multiple transaction blocks in parallel; performing transaction multi-version checks on each transaction block serially; Write multiple transaction blocks to disk at the same time.
- the data node 102 receives the block sent by the consensus node 104 and caches the received block so that the data node 102 can execute the block processing method described above when it obtains the transaction commit instruction.
- Both the data node 102 and the consensus node 104 correspond to a server, and the server can be implemented by an independent server or a server cluster composed of multiple servers.
- the data node 102 and the data node 102 both belong to the blockchain network, and the blockchain network includes multiple data nodes 102 and multiple data nodes 102.
- a data node is a server, and correspondingly, a consensus node is a server.
- a block processing method is provided. Taking the method applied to the data node in FIG. 1 as an example, the method includes the following steps:
- the transaction commit instruction is an instruction used to trigger the transaction commit operation. Specifically, when the previously executed transaction commit operation is completed, the data node detects in real time whether there is a block sequence to be processed currently in the cache. When a block sequence to be processed is detected in the cache, the data node triggers the generation of a transaction commit instruction corresponding to the block sequence.
- the transaction commit operation performed last time may be a transaction commit operation performed on multiple transaction blocks in the configuration block, transaction block sequence, or currently cached block sequence. It is understandable that both the transaction block sequence and the block sequence can include a single transaction block.
- the data node receives the block (transaction block or configuration block) sent by the consensus node, and caches the received block in the local cache.
- the data node can cache the received block in the cache queue.
- the data node sequentially caches the blocks in the cache queue according to their block numbers.
- a block sequence is a block set composed of multiple blocks arranged according to their respective block numbers.
- the block can be a transaction block or a configuration block.
- the transaction block corresponds to the transaction block identifier
- the configuration block corresponds to the configuration block identifier.
- the transaction data in the transaction block corresponds to the business data.
- the transaction data in the configuration block corresponds to the configuration data.
- the configuration data refers to the data on which the data node performs the transaction commit operation on the transaction block or the configuration block, such as verification logic or rule parameters. For example, when the number of digital signatures that have passed the verification reaches the preset number threshold, it is determined that the signature verification result of the corresponding transaction is verified, and the verification logic or rule parameter may be the preset number threshold.
- the data node queries the currently cached block sequence in the cache or cache queue according to the acquired transaction commit instruction, and according to the pre-configured configuration block sequence identifier, the current cache Query the configuration block in the block sequence to determine whether there is a configuration block in the currently cached block sequence according to the query result.
- the transaction block sequence is a block set composed of multiple transaction blocks arranged according to their respective block numbers.
- the transaction block sequence may specifically be a block set composed of multiple transaction blocks with continuous block numbers arranged according to their respective block numbers.
- the data node uses the queried configuration block as a dividing reference point to divide the block sequence into a configuration block and a transaction block sequence. It is understandable that one or more transaction block sequences can be obtained by dividing the block sequence with the configuration block as the dividing reference point.
- the data node when the queried configuration block is located at the critical position (starting position or end position) of the block sequence, the data node divides the block sequence into configuration blocks and a transaction block sequence. When the queried configuration block is located in the middle of the block sequence, the data node divides the block sequence into a configuration block and two transaction block sequences. It is understandable that when multiple configuration blocks are queried in the currently cached block sequence, the data node uses the multiple configuration blocks as the dividing reference point to divide the block sequence into multiple configuration blocks and Sequence of multiple transaction blocks.
- the block sequence includes blocks a, b, c, d, e, and f
- d is the configuration block.
- the transaction block sequence X including transaction Blocks a, b, and c
- transaction block sequence Y including transaction blocks e and f.
- S208 Perform transaction commit operations on the configuration block and transaction blocks in the transaction block sequence respectively in the order of the block sequence; the transaction commit operations performed on multiple transaction blocks in the transaction block sequence include: Transaction signature verification is performed on multiple transaction blocks; multiple transaction versions are checked for each transaction block serially; multiple transaction blocks are simultaneously written to the disk.
- Transaction signature verification refers to verifying whether the digital signature corresponding to the transaction in the block meets the preset signature conditions.
- the preset signature condition for example, the number of digital signatures that have passed the verification reaches a preset number threshold.
- Transaction multi-version checking refers to checking whether the target data version number contained in the transaction in the block is consistent with the corresponding latest data version number.
- the data nodes when the currently cached block sequence is divided into a configuration block and a transaction block sequence, the data nodes respectively perform the configuration block and transaction block sequence according to the order of the configuration block and transaction block sequence in the block sequence.
- the transaction block in the block sequence performs the transaction commit operation.
- the transaction commit operation performed for the configuration block includes: the data node performs transaction signature verification on the transaction in the configuration block; when the transaction signature verification step is completed, the data node performs multiple transactions on the transaction in the configuration block Version check: When the multi-version check step of the transaction is completed, the data node calls the preset write interface to write the configuration block to the disk, that is, write the configuration block to the corresponding blockchain.
- the data node when the transaction signature verification step is executed, the data node writes the signature verification result into the configuration block, and performs multiple transactions for the transaction whose signature verification result in the configuration block is verified. Version check; when the result of the multi-version check is passed, the data node updates its configuration data according to the transaction data corresponding to the transaction that passed the check, so that the data node can use the updated configuration data for all subsequent configuration blocks. Configure the block or transaction block to perform transaction commit operations. Correspondingly, the data node writes the multi-version check result into the configuration block, and writes the configuration block to the disk,
- the transaction commit operation performed on multiple transaction blocks in the transaction block sequence includes: the data node performs transaction signature verification on the multiple transaction blocks in parallel through multiple verification threads; When the transaction signature verification steps performed by the transaction block are all executed, the data node serially performs multi-version check on each transaction block through a single check thread, that is, the data node performs multi-version check on each transaction block according to the multiple transaction blocks.
- the transaction multi-version check is performed on each transaction block in turn; when the transaction multi-version check for each transaction block is sequentially executed, the data node calls the preset write interface to write the multiple transaction blocks Disk.
- the preset write interface may specifically be a preset batch write interface, and the data node can call the batch write interface to write multiple transaction blocks into the disk at one time.
- the data node determines the number of check threads equal to the number of transaction blocks, and compares the number of check threads in the transaction block sequence Each transaction block is allocated to a corresponding verification thread to perform transaction signature verification on the allocated transaction block in parallel by the verification thread of the number of transaction blocks.
- the data node determines the preset number of verification threads, and allocates multiple transaction blocks in the transaction block sequence to the preset number of verification threads to pass the preset number.
- a number of verification threads perform transaction signature verification on the allocated transaction blocks in parallel.
- the data node first performs transaction commit operations on transaction blocks a, b, and c in the transaction block sequence X according to the sequence of the block sequence; when the transaction commit operation for the transaction block sequence X is completed, the data The node performs transaction commit operation on configuration block d, and updates its own configuration data according to the configuration data in configuration block d; when the transaction commit operation for configuration block d is completed, the data node performs transaction block sequence Y
- the transaction blocks e and f perform transaction commit operations.
- the data node may receive the consensus The block sent by the node (transaction block or configuration block), and the received block is cached as a new block. Therefore, the transaction block sequence Y may also include blocks newly added during the transaction commit operation on the transaction block sequence X and the configuration block d.
- the data node can use transaction block sequence Y as the currently cached block sequence, and query whether there is a configuration block in the currently cached block sequence according to the above query method, According to the query result, the transaction commit operation is performed on the block sequence according to the method provided in the corresponding embodiment of this application.
- the configuration block is queried in the currently cached block sequence according to the acquired transaction commit instruction.
- the configuration block is used as a partition
- the currently cached block sequence is divided into a configuration block and a transaction block sequence, and the transaction commit operation is performed on the configuration block and the transaction block in the transaction block sequence according to the sequence of the block sequence.
- the transaction commit operation performed in sequence for multiple transaction blocks in the transaction block sequence includes: performing transaction signature verification on multiple transaction blocks in parallel; performing transaction multi-version checks on each transaction block serially; A transaction block is written to the disk at the same time.
- the overall efficiency of signature verification is improved, thereby improving the processing efficiency of the block.
- the multiple transaction blocks are written to the disk at the same time, which improves the overall submission efficiency of transactions in the transaction block, thereby further improving the block processing efficiency. Further, writing multiple transaction blocks to the disk at the same time improves the overall throughput of the blockchain system, thereby saving computer resources.
- performing transaction signature verification on multiple transaction blocks in parallel includes: determining the number of verification threads according to the number of transaction blocks in the transaction block sequence and the number of CPU cores of the corresponding server; Multiple verification threads are allocated according to the number; multiple verification threads are used to perform transaction signature verification on multiple transaction blocks in parallel.
- the data node obtains the number of transaction blocks in the transaction block sequence and the number of CPU cores of its corresponding server, determines the number of verification threads according to the number of transaction blocks and the number of CPU cores of the server, and determines the number and the number of cores. Multiple verification threads with the same number of verification threads.
- the service node allocates multiple transaction blocks in the transaction block sequence to the multiple verification threads, so as to perform transaction signature verification on the multiple transaction blocks in parallel through the multiple verification threads.
- the data node is a server
- the number of CPU cores of the server corresponding to the data node itself is the number of CPU cores of the data node itself.
- the data node determines the threshold of the number of check threads that the server is allowed to carry according to the number of CPU cores of the server, and compares the threshold with the number of transaction blocks. When the number of transaction blocks is less than or equal to the number threshold, the data node determines the number of transaction blocks as the number of verification threads; when the number of transaction blocks is greater than the number threshold, the data node determines the number threshold as the verification thread quantity.
- the threshold of the number of check threads that the server is allowed to carry is determined according to the number of CPU cores. If the number of transaction blocks in the transaction block sequence is 5, the number of check threads determined according to the number of CPU cores and the number of transaction blocks is 5, and 5 transaction blocks are distributed to the 5 check threads in parallel Perform transaction signature verification; if the number of transaction blocks is 10, the number of verification threads is determined to be 6, and the 10 transaction blocks are distributed to the 6 verification threads to perform transaction signature verification in parallel. For example, 4 verification threads are allocated 2 transaction blocks, and 2 verification threads are allocated 1 transaction block.
- the data node may create corresponding multiple verification threads according to the number of verification threads, or obtain multiple idle threads from the thread pool according to the number, as the multiple verification threads allocated.
- the number of verification threads is determined according to the number of transaction blocks to be processed and the number of CPU cores of the corresponding server, so that the number of verification threads can perform transaction signature verification on multiple transaction blocks in parallel.
- the computer resources are fully utilized, the efficiency of transaction signature verification is improved, and the efficiency of block sorting and processing is improved.
- performing transaction signature verification on multiple transaction blocks in parallel through multiple verification threads includes: allocating multiple transaction blocks to multiple verification threads; The allocated transaction block is analyzed to obtain multiple transactions corresponding to the analyzed transaction block; transaction signature verification is performed on each transaction in turn according to the order of the multiple transactions in the transaction block.
- the data node allocates multiple transaction blocks in the transaction block sequence to the multiple verification threads. For the transaction block that has been allocated to each verification thread, the data node analyzes its own allocated transaction block in parallel through each verification thread, and obtains multiple transactions corresponding to the analyzed transaction block, and according to the multiple The order of the transaction in the corresponding transaction block, and the transaction signature verification for each transaction in the multiple transactions in turn.
- the data node allocates the multiple transaction blocks to the determined multiple verification threads at the same time in accordance with the principle of equal distribution or proportional distribution, and uses each verification thread to allocate the multiple
- the transaction block performs transaction signature verification serially.
- the data node uses each verification thread to assign multiple transaction blocks to itself, according to the ordering of the multiple transaction blocks in the transaction block sequence (or the block number corresponding to the transaction block), and sequentially Each transaction block in the plurality of transaction blocks performs transaction signature verification.
- the steps of performing transaction signature verification on each transaction block include: parsing the transaction block to obtain multiple transactions, and sequentially performing transaction signature verification on each transaction according to the order of the transactions in the transaction block.
- the data node extracts a transaction block equal to the number of verification threads from the transaction block sequence in the order of the transaction block sequence, and allocates the extracted transaction block to the corresponding verification thread , To perform transaction signature verification on the extracted multiple transaction blocks in parallel through the multiple verification threads.
- the data node detects the check thread in the idle state in real time, extracts from the transaction block sequence the transaction block that has not yet been subjected to the transaction commit operation and is sorted first, and allocates it to the check thread in the idle state.
- multiple transaction blocks are allocated to multiple verification threads, so that each verification thread performs transaction signature verification on transactions in the allocated transaction block in parallel, which improves transaction signature verification. Therefore, the processing efficiency of the block is improved.
- allocating multiple transaction blocks to multiple verification threads includes: creating a block cache queue corresponding to each verification thread; and allocating multiple transaction blocks to each block according to a preset allocation method The cache queue is used as a transaction block allocated to the corresponding verification thread.
- the preset allocation method for example, allocates multiple transaction blocks to multiple created block cache queues according to the principle of equal allocation or proportional allocation.
- the data node when multiple verification threads are allocated according to the number of verification threads, the data node creates a block cache queue whose number is equal to the number of verification threads, and the created block cache queue corresponds to the verification thread respectively.
- the data node allocates multiple transaction blocks in the transaction block sequence to the created block cache queue for caching according to a preset allocation method, so that each verification thread can read from the corresponding block cache queue in parallel Transaction block, and perform transaction signature verification on the read transaction block.
- the data node when the number of transaction blocks in the transaction block sequence is greater than the specified number, allocates the specified number of transaction blocks that are ranked higher in the transaction block sequence to the multiple created regions
- the block cache queue is cached to read transaction blocks from the corresponding block cache queue in parallel through each verification thread and perform transaction signature verification.
- the specified number is determined by the number of CPU cores of the server and the threshold of the number of transaction blocks allowed by each verification thread.
- the threshold of the number of verification threads allowed by the server is determined according to the number of CPU cores, and the calculation of the verification thread
- the product of the number threshold and the number threshold of the transaction block corresponding to the number of each verification thread is the specified number.
- the transaction block is allocated to the block cache queue corresponding to each verification thread for caching, so that each verification thread reads the transaction block cached in the block cache queue in parallel, and signs the transaction Verification improves the efficiency of transaction block allocation, thereby improving the efficiency of transaction signature verification.
- each transaction is parsed in turn according to the ordering of multiple transactions in the transaction block to obtain transaction data and digital signature arrays corresponding to the parsed transactions; the digital signature array is parsed to obtain multiple digital signatures and digital signatures.
- the public key corresponding to the signature decrypt the corresponding digital signature according to each public key to obtain the decrypted digital signature; generate the transaction hash value according to the transaction data, and based on the transaction hash value and each decrypted digital signature, respectively
- Each digital signature is verified; when the number of digital signatures that have passed the verification reaches a preset number threshold, it is determined that the signature verification result corresponding to the parsed transaction is a verification pass.
- Transaction data is data corresponding to the transaction in the transaction block.
- the transaction data includes the business data to be updated (may be called target data) and the updated business data (may be called update data), and the data identifier corresponding to the business data, and may also include the target data version number corresponding to the target data.
- the data identifier corresponding to the business data can be used as the corresponding transaction data and/or the transaction data identifier corresponding to the transaction. It is understandable that the transaction data identifier corresponds to one or more transaction data (and/or transactions), that is, the corresponding one or more transactions can be queried in the blockchain according to the transaction data identifier, and the corresponding transaction data Transaction data.
- the preset number threshold is a preset value, such as 2.
- the digital signature array includes one or more digital signatures, and may also include a decryption key (public key or private key) corresponding to each digital signature.
- the decryption key and the encryption key form a key pair. For example, if the encryption key is a private key, the decryption key is the public key corresponding to the private key.
- a digital signature is a data ciphertext obtained by encrypting transaction data using an encryption algorithm, for example, using a public key and a private key to encrypt transaction data to obtain a digital signature. Encryption algorithms such as symmetric encryption algorithms and asymmetric encryption algorithms.
- Symmetric encryption algorithm such as DES (Data Encryption Standard, symmetric algorithm), AES (Advanced Encryption Standard, Advanced Encryption Standard), or IDEA (International Data Encryption Algorithm, International Data Encryption Algorithm), etc.
- Asymmetric encryption algorithms such as RSA (Rivest, Shamir, Adleman, encryption algorithm), DSA (Digital Signature Algorithm, digital signature algorithm), or ECC (Elliptic curve cryptography, elliptic curve encryption algorithm), etc.
- the data node uses the verification thread according to the order of the multiple transactions in the transaction block to order the Each transaction in multiple transactions is analyzed, and transaction data and digital signature array corresponding to the analyzed transaction are obtained.
- the data node parses the digital signature array through the verification thread to obtain the corresponding multiple digital signatures and the public key corresponding to each digital signature, and decrypts the corresponding digital signature according to each public key to obtain the decrypted digital signature.
- the data node uses the verification thread to hash the parsed transaction data based on the hash algorithm to obtain the transaction hash value, and compare the transaction hash value with each decrypted digital signature to compare As a result, the corresponding digital signature is verified.
- the transaction hash value is consistent with the decrypted digital signature, it indicates that the verification result of the corresponding digital signature is a verification pass.
- the data node counts the verification result as the number of digital signatures that have passed the verification through the verification thread. When the counted number is greater than or equal to the preset number threshold, it is determined that the signature verification result of the corresponding transaction is the verification passed.
- Commonly used hash algorithms such as MD5 (Message Digest Algorithm, fifth edition of message digest algorithm), SHA1 (Secure Hash Algorithm, secure hash algorithm), and SHA2, are not specifically limited in this embodiment.
- the digital signature array includes a single digital signature and corresponding public key, and the preset number threshold is 1. Similar to the above transaction signature verification steps, the data node verifies the digital signature through the verification thread. When the verification result of the digital signature is a verification pass, it is determined that the signature verification result of the corresponding transaction is verification. by.
- the data node receives the signature request sent by the blockchain client, obtains the transaction data to be signed according to the signature request, and hashes the transaction data to be signed by the hash algorithm to obtain the transaction hash value (can be Understand as a digest), use its own private key to encrypt the transaction hash value to obtain a digital signature, and feed the digital signature and its own public key to the blockchain client.
- the blockchain client detects the business data in real time, uses the detected business data as the transaction data to be signed, and sends the transaction data to be signed to multiple data nodes for digital signature according to the signature configuration, and the multiple The digital signatures and public keys fed back by each data node are spliced to obtain a digital signature array.
- the blockchain client obtains the transaction according to the transaction data and the corresponding digital signature array, and sends the transaction to the consensus node for consensus.
- the consensus node performs a consensus on the received transaction based on the consensus mechanism, generates a corresponding block according to the transaction passed by the consensus, and sends the generated block to the data node, so that the data node is based on the information provided in the foregoing embodiments
- the block processing method writes the block into the block chain.
- the blockchain client, data node, and consensus node all belong to the blockchain network, and the blockchain network may include multiple blockchain clients, data nodes, and consensus nodes.
- the transaction signature verification is performed on the transaction based on the digital signature array and the transaction hash value to ensure the authenticity, validity and reliability of the corresponding transaction data.
- performing transaction multi-version checking on each transaction block in series includes: according to the sequence of the transaction block sequence, sequentially performing the following transaction multi-version checking steps on multiple transactions in each transaction block : Analyze each transaction in turn according to the order of multiple transactions in the transaction block to obtain the transaction data identifier and target data version number corresponding to the parsed transaction; query the latest data version number corresponding to the transaction data identifier; when the latest data version When the number is consistent with the target data version number, it is determined that the multi-version check result of the parsed transaction is passed.
- the data node sequentially performs the multiple transaction blocks according to the order of the multiple transaction blocks in the transaction block sequence.
- Each transaction block in each transaction block performs transaction multi-version check.
- the data node performs transaction multi-version check on the transaction block.
- the data node performs transaction multi-version check for multiple transactions in the transaction block, which specifically includes the following steps: the data node parses the transaction block to obtain the corresponding multiple transactions , According to the order of the multiple transactions in the transaction block, analyze each transaction in the multiple transactions in turn to obtain the transaction data identifier and target data version number corresponding to the analyzed transaction.
- the data node queries the corresponding latest data version number in the blockchain and/or local cache according to the transaction data identifier, and compares the latest data version number found with the target data version number. When the latest data version number is consistent with the target data version number, the data node determines that the multi-version check result of the corresponding transaction is passed.
- the data node queries the corresponding latest data version number in the cache according to the parsed transaction data identifier, and performs the above-mentioned transaction multi-version check operation according to the latest data version number found.
- the data node queries the latest data version number from the blockchain that has been written to the disk, and executes the above transaction based on the latest data version number queried. Version check operation.
- each transaction block corresponds to a block number
- the block number can be used to characterize the order of the transaction block in the transaction block sequence, block sequence, or corresponding blockchain.
- Each transaction in the transaction block corresponds to a transaction number, and the transaction number is used to characterize the order of each transaction in the corresponding transaction block.
- the data node When the multi-version check result of a transaction is passed, the data node generates a corresponding data version number according to the transaction number and block number corresponding to the transaction, which is used as the corresponding transaction data to identify the current corresponding latest data version number.
- the data node When the multi-version check result of the transaction is that the check fails, the data node will mark the multi-version check result and will not generate the corresponding data version number, that is, the data version number corresponding to the transaction data identifier corresponding to the transaction will not be updated .
- the data node when the transaction signature verification operation performed for each transaction in the transaction block is completed, marks the transaction according to the signature verification result corresponding to the transaction.
- the data node performs multi-version check on the transaction whose signature verification result is the verification result according to the signature verification result marked for the transaction, and according to the transaction corresponding
- the multi-version check result marks the transaction. It is understandable that the data node writes multiple transactions in each transaction block, as well as the signature verification results and multi-version verification results corresponding to each transaction, into the blockchain.
- the data node may mark a transaction whose signature verification result is that the verification fails and/or the multi-version check result is that the verification fails as an invalid transaction.
- the data node may specifically perform the above-mentioned transaction multi-version check step on multiple transactions in each transaction block in the order of the transaction block sequence through a single check thread.
- multi-version concurrency control is achieved through multi-version checking operations, so as to avoid the problem of data update errors caused when the same target data is modified by different users or different operations at the same time, and to ensure the accuracy and consistency of transaction data.
- the block processing method described above further includes: when the configuration block is not found, directly perform the following transaction commit operation on multiple transaction blocks in the block sequence: Transaction signature verification is performed on each transaction block; transaction multi-version check is performed on each transaction block serially; multiple transaction blocks are simultaneously written to the disk.
- the data node uses the currently cached block sequence as a transaction block sequence and targets multiple transaction areas in the transaction block sequence.
- the block performs the following transaction commit operations: transaction signature verification is performed on multiple transaction blocks in parallel through multiple verification threads; when the transaction signature verification operations performed for each transaction block are all executed, follow the transaction block
- the sequence of the sequence is to perform transaction multi-version checks on each transaction block serially; when the transaction multi-version check performed for each transaction block is executed sequentially, the preset write interface is called to write the multiple transaction blocks at the same time Disk.
- the data node in the process of sequentially performing transaction multi-version checks for multiple transaction blocks in the transaction block sequence, caches the transaction blocks that have performed transaction multi-version checks locally, so as to facilitate the When the multi-version checks of the transactions that are executed in sequence are all executed, the multiple transaction blocks are directly read from the cache, which improves the reading efficiency and thus the writing efficiency.
- the data node determines the block sequence as a transaction block sequence, and is based on the transaction block sequence provided in the foregoing embodiments.
- the transaction executed by the block is submitted for processing.
- a block processing method which specifically includes the following steps:
- S308 Perform transaction commit operations on the configuration block and transaction blocks in the transaction block sequence respectively in the order of the block sequence; the transaction commit operations performed on multiple transaction blocks in the transaction block sequence include: Transaction signature verification is performed on multiple transaction blocks; multiple transaction versions are checked for each transaction block serially; multiple transaction blocks are simultaneously written to the disk.
- S310 When the configuration block is not queried, directly perform the following transaction commit operations on multiple transaction blocks in the block sequence: perform transaction signature verification on multiple transaction blocks in parallel; and perform transaction signature verification on multiple transaction blocks in series; Block multi-version checking of transactions; write multiple transaction blocks to disk at the same time.
- the corresponding block processing procedures are provided for the two cases of whether the currently cached block sequence contains configuration blocks, and the block sequence and the divided transaction block sequence are processed in batches. , Improve the efficiency of block processing.
- the transaction commit operation performed by the data node for multiple transaction blocks in the transaction block sequence includes the following steps:
- S402 Determine the number of verification threads according to the number of transaction blocks in the transaction block sequence and the number of CPU cores of the corresponding server.
- S406 Create a block buffer queue corresponding to each verification thread.
- S408 Allocate multiple transaction blocks to each block cache queue according to a preset allocation method, as transaction blocks allocated to corresponding verification threads.
- S410 Analyze the allocated transaction block by each verification thread to obtain multiple transactions corresponding to the analyzed transaction block.
- S412 Analyze each transaction in turn according to the order of multiple transactions in the transaction block to obtain transaction data and a digital signature array corresponding to the analyzed transaction.
- S414 Parse the digital signature array to obtain multiple digital signatures and public keys corresponding to each digital signature.
- S416 Decrypt the corresponding digital signature according to each public key to obtain a decrypted digital signature.
- S418 Generate a transaction hash value according to the transaction data, and verify each digital signature based on the transaction hash value and each decrypted digital signature.
- S422 According to the order of the transaction block sequence, sequentially analyze the multiple transactions in each transaction block according to the order of the multiple transactions in the transaction block to obtain the transaction data identifier and the transaction data corresponding to the analyzed transaction. Target data version number.
- S424 Query the latest data version number corresponding to the transaction data identifier.
- S428 Write multiple transaction blocks into the disk at the same time.
- the transaction signature verification is performed on multiple transaction blocks in parallel, which improves the overall efficiency of transaction signature verification.
- the serial multi-version check ensures the correctness and consistency of transaction data. Transaction blocks are written to the disk at the same time, reducing the number of calls of the blockchain network system, improving the overall throughput of the system, improving the submission efficiency of transaction blocks, and saving computer resources. As a result, the overall block processing efficiency is improved.
- the block processing method provided in the above embodiments can be applied to the alliance chain, and can also be applied to the public chain or the private chain.
- the consensus node and the data node may be the same blockchain node, and the consensus node and the data node may correspond to the same server or server cluster.
- a block processing device 500 which includes: an acquisition module 502, a query module 504, a segmentation module 506, and a submission module 508, wherein:
- the obtaining module 502 is used to obtain a transaction commit instruction.
- the query module 504 is used to query the configuration block in the currently cached block sequence according to the transaction commit instruction.
- the dividing module 506 is used to divide the block sequence into the configuration block and the transaction block sequence when the configuration block is queried, using the queried configuration block as the dividing reference point.
- the commit module 508 is used to perform transaction commit operations on the configuration block and transaction blocks in the transaction block sequence according to the sequence of the block sequence; the transaction commit operations performed for multiple transaction blocks in the transaction block sequence include : Perform transaction signature verification on multiple transaction blocks in parallel; perform transaction multi-version check on each transaction block serially; write multiple transaction blocks into the disk at the same time.
- the commit module 508 is further configured to determine the number of verification threads according to the number of transaction blocks in the transaction block sequence and the number of CPU cores of its corresponding server; and to allocate multiple verification threads according to the number; Multiple verification threads perform transaction signature verification on multiple transaction blocks in parallel.
- the commit module 508 is also used to allocate multiple transaction blocks to multiple verification threads; each verification thread analyzes the allocated transaction blocks by each verification thread to obtain the resolved transaction block correspondence A number of transactions; according to the order of multiple transactions in the transaction block, transaction signature verification is performed on each transaction.
- the commit module 508 is also used to parse each transaction in turn according to the ordering of multiple transactions in the transaction block to obtain transaction data and digital signature array corresponding to the parsed transaction; parse the digital signature array to obtain Multiple digital signatures and public keys corresponding to each digital signature; decrypt the corresponding digital signature according to each public key to obtain the decrypted digital signature; generate transaction hash value based on transaction hash value and each decryption After the digital signature, each digital signature is verified separately; when the number of digital signatures that have passed the verification reaches the preset number threshold, it is determined that the signature verification result corresponding to the parsed transaction is the verification passed.
- the submission module 508 is also used to create a block cache queue corresponding to each verification thread; to allocate multiple transaction blocks to each block cache queue according to a preset allocation method, as the allocation to the corresponding school The transaction block of the verification thread.
- the commit module 508 is also used to perform the following transaction multi-version check steps on multiple transactions in each transaction block in sequence according to the order of the transaction block sequence: The sorting in parses each transaction in turn to obtain the transaction data ID and target data version number corresponding to the parsed transaction; query the latest data version number corresponding to the transaction data ID; when the latest data version number is consistent with the target data version number, It is determined that the result of the multi-version check of the parsed transaction is passed.
- the commit module 508 is also used to directly perform the following transaction commit operations on multiple transaction blocks in the block sequence when the configuration block is not queried: perform multiple transaction blocks in parallel Transaction signature verification; serially perform transaction multi-version check on each transaction block; write multiple transaction blocks to the disk at the same time.
- each module in the block processing device described above can be implemented in whole or in part by software, hardware, and a combination thereof.
- the foregoing modules may be embedded in the form of hardware or independent of the processor in the computer device, or may be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the foregoing modules.
- a computer device is provided.
- the computer device may be a server corresponding to a data node, and its internal structure diagram may be as shown in FIG. 6.
- the computer equipment includes a processor, a memory, a network interface and a database connected through a system bus.
- the processor of the computer device is used to provide calculation and control capabilities.
- the memory of the computer device includes a non-volatile storage medium and an internal memory.
- the non-volatile storage medium stores an operating system, computer readable instructions, and a database.
- the internal memory provides an environment for the operation of the operating system and computer-readable instructions in the non-volatile storage medium.
- the database of the computer device is used to store a block sequence, and the stored block sequence includes configuration blocks and/or transaction blocks.
- the network interface of the computer device is used to communicate with an external terminal through a network connection.
- the computer readable instructions are executed by the processor to realize a block processing method.
- FIG. 6 is only a block diagram of part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied.
- the specific computer device may Including more or fewer parts than shown in the figure, or combining some parts, or having a different arrangement of parts.
- a computer device including a memory and one or more processors.
- the memory stores computer readable instructions.
- the computer readable instructions are executed by one or more processors, the one or more processors can realize any one of the present application.
- One or more non-volatile computer-readable storage media storing computer-readable instructions.
- the one or more processors implement any one of the embodiments of the present application. Provides the steps of the block processing method. In one of the embodiments in one of the embodiments
- Non-volatile memory may include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory.
- Volatile memory may include random access memory (RAM) or external cache memory.
- RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous chain Channel (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
- SRAM static RAM
- DRAM dynamic RAM
- SDRAM synchronous DRAM
- DDRSDRAM double data rate SDRAM
- ESDRAM enhanced SDRAM
- SLDRAM synchronous chain Channel
- memory bus Radbus direct RAM
- RDRAM direct memory bus dynamic RAM
- RDRAM memory bus dynamic RAM
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- Human Computer Interaction (AREA)
- Computer Security & Cryptography (AREA)
- Computational Linguistics (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
Description
Claims (20)
- 一种区块处理方法,包括:A block processing method, including:获取事务提交指令;Obtain transaction commit instructions;根据所述事务提交指令在当前缓存的区块序列中查询配置区块;Query the configuration block in the currently cached block sequence according to the transaction commit instruction;当查询到所述配置区块时,以查询到的所述配置区块为分割基准点,将所述区块序列分割为配置区块和事务区块序列;及When the configuration block is queried, the block sequence is divided into a configuration block and a transaction block sequence using the queried configuration block as a division reference point; and按照所述区块序列的顺序分别对所述配置区块和所述事务区块序列中的事务区块执行事务提交操作;针对所述事务区块序列中的多个事务区块执行的事务提交操作包括:并行地对所述多个事务区块进行事务签名校验;串行地对各所述事务区块进行事务多版本检查;将所述多个事务区块同时写入磁盘中。A transaction commit operation is performed on the configuration block and the transaction block in the transaction block sequence respectively according to the sequence of the block sequence; transaction commit performed on multiple transaction blocks in the transaction block sequence The operations include: performing transaction signature verification on the plurality of transaction blocks in parallel; performing transaction multi-version checking on each of the transaction blocks serially; and simultaneously writing the plurality of transaction blocks to a disk.
- 根据权利要求1所述的方法,其特征在于,所述并行地对所述多个事务区块进行事务签名校验,包括:The method according to claim 1, wherein the performing transaction signature verification on the plurality of transaction blocks in parallel comprises:根据所述事务区块序列中的事务区块数量和自身对应的服务器的CPU核数确定校验线程的数量;Determining the number of verification threads according to the number of transaction blocks in the transaction block sequence and the number of CPU cores of the server corresponding to the transaction block;按照所述数量分配多个校验线程;及Allocate multiple verification threads according to the number; and通过所述多个校验线程对所述多个事务区块并行地进行事务签名校验。The transaction signature verification is performed on the plurality of transaction blocks in parallel by the plurality of verification threads.
- 根据权利要求2所述的方法,其特征在于,所述通过所述多个校验线程对所述多个事务区块并行地进行事务签名校验,包括:The method according to claim 2, wherein said performing transaction signature verification on said plurality of transaction blocks in parallel by said plurality of verification threads comprises:将所述多个事务区块分配至所述多个校验线程;Allocating the multiple transaction blocks to the multiple verification threads;通过各所述校验线程对自身已分配的事务区块进行解析,得到解析的所述事务区块对应的多项事务;及Analyze the allocated transaction block by each verification thread to obtain multiple transactions corresponding to the analyzed transaction block; and按照所述多项事务在所述事务区块中的排序依次对各所述事务进行事务签名校验。According to the order of the multiple transactions in the transaction block, transaction signature verification is performed on each transaction in turn.
- 根据权利要求3所述的方法,其特征在于,所述按照所述多项事务在所述事务区块中的排序依次对各所述事务进行事务签名校验,包括:The method according to claim 3, wherein the step of performing transaction signature verification on each of the transactions according to the order of the multiple transactions in the transaction block comprises:按照所述多项事务在所述事务区块中的排序依次对各所述事务进行解析,得到解析的所述事务对应的事务数据和数字签名数组;Analyze each of the transactions in turn according to the order of the multiple transactions in the transaction block to obtain transaction data and digital signature arrays corresponding to the analyzed transactions;解析所述数字签名数组得到多个数字签名和各所述数字签名对应的公钥;Parsing the digital signature array to obtain multiple digital signatures and public keys corresponding to each of the digital signatures;根据各所述公钥对相应的数字签名进行解密,得到解密后的数字签名;Decrypt the corresponding digital signature according to each said public key to obtain the decrypted digital signature;根据所述事务数据生成事务哈希值,并基于所述事务哈希值和各所述解密后的数字签名,分别对各所述数字签名进行校验;及Generate a transaction hash value according to the transaction data, and verify each of the digital signatures based on the transaction hash value and each of the decrypted digital signatures; and当校验通过的所述数字签名的数量达到预设数量阈值时,则判定解析的所述事务对应的签名校验结果为校验通过。When the number of the digital signatures that have passed the verification reaches a preset number threshold, it is determined that the signature verification result corresponding to the parsed transaction is a verification pass.
- 根据权利要求3所述的方法,其特征在于,所述将所述多个事务区块分配至所述多个校验线程,包括:The method according to claim 3, wherein the allocating the plurality of transaction blocks to the plurality of verification threads comprises:创建与各所述校验线程对应的区块缓存队列;及Creating a block buffer queue corresponding to each verification thread; and将所述多个事务区块按照预设分配方式分配至各所述区块缓存队列,作为分配给相应校验线程的事务区块。The plurality of transaction blocks are allocated to each of the block cache queues according to a preset allocation method as the transaction blocks allocated to the corresponding verification thread.
- 根据权利要求1所述的方法,其特征在于,所述串行地对各所述事务区块进行事务多版本检查,包括:The method according to claim 1, wherein the serially performing transaction multi-version checking on each of the transaction blocks comprises:按照所述事务区块序列的顺序,依次对各所述事务区块中的多项事务执行以下事务多版本检查的步骤:According to the sequence of the transaction block sequence, the following transaction multi-version checking steps are performed sequentially on multiple transactions in each transaction block:按照所述多项事务在所述事务区块中的排序依次对各所述事务进行解析,得到解析的所述事务对应的事务数据标识和目标数据版本号;Analyze each of the transactions in turn according to the order of the multiple transactions in the transaction block to obtain the transaction data identifier and target data version number corresponding to the analyzed transaction;查询与所述事务数据标识对应的最新数据版本号;及Query the latest data version number corresponding to the transaction data identifier; and当所述最新数据版本号与所述目标数据版本号一致时,则判定解析的所述事务的多版本检查结果为检查通过。When the latest data version number is consistent with the target data version number, it is determined that the parsed multi-version check result of the transaction is passed.
- 根据权利要求1至6任一项所述的方法,其特征在于,所述根据所述事务提交指令在当前缓存的区块序列中查询配置区块之后,上述方法还包括:The method according to any one of claims 1 to 6, characterized in that, after the query configuration block in the currently cached block sequence according to the transaction commit instruction, the method further comprises:当未查询到所述配置区块时,直接对所述区块序列中的多个事务区块执行以下事务提交操作:When the configuration block is not found, the following transaction commit operations are directly performed on multiple transaction blocks in the block sequence:并行地对所述多个事务区块进行事务签名校验;串行地对各所述事务区块进行事务多版本检查;将所述多个事务区块同时写入磁盘中。Perform transaction signature verification on the multiple transaction blocks in parallel; perform transaction multi-version checks on each transaction block serially; write the multiple transaction blocks into the disk at the same time.
- 一种区块处理装置,其特征在于,所述装置包括:A block processing device, characterized in that the device includes:获取模块,用于获取事务提交指令;Obtaining module for obtaining transaction commit instructions;查询模块,用于根据所述事务提交指令在当前缓存的区块序列中查询配置区块;The query module is used to query the configuration block in the currently cached block sequence according to the transaction commit instruction;分割模块,用于当查询到所述配置区块时,以查询到的所述配置区块为分割基准点,将所述区块序列分割为配置区块和事务区块序列;A segmentation module, configured to, when the configuration block is queried, use the queried configuration block as a segmentation reference point to split the block sequence into a configuration block and a transaction block sequence;提交模块,用于按照所述区块序列的顺序分别对所述配置区块和所述事务区块序列中的事务区块执行事务提交操作;针对所述事务区块序列中的多个事务区块执行的事务提交操作包括:并行地对所述多个事务区块进行事务签名校验;串行地对各所述事务区块进行事务多版本检查;将所述多个事务区块同时写入磁盘中。The commit module is configured to perform transaction commit operations on the configuration block and the transaction block in the transaction block sequence according to the sequence of the block sequence; for multiple transaction areas in the transaction block sequence The transaction commit operation performed by the block includes: performing transaction signature verification on the multiple transaction blocks in parallel; performing multi-version check on each transaction block serially; writing the multiple transaction blocks simultaneously Into the disk.
- 根据权利要求8所述的装置,其特征在于,所述提交模块,还用于根据所述事务区块序列中的事务区块数量和自身对应的服务器的CPU核数确定校验线程的数量;按照所述数量分配多个校验线程;及通过所述多个校验线程对所述多个事务区块并行地进行事务签名校验。The device according to claim 8, wherein the commit module is further configured to determine the number of check threads according to the number of transaction blocks in the transaction block sequence and the number of CPU cores of the server corresponding to it; A plurality of verification threads are allocated according to the number; and transaction signature verification is performed on the plurality of transaction blocks in parallel through the plurality of verification threads.
- 根据权利要求9所述的装置,其特征在于,所述提交模块,还用于将所述多个事务区块分配至所述多个校验线程;通过各所述校验线程对自身已分配的事务区块进行解析,得到解析的所述事务区块对应的多项事务;及按照所述多项事务在所述事务区块中的排序依次对各所述事务进行事务签名校验。The device according to claim 9, wherein the commit module is further configured to allocate the plurality of transaction blocks to the plurality of verification threads; each verification thread allocates itself to Parse the transaction block to obtain multiple transactions corresponding to the parsed transaction block; and perform transaction signature verification on each transaction in sequence according to the order of the multiple transactions in the transaction block.
- 根据权利要求10所述的装置,其特征在于,所述提交模块,还用于按照所述多项事务在所述事务区块中的排序依次对各所述事务进行解析,得到解析的所述事务对应的事务数据和数字签名数组;解析所述数字签名数组得到多个数字签名和各所述数字签名对应的公钥;根据各所述公钥对相应的数字签名进行解密,得到解密后的数字签名;根据所述事务数据生成事务哈希值,并基于所述事务哈希值和各所述解密后的数字签名,分别对各所述数字签名进行校验;及当校验通过的所述数字签名的数量达到预设数量阈值时,则判定解析的所述事务对应的签名校验结果为校验通过。The apparatus according to claim 10, wherein the commit module is further configured to parse each of the transactions in sequence according to the order of the multiple transactions in the transaction block to obtain the parsed Transaction data and digital signature array corresponding to the transaction; parsing the digital signature array to obtain multiple digital signatures and public keys corresponding to each of the digital signatures; decrypting the corresponding digital signatures according to each of the public keys to obtain the decrypted Digital signature; generate a transaction hash value based on the transaction data, and verify each of the digital signatures based on the transaction hash value and each of the decrypted digital signatures; and when the verification passes When the number of the digital signatures reaches the preset number threshold, it is determined that the signature verification result corresponding to the analyzed transaction is passed.
- 根据权利要求10所述的装置,其特征在于,所述提交模块,还用于创建与各所述校验线程对应的区块缓存队列;及将所述多个事务区块按照预设分配方式分配至各所述区块缓存队列,作为分配给相应校验线程的事务区块。The device according to claim 10, wherein the submission module is further configured to create a block cache queue corresponding to each of the verification threads; and assign the plurality of transaction blocks according to a preset allocation method Allocate to each of the block cache queues as transaction blocks allocated to the corresponding verification thread.
- 根据权利要求8所述的装置,其特征在于,所述提交模块,还用于按照所述事务区块序列的顺序,依次对各所述事务区块中的多项事务执行以下事务多版本检查的步骤:按照所述多项事务在所述事务区块中的排序依次对各所述事务进行解析,得到解析的所述事务对应的事务数据标识和目标数据版本号;查询与所述事务数据标识对应的最新数据版本号;及当所述最新数据版本号与所述目标数据版本号一致时,则判定解析的所述事务的多版本检查结果为检查通过。8. The device according to claim 8, wherein the commit module is further configured to perform the following transaction multi-version checks on multiple transactions in each transaction block in sequence according to the sequence of the transaction block sequence The steps of: parse each of the transactions in turn according to the order of the multiple transactions in the transaction block to obtain the transaction data identifier and target data version number corresponding to the analyzed transaction; query the transaction data Identify the corresponding latest data version number; and when the latest data version number is consistent with the target data version number, it is determined that the parsed multi-version check result of the transaction is passed.
- 根据权利要求8至13任一项所述的装置,其特征在于,所述提交模块,还用于当未查询到所述配置区块时,直接对所述区块序列中的多个事务区块执行以下事务提交操作:并行地对所述多个事务区块进行事务签名校验;串行地对各所述事务区块进行事务多版本检查;将所述多个事务区块同时写入磁盘中。The device according to any one of claims 8 to 13, wherein the submission module is further configured to directly check multiple transaction areas in the block sequence when the configuration block is not found. The block performs the following transaction commit operations: performs transaction signature verification on the multiple transaction blocks in parallel; performs multi-version check on each transaction block serially; writes the multiple transaction blocks simultaneously Disk.
- 一种计算机设备,包括存储器和一个或多个处理器,所述存储器中储存有计算机可读指令,所述计算机可读指令被所述一个或多个处理器执行时,使得所述一个或多个处理器执行以下步骤:A computer device includes a memory and one or more processors. The memory stores computer readable instructions. When the computer readable instructions are executed by the one or more processors, the one or more Each processor performs the following steps:获取事务提交指令;Obtain transaction commit instructions;根据所述事务提交指令在当前缓存的区块序列中查询配置区块;Query the configuration block in the currently cached block sequence according to the transaction commit instruction;当查询到所述配置区块时,以查询到的所述配置区块为分割基准点,将所述区块序列分割为配置区块和事务区块序列;及When the configuration block is queried, the block sequence is divided into a configuration block and a transaction block sequence using the queried configuration block as a division reference point; and按照所述区块序列的顺序分别对所述配置区块和所述事务区块序列中的事务区块执行事务提交操作;针对所述事务区块序列中的多个事务区块执行的事务提交操作包括:并行地对所述多个事务区块进行事务签名校验;串行地对各所述事务区块进行事务多版本检查;将所述多个事务区块同时写入磁盘中。A transaction commit operation is performed on the configuration block and the transaction block in the transaction block sequence respectively according to the sequence of the block sequence; transaction commit performed on multiple transaction blocks in the transaction block sequence The operations include: performing transaction signature verification on the plurality of transaction blocks in parallel; performing transaction multi-version checking on each of the transaction blocks serially; and simultaneously writing the plurality of transaction blocks to a disk.
- 根据权利要求15所述的计算机设备,其特征在于,所述处理器执行所述计算机可读指令时还执行以下步骤:The computer device according to claim 15, wherein the processor further executes the following steps when executing the computer-readable instruction:根据所述事务区块序列中的事务区块数量和自身对应的服务器的CPU核数确定校验线程的数量;Determining the number of verification threads according to the number of transaction blocks in the transaction block sequence and the number of CPU cores of the server corresponding to the transaction block;按照所述数量分配多个校验线程;及Allocate multiple verification threads according to the number; and通过所述多个校验线程对所述多个事务区块并行地进行事务签名校验。The transaction signature verification is performed on the plurality of transaction blocks in parallel by the plurality of verification threads.
- 根据权利要求16所述的计算机设备,其特征在于,所述通过所述多个校验线程对所述多个事务区块并行地进行事务签名校验,包括:16. The computer device according to claim 16, wherein the performing transaction signature verification on the multiple transaction blocks in parallel by the multiple verification threads comprises:将所述多个事务区块分配至所述多个校验线程;Allocating the multiple transaction blocks to the multiple verification threads;通过各所述校验线程对自身已分配的事务区块进行解析,得到解析的所述事务区块对应的多项事务;及Analyze the allocated transaction block by each verification thread to obtain multiple transactions corresponding to the analyzed transaction block; and按照所述多项事务在所述事务区块中的排序依次对各所述事务进行事务签名校验。According to the order of the multiple transactions in the transaction block, transaction signature verification is performed on each transaction in turn.
- 一个或多个存储有计算机可读指令的非易失性计算机可读存储介质,所述计算机可读指令被一个或多个处理器执行时,使得所述一个或多个处理器执行以下步骤:One or more non-volatile computer-readable storage media storing computer-readable instructions, which when executed by one or more processors, cause the one or more processors to perform the following steps:获取事务提交指令;Obtain transaction commit instructions;根据所述事务提交指令在当前缓存的区块序列中查询配置区块;Query the configuration block in the currently cached block sequence according to the transaction commit instruction;当查询到所述配置区块时,以查询到的所述配置区块为分割基准点,将所述区块序列分割为配置区块和事务区块序列;及When the configuration block is queried, the block sequence is divided into a configuration block and a transaction block sequence using the queried configuration block as a division reference point; and按照所述区块序列的顺序分别对所述配置区块和所述事务区块序列中的事务区块执行事务提交操作;针对所述事务区块序列中的多个事务区块执行的事务提交操作包括:并行地对所述多个事务区块进行事务签名校验;串行地对各所述事务区块进行事务多版本检查;将所述多个事务区块同时写入磁盘中。A transaction commit operation is performed on the configuration block and the transaction block in the transaction block sequence respectively according to the sequence of the block sequence; transaction commit performed on multiple transaction blocks in the transaction block sequence The operations include: performing transaction signature verification on the plurality of transaction blocks in parallel; performing transaction multi-version checking on each of the transaction blocks serially; and simultaneously writing the plurality of transaction blocks to a disk.
- 根据权利要求18所述的存储介质,其特征在于,所述计算机可读指令被所述处理器执行时还执行以下步骤:18. The storage medium of claim 18, wherein the following steps are further performed when the computer-readable instructions are executed by the processor:根据所述事务区块序列中的事务区块数量和自身对应的服务器的CPU核数确定校验线程的数量;Determining the number of verification threads according to the number of transaction blocks in the transaction block sequence and the number of CPU cores of the server corresponding to the transaction block;按照所述数量分配多个校验线程;及Allocate multiple verification threads according to the number; and通过所述多个校验线程对所述多个事务区块并行地进行事务签名校验。The transaction signature verification is performed on the plurality of transaction blocks in parallel by the plurality of verification threads.
- 根据权利要求19所述的存储介质,其特征在于,所述计算机可读指令被所述处理器执行时还执行以下步骤:The storage medium according to claim 19, wherein the following steps are further executed when the computer-readable instructions are executed by the processor:将所述多个事务区块分配至所述多个校验线程;Allocating the multiple transaction blocks to the multiple verification threads;通过各所述校验线程对自身已分配的事务区块进行解析,得到解析的所述事务区块对应的多项事务;及Analyze the allocated transaction block by each verification thread to obtain multiple transactions corresponding to the analyzed transaction block; and按照所述多项事务在所述事务区块中的排序依次对各所述事务进行事务签名校验。According to the order of the multiple transactions in the transaction block, transaction signature verification is performed on each transaction in turn.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910420112.5A CN110245126A (en) | 2019-05-20 | 2019-05-20 | Block processes method, apparatus, computer equipment and storage medium |
CN201910420112.5 | 2019-05-20 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2020233086A1 true WO2020233086A1 (en) | 2020-11-26 |
Family
ID=67884599
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2019/122676 WO2020233086A1 (en) | 2019-05-20 | 2019-12-03 | Block processing method and apparatus, computer device and storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN110245126A (en) |
WO (1) | WO2020233086A1 (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110245126A (en) * | 2019-05-20 | 2019-09-17 | 深圳壹账通智能科技有限公司 | Block processes method, apparatus, computer equipment and storage medium |
CN111985928A (en) * | 2020-09-03 | 2020-11-24 | 深圳壹账通智能科技有限公司 | Verification method, verification device, electronic equipment and storage medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107291862A (en) * | 2017-06-12 | 2017-10-24 | 腾讯科技(深圳)有限公司 | Business datum storage method, device, storage medium and electronic equipment |
CN109614206A (en) * | 2018-10-25 | 2019-04-12 | 深圳壹账通智能科技有限公司 | Device, method and the storage medium of block chain issued transaction |
CN110245126A (en) * | 2019-05-20 | 2019-09-17 | 深圳壹账通智能科技有限公司 | Block processes method, apparatus, computer equipment and storage medium |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107145768B (en) * | 2016-03-01 | 2021-02-12 | 华为技术有限公司 | Copyright management method and system |
EP3382629A1 (en) * | 2017-03-31 | 2018-10-03 | Siemens Aktiengesellschaft | Procedure and time provider for provision of security-protected time values |
CN107070938A (en) * | 2017-04-27 | 2017-08-18 | 电子科技大学 | Data access control system based on block chain |
CN107729137B (en) * | 2017-09-04 | 2021-06-22 | 深圳壹账通智能科技有限公司 | Server, block chain signature verification decryption method and storage medium |
CN108388989A (en) * | 2018-02-26 | 2018-08-10 | 深圳智乾区块链科技有限公司 | Transaction methods, system and computer readable storage medium |
-
2019
- 2019-05-20 CN CN201910420112.5A patent/CN110245126A/en active Pending
- 2019-12-03 WO PCT/CN2019/122676 patent/WO2020233086A1/en active Application Filing
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107291862A (en) * | 2017-06-12 | 2017-10-24 | 腾讯科技(深圳)有限公司 | Business datum storage method, device, storage medium and electronic equipment |
CN109614206A (en) * | 2018-10-25 | 2019-04-12 | 深圳壹账通智能科技有限公司 | Device, method and the storage medium of block chain issued transaction |
CN110245126A (en) * | 2019-05-20 | 2019-09-17 | 深圳壹账通智能科技有限公司 | Block processes method, apparatus, computer equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN110245126A (en) | 2019-09-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10439804B2 (en) | Data encrypting system with encryption service module and supporting infrastructure for transparently providing encryption services to encryption service consumer processes across encryption service state changes | |
WO2021218167A1 (en) | Data processing model generation method and apparatus and data processing method and apparatus | |
CN111625593B (en) | Block chain-based data processing method and device and computer equipment | |
WO2019100598A1 (en) | Transaction processing method and device, computer equipment, and storage medium | |
US10615971B2 (en) | High integrity logs for distributed software services | |
TW202034251A (en) | Methods and devices for testing signature verification for blockchain system | |
WO2020224489A1 (en) | Blockchain-based bank data sharing method and related apparatus | |
US20200293663A1 (en) | Discovery and Matching of Internet of Things (IoT) Devices and Services Using a Secure Global Registry | |
CN110781140B (en) | Method, device, computer equipment and storage medium for signing data in blockchain | |
US7318160B2 (en) | Cryptographic key setup in queued cryptographic systems | |
WO2020233086A1 (en) | Block processing method and apparatus, computer device and storage medium | |
US20190044716A1 (en) | Encoding process for multiple rsa and ecc keys | |
CN115604038B (en) | Cloud storage data auditing system and method based on blockchain and edge computing | |
US11917084B2 (en) | Cryptographic validation of media integrity | |
CN110688666A (en) | Data encryption and storage method in distributed storage | |
CN111404892B (en) | Data supervision method and device and server | |
WO2020253380A1 (en) | Data encryption method and apparatus, and terminal device | |
CN114127724A (en) | Integrity audit for multi-copy storage | |
CN114172659B (en) | Message transmission method, device, equipment and storage medium in block chain system | |
CN109284302B (en) | Data processing method and device | |
US20200396054A1 (en) | Secure Memory Read | |
Ma et al. | Authenticating query results in data publishing | |
CN116192395A (en) | Trusted system for distributed data storage | |
US20220345292A1 (en) | Method and device for encryption of video stream, communication equipment, and storage medium | |
CN113452519B (en) | Key synchronization method and device, computer equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 19929985 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 19929985 Country of ref document: EP Kind code of ref document: A1 |
|
32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205 DATED 18/03/2022) |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 19929985 Country of ref document: EP Kind code of ref document: A1 |