WO2020233086A1 - Procédé et appareil de traitement de blocs, dispositif informatique et support de stockage - Google Patents

Procédé et appareil de traitement de blocs, dispositif informatique et support de stockage Download PDF

Info

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
Application number
PCT/CN2019/122676
Other languages
English (en)
Chinese (zh)
Inventor
褚镇飞
冯世伟
张培培
Original Assignee
深圳壹账通智能科技有限公司
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 深圳壹账通智能科技有限公司 filed Critical 深圳壹账通智能科技有限公司
Publication of WO2020233086A1 publication Critical patent/WO2020233086A1/fr

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/219Managing data history or versioning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24553Query execution of query operations
    • G06F16/24554Unary operations; Data partitioning operations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input 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/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0604Improving or facilitating administration, e.g. storage management
    • G06F3/0607Improving 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input 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/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0629Configuration or reconfiguration of storage systems
    • G06F3/0631Configuration or reconfiguration of storage systems by allocating resources to storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input 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/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/067Distributed or networked storage systems, e.g. storage area networks [SAN], network attached storage [NAS]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic 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/3247Cryptographic 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

Procédé de traitement de blocs, comprenant les étapes consistant à : acquérir une instruction de validation de transaction ; interroger la séquence de blocs actuelle mise en mémoire cache à la recherche d'un bloc de configuration conformément à l'instruction de validation de transaction ; lorsque le bloc de configuration est trouvé, segmenter, en utilisant le bloc de configuration trouvé en tant que point de référence de segmentation, la séquence de blocs en un bloc de configuration et en une séquence de blocs de transaction ; effectuer des opérations de validation de transaction sur le bloc de configuration et sur les blocs de transaction de la séquence de blocs de transaction dans l'ordre de la séquence de blocs ; les opérations de validation de transaction effectuées sur la pluralité de blocs de transaction de la séquence de blocs de transaction comprenant : la mise en œuvre, en parallèle, de vérifications de signature de transaction sur la pluralité de blocs de transaction ; la mise en œuvre successive de vérifications de transaction multi-version sur chacun des blocs de transaction ; et l'enregistrement simultané de la pluralité de blocs de transaction sur un disque.
PCT/CN2019/122676 2019-05-20 2019-12-03 Procédé et appareil de traitement de blocs, dispositif informatique et support de stockage WO2020233086A1 (fr)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910420112.5A CN110245126A (zh) 2019-05-20 2019-05-20 区块处理方法、装置、计算机设备和存储介质
CN201910420112.5 2019-05-20

Publications (1)

Publication Number Publication Date
WO2020233086A1 true WO2020233086A1 (fr) 2020-11-26

Family

ID=67884599

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/122676 WO2020233086A1 (fr) 2019-05-20 2019-12-03 Procédé et appareil de traitement de blocs, dispositif informatique et support de stockage

Country Status (2)

Country Link
CN (1) CN110245126A (fr)
WO (1) WO2020233086A1 (fr)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110245126A (zh) * 2019-05-20 2019-09-17 深圳壹账通智能科技有限公司 区块处理方法、装置、计算机设备和存储介质

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107291862A (zh) * 2017-06-12 2017-10-24 腾讯科技(深圳)有限公司 业务数据存储方法、装置、存储介质及电子设备
CN109614206A (zh) * 2018-10-25 2019-04-12 深圳壹账通智能科技有限公司 区块链事务处理的装置、方法及存储介质
CN110245126A (zh) * 2019-05-20 2019-09-17 深圳壹账通智能科技有限公司 区块处理方法、装置、计算机设备和存储介质

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107145768B (zh) * 2016-03-01 2021-02-12 华为技术有限公司 版权管理方法和系统
EP3382629A1 (fr) * 2017-03-31 2018-10-03 Siemens Aktiengesellschaft Procédure et fournisseur de temps pour la fourniture de valeurs de temps protégées par la sécurité
CN107070938A (zh) * 2017-04-27 2017-08-18 电子科技大学 基于区块链的数据访问控制系统
CN107729137B (zh) * 2017-09-04 2021-06-22 深圳壹账通智能科技有限公司 服务器、区块链验签解密的方法及存储介质
CN108388989A (zh) * 2018-02-26 2018-08-10 深圳智乾区块链科技有限公司 事务处理方法、系统及计算机可读存储介质

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107291862A (zh) * 2017-06-12 2017-10-24 腾讯科技(深圳)有限公司 业务数据存储方法、装置、存储介质及电子设备
CN109614206A (zh) * 2018-10-25 2019-04-12 深圳壹账通智能科技有限公司 区块链事务处理的装置、方法及存储介质
CN110245126A (zh) * 2019-05-20 2019-09-17 深圳壹账通智能科技有限公司 区块处理方法、装置、计算机设备和存储介质

Also Published As

Publication number Publication date
CN110245126A (zh) 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 (fr) Procédé et appareil de génération de modèle de traitement de données, et procédé et appareil de traitement de données
CN111556120B (zh) 基于区块链的数据处理方法、装置、存储介质及设备
CN111625593B (zh) 基于区块链的数据处理方法、装置、计算机设备
WO2019100598A1 (fr) Procédé et dispositif de traitement de transaction, équipement informatique et support de stockage
JP4566256B2 (ja) 暗号鍵および証明書の配備および配付の自動妥当性検査および実行のためのシステムおよび方法
TW202034251A (zh) 對用於區塊鏈系統的簽章驗證進行測試的方法及裝置
WO2021042851A1 (fr) Procédé et dispositif de signature de données destinés à être utilisés dans une chaîne de blocs, appareil informatique et support de stockage
US20200293663A1 (en) Discovery and Matching of Internet of Things (IoT) Devices and Services Using a Secure Global Registry
US7318160B2 (en) Cryptographic key setup in queued cryptographic systems
US20180337695A1 (en) Block Chain Decoding With Fair Delay For Distributed Network Devices
CN115604038B (zh) 基于区块链和边缘计算的云存储数据审计系统及方法
US11917084B2 (en) Cryptographic validation of media integrity
CN110688666A (zh) 一种分布式存储中数据加密保存方法
CN111404892B (zh) 数据监管方法、装置和服务器
WO2020253380A1 (fr) Procédé et appareil de chiffrement de données, et équipement terminal
CN113888164A (zh) 区块链交易池实现方法、装置、计算机设备和存储介质
CN114172659B (zh) 区块链系统中的消息传输方法、装置、设备及存储介质
WO2020233086A1 (fr) Procédé et appareil de traitement de blocs, dispositif informatique et support de stockage
CN109284302B (zh) 数据处理方法及装置
CN116192395A (zh) 用于分散式数据存储的可信系统
US20220345292A1 (en) Method and device for encryption of video stream, communication equipment, and storage medium
CN113452519B (zh) 密钥同步方法、装置、计算机设备及存储介质
CN115481440A (zh) 数据处理方法、装置、电子设备和介质
CN114124469A (zh) 数据处理的方法、装置和设备

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