A method, device and electronic device for verifying signatures of transactions in blockchain
By caching transaction signature verification results in the blockchain and using transaction hashes to search and utilize the cached results, repeated signature verification of transactions is avoided, the problem of waste of transaction signature verification resources in the blockchain is solved, and processing capabilities are improved.
Patent Information
- Application Number
- CN202110914730.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-10
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2041-08-10
AI Technical Summary
In the blockchain, due to different transaction sources during the transaction signature verification process, the same transaction may be repeatedly verified, resulting in a waste of resources and reduced processing capabilities.
The transaction verification results of the most recent period are cached in the transaction pool module, and the matching signature verification results are searched through the transaction hash. If found, the signature verification operation is skipped, otherwise the signature verification is performed and the results are cached.
It effectively avoids repeated signature verification of transactions, saves processing resources, and improves transaction processing capabilities.
Smart Images

Figure CN113723963B
Abstract
Description
Technical Field
[0001] This document relates to the field of blockchain technology, and in particular to a method, device and electronic device for verifying signatures of transactions in a blockchain. Background Art
[0002] Blockchain is a decentralized and innovative solution that uses distributed ledger technology to solve multi-party trust issues. It is a cutting-edge technology in today's society.
[0003] When blockchain nodes process transactions normally, they need to perform necessary signature verification on the transactions to ensure the normal execution of the transactions. Currently, transactions that need signature verification come from the following sources: transactions sent directly to blockchain nodes through the Remote Procedure Call (RPC) interface, transactions forwarded by other blockchain nodes, and transactions included in consensus blocks.
[0004] For all three types of transactions, transaction signatures need to be verified. However, due to different transaction sources, the same transaction may be repeatedly verified. Summary of the invention
[0005] The purpose of one or more embodiments of this specification is to provide a method, device and electronic device for verifying transactions in a blockchain, so as to avoid repeated verification by caching transaction verification results of a recent period of time in a transaction pool module.
[0006] To solve the above technical problems, one or more embodiments of this specification are implemented as follows:
[0007] First, a method for verifying transactions in a blockchain is proposed, including:
[0008] After receiving the target transaction, according to the transaction hash of the target transaction, check whether there is a signature verification result matching the target transaction cached in the cache pool, wherein the signature verification results cached in the cache pool are cached in a key-value pair KV storage mode, and the key of each signature verification result is the transaction hash, and the value is the signature verification result;
[0009] If a signature verification result matching the target transaction is found, the current signature verification operation is skipped;
[0010] If no signature verification result matching the target transaction is found, the target transaction is verified, and the signature verification result obtained this time and the transaction hash of the target transaction are cached in the cache pool in a KV storage manner.
[0011] In the second aspect, a device for verifying the signature of transactions in a blockchain is proposed, comprising:
[0012] The search module searches, after receiving the target transaction, whether there is a signature verification result matching the target transaction cached in the cache pool according to the transaction hash of the target transaction, wherein the signature verification results cached in the cache pool are cached in a key-value pair KV storage manner, and the key of each signature verification result is the transaction hash, and the value is the signature verification result;
[0013] End module: if a signature verification result matching the target transaction is found, the current signature verification operation is skipped;
[0014] If the signature verification module cannot find a signature verification result matching the target transaction, it verifies the target transaction and caches the signature verification result and the transaction hash of the target transaction in a cache pool in a KV storage manner.
[0015] In a third aspect, an electronic device is provided, comprising:
[0016] Processor; and
[0017] a memory arranged to store computer executable instructions which, when executed, cause the processor to:
[0018] After receiving the target transaction, according to the transaction hash of the target transaction, check whether there is a signature verification result matching the target transaction cached in the cache pool, wherein the signature verification results cached in the cache pool are cached in a key-value pair KV storage mode, and the key of each signature verification result is the transaction hash, and the value is the signature verification result;
[0019] If a signature verification result matching the target transaction is found, the current signature verification operation is skipped;
[0020] If no signature verification result matching the target transaction is found, the target transaction is verified, and the signature verification result obtained this time and the transaction hash of the target transaction are cached in the cache pool in a KV storage manner.
[0021] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores one or more programs, and when the one or more programs are executed by an electronic device including a plurality of application programs, the electronic device executes:
[0022] After receiving the target transaction, according to the transaction hash of the target transaction, check whether there is a signature verification result matching the target transaction cached in the cache pool, wherein the signature verification results cached in the cache pool are cached in a key-value pair KV storage mode, and the key of each signature verification result is the transaction hash, and the value is the signature verification result;
[0023] If a signature verification result matching the target transaction is found, the current signature verification operation is skipped;
[0024] If no signature verification result matching the target transaction is found, the target transaction is verified, and the signature verification result obtained this time and the transaction hash of the target transaction are cached in the cache pool in a KV storage manner.
[0025] It can be seen from the technical solutions provided by one or more embodiments of the present specification that when verifying the signature of a target transaction, the target transaction is not directly verified, but based on the transaction hash of the target transaction, the cache pool is searched to see whether a verification result corresponding to the transaction hash of the target transaction has been cached. If it is found, there is no need to verify the signature again, and the verification result can be directly used for subsequent operations. If it is not found, the target transaction is verified and the verification result is cached in the cache pool. Thus, by caching the verification result in the cache pool, unnecessary repeated verification of the target transaction is avoided, and processing resources are reasonably saved. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate one or more embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the description of one or more embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0027] Figure 1a This is one of the schematic diagrams of a method for verifying signatures of transactions in a blockchain provided in an embodiment of this specification.
[0028] Figure 1b This is the second schematic diagram of a method and steps for verifying signatures of transactions in a blockchain provided in an embodiment of this specification.
[0029] Figure 2 It is a schematic diagram of the structure of a device for verifying signatures of transactions in a blockchain provided in an embodiment of this specification.
[0030] Figure 3 It is a schematic diagram of the structure of an electronic device provided by an embodiment of this specification. DETAILED DESCRIPTION
[0031] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in one or more embodiments of this specification will be clearly and completely described below in conjunction with the drawings in one or more embodiments of this specification. Obviously, the one or more embodiments described are only part of the embodiments of this specification, not all of the embodiments. Based on one or more embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this document.
[0032] The blockchain is usually composed of several blocks, each of which records a timestamp corresponding to the creation time of the block. All blocks strictly follow the timestamps recorded in the blocks to form a temporally ordered data chain. For real data generated in the physical world, it can be constructed into a standard transaction format supported by the blockchain and published to the blockchain. The node devices in the blockchain will process the received transactions through consensus. After reaching a consensus, the node devices in the blockchain that serve as accounting nodes will package the transaction into a block and store it persistently in the blockchain.
[0033] KV database refers to Key-value database, which is a database that stores data in key-value pairs, similar to map in Java. The entire database can be understood as a large map, and each key corresponds to a unique value. The key-value distributed storage system has fast query speed, large data storage volume, and supports high concurrency. It is very suitable for querying by primary key, but cannot perform complex conditional queries.
[0034] In view of the problems mentioned in the background technology, the existing blockchain nodes that process transactions generally perform multiple signature verifications at different stages when processing transactions, or perform multiple signature verifications for the same transaction from different sources, resulting in repeated signature verification operations. In order to avoid repeated signature verifications, save processing resources, and improve transaction processing capabilities, a processing solution for avoiding repeated signature verifications during the consensus process is proposed. In specific implementation, a cache pool specifically used to store signature verification results can be defined or divided on the blockchain node. The data in the cache pool is cached in a KV storage manner. When verifying the signature of a target transaction, the target transaction is not directly verified, but based on the transaction hash of the target transaction, it is searched whether the cache pool has cached the signature verification result corresponding to the transaction hash of the target transaction. If it is found, there is no need to verify the signature again, and the signature verification result can be directly used for subsequent operations. If it is not found, the target transaction is verified and the signature verification result is cached in the cache pool. Thus, by caching the signature verification result in the cache pool, unnecessary repeated signature verification of the target transaction is avoided, and processing resources are reasonably saved.
[0035] Embodiment 1
[0036] Reference Figure 1a As shown, it is a schematic diagram of the steps of a method for verifying transactions in a blockchain provided in an embodiment of this specification. It should be understood that the method is applied in a device for verifying transactions in a blockchain. Specifically, the device for verifying signatures can be a software module that can execute the following method and has corresponding functions, or the device for verifying signatures can execute the following method and has a blockchain node with corresponding functions.
[0037] The signature verification method may include the following steps:
[0038] Step 102: After receiving the target transaction, according to the transaction hash of the target transaction, check whether there is a signature verification result matching the target transaction cached in the cache pool, wherein the signature verification result pairs cached in the cache pool are cached in a key-value pair KV storage manner, and the keyword of each signature verification result pair is the transaction hash, and the value is the signature verification result.
[0039] The cache pool can be a temporary storage space separated by a blockchain node, which is used to cache transaction verification results within a certain transaction cycle. It should be understood that multiple verification result pairs can be stored in the cache pool, and the transaction hash of each verification result pair is unique, that is, the verification result of each target transaction is guaranteed to be unique in the cache pool. The verification result is not stored independently, but is stored in a KV storage method corresponding to the transaction hash to form a verification result pair for each target transaction. For example: target transaction 1: transaction hash 1-verification result 1; target transaction 2: transaction hash 2-verification result 2.
[0040] In the embodiments of this specification, the target transaction is sent via a remote procedure call (RPC) interface, or the target transaction is sent from other blockchain nodes. It should be understood that the target transaction involved in this specification can be sent via an RPC interface or forwarded by other blockchain nodes, so the source of the target transaction is not limited.
[0041] Optionally, when searching for a signature verification result that matches the target transaction in the cache pool, it is specifically possible to search for a transaction hash of the target transaction in the cache pool, and whether the transaction hash and the signature verification result are cached in a KV storage manner. Considering that when searching for a signature verification result for a target transaction, it is necessary not only to determine whether the transaction hash of the target transaction is cached in the cache pool, but also to determine whether the found transaction hash is cached in a KV storage manner with the corresponding signature verification result. Only when these two conditions are met at the same time can it be determined that there is a signature verification result that matches the target transaction in the cache pool.
[0042] Step 104: If a signature verification result matching the target transaction is found, the current signature verification operation is skipped.
[0043] If a verification result matching the target transaction is found, it means that the target transaction has been verified and does not need to be verified again. If the verification result found is correct, skip this verification operation and use the verification result directly for subsequent operations. If the verification result found is wrong, skip this verification operation and roll back the data of the target transaction directly.
[0044] Step 106: If no signature verification result matching the target transaction is found, the target transaction is verified, and the signature verification result obtained this time and the transaction hash of the target transaction are cached in the cache pool in a KV storage manner.
[0045] If the verification result that matches the target transaction cannot be found in the cache pool, it means that the target transaction has not been verified yet, and the target transaction needs to be verified according to the existing verification method. Generally, the signature of the target transaction is decrypted using the public key of the user who initiated the transaction to obtain the verification result. At the same time, the transaction hash of the target transaction that has been calculated is calculated or used. After that, the verification result and transaction hash of the target transaction are cached in the cache pool in KV storage mode.
[0046] Further, refer to Figure 1b As shown, at the time of consensus block, the method may further include:
[0047] Step 108: For each target transaction in the block to be agreed upon, check whether there is a signature verification result matching the target transaction cached in the cache pool.
[0048] Optionally, when searching whether a signature verification result matching the target transaction is cached in the cache pool, it may be specifically searched whether a transaction hash of the target transaction is cached in the cache pool, and whether the transaction hash and the signature verification result are cached correspondingly in a KV storage manner.
[0049] In the consensus phase, each target transaction in the block needs to be verified. Considering that some of these target transactions may have been verified before, it is necessary to search all target transactions in the block to determine whether the verification results of the corresponding target transactions are cached in the cache pool. In other words, the legitimacy of the block is verified.
[0050] Step 110: If the verification results of all target transactions in the consensus block are found and each verification result is correct, all target transactions skip this verification operation.
[0051] Step 112: If the verification results of some target transactions in the block to be agreed upon are found and all the verification results are correct, only the other target transactions except the part of the target transactions are verified, and the verification results obtained this time and the transaction hash of the corresponding target transaction are cached in the cache pool in KV storage mode.
[0052] Step 114: If the verification results of some target transactions in the block to be agreed upon are found and there are verification errors in the verification results found, it is determined that the current block to be agreed upon is illegal, and the consensus operation is terminated.
[0053] It should be understood that in the embodiments of this specification, when a target transaction is executed or the target transaction data is rolled back due to an error in the signature verification result, the signature verification result pair of the target transaction cached in the cache pool may be automatically deleted.
[0054] When a node receives a block being consensused during the consensus process, it needs to check the legitimacy of the consensus block. At this time, it needs to verify whether all transactions in the block are legal. In this case, it first obtains the query transaction from the cache to see whether the signature has been verified and the signature is correct. If all transaction signatures are correct, the transactions in the consensus block do not need to be verified again; if only some transactions are found to have correct signatures and the remaining transactions are not in the cache, only the signatures of the remaining transactions need to be verified, and then the verified results are cached; if it is found that some of the transaction signatures are incorrect, it means that the block is illegal and verification will not continue.
[0055] In the embodiments of this specification, when verifying the signature of a target transaction, the target transaction is not directly verified, but based on the transaction hash of the target transaction, a search is performed in the cache pool to find whether a verification result corresponding to the transaction hash of the target transaction has been cached. If it is found, there is no need to verify the signature again, and the verification result can be directly used for subsequent operations. If it is not found, the target transaction is verified and the verification result is cached in the cache pool. Thus, by caching the verification result in the cache pool, unnecessary repeated verification of the target transaction is avoided, and processing resources are reasonably saved.
[0056] Embodiment 2
[0057] Reference Figure 2 As shown, the device for verifying the signature of transactions in the blockchain provided by the embodiment of this specification 200 may include: a search module 202, an end module 204, and a verification module 206; wherein,
[0058] After receiving the target transaction, the search module 202 searches the cache pool for a signature verification result matching the target transaction according to the transaction hash of the target transaction, wherein the signature verification results cached in the cache pool are cached in a key-value pair KV storage manner, and the key of each signature verification result is the transaction hash, and the value is the signature verification result;
[0059] End module 204: if a signature verification result matching the target transaction is found, the current signature verification operation is skipped;
[0060] If the signature verification module 206 cannot find a signature verification result matching the target transaction, it verifies the target transaction and caches the signature verification result and the transaction hash of the target transaction in a cache pool in a KV storage manner.
[0061] Optionally, as an embodiment, the signature verification device further includes: a receiving module, receiving a target transaction sent by a remote procedure call RPC interface, or receiving a target transaction sent by other blockchain nodes.
[0062] In a specific implementation of the embodiment of this specification, at the time of consensus block,
[0063] The search module further searches, for each target transaction in the block to be consensused, whether there is a signature verification result matching the target transaction cached in the cache pool;
[0064] In the end module, if the verification results of all target transactions in the consensus block are found and each verification result is correct, all target transactions will skip the current verification operation;
[0065] If the verification module finds the verification results of some target transactions in the consensus block and the verification results are all correct, it will only verify the other target transactions except the part of the target transactions, and cache the verification results and the transaction hash of the corresponding target transaction in the cache pool in KV storage mode;
[0066] The end module, if the verification results of some target transactions in the block to be agreed upon are found and there are verification errors in the verification results found, determines that the current block to be agreed upon is illegal and terminates the consensus operation.
[0067] In another specific implementation of the embodiment of this specification, when the search module determines whether there is a signature verification result matching the target transaction cached in the cache pool, it is specifically used to:
[0068] Check whether the transaction hash of the target transaction is cached in the cache pool, and whether the transaction hash and the signature verification result are cached in a corresponding manner in KV storage.
[0069] In the embodiments of this specification, when verifying the signature of a target transaction, the target transaction is not directly verified, but based on the transaction hash of the target transaction, a search is performed in the cache pool to find whether a verification result corresponding to the transaction hash of the target transaction has been cached. If it is found, there is no need to verify the signature again, and the verification result can be directly used for subsequent operations. If it is not found, the target transaction is verified and the verification result is cached in the cache pool. Thus, by caching the verification result in the cache pool, unnecessary repeated verification of the target transaction is avoided, and processing resources are reasonably saved.
[0070] Embodiment 3
[0071] Figure 3 This is a schematic diagram of the structure of an electronic device according to an embodiment of this specification. Figure 3 At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. The memory may include a memory, such as a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. Of course, the electronic device may also include hardware required for other services.
[0072] The processor, network interface and memory can be interconnected through an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0073] The memory is used to store the program. Specifically, the program may include a program code, and the program code includes a computer operation instruction. The memory may include a memory and a non-volatile memory, and provides instructions and data to the processor.
[0074] The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming a device for verifying transactions in the blockchain at the logical level. The processor executes the program stored in the memory and is specifically used to perform the following operations:
[0075] After receiving the target transaction, according to the transaction hash of the target transaction, check whether there is a signature verification result matching the target transaction cached in the cache pool, wherein the signature verification results cached in the cache pool are cached in a key-value pair KV storage mode, and the key of each signature verification result is the transaction hash, and the value is the signature verification result;
[0076] If a signature verification result matching the target transaction is found, the current signature verification operation is skipped;
[0077] If no signature verification result matching the target transaction is found, the target transaction is verified, and the signature verification result obtained this time and the transaction hash of the target transaction are cached in the cache pool in a KV storage manner.
[0078] The above is as in this manual Figure 1a The method performed by the device disclosed in the illustrated embodiment can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The above processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in one or more embodiments of this specification can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in one or more embodiments of this specification can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0079] The electronic device may also perform Figure 1a The method and the corresponding device are implemented in Figure 1a The functions of the illustrated embodiments will not be described in detail in the embodiments of this specification.
[0080] Of course, in addition to software implementation, the electronic device of the embodiments of this specification does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0081] In the embodiments of this specification, when verifying the signature of a target transaction, the target transaction is not directly verified, but based on the transaction hash of the target transaction, a search is performed in the cache pool to find whether a verification result corresponding to the transaction hash of the target transaction has been cached. If it is found, there is no need to verify the signature again, and the verification result can be directly used for subsequent operations. If it is not found, the target transaction is verified and the verification result is cached in the cache pool. Thus, by caching the verification result in the cache pool, unnecessary repeated verification of the target transaction is avoided, and processing resources are reasonably saved.
[0082] Embodiment 4
[0083] The embodiment of the present specification also provides a computer-readable storage medium, which stores one or more programs, wherein the one or more programs include instructions, which, when executed by a portable electronic device including a plurality of application programs, enable the portable electronic device to execute Figure 1a The method of the embodiment shown is specifically used to perform the following method:
[0084] After receiving the target transaction, according to the transaction hash of the target transaction, check whether there is a signature verification result matching the target transaction cached in the cache pool, wherein the signature verification results cached in the cache pool are cached in a key-value pair KV storage mode, and the key of each signature verification result is the transaction hash, and the value is the signature verification result;
[0085] If a signature verification result matching the target transaction is found, the current signature verification operation is skipped;
[0086] If no signature verification result matching the target transaction is found, the target transaction is verified, and the signature verification result obtained this time and the transaction hash of the target transaction are cached in the cache pool in a KV storage manner.
[0087] In the embodiments of this specification, when verifying the signature of a target transaction, the target transaction is not directly verified, but based on the transaction hash of the target transaction, a search is performed in the cache pool to find whether a verification result corresponding to the transaction hash of the target transaction has been cached. If it is found, there is no need to verify the signature again, and the verification result can be directly used for subsequent operations. If it is not found, the target transaction is verified and the verification result is cached in the cache pool. Thus, by caching the verification result in the cache pool, unnecessary repeated verification of the target transaction is avoided, and processing resources are reasonably saved.
[0088] In short, the above description is only a preferred embodiment of this specification and is not intended to limit the protection scope of this specification. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this specification shall be included in the protection scope of this specification.
[0089] The systems, devices, modules or units described in one or more of the above embodiments may be implemented by a computer chip or entity, or by a product having a certain function. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0090] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0091] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0092] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0093] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
Claims
1. A method for verifying transactions in a blockchain. include: After receiving the target transaction, according to the transaction hash of the target transaction, check whether there is a signature verification result matching the target transaction cached in the cache pool, wherein the signature verification results cached in the cache pool are cached in a key-value pair KV storage mode, and the key of each signature verification result is the transaction hash, and the value is the signature verification result; If a signature verification result matching the target transaction is found, the current signature verification operation is skipped; If no signature verification result matching the target transaction is found, the target transaction is verified, and the verification result and the transaction hash of the target transaction are cached in the cache pool in a KV storage manner; wherein, According to the transaction hash of the target transaction, searching whether a signature verification result matching the target transaction is cached in the cache pool includes: According to the transaction hash of the target transaction, check whether the transaction hash of the target transaction is cached in the cache pool, and whether the transaction hash of the target transaction and the corresponding signature verification result are cached in a corresponding manner in a KV storage manner; At the time of consensus block, the method further comprises: For each target transaction in the block to be consensus, check whether there is a signature verification result matching the target transaction cached in the cache pool; If the verification results of all target transactions in the consensus block are found and each verification result is correct, all target transactions will skip this verification operation; If the verification results of some target transactions in the consensus block are found and all the verification results are correct, only the other target transactions except the part of the target transactions are verified, and the verification results and the transaction hash of the corresponding target transaction are cached in the cache pool in KV storage mode; If the verification results of some target transactions in the block to be agreed upon are found and there are verification errors in the verification results found, it is determined that the current block to be agreed upon is illegal and the consensus operation is terminated.
2. According to the method for verifying transactions in a blockchain as described in claim 1, the target transaction is sent via a remote procedure call (RPC) interface, or the target transaction is sent from other blockchain nodes.
3. The method for verifying a transaction in a blockchain according to claim 1, wherein the verification result matching the target transaction is cached in the cache pool. include: Check whether the transaction hash of the target transaction is cached in the cache pool, and whether the transaction hash and the signature verification result are cached in a corresponding manner in KV storage.
4. A device for verifying the signature of transactions in a blockchain. include: The search module searches, after receiving the target transaction, whether there is a signature verification result matching the target transaction cached in the cache pool according to the transaction hash of the target transaction, wherein the signature verification results cached in the cache pool are cached in a key-value pair KV storage manner, and the key of each signature verification result is the transaction hash, and the value is the signature verification result; End module: if a signature verification result matching the target transaction is found, the current signature verification operation is skipped; The signature verification module, if no signature verification result matching the target transaction is found, verifies the target transaction, and caches the signature verification result obtained this time and the transaction hash of the target transaction in the cache pool in a KV storage manner; wherein, After receiving the target transaction, the search module searches, based on the transaction hash of the target transaction, whether the transaction hash of the target transaction is cached in the cache pool, and whether the transaction hash of the target transaction and the corresponding signature verification result are cached in a corresponding manner in a KV storage manner; When the consensus block is reached, the search module also searches for each target transaction in the consensus block to see whether there is a signature verification result matching the target transaction cached in the cache pool; In the end module, if the verification results of all target transactions in the consensus block are found and each verification result is correct, all target transactions will skip the current verification operation; If the verification module finds the verification results of some target transactions in the consensus block and the verification results are all correct, it will only verify the other target transactions except the part of the target transactions, and cache the verification results and the transaction hash of the corresponding target transaction in the cache pool in KV storage mode; The end module, if the verification results of some target transactions in the block to be agreed upon are found and there are verification errors in the verification results found, determines that the current block to be agreed upon is illegal and terminates the consensus operation.
5. The device for verifying the signature of a transaction in a blockchain as claimed in claim 4, further comprising: include: The receiving module receives the target transaction sent by the remote procedure call (RPC) interface, or receives the target transaction sent by other blockchain nodes.
6. The device for verifying signatures of transactions in a blockchain according to claim 4, wherein when the search module determines whether a verification result matching the target transaction is cached in the cache pool, the search module is specifically used to: Check whether the transaction hash of the target transaction is cached in the cache pool, and whether the transaction hash and the signature verification result are cached in a corresponding manner in KV storage.
7. An electronic device, include: processor; as well as a memory arranged to store computer executable instructions which, when executed, cause the processor to: After receiving the target transaction, according to the transaction hash of the target transaction, check whether there is a signature verification result matching the target transaction cached in the cache pool, wherein the signature verification results cached in the cache pool are cached in a key-value pair KV storage mode, and the key of each signature verification result is the transaction hash, and the value is the signature verification result; If a signature verification result matching the target transaction is found, the current signature verification operation is skipped; If no signature verification result matching the target transaction is found, the target transaction is verified, and the verification result and the transaction hash of the target transaction are cached in the cache pool in a KV storage manner; wherein, According to the transaction hash of the target transaction, searching whether a signature verification result matching the target transaction is cached in the cache pool includes: According to the transaction hash of the target transaction, check whether the transaction hash of the target transaction is cached in the cache pool, and whether the transaction hash of the target transaction and the corresponding signature verification result are cached in a corresponding manner in a KV storage manner; When the consensus block is reached, for each target transaction in the consensus block, check whether there is a signature verification result matching the target transaction cached in the cache pool; If the verification results of all target transactions in the consensus block are found and each verification result is correct, all target transactions will skip this verification operation; If the verification results of some target transactions in the consensus block are found and all the verification results are correct, only the other target transactions except the part of the target transactions are verified, and the verification results and the transaction hash of the corresponding target transaction are cached in the cache pool in KV storage mode; If the verification results of some target transactions in the block to be agreed upon are found and there are verification errors in the verification results found, it is determined that the current block to be agreed upon is illegal and the consensus operation is terminated.
8. A computer-readable storage medium storing one or more programs which, when executed by an electronic device including a plurality of application programs, cause the electronic device to execute: After receiving the target transaction, the transaction hash of the target transaction is used to check whether there is a signature verification result matching the target transaction cached in the cache pool. in, The verification results cached in the cache pool are cached in a key-value pair KV storage mode. The key of each verification result is the transaction hash, and the value is the verification result. If a signature verification result matching the target transaction is found, the current signature verification operation is skipped; If no signature verification result matching the target transaction is found, the target transaction is verified, and the verification result and the transaction hash of the target transaction are cached in the cache pool in a KV storage manner; wherein, According to the transaction hash of the target transaction, searching whether a signature verification result matching the target transaction is cached in the cache pool includes: According to the transaction hash of the target transaction, check whether the transaction hash of the target transaction is cached in the cache pool, and whether the transaction hash of the target transaction and the corresponding signature verification result are cached in a corresponding manner in a KV storage manner; When the consensus block is reached, for each target transaction in the consensus block, check whether there is a signature verification result matching the target transaction cached in the cache pool; If the verification results of all target transactions in the consensus block are found and each verification result is correct, all target transactions will skip this verification operation; If the verification results of some target transactions in the consensus block are found and all the verification results are correct, only the other target transactions except the part of the target transactions are verified, and the verification results and the transaction hash of the corresponding target transaction are cached in the cache pool in KV storage mode; If the verification results of some target transactions in the block to be agreed upon are found and there are verification errors in the verification results found, it is determined that the current block to be agreed upon is illegal and the consensus operation is terminated.
