CN113723963A - Method and device for checking and signing transactions in block chain and electronic equipment - Google Patents

Method and device for checking and signing transactions in block chain and electronic equipment Download PDF

Info

Publication number
CN113723963A
CN113723963A CN202110914730.2A CN202110914730A CN113723963A CN 113723963 A CN113723963 A CN 113723963A CN 202110914730 A CN202110914730 A CN 202110914730A CN 113723963 A CN113723963 A CN 113723963A
Authority
CN
China
Prior art keywords
transaction
signature
target transaction
target
checking
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110914730.2A
Other languages
Chinese (zh)
Inventor
王晓亮
张亚宁
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Rivtower Technology Co Ltd
Original Assignee
Hangzhou Rivtower Technology Co Ltd
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 Hangzhou Rivtower Technology Co Ltd filed Critical Hangzhou Rivtower Technology Co Ltd
Priority to CN202110914730.2A priority Critical patent/CN113723963A/en
Publication of CN113723963A publication Critical patent/CN113723963A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/40Authorisation, e.g. identification of payer or payee, verification of customer or shop credentials; Review and approval of payers, e.g. check credit lines or negative lists
    • G06Q20/401Transaction verification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3825Use of electronic signatures

Abstract

One or more embodiments of the present specification disclose a method, an apparatus, and an electronic device for performing signature verification on a transaction in a blockchain, in the scheme, when a target transaction is subjected to signature verification, the target transaction is not directly subjected to signature verification processing, but based on transaction hash of the target transaction, whether a signature verification result stored corresponding to the transaction hash of the target transaction is cached in a cache pool is searched, if the signature verification result is found, the signature verification is not required again, a subsequent operation is directly performed by using the signature verification result, and if the signature verification result is not found, the signature verification operation is performed on the target transaction, and the signature verification result is cached in the cache pool. Therefore, by means of 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.

Description

Method and device for checking and signing transactions in block chain and electronic equipment
Technical Field
The present disclosure relates to the field of blockchain technologies, and in particular, to a method and an apparatus for verifying a signature of a transaction in a blockchain, and an electronic device.
Background
The blockchain is a decentralized and innovative solution for solving the multi-party trust problem by using a distributed book technology, and is a leading-edge technology of the current society.
When the block chain node normally processes the transaction, the transaction needs to be checked and signed necessarily, and normal execution of the transaction can be guaranteed. Currently, there are several sources of transactions that require a signature to be verified: transactions sent directly to the block chain nodes, transactions forwarded by other block chain nodes, transactions contained in the consensus block through a Remote Procedure Call (RPC) interface.
The transaction signature needs to be verified for all three types of transactions, but due to different transaction sources, the same transaction may be repeatedly verified.
Disclosure of Invention
One or more embodiments of the present specification are directed to a method, an apparatus, and an electronic device for performing signature verification on transactions in a blockchain, so as to avoid repeated signature verification by caching a transaction verification result in a transaction pool module for a recent period of time.
To solve the above technical problem, one or more embodiments of the present specification are implemented as follows:
in a first aspect, a method for verifying a transaction in a blockchain is provided, including:
after a target transaction is received, whether a signature verification result matched with the target transaction is cached in a cache pool or not is searched according to the transaction hash of the target transaction, wherein the signature verification result cached in the cache pool is cached in a key value-to-KV storage mode, a keyword of each signature verification result is the transaction hash, and the value is the signature verification result;
if the label checking result matched with the target transaction is found, skipping the label checking operation;
and if the signature checking result matched with the target transaction cannot be found, checking the target transaction, and caching the signature checking result obtained this time and the transaction hash of the target transaction into a cache pool in a KV storage mode.
In a second aspect, an apparatus for verifying a transaction in a blockchain is provided, including:
the system comprises a searching module, a storage module and a processing module, wherein the searching module searches whether a signature checking result matched with a target transaction is cached in a cache pool or not according to the transaction hash of the target transaction, the signature checking result cached in the cache pool is cached in a key value-pair KV storage mode, a keyword of each signature checking result is the transaction hash, and the value is the signature checking result;
the ending module skips the signature checking operation if the signature checking result matched with the target transaction is found;
and the signature checking module checks the target transaction if the signature checking result matched with the target transaction cannot be found, and caches the signature checking result obtained this time and the transaction hash of the target transaction in a cache pool in a KV storage mode.
In a third aspect, an electronic device is provided, including:
a processor; and
a memory arranged to store computer executable instructions that, when executed, cause the processor to perform:
after a target transaction is received, whether a signature verification result matched with the target transaction is cached in a cache pool or not is searched according to the transaction hash of the target transaction, wherein the signature verification result cached in the cache pool is cached in a key value-to-KV storage mode, a keyword of each signature verification result is the transaction hash, and the value is the signature verification result;
if the label checking result matched with the target transaction is found, skipping the label checking operation;
and if the signature checking result matched with the target transaction cannot be found, checking the target transaction, and caching the signature checking result obtained this time and the transaction hash of the target transaction into a cache pool in a KV storage mode.
In a fourth aspect, a computer-readable storage medium is presented, storing one or more programs which, when executed by an electronic device comprising a plurality of application programs, cause the electronic device to perform:
after a target transaction is received, whether a signature verification result matched with the target transaction is cached in a cache pool or not is searched according to the transaction hash of the target transaction, wherein the signature verification result cached in the cache pool is cached in a key value-to-KV storage mode, a keyword of each signature verification result is the transaction hash, and the value is the signature verification result;
if the label checking result matched with the target transaction is found, skipping the label checking operation;
and if the signature checking result matched with the target transaction cannot be found, checking the target transaction, and caching the signature checking result obtained this time and the transaction hash of the target transaction into a cache pool in a KV storage mode.
As can be seen from the technical solutions provided in one or more embodiments of the present specification, when a target transaction is checked, instead of directly checking the target transaction, based on the transaction hash of the target transaction, whether a check result stored in the cache pool corresponding to the transaction hash of the target transaction is cached is searched, if the check result is found, the check is not needed again, and the subsequent operation is directly performed by using the check result, if the check result is not found, the check operation is performed on the target transaction, and the check result is cached in the cache pool. Therefore, by means of 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.
Drawings
In order to more clearly illustrate one or more embodiments or prior art solutions of the present specification, reference will now be made briefly to the attached drawings, which are needed in the description of one or more embodiments or prior art, and it should be apparent that the drawings in the description below are only some of the embodiments described in the specification, and that other drawings may be obtained by those skilled in the art without inventive exercise.
Fig. 1a is a schematic diagram illustrating steps of a method for verifying a transaction in a blockchain according to an embodiment of the present disclosure.
Fig. 1b is a second schematic diagram of the steps of a method for verifying a transaction in a blockchain according to the embodiment of the present disclosure.
Fig. 2 is a schematic structural diagram of an apparatus for verifying a transaction in a blockchain according to an embodiment of the present disclosure.
Fig. 3 is a schematic structural diagram of an electronic device provided in an embodiment of the present specification.
Detailed Description
In order to make the technical solutions in the present specification better understood, the technical solutions in one or more embodiments of the present specification will be clearly and completely described below with reference to the accompanying drawings in one or more embodiments of the present specification, and it is obvious that the one or more embodiments described are only a part of the embodiments of the present specification, and not all embodiments. All other embodiments that can be derived by a person skilled in the art from one or more of the embodiments described herein without making any inventive step shall fall within the scope of protection of this document.
The block chain is generally composed of a plurality of blocks, time stamps corresponding to the creation time of the block are recorded in the blocks, and all the blocks form a time-ordered data chain according to the time stamps recorded in the blocks. The real data generated by the physical world can be constructed into a standard transaction (transaction) format supported by a block chain, and is issued to the block chain, the node equipment in the block chain performs consensus processing on the received transaction, and after the consensus is achieved, the node equipment serving as an accounting node in the block chain packs the transaction into a block, and the block chain performs persistent evidence storage.
The KV database is a Key-value database, is a database for storing data by Key value pairs, and is similar to map in java. The entire database can be understood as a large map, with each key corresponding to a unique value. The key-value distributed storage system has the advantages of high query speed, large data storage amount and high support concurrency, is very suitable for query through a main key, and cannot perform complex condition query.
In view of the problems mentioned in the background art, when a block chain node for processing a transaction processes the transaction, multiple signature checks are generally performed at different stages, or multiple signature checks are performed for the same transaction from different sources, which results in repeated signature check operations. In order to avoid repeated signature checking, save processing resources and improve transaction processing capacity, a processing scheme for avoiding repeated signature checking in the process of consensus is provided. In a specific implementation, a cache pool specially used for storing the signature verification result can be defined or divided on the blockchain node. The data in the cache pool are cached in a KV storage mode. When the target transaction is checked, the target transaction is not directly checked, but based on the transaction hash of the target transaction, whether a check result stored corresponding to the transaction hash of the target transaction is cached in a cache pool or not is searched, if the check result is searched, the check result is not needed to be checked again, the follow-up operation is directly carried out by using the check result, and if the check result is not searched, the check operation is carried out on the target transaction, and the check result is cached in the cache pool. Therefore, by means of 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.
Example one
Referring to fig. 1a, a schematic step diagram of a method for signing a transaction in a blockchain is provided for the embodiment of the present specification, and it should be understood that the method is applied to a device for signing a transaction in a blockchain, and specifically, the signing device may be a software module capable of executing the following method and having a corresponding function, or alternatively, the signing device may be a blockchain node capable of executing the following method and having a corresponding function.
The signature verification method can comprise the following steps:
step 102: after receiving a target transaction, searching whether a signature verification result matched with the target transaction is cached in a cache pool or not according to the transaction hash of the target transaction, wherein the signature verification result pairs cached in the cache pool are cached in a key value pair KV storage mode, the keyword of each signature verification result pair is the transaction hash, and the value is the signature verification result.
The cache pool can be a temporary storage space divided by the block chain link points and used for caching a transaction signature verification result in a certain transaction period. It should be understood that a plurality of signature verification result pairs may be stored in the cache pool, and the transaction hash of each signature verification result pair is unique, that is, the signature verification result of each target transaction is guaranteed to be unique in the cache pool. And the signature verification result is not stored independently, but is stored in a KV storage mode and the transaction hash correspondingly to form a signature verification result pair of each target transaction. For example: target transaction 1: transaction Hash 1-signature verification result 1; target transaction 2: transaction hash 2-signature verification result 2.
In the embodiment of the specification, the target transaction is sent through a Remote Procedure Call (RPC) interface, or the target transaction is sent by other block link nodes. It should be understood that the target transaction referred to in this description may be sent through the RPC interface or forwarded by other block link nodes, and thus, the source of the target transaction is not limited.
Optionally, when searching whether the signature verification result matched with the target transaction is cached in the cache pool, specifically, whether a transaction hash of the target transaction is cached in the cache pool or not may be searched, and whether the transaction hash and the signature verification result are cached correspondingly in a KV storage manner or not may be searched. In consideration of the fact that when the signature checking result is searched for the target transaction, whether the transaction hash of the target transaction is cached in the cache pool or not needs to be determined, and whether the searched transaction hash and the corresponding signature checking result are cached in a KV storage mode or not needs to be determined. Only if the two conditions are met simultaneously, the fact that the signature verification result matched with the target transaction exists in the cache pool can be determined.
Step 104: and if the label checking result matched with the target transaction is found, skipping the label checking operation.
If the signature checking result matched with the target transaction is found, the target transaction is checked and checked, and the signature checking is not required to be repeated. And when the found signature checking result is that the signature checking is correct, skipping the signature checking operation, and directly using the signature checking result to perform subsequent operation. And when the found signature checking result is a signature checking error, skipping the signature checking operation and directly rolling back the data of the target transaction.
Step 106: and if the signature checking result matched with the target transaction cannot be found, checking the target transaction, and caching the signature checking result obtained this time and the transaction hash of the target transaction into a cache pool in a KV storage mode.
If the signature checking result matched with the target transaction cannot be found in the cache pool, the target transaction is not subjected to signature checking, and the signature checking of the target transaction needs to be carried out according to the existing signature checking mode. Generally, the public key of the user end initiating the transaction is used for signing off the signature of the target transaction, and a signature verification result is obtained. At the same time, a transaction hash for the target transaction that has been calculated is calculated or used. And then, caching the current signature verification result of the target transaction and the transaction hash into a cache pool in a KV storage mode.
Further, referring to fig. 1b, when the blocks are identified, the method may further include:
step 108: and respectively searching whether a signature checking result matched with the target transaction is cached in a cache pool or not aiming at each target transaction in the block to be identified.
Optionally, when searching whether the signature verification result matched with the target transaction is cached in the cache pool, specifically, whether a transaction hash of the target transaction is cached in the cache pool or not may be searched, and whether the transaction hash and the signature verification result are cached correspondingly in a KV storage manner or not may be searched.
In the consensus phase, each target transaction in the block needs to be checked, and considering that some target transactions in the target transactions may have been previously checked, all target transactions in the block need to be searched to determine whether the check result of the corresponding target transaction is cached in the cache pool. I.e. the block is validated legally.
Step 110: and if the label checking results of all the target transactions in the block to be identified are found and each label checking result is correct, skipping the label checking operation for all the target transactions.
Step 112: and if the signature checking result of part of the target transactions in the block to be identified is found and the found signature checking results are correct, checking the signatures of other target transactions except the part of the target transactions, and caching the signature checking result obtained this time and the transaction hash corresponding to the target transaction into a cache pool in a KV storage mode.
Step 114: and if the signature checking result of part of the target transaction in the block to be identified is found and a signature checking error exists in the found signature checking result, determining that the current block to be identified is illegal, and terminating the identification operation.
It should be understood that, in this embodiment of the present specification, after a target transaction is executed and executed or the target transaction data is rolled back by an error in the check result, the pair of check results of the target transaction cached in the cache pool may also be automatically deleted.
When the node receives the block which is being identified in the process of identifying in common, the legality of the block which is being identified in common needs to be checked, and whether all transactions in the block are legal needs to be verified at the moment, under the condition, whether the signature is verified and the signature is correct is obtained from the cache, and if all transactions are verified and signed correctly, the transactions in the block which is identified in common do not need to be verified and signed again; if only partial transactions can be inquired that the signatures are correct and the rest transactions are not in the cache, only the signatures of the rest transactions need to be verified, and then the verified results are cached; if some transaction signature errors are found in the inquiry, the block is illegal, and the verification is not continued.
In this embodiment of the present specification, when checking a target transaction, rather than directly checking the target transaction, based on the transaction hash of the target transaction, whether a check result stored in the cache pool corresponding to the transaction hash of the target transaction is cached is searched, if the check result is found, the check result is not needed to be checked again, and the follow-up operation is directly performed by using the check result, if the check result is not found, the check operation is performed on the target transaction, and the check result is cached in the cache pool. Therefore, by means of 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.
Example two
Referring to fig. 2, for the apparatus for verifying a transaction in a blockchain provided in the embodiment of the present disclosure, the apparatus 200 may include: a search module 202, an end module 204 and a signature verification module 206; wherein the content of the first and second substances,
the searching module 202 searches whether a signature checking result matched with the target transaction is cached in a cache pool or not according to the transaction hash of the target transaction after receiving the target transaction, wherein the signature checking result cached in the cache pool is cached in a key-value-pair KV storage mode, a keyword of each signature checking result is the transaction hash, and a value is the signature checking result;
an end module 204, which skips the signature verification operation if the signature verification result matched with the target transaction is found;
and the signature checking module 206 checks the target transaction if the signature checking result matched with the target transaction cannot be found, and caches the signature checking result obtained this time and the transaction hash of the target transaction in a cache pool in a KV storage mode.
Optionally, as an embodiment, the signature verification device further includes: and the receiving module is used for receiving the target transaction sent by the Remote Procedure Call (RPC) interface or other block chain nodes.
In one implementation of the embodiments of the present description, when blocks are commonly identified,
the searching module is also used for respectively searching whether a signature checking result matched with the target transaction is cached in the cache pool or not aiming at each target transaction in the block to be identified;
the ending module is used for skipping the signature verification operation of all target transactions if the signature verification results of all target transactions in the block to be identified are found and each signature verification result is correct;
the signature checking module is used for checking only other target transactions except for the partial target transaction if the signature checking result of the partial target transaction in the block to be identified is found and the found signature checking results are correct, and caching the signature checking result obtained this time and the transaction hash corresponding to the target transaction into a cache pool in a KV storage mode;
and the ending module is used for determining that the current block to be identified is illegal and terminating the identification operation if the label checking result of part of the target transaction in the block to be identified is found and the found label checking result has label checking errors.
In another specific implementation manner of the embodiment of this specification, when the tag verification result matching with the target transaction is cached in the cache pool, the lookup module is specifically configured to:
and searching whether the transaction hash of the target transaction is cached in a cache pool or not, and whether the transaction hash and the signature checking result are correspondingly cached in a KV storage mode or not.
In this embodiment of the present specification, when checking a target transaction, rather than directly checking the target transaction, based on the transaction hash of the target transaction, whether a check result stored in the cache pool corresponding to the transaction hash of the target transaction is cached is searched, if the check result is found, the check result is not needed to be checked again, and the follow-up operation is directly performed by using the check result, if the check result is not found, the check operation is performed on the target transaction, and the check result is cached in the cache pool. Therefore, by means of 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.
EXAMPLE III
Fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure. Referring to fig. 3, at a hardware level, the electronic device includes a processor, and optionally further includes an internal bus, a network interface, and a memory. The Memory may include a Memory, such as a Random-Access Memory (RAM), and may further include a non-volatile Memory, such as at least 1 disk Memory. Of course, the electronic device may also include hardware required for other services.
The processor, the network interface, and the memory may be connected to each other via an internal bus, which may be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one double-headed arrow is shown in FIG. 3, but this does not indicate only one bus or one type of bus.
And the memory is used for storing programs. In particular, the program may include program code comprising computer operating instructions. The memory may include both memory and non-volatile storage and provides instructions and data to the processor.
The processor reads the corresponding computer program from the nonvolatile memory into the memory and then runs the computer program to form a device for verifying the transaction in the block chain on a logic level. The processor is used for executing the program stored in the memory and is specifically used for executing the following operations:
after a target transaction is received, whether a signature verification result matched with the target transaction is cached in a cache pool or not is searched according to the transaction hash of the target transaction, wherein the signature verification result cached in the cache pool is cached in a key value-to-KV storage mode, a keyword of each signature verification result is the transaction hash, and the value is the signature verification result;
if the label checking result matched with the target transaction is found, skipping the label checking operation;
and if the signature checking result matched with the target transaction cannot be found, checking the target transaction, and caching the signature checking result obtained this time and the transaction hash of the target transaction into a cache pool in a KV storage mode.
The method performed by the apparatus disclosed in the embodiment of fig. 1a in this specification can be applied to or implemented by a processor. The processor may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in a processor or instructions in the form of software. The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components. The methods, steps, and logic blocks disclosed in one or more embodiments of the present specification may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with one or more embodiments of the present disclosure may be embodied directly in hardware, in a software module executed by a hardware decoding processor, or in a combination of the hardware and software modules executed by a hardware decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in a memory, and a processor reads information in the memory and completes the steps of the method in combination with hardware of the processor.
The electronic device may also execute the method of fig. 1a and implement the functions of the corresponding apparatus in the embodiment shown in fig. 1a, which are not described herein again in this specification.
Of course, besides the software implementation, the electronic device of the embodiment of the present disclosure does not exclude other implementations, such as a logic device or a combination of software and hardware, and the like, that is, the execution subject of the following processing flow is not limited to each logic unit, and may also be hardware or a logic device.
In this embodiment of the present specification, when checking a target transaction, rather than directly checking the target transaction, based on the transaction hash of the target transaction, whether a check result stored in the cache pool corresponding to the transaction hash of the target transaction is cached is searched, if the check result is found, the check result is not needed to be checked again, and the follow-up operation is directly performed by using the check result, if the check result is not found, the check operation is performed on the target transaction, and the check result is cached in the cache pool. Therefore, by means of 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.
Example four
This specification embodiment also proposes a computer-readable storage medium storing one or more programs, the one or more programs comprising instructions, which when executed by a portable electronic device comprising a plurality of application programs, are capable of causing the portable electronic device to perform the method of the embodiment shown in fig. 1a, and in particular for performing the following method:
after a target transaction is received, whether a signature verification result matched with the target transaction is cached in a cache pool or not is searched according to the transaction hash of the target transaction, wherein the signature verification result cached in the cache pool is cached in a key value-to-KV storage mode, a keyword of each signature verification result is the transaction hash, and the value is the signature verification result;
if the label checking result matched with the target transaction is found, skipping the label checking operation;
and if the signature checking result matched with the target transaction cannot be found, checking the target transaction, and caching the signature checking result obtained this time and the transaction hash of the target transaction into a cache pool in a KV storage mode.
In this embodiment of the present specification, when checking a target transaction, rather than directly checking the target transaction, based on the transaction hash of the target transaction, whether a check result stored in the cache pool corresponding to the transaction hash of the target transaction is cached is searched, if the check result is found, the check result is not needed to be checked again, and the follow-up operation is directly performed by using the check result, if the check result is not found, the check operation is performed on the target transaction, and the check result is cached in the cache pool. Therefore, by means of 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.
In short, the above description is only a preferred embodiment of the present disclosure, and is not intended to limit the scope of the present disclosure. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present specification shall be included in the protection scope of the present specification.
The system, apparatus, module or unit illustrated in one or more of the above embodiments may be implemented by a computer chip or an entity, or by an article of manufacture with a certain functionality. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, 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.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, 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 disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.

Claims (10)

1. A method of verifying a signature for a transaction in a blockchain, comprising:
after a target transaction is received, whether a signature verification result matched with the target transaction is cached in a cache pool or not is searched according to the transaction hash of the target transaction, wherein the signature verification result cached in the cache pool is cached in a key value-to-KV storage mode, a keyword of each signature verification result is the transaction hash, and the value is the signature verification result;
if the label checking result matched with the target transaction is found, skipping the label checking operation;
and if the signature checking result matched with the target transaction cannot be found, checking the target transaction, and caching the signature checking result obtained this time and the transaction hash of the target transaction into a cache pool in a KV storage mode.
2. The method of claim 1, wherein the target transaction is sent through a Remote Procedure Call (RPC) interface, or other block chain nodes.
3. A method of signing transactions in a blockchain according to claim 1 or 2, the method further comprising, in the event of a block being agreed:
aiming at each target transaction in the block to be identified, respectively searching whether a signature checking result matched with the target transaction is cached in a cache pool;
if the label checking results of all target transactions in the block to be identified are found and each label checking result is correct, skipping the label checking operation for all target transactions;
if the signature checking result of part of the target transactions in the block to be identified is found and the found signature checking results are correct, checking the signatures of other target transactions except the part of the target transactions, and caching the signature checking result obtained this time and the transaction hash corresponding to the target transactions into a cache pool in a KV storage mode;
and if the signature checking result of part of the target transaction in the block to be identified is found and a signature checking error exists in the found signature checking result, determining that the current block to be identified is illegal, and terminating the identification operation.
4. The method for performing signature verification on transactions in a blockchain according to claim 3, wherein the step of searching whether a signature verification result matched with the target transaction is cached in a cache pool specifically comprises the following steps:
and searching whether the transaction hash of the target transaction is cached in a cache pool or not, and whether the transaction hash and the signature checking result are correspondingly cached in a KV storage mode or not.
5. An apparatus for verifying a signature for a transaction in a blockchain, comprising:
the system comprises a searching module, a storage module and a processing module, wherein the searching module searches whether a signature checking result matched with a target transaction is cached in a cache pool or not according to the transaction hash of the target transaction, the signature checking result cached in the cache pool is cached in a key value-pair KV storage mode, a keyword of each signature checking result is the transaction hash, and the value is the signature checking result;
the ending module skips the signature checking operation if the signature checking result matched with the target transaction is found;
and the signature checking module checks the target transaction if the signature checking result matched with the target transaction cannot be found, and caches the signature checking result obtained this time and the transaction hash of the target transaction in a cache pool in a KV storage mode.
6. The apparatus for validating transactions in a blockchain as claimed in claim 5, further comprising: and the receiving module is used for receiving the target transaction sent by the Remote Procedure Call (RPC) interface or other block chain nodes.
7. The apparatus for conducting signature verification of transactions in blockchain as claimed in claim 5 or 6, wherein, when the blocks are identified,
the searching module is also used for respectively searching whether a signature checking result matched with the target transaction is cached in the cache pool or not aiming at each target transaction in the block to be identified;
the ending module is used for skipping the signature verification operation of all target transactions if the signature verification results of all target transactions in the block to be identified are found and each signature verification result is correct;
the signature checking module is used for checking only other target transactions except for the partial target transaction if the signature checking result of the partial target transaction in the block to be identified is found and the found signature checking results are correct, and caching the signature checking result obtained this time and the transaction hash corresponding to the target transaction into a cache pool in a KV storage mode;
and the ending module is used for determining that the current block to be identified is illegal and terminating the identification operation if the label checking result of part of the target transaction in the block to be identified is found and the found label checking result has label checking errors.
8. The apparatus for performing signature verification on transactions in a blockchain according to claim 7, wherein the lookup module is specifically configured to, when a signature verification result matching the target transaction is cached in the cache pool, perform:
and searching whether the transaction hash of the target transaction is cached in a cache pool or not, and whether the transaction hash and the signature checking result are correspondingly cached in a KV storage mode or not.
9. An electronic device, comprising:
a processor; and
a memory arranged to store computer executable instructions that, when executed, cause the processor to perform:
after a target transaction is received, whether a signature verification result matched with the target transaction is cached in a cache pool or not is searched according to the transaction hash of the target transaction, wherein the signature verification result cached in the cache pool is cached in a key value-to-KV storage mode, a keyword of each signature verification result is the transaction hash, and the value is the signature verification result;
if the label checking result matched with the target transaction is found, skipping the label checking operation;
and if the signature checking result matched with the target transaction cannot be found, checking the target transaction, and caching the signature checking result obtained this time and the transaction hash of the target transaction into a cache pool in a KV storage mode.
10. A computer-readable storage medium storing one or more programs that, when executed by an electronic device including a plurality of application programs, cause the electronic device to perform:
after a target transaction is received, whether a signature verification result matched with the target transaction is cached in a cache pool or not is searched according to the transaction hash of the target transaction, wherein the signature verification result cached in the cache pool is cached in a key value-to-KV storage mode, a keyword of each signature verification result is the transaction hash, and the value is the signature verification result;
if the label checking result matched with the target transaction is found, skipping the label checking operation;
and if the signature checking result matched with the target transaction cannot be found, checking the target transaction, and caching the signature checking result obtained this time and the transaction hash of the target transaction into a cache pool in a KV storage mode.
CN202110914730.2A 2021-08-10 2021-08-10 Method and device for checking and signing transactions in block chain and electronic equipment Pending CN113723963A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110914730.2A CN113723963A (en) 2021-08-10 2021-08-10 Method and device for checking and signing transactions in block chain and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110914730.2A CN113723963A (en) 2021-08-10 2021-08-10 Method and device for checking and signing transactions in block chain and electronic equipment

Publications (1)

Publication Number Publication Date
CN113723963A true CN113723963A (en) 2021-11-30

Family

ID=78675408

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110914730.2A Pending CN113723963A (en) 2021-08-10 2021-08-10 Method and device for checking and signing transactions in block chain and electronic equipment

Country Status (1)

Country Link
CN (1) CN113723963A (en)

Similar Documents

Publication Publication Date Title
US11626972B2 (en) Data processing method and apparatus
CN107395659B (en) Method and device for service acceptance and consensus
CN108846749B (en) Partitioned transaction execution system and method based on block chain technology
CN111415158B (en) Wind control method and system based on block chain
CN113205416A (en) Service processing method and system based on block chain prediction machine
CN109271611B (en) Data verification method and device and electronic equipment
CN111698244B (en) Method and device for rapidly participating in consensus of newly added nodes and electronic equipment
CN111260469A (en) Block chain-based evidence storing method, block chain-based evidence storing query method, corresponding device and electronic equipment
CN112235278A (en) Method and device for monitoring address information of trader and electronic equipment
CN110648136A (en) Consensus and transaction synchronous parallel processing method and device and electronic equipment
CN108616361B (en) Method and device for identifying uniqueness of equipment
CN113392404A (en) Vulnerability detection method and device and electronic equipment
CN111651467A (en) Block chain link point interface issuing and calling method and device
CN110460686B (en) Block chain address registration method and device
CN109345081B (en) Data acquisition method and device and electronic equipment
CN110851207A (en) State transition management method and device, electronic equipment and computer readable storage medium
CN113486109A (en) Data synchronization method and device of heterogeneous database and electronic equipment
CN106502707B (en) Code generation method and device
CN111488371A (en) Data query method and device
CN108710658B (en) Data record storage method and device
CN111461886A (en) Management method and device for system configuration independent of intelligent contracts on block chains
CN113723963A (en) Method and device for checking and signing transactions in block chain and electronic equipment
CN110018844B (en) Management method and device of decision triggering scheme and electronic equipment
CN110599139B (en) Block output method and device in block chain consensus algorithm
CN111383124A (en) User material verification method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination