Blockchain Transaction Processing Method, Device, Electronic Device and Storage Medium

By assigning the first signature verification parameter to the preset bits of the second signature value in blockchain transaction processing, the problem of increasing the digital signature length in the blockchain system is solved, and the effect of reducing transaction costs and system overhead is achieved.

CN115225287BActive Publication Date: 2025-06-13NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210864807.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-21
Publication Date
2025-06-13
Estimated Expiration
2042-07-21

AI Technical Summary

Technical Problem

In blockchain systems, when 256-bit alignment is used, the length of the digital signature increases, resulting in increased gas fees for transactions and waste of system overhead.

Method used

By assigning the first signature verification parameter to the preset bits in the second signature value, the target signature message contains only the compressed second signature value and the first signature value, avoiding injection of zero bytes in the case of 256-bit alignment.

Benefits of technology

Shorten the length of digital signatures, reducing transaction fees and system overhead.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115225287B_ABST
    Figure CN115225287B_ABST
Patent Text Reader

Abstract

The present invention provides a blockchain transaction processing method, apparatus, electronic device and storage medium, relating to the field of information security technology. The method includes: signing first transaction data to be signed to generate an initial signature message, where the initial signature message includes: a first signature value, a second signature value and a first signature verification parameter; assigning preset bit positions in the second signature value according to the first signature verification parameter to obtain a compressed second signature value; and sending a transaction request to a blockchain node, where the transaction request includes the first transaction data, a target signature message of the first transaction data and a verification public key of a blockchain wallet, and the target signature message includes: the compressed second signature value and the first signature value. The present invention can shorten the length of digital signatures, reduce transaction fees and system overhead.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of information security technology, and in particular, to a blockchain transaction processing method, apparatus, electronic device, and storage medium. Background Art

[0002] A blockchain is a distributed database participated by multiple distributed nodes, which has the characteristics of being immutable and non-forgeable. In a blockchain, a private key can be used to sign transaction data, and the public key can be extracted and the legality of the signature can be verified during the execution of the signed transaction data at a node.

[0003] Currently, the commonly used digital signature algorithm is mainly the Elliptic Curve Digital Signature Algorithm (ECDSA) based on secp256k1. The digital signature generated by the ECDSA-secp256k1 algorithm includes a left part signature value r, a right part signature value s, and a signature verification parameter yParity. Among them, the left part signature value r and the right part signature value s each occupy 32 bytes, and the signature verification parameter yParity occupies 1 byte. That is, the digital signature needs 65 bytes to represent.

[0004] However, in the blockchain system, the 256-bit alignment method is adopted, so that although the signature verification parameter yParity occupies 1 byte (8 bits), 31 zero bytes need to be injected, making the length of the digital signature 96 bytes, increasing the gas fee of the transaction and wasting the overhead of the blockchain system. Summary of the Invention

[0005] The purpose of the present invention is to provide a blockchain transaction processing method, apparatus, electronic device, and storage medium for shortening the length of the digital signature, reducing the transaction cost and system overhead in view of the above-mentioned deficiencies in the prior art.

[0006] To achieve the above object, the technical solutions adopted in the embodiments of the present invention are as follows:

[0007] In a first aspect, an embodiment of the present invention provides a blockchain transaction processing method applied to a blockchain wallet. The method includes:

[0008] Sign the first transaction data to be signed to generate an initial signature message, where the initial signature message includes: a first signature value, a second signature value, and a first signature verification parameter;

[0009] Assign values to preset bit positions in the second signature value according to the first signature verification parameter to obtain a compressed second signature value;

[0010] Send a transaction request to the blockchain node, where the transaction request includes: the first transaction data, the target signature message of the first transaction data, and the verification public key of the blockchain wallet, and the target signature message includes: the first signature value and the compressed second signature value.

[0011] Optionally, the step of assigning a preset bit position in the second signature value according to the first signature verification parameter to obtain the compressed second signature value includes:

[0012] If the second signature value is within the preset signature threshold range, assign the preset bit position in the second signature value according to the first signature verification parameter to obtain the compressed second signature value.

[0013] Optionally, the step of assigning a preset bit position in the second signature value according to the first signature verification parameter to obtain the compressed second signature value further includes:

[0014] If the second signature value is not within the preset signature threshold range, convert the second signature value to obtain a converted second signature value, and convert the first signature verification parameter to obtain a converted first signature verification parameter;

[0015] Assign the preset bit position in the converted second signature value according to the converted first signature verification parameter to obtain the compressed second signature value.

[0016] Optionally, the step of converting the second signature value to obtain a converted second signature value includes:

[0017] Determine the converted second signature value according to the preset signature order and the difference of the second signature value, where the signature order is the signature order used when signing the first transaction data.

[0018] Optionally, the step of converting the first signature verification parameter to obtain a converted first signature verification parameter includes:

[0019] Perform a binary negation on the first signature verification parameter to obtain the converted first signature verification parameter.

[0020] Optionally, before the step of assigning a preset bit position in the second signature value according to the first signature verification parameter to obtain the compressed second signature value, the method further includes:

[0021] Determine the preset signature threshold range according to the preset signature order, where the maximum value of the preset signature threshold range is less than the signature order.

[0022] Optionally, the preset bit position is: the highest bit position.

[0023] In a second aspect, an embodiment of the present invention further provides a blockchain transaction processing method, which is applied to a blockchain node. The method includes:

[0024] Receiving a transaction request sent by a blockchain wallet, where the transaction request includes: second transaction data to be verified, a signature message of the second transaction data, and a verification public key of the blockchain wallet;

[0025] Determining whether the length of the signature message is a first preset length or a second preset length, where the first preset length is less than the second preset length;

[0026] If the length of the signature message is the first preset length, determining that the signature message includes: a third signature value and a compressed fourth signature value;

[0027] Decompressing the compressed fourth signature value to obtain an uncompressed fourth signature value and a second signature verification parameter;

[0028] Calculating a first verification signature value according to the verification public key, the third signature value, the uncompressed fourth signature value, and the second signature verification parameter;

[0029] If the first verification signature value is equal to the third signature value, determining that the signature message passes the verification;

[0030] Performing a transaction operation using the second transaction data.

[0031] Optionally, the method further includes:

[0032] If the length of the signature message is the second preset length, determining that the signature message includes: a third signature value, an uncompressed fourth signature value, and a second signature verification parameter;

[0033] If the uncompressed fourth signature value is within a preset signature threshold range, calculating a second verification signature value according to the verification public key, the third signature value, the uncompressed fourth signature value, and the second signature verification parameter;

[0034] If the second verification signature value is equal to the third signature value, determining that the signature message passes the verification;

[0035] Performing a transaction operation using the second transaction data.

[0036] Optionally, the method further includes:

[0037] If the uncompressed fourth signature value is not within the preset signature threshold range, determining that the signature message fails the verification.

[0038] In a third aspect, an embodiment of the present invention further provides a blockchain transaction processing device, which is applied to a blockchain wallet. The device includes:

[0039] A signature generation module, configured to sign the first transaction data to be signed to generate an initial signature message, where the initial signature message includes: a first signature value, a second signature value, and a first signature verification parameter;

[0040] An assignment module, configured to assign values to preset bit positions in the second signature value according to the first signature verification parameter to obtain a compressed second signature value;

[0041] A request sending module, configured to send a transaction request to a blockchain node, where the transaction request includes: the first transaction data, a target signature message of the first transaction data, and a verification public key of the blockchain wallet, and the target signature message includes: the first signature value and the compressed second signature value.

[0042] Optionally, the assignment module is specifically configured to, if the second signature value is within a preset signature threshold range, assign values to the preset bit positions in the second signature value according to the first signature verification parameter to obtain a compressed second signature value.

[0043] Optionally, the assignment module specifically includes:

[0044] A conversion unit, configured to, if the second signature value is not within the preset signature threshold range, convert the second signature value to obtain a converted second signature value, and convert the first signature verification parameter to obtain a converted first signature verification parameter;

[0045] An assignment unit, configured to assign values to the preset bit positions in the converted second signature value according to the converted first signature verification parameter to obtain the compressed second signature value.

[0046] Optionally, the conversion unit is specifically configured to determine the converted second signature value according to a preset signature order and a difference between the second signature values, where the signature order is the signature order used when signing the first transaction data.

[0047] Optionally, the conversion unit is further configured to perform a binary negation on the first signature verification parameter to obtain the converted first signature verification parameter.

[0048] Optionally, the device includes:

[0049] A threshold range determination module, configured to determine the preset signature threshold range according to a preset signature order, where the maximum value of the preset signature threshold range is less than the signature order.

[0050] Optionally, the preset bit position is: the highest bit position.

[0051] Fourthly, an embodiment of the present invention further provides a blockchain transaction processing device, which is applied to a blockchain node. The device includes:

[0052] A request receiving module, configured to receive a transaction request sent by a blockchain wallet. The transaction request includes: second transaction data to be verified, a signature message of the second transaction data, and a verification public key of the blockchain wallet;

[0053] A length judgment module, configured to judge whether the length of the signature message is a first preset length or a second preset length, where the first preset length is less than the second preset length;

[0054] A signature confirmation module, configured to, if the length of the signature message is the first preset length, determine that the signature message includes: a third signature value and a compressed fourth signature value;

[0055] A decompression module, configured to decompress the compressed fourth signature value to obtain a pre-compression fourth signature value and a second signature verification parameter;

[0056] A calculation module, configured to calculate a first verification signature value according to the verification public key, the third signature value, the pre-compression fourth signature value, and the second signature verification parameter;

[0057] A verification module, configured to, if the first verification signature value is equal to the third signature value, determine that the signature message passes the verification;

[0058] A transaction module, configured to perform a transaction operation using the second transaction data.

[0059] Optionally, the signature confirmation module is further configured to, if the length of the signature message is the second preset length, determine that the signature message includes: a third signature value, an uncompressed fourth signature value, and a second signature verification parameter;

[0060] The calculation module is further configured to, if the uncompressed fourth signature value is within a preset signature threshold range, calculate a second verification signature value according to the verification public key, the third signature value, the pre-compression fourth signature value, and the second signature verification parameter;

[0061] The verification module is further configured to, if the second verification signature value is equal to the third signature value, determine that the signature message passes the verification;

[0062] The transaction module is further configured to perform a transaction operation using the second transaction data.

[0063] Optionally, the verification module is further configured to determine that the signature message verification fails if the uncompressed fourth signature value is not within the preset signature threshold range.

[0064] In a fifth aspect, an embodiment of the present invention further provides an electronic device, including: a processor, a storage medium, and a bus. The storage medium stores program instructions executable by the processor. When the electronic device runs, the processor communicates with the storage medium through the bus. The processor executes the program instructions to perform the steps of the blockchain transaction processing method according to any one of the first aspect or the second aspect as described above.

[0065] In a sixth aspect, a computer-readable storage medium stores a computer program. When the computer program is run by a processor, it performs the steps of the blockchain transaction processing method according to any one of the first aspect or the second aspect as described above.

[0066] The beneficial effects of the present invention are:

[0067] The present invention provides a blockchain transaction processing method, apparatus, electronic device, and storage medium. The method includes: signing first transaction data to be signed to generate an initial signature message, where the initial signature message includes: a first signature value, a second signature value, and a first signature verification parameter; according to the first signature verification parameter, assigning values to preset bits in the second signature value to obtain a compressed second signature value; sending a transaction request to a blockchain node, where the transaction request includes the first transaction data, the target signature message of the first transaction data, and the verification public key of the blockchain wallet, and the target signature message includes: the compressed second signature value and the first signature value. By assigning the first signature verification parameter to the preset bits in the second signature value, the target signature message only includes the compressed second signature value and the first signature value, and the first signature verification parameter does not occupy extra bytes, and thus no zero bytes are injected in the case of 256-bit alignment, shortening the length of the digital signature, reducing transaction fees and system overhead. Description of the Drawings

[0068] To more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the drawings required in the embodiments. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as limiting the scope. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative efforts.

[0069] Figure 1 It is a schematic diagram of the blockchain transaction processing system provided by the embodiment of the present application;

[0070] Figure 2Schematic flowchart of the first embodiment of the blockchain transaction processing method provided by the present invention;

[0071] Figure 3 Schematic flowchart of the second embodiment of the blockchain transaction processing method provided by the present invention;

[0072] Figure 4 Schematic flowchart of the third embodiment of the blockchain transaction processing method provided by the present invention;

[0073] Figure 5 Schematic flowchart of the fourth embodiment of the blockchain transaction processing method provided by the present invention;

[0074] Figure 6 Schematic structural diagram of the first embodiment of the blockchain transaction processing device provided by the present invention;

[0075] Figure 7 Schematic structural diagram of the second embodiment of the blockchain transaction processing device provided by the present invention;

[0076] Figure 8 Schematic diagram of the electronic device provided by the embodiments of the present invention. Detailed implementation manners

[0077] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Apparently, the described embodiments are some, but not all, of the embodiments of the present invention.

[0078] Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed present invention, but merely represents selected embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0079] In addition, the terms "first", "second", etc. in the specification and claims of the present invention and the above accompanying drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that such data may be interchanged under appropriate circumstances so that the embodiments of the present invention described herein can be implemented in an order different from those illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these process, method, product, or device.

[0080] It should be noted that, without conflict, the features in the embodiments of the present invention can be combined with each other.

[0081] A blockchain is a distributed database participated by multiple distributed nodes, consisting of a series of blocks. Each block can store transaction data of transactions between two or more participants. The transaction data cannot be tampered with or forged. Among them, transactions between blockchains include, but are not limited to, exchanges of valuable items such as services, currencies, and assets.

[0082] For the convenience of understanding the solution of the present invention, an application system of the present invention is provided for reference only. Please refer to Figure 1 , which is a schematic diagram of the blockchain transaction processing system provided by the embodiment of the present application. As Figure 1 shown, the blockchain transaction processing system includes: a blockchain network composed of multiple blockchain nodes 100 and a blockchain wallet 200.

[0083] The blockchain node 100 is a computer device in the blockchain network, such as a mobile device, a mining machine, and a server, etc. The blockchain wallet 200, as a transaction initiator, can exist in the form of a plugin in a browser or in the form of an application program in a mobile device. When the blockchain wallet 200 initiates a transaction, it selects the address of one or more blockchain nodes to send the transaction data and transaction signature to the specified blockchain node. After receiving the transaction data, the specified blockchain node puts the transaction data into the transaction pool and synchronizes the transaction data to other blockchain nodes in the blockchain network.

[0084] Specifically, there can be direct or indirect information connections between multiple blockchain nodes 100 in the blockchain network, and information transmission can be carried out between multiple blockchain nodes 100 based on the information connections. When any one or more blockchain nodes 100 in the blockchain network receive the transaction data sent by the blockchain wallet 200, the blockchain nodes that receive the transaction data synchronize the transaction data to other blockchain nodes in the blockchain network based on the synchronization algorithm, so that the transaction data stored on all blockchain nodes 100 in the blockchain network is consistent.

[0085] The blockchain wallet 200, also known as a digital asset wallet, can provide functions such as balance query, asset management, and sending transactions for users. When a user initiates a transaction through the blockchain wallet 200, the user can select the address of one or more blockchain nodes in the blockchain network from the blockchain wallet 200 to send the transaction data and transaction signature to the specified blockchain node.

[0086] In an alternative embodiment, the blockchain wallet 200, as an independent transaction program, can run on a computer device, and the user can directly send transactions to the blockchain node through the blockchain wallet 200.

[0087] In another alternative embodiment, as Figure 1 shown, the blockchain transaction processing system further includes: a blockchain client 300. As a decentralized application (DAPP), the blockchain client 300 and the blockchain wallet 200 run on the same computer device. When a user initiates a transaction through the blockchain client 300, the blockchain client 300 assembles the transaction, then activates the blockchain wallet 200 to sign the transaction. After the signing is completed, it can be selected to send the transaction data and the transaction signature to the blockchain node by either the blockchain wallet 200 or the blockchain client 300. Among them, when the blockchain wallet 200 sends the transaction data and the transaction signature, the address of the blockchain node for the transaction is selected through the blockchain wallet 200; when the blockchain client 300 sends the transaction data and the transaction signature, the address of the blockchain node for the transaction is selected through the blockchain client 300.

[0088] In some blockchain networks, if it is necessary to maintain the privacy of transactions between the blockchain client 300 and the blockchain node 100, the transaction data can be encrypted through the blockchain wallet 200. Before the blockchain wallet 200 submits the transaction data to other blockchain nodes 100, an asymmetric encryption algorithm needs to be used to create a key pair. The key pair includes a private key and a public key. The private key is only known to the blockchain wallet 200, while the public key is known to all blockchain nodes in the blockchain network.

[0089] The private key is used for the blockchain wallet to sign the transaction data, and the generated digital signature and the transaction data are sent together to the blockchain node of the transaction recipient. The blockchain node of the transaction recipient decrypts the digital signature using the public key. If the decryption result is consistent with the transaction data, it means that the transaction data is complete and has not been tampered with. The digital signature is a process of encrypting the transaction data, and the data signature verification is a process of decryption.

[0090] Currently, the commonly used digital signature algorithm is mainly the elliptic curve digital signature algorithm (ECDSA) based on secp256k1. The digital signature generated by the ECDSA-secp256k1 algorithm includes the left part signature value r, the right part signature value s, and the signature verification parameter yParity. Among them, the left part signature value r and the right part signature value s each occupy 32 bytes, and the signature verification parameter yParity occupies 1 byte. That is, the digital signature needs 65 bytes to represent.

[0091] However, the 256-bit alignment method is used in the blockchain system, so the signature verification parameter yParity occupies 1 byte (8 bits). Therefore, 31 zero bytes need to be injected, making the length of the digital signature 96 bytes, which increases the gas fee of the transaction and wastes the overhead of the blockchain system.

[0092] Based on the above-mentioned blockchain transaction processing system, the blockchain transaction processing method, device, electronic device and storage medium provided by the present invention are described in detail below.

[0093] First, the present invention provides a blockchain transaction processing method applied to a blockchain wallet in the above-mentioned blockchain transaction processing system. Figure 2 , which is a flow chart of the first embodiment of the blockchain transaction processing method provided by the present invention, such as Figure 2 As shown, the method includes:

[0094] S11: Sign the first transaction data to be signed to generate an initial signature message, where the initial signature message includes: a first signature value, a second signature value, and a first signature verification parameter.

[0095] In this embodiment, the first transaction data is transaction data to be sent to the blockchain node by the blockchain wallet or the blockchain client. The process of signing the first transaction data to be signed is actually a process in which the blockchain wallet uses a private key in a pre-created key pair to encrypt the first transaction data based on a preset digital signature algorithm to generate an initial signature message. The initial signature message includes: a first signature value, a second signature value, and a first signature verification parameter, wherein the second signature value and the first signature value are a set of signature values ​​for the first transaction data, and the first signature verification parameter is a parity check parameter, which is used in the process of verifying the digital signature.

[0096] In a possible implementation, the pre-created key pair is also implemented by the above-mentioned preset digital signature algorithm.

[0097] This embodiment takes the ECDSA-secp256k1 algorithm as an example to describe in detail the process of creating a key pair and signing the first transaction data.

[0098] Assume that E is built on a finite field F q An elliptic curve on the 2 =x 3 +ax+b, where a and b represent the finite field F q Define F q The predefined parameters of the elliptic curve E above are used to create a key pair using the following formula using the base point on the elliptic curve E.

[0099] QA = d A × G

[0100] Wherein, Q A represents the public key, d A represents the private key corresponding to the public key Q A The base point G on the elliptic curve E has a prime order, and the order of the base point G, 0(G) = n, n > 2 160 , and

[0101] Calculate the selected curve point R on the elliptic curve E using a random number. For example, the calculation formula of R can be:

[0102] R = (x R , y R ) = k × G

[0103] Wherein, x R , y R respectively represent the x-axis value and y-axis value of the selected curve point R. The first signature verification parameter yParity is used as a parity check parameter to represent the parity of the y-axis value y R of the selected curve point R. k represents a random number in [1, n - 1] and can be generated by a random number generator.

[0104] Calculate the first signature value r = x R mod n. If r is 0, it indicates a relatively high risk of signature private key leakage and a random number k needs to be reselected; if r is not 0, it means that no information about the signature private key will be leaked.

[0105] Perform a hash operation on the first transaction data m to obtain the first hash value e = H(m), where H is a secure hash function. Perform an operation on the first hash value e, the random number k, the signature private key d A and the first signature value r to obtain the second signature value s. For example, the calculation formula of the second signature value s can be:

[0106] s = k -1 [e + d A r] mod n

[0107] If s is 0, it indicates a relatively high risk of signature private key leakage and a random number k needs to be reselected; if s is not 0, it means that no information about the signature private key will be leaked, and the signature value of the first transaction data m is (r, s).

[0108] S12: According to the first signature verification parameter, assign values to the preset bit positions in the second signature value to obtain the compressed second signature value.

[0109] In this embodiment, since the first signature verification parameter is a parity check parameter and occupies one byte, the value of the first signature verification parameter is either used to indicate an odd number or an even number. The preset bit positions in the second signature value are bit positions with unchanging values. The preset bit positions in the second signature value can be hijacked, and the first signature verification parameter can be assigned to the preset bit positions of the second signature value, so as to store the first signature verification parameter through the preset bit positions of the second signature value. In this way, it is not necessary to pad with zero bytes to align to 256 bits because the first signature verification parameter occupies one byte.

[0110] In a specific implementation manner, the preset bit position is the highest bit position.

[0111] Specifically, the highest bit position of the second signature value s has a fixed value. The highest bit position in the second signature value can be hijacked, and the first signature verification parameter can be assigned to the highest bit position of the second signature value, so as to store the first signature verification parameter through the highest bit position of the second signature value.

[0112] S13: Send a transaction request to the blockchain node. The transaction request includes: first transaction data, the target signature message of the first transaction data, and the verification public key of the blockchain wallet. The target signature message includes: the first signature value and the compressed second signature value.

[0113] In this embodiment, the target signature message is composed of the first signature value and the compressed second signature value. After the blockchain wallet completes the compression of the signature message by using S11 and S12 above, the target signature message, the first transaction data, and the verification public key of the blockchain wallet are sent to the blockchain node.

[0114] In an example, after generating the verification public key, the blockchain wallet directly sends the verification public key to all nodes in the blockchain network. When the blockchain wallet needs to send transaction data to the blockchain node later, it does not repeat sending the verification public key, but only sends the transaction data and the target signature message of the transaction data.

[0115] It should be noted that when the blockchain client and the blockchain wallet are used together, the blockchain client assembles the transaction and then invokes the blockchain wallet to execute the process of signing the transaction data in S11 - S12 above. However, the step of sending a request to the blockchain node in S13 can be executed by the blockchain wallet or the blockchain client.

[0116] The blockchain transaction processing method provided in the above embodiment makes the target signature message contain only the compressed second signature value and the first signature value by assigning the first signature verification parameter to the preset bit positions in the second signature value. The first signature verification parameter does not occupy extra bytes, and thus does not inject zero bytes in the case of 256-bit alignment, shortening the length of the digital signature and reducing transaction fees and system overhead.

[0117] Based on the above embodiment, the size of the second signature value in the initial signature message generated by using the preset digital signature algorithm is within a preset range. However, within this preset range, the binary value of the preset bit positions of the second signature value is not fixed, and its binary value can be either 0 or 1. To ensure that the binary value of the preset bit positions of the second signature value is a fixed value, the second signature value needs to be limited within a preset signature threshold range.

[0118] Based on this, in a possible implementation manner, the process of assigning values to the preset bit positions in the second signature value according to the first signature verification parameter in S12 above to obtain the compressed second signature value may include:

[0119] If the second signature value is within the preset signature threshold range, then assign values to the preset bit positions in the second signature value according to the first signature verification parameter to obtain the compressed second signature value.

[0120] In this embodiment, as can be seen from the foregoing, the maximum value of the preset signature threshold range is the critical value when the value of the preset bit positions of the second signature value changes from 0 to 1. When the second signature value is within the preset signature threshold range, the preset bit positions of the second signature value are fixed values, and the preset bit positions of the second signature value can be directly hijacked, and the first signature verification parameter is assigned to the preset bit positions of the second signature value to store the first signature verification parameter through the preset bit positions of the second signature value.

[0121] Furthermore, if the second signature value is within the preset signature threshold range, then assign values to the highest bit positions in the second signature value according to the first signature verification parameter to obtain the compressed second signature value.

[0122] In another possible implementation manner, please refer to Figure 3 , which is a schematic flowchart of the second embodiment of the blockchain transaction processing method provided by the present invention. As Figure 3 shown, the process of assigning values to the preset bit positions in the second signature value according to the first signature verification parameter in S12 above to obtain the compressed second signature value may include:

[0123] S121: If the second signature value is not within the preset signature threshold range, convert the second signature value to obtain a converted second signature value, and convert the first signature verification parameter to obtain a converted first signature verification parameter.

[0124] In this embodiment, when the second signature value exceeds the preset signature threshold range, the fixed value of the preset bit of the second signature value is different from the fixed value of the preset bit when the second signature value is within the preset signature threshold range. To make the value of the preset bit the same when the second signature value is within and not within the preset signature threshold range, the second signature value not within the preset signature threshold range can be converted so that the converted second signature value is within the preset signature threshold range.

[0125] To ensure the correct result when the blockchain node verifies the target digital signature, after converting the second signature value, the first signature verification parameter also needs to be converted to ensure the consistency between the second signature value and the first signature verification parameter. The first signature verification parameter is a parity check parameter, and the conversion of the first signature verification parameter is to convert an odd parity check parameter to an even parity check parameter, or convert an even parity check parameter to an odd parity check parameter.

[0126] In an alternative embodiment, the process of converting the second signature value in S121 above to obtain a converted second signature value may include:

[0127] Determine the converted second signature value according to the difference between the preset signature order and the second signature value. The signature order is the signature order used when signing the transaction data to be signed.

[0128] Specifically, the signature order is the order of the preset base point selected on the curve corresponding to the preset digital signature algorithm. The second signature value is less than the signature order. When the second signature value is not within the preset signature threshold range, the second signature value can be converted by subtracting the second signature value from the signature order so that the obtained difference is within the preset signature threshold range, and this difference is the converted second signature value.

[0129] In an alternative embodiment, the process of converting the first signature verification parameter in S121 above to obtain a converted first signature verification parameter may include:

[0130] Perform a binary inversion on the first signature verification parameter to obtain a converted first signature verification parameter.

[0131] Specifically, the first signature verification parameter is a parity check parameter. Representing the first signature verification parameter as an odd parity check parameter with binary 0 and as an even parity check parameter with binary 1, the conversion of the first signature verification parameter is to perform a binary bitwise inversion on the binary value of the first signature verification parameter, converting binary 0 to binary 1, or converting binary 1 to binary 0, to obtain the converted first signature verification parameter.

[0132] S122: According to the converted first signature verification parameter, assign values to the preset bit positions in the converted second signature value to obtain the compressed second signature value.

[0133] In this embodiment, the fixed value of the preset bit position of the converted first signature verification parameter is the same as the fixed value of the preset bit position when the second signature value is within the preset signature threshold range. By hijacking the preset bit position in the converted second signature value, assign the converted first signature verification parameter to the preset bit position of the converted second signature value, so as to store the converted first signature verification parameter through the preset bit position of the converted second signature value to obtain the compressed second signature value.

[0134] Furthermore, according to the converted first signature verification parameter, assign a value to the highest bit position in the converted second signature value to obtain the compressed second signature value.

[0135] Based on any of the above embodiments, before assigning values to the preset bit positions in the second signature value according to the first signature verification parameter to obtain the compressed second signature value, the method further includes:

[0136] Determine the preset signature threshold range according to the preset signature order, where the maximum value of the preset signature threshold range is less than the signature order.

[0137] In this embodiment, if the second signature value is less than the preset signature order, then the maximum value of the preset signature threshold range should be less than the signature order, and the maximum value of the preset signature threshold range is the critical value at which the value of the preset bit position of the second signature value changes among the values less than the signature order. For example, the maximum value of the preset signature threshold range can be half of the signature order.

[0138] For example, taking the Elliptic Curve Digital Signature Algorithm ECDSA-secp256k1 as an example, the above conversion process is explained in detail, but it should be noted that the solution of the present invention is not limited to the Elliptic Curve Digital Signature Algorithm ECDSA-secp256k1.

[0139] Specifically, randomly select a base point G on the elliptic curve E, and n is the order of the base point G on the elliptic curve E. As known from the foregoing, n > 2 160 , and

[0140] The maximum value of the preset signature threshold range is half of the signature end, so the preset signature threshold range can be The conversion rule provided based on the embodiments of the present invention can be:

[0141] If the value range of the second signature value s is: Then the second signature value s and the first signature verification parameter yParity remain unchanged; if the value range of the second signature value s is: Then the second signature value s = secp256k1n - s, and the first signature verification parameter yParity is inverted, that is, 0 => 1 or 1 => 0.

[0142] After the above conversion rule, it is determined that the value range of the second signature value s is: Within this range, the highest bit of the second signature value s is always 0. Since the value of the first signature verification parameter yParity is 0 or 1 and only one bit is required to represent it, therefore, by hijacking the highest bit of the second signature value s, the first signature verification parameter yParity can be assigned to the highest bit of the second signature value s, so as to store the first signature verification parameter yParity through the highest bit of the second signature value s, and obtain the compressed second signature value yParityAndS. The compressed signature value is represented as [256bit r value][1bit yParity value][255bit s value].

[0143] Among them, the specific method of hijacking the highest bit of the second signature value s and assigning the first signature verification parameter yParity to the highest bit of the second signature value s can be: shifting the first signature verification parameter yParity 255 bits to the left and performing an OR operation with the second signature value s ((yParity << 255 | S)), then the compressed second signature value yParityAndS can be obtained. Here, << means shifting the parameter on the left by the specified number of bits on the right, discarding the high bits and filling the low bits with zeros, and | means performing an OR operation on the two parameters participating in the operation.

[0144] The blockchain transaction processing method provided by the above embodiments determines whether the second signature value is within the preset signature threshold range, and when the second signature value is not within the preset signature threshold range, the second signature value is converted so that the converted second signature value is within the preset signature threshold range, ensuring that the preset bit of the second signature value is always a fixed value, so that assigning the first signature verification parameter to the preset bit of the second signature value will not affect the second signature value either. Thus, the first signature verification parameter and the second signature value are compressed, shortening the length of the digital signature and reducing the transaction cost and system overhead.

[0145] Based on the above embodiments, the present invention further provides a blockchain transaction processing method applied to a blockchain node in the above blockchain transaction processing system. Please refer to Figure 4 , which is a schematic flowchart of the third embodiment of the blockchain transaction processing method provided by the present invention. As Figure 4 shown, the method includes:

[0146] S21: Receive a transaction request sent by a blockchain wallet. The transaction request includes: second transaction data to be verified, a signature message of the second transaction data, and a verification public key of the blockchain wallet.

[0147] In this embodiment, the blockchain node receives a transaction request sent by the blockchain wallet. The transaction request may include: second transaction data sent by the blockchain wallet, a signature message generated by the blockchain wallet for the second transaction data using the foregoing method, and a verification public key.

[0148] In an alternative embodiment, the verification public key is not necessarily sent to the blockchain node together with the second transaction data and the signature message. It may also be sent to the blockchain node separately by the blockchain wallet after generating the verification public key. After that, when the blockchain wallet needs to send a transaction request to the blockchain node, it only needs to send the second transaction data and the signature message.

[0149] S22: Determine whether the length of the signature message is a first preset length or a second preset length, where the first preset length is less than the second preset length.

[0150] In this embodiment, since different blockchain wallets may use different digital signature methods, some blockchain wallets may use existing digital signature methods to generate signature messages of the second preset length, and some blockchain wallets may use the methods of S11 - S13 above to generate signature messages of the first preset length. Different lengths of signature messages are used to indicate that the blockchain node uses different decompression methods for decompression. Therefore, after receiving the transaction request, the blockchain node needs to determine the length of the signature message included in the transaction request to determine whether the length of the signature message is the first preset length or the second preset length.

[0151] Exemplarily, generating a signature message of the first preset length using the methods of S11 - S13 above can be expressed as: [256bit r value][1bit yParity value][255bit s value], and generating a signature message of the second preset length using existing methods can be expressed as: [256bit r value][256bit s value][1bit yParityvalue + 255bit 0 value].

[0152] S23: If the length of the signed message is the first preset length, it is determined that the signed message includes: a third signature value and a compressed fourth signature value.

[0153] In this embodiment, if the blockchain node determines that the length of the signed message is the first preset length, it can be determined that the blockchain wallet generates the signed message by using the above S11 - S13 method. The signed message includes: a third signature value and a compressed fourth signature value. The compressed fourth signature value is the fourth signature value obtained by using the above S11 - S13 method.

[0154] S24: Decompress the compressed fourth signature value to obtain the pre - compressed fourth signature value and a second signature verification parameter.

[0155] In this embodiment, since S11 - S13 above assigns the signature verification parameter to the preset bit of the right - hand part signature value, when decompressing the compressed fourth signature value, it is necessary to extract the second signature verification parameter from the preset bit of the compressed fourth signature value and restore the preset bit of the fourth signature value to its original fixed value to obtain the pre - compressed fourth signature value and the second signature verification parameter.

[0156] Exemplarily, corresponding to the aforementioned obtained compressed second signature value yParityAndS, the specific implementation manner of decompressing the compressed fourth signature value yParityAndS to obtain the pre - compressed fourth signature value s and the second signature verification parameter yParity can be:

[0157] Shift 1 to the left by 255 bits and then subtract 1 to obtain a parameter with the first bit being 0 and the remaining 255 bits being 1. Perform an AND operation on this parameter and the compressed fourth signature value yParityAndS (yParityAndS & ((1 << 255) - 1)) to obtain the pre - compressed fourth signature value s; shift the compressed fourth signature value yParityAndS to the right by 255 bits (yParity >> 255) to obtain the second signature verification parameter yParity. Here, >> means shifting the left - hand parameter to the right by the specified number of bits on the right, filling the high - order bits with zeros and discarding the low - order bits, and & means performing an AND operation on the two parameters participating in the operation.

[0158] S25: Calculate a first verification signature value according to the verification public key, the third signature value, the pre - compressed fourth signature value, and the second signature verification parameter.

[0159] In this embodiment, verifying the signed message is on the one hand to ensure that the blockchain wallet sending the transaction request is the client to which the verification public key belongs, and on the other hand to ensure the integrity of the second transaction data and that it has not been tampered with during the sending process.

[0160] Specifically, perform a preset process on the fourth signature value before compression to obtain a first result, extract the digest of the second transaction data to determine the digest of the second transaction data, calculate the first result and the digest to obtain a second result, calculate the first result and the third signature value to obtain a third result, determine a target base point from at least one base point according to the parity of the second signature verification parameter, calculate an intermediate signature based on the verification public key, the second result and the third result, and calculate the first verification signature value from the intermediate signature. By way of example, the extraction of the digest of the second transaction data may employ hash calculation.

[0161] In an alternative embodiment, before calculating the first verification signature value, determine the magnitudes of the third signature value and the fourth signature value before compression. If the third signature value and the fourth signature value before compression are not within a preset range, it indicates that the signature is invalid and the signature message needs to be rejected.

[0162] S26: If the first verification signature value is equal to the third signature value, determine that the signature message is verified successfully.

[0163] In this embodiment, when the first verification signature value is equal to the third signature value, determine that the signature message is verified successfully, and the second transaction data is complete and has not been tampered with.

[0164] By way of example, taking the Elliptic Curve Digital Signature Algorithm ECDSA-secp256k1 as an example, the above verification process is explained in detail. However, it should be noted that the solution of the present invention is not limited to the Elliptic Curve Digital Signature Algorithm ECDSA-secp256k1.

[0165] After the blockchain node determines the signature values (r, s) from the signature message of the second transaction data m, it judges that if then it determines that the signature is invalid and rejects the signature message. If this condition is met, calculate the hash value e = hash(m) of the second transaction data m, and this hash value e represents the digest of the second transaction data m. Based on the order n of the elliptic curve E, take the remainder of the inverse operation of the fourth signature value s before compression to obtain the first result w = s -1 mod n; based on the order n of the elliptic curve E, take the remainder of the dot product of the first result w and the digest e to obtain the second result u 1 = e·w mod n, take the remainder of the dot product of the first result w and the third signature value r to obtain the third result u 2 = r·w mod n, select a target base point corresponding to the parity from at least one base point according to the parity of the second signature verification parameter, and according to the second result u 1 and the dot product of the target base point G and the third result u 2 and the verification public key Q A calculate the intermediate signature R = u 1 ·G + u2 ·Q A Based on the order n of the elliptic curve E, the abscissa x of the intermediate signature R is taken modulo n to obtain the first verification signature value v = x mod n. If the first verification signature value v is equal to the third signature value r, it indicates that the signature message verification passes.

[0166] S27: Execute a transaction operation using the second transaction data.

[0167] In this embodiment, after determining that the second transaction data is verified successfully, the blockchain node determines whether there is a signed transaction inside the contract. If not, it directly executes a transaction operation on the second transaction data and returns a transaction result; if there is a signed transaction inside the contract, it calls the method inside the contract to perform signature verification again. The verification process is the same as that of the aforementioned S22 - S26 and will not be elaborated again.

[0168] It should be noted that in the embodiment of the present invention, a virtual machine (Ethereum Virtual Machine, EVM) for running a smart contract is deployed on the blockchain node. The smart contract includes a transaction verification contract, and the virtual machine calls and executes the transaction verification contract to implement the processes of the above S21 - S27.

[0169] For the blockchain transaction processing method provided in the above embodiment, the blockchain node judges the signature length sent by the blockchain wallet received. When the signature length is the first preset length, it decompresses the signature message, and verifies the signature message according to the decompressed fourth signature value before compression, the second signature verification parameter, and the third signature value, so as to execute a transaction operation using the second transaction data in the case of passing the verification. Since the blockchain node receives a compressed signature message, the length of this signature message is shorter, reducing transaction fees and system overhead.

[0170] In an alternative embodiment, please refer to Figure 5 , which is a schematic flowchart of the fourth embodiment of the blockchain transaction processing method provided by the present invention. As Figure 5 shown, the method further includes:

[0171] S31: If the length of the signature message is the second preset length, it is determined that the signature message includes: the third signature value, the uncompressed fourth signature value, and the second signature verification parameter.

[0172] In this embodiment, if the blockchain node judges that the length of the signature message is the second preset length, it can be determined that the blockchain wallet generates the signature message using an existing method. This signature message includes: the third signature value, the uncompressed fourth signature value, and the second signature verification parameter.

[0173] S32: If the uncompressed fourth signature value is within the preset signature threshold range, calculate a second verification signature value according to the verification public key, the third signature value, the uncompressed fourth signature value, and the second signature verification parameter.

[0174] S33: If the second verification signature value is equal to the third signature value, determine that the signature message verification passes.

[0175] S34: Execute a transaction operation using the second transaction data.

[0176] Specifically, due to the symmetry of the elliptic curve in the digital signature algorithm, when the right - hand part signature value is not within the preset signature threshold range, it has flip - ability, which may lead to inaccurate results during signature verification. Therefore, it is necessary to limit the uncompressed fourth signature value within the preset signature threshold range to avoid the flip of the uncompressed fourth signature value.

[0177] In this embodiment, the uncompressed fourth signature value is judged. Only when the uncompressed fourth signature value is within the preset signature threshold range, calculate the second verification signature value. Among them, the method of calculating the second verification signature value, the step of determining that the signature message verification passes, and the step of executing a transaction operation using the second transaction data are the same as those in the foregoing S25 - S27, and will not be elaborated again.

[0178] Optionally, if the uncompressed fourth signature value is not within the preset signature threshold range, determine that the signature message verification fails.

[0179] In this embodiment, if the uncompressed fourth signature value is not within the preset signature threshold range, determine that the signature message verification fails and recognize that the signature message is an invalid signature.

[0180] In the blockchain transaction processing method provided in the above - mentioned embodiment, when the length of the signature message is the second preset length, by judging whether the uncompressed fourth signature value is within the preset signature threshold range, it is determined that if the uncompressed fourth signature value is not within the preset signature threshold range, the signature message is invalid, and the signature message is only verified when the uncompressed fourth signature value is within the preset signature threshold range, avoiding incorrect verification results.

[0181] Based on the above - mentioned embodiment, an embodiment of the present invention further provides a blockchain transaction processing device, which is applied to a blockchain wallet. Please refer to Figure 6 , which is the structural schematic diagram of the first embodiment of the blockchain transaction processing device provided by the present invention. As Figure 6 shown, the device includes:

[0182] A signature generation module 11, configured to sign the first transaction data to be signed to generate an initial signature message. The initial signature message includes: a first signature value, a second signature value, and a first signature verification parameter.

[0183] An assignment module 12 is configured to assign values to preset bit positions in the second signature value according to the first signature verification parameter to obtain a compressed second signature value.

[0184] Optionally, the preset bit position is the most significant bit position.

[0185] A request sending module 13 is configured to send a transaction request to a blockchain node. The transaction request includes: first transaction data, a target signature message of the first transaction data, and a verification public key of a blockchain wallet. The target signature message includes: a first signature value and a compressed second signature value.

[0186] In the blockchain transaction processing device provided in the above embodiment, by assigning the first signature verification parameter to the preset bit positions in the second signature value, the target signature message only includes the compressed second signature value and the first signature value, and the first signature verification parameter does not occupy extra bytes, so no zero bytes will be injected in the case of 256-bit alignment, shortening the length of the digital signature and reducing the transaction cost and system overhead.

[0187] In a possible implementation manner, the assignment module 12 is specifically configured to, if the second signature value is within a preset signature threshold range, assign values to preset bit positions in the second signature value according to the first signature verification parameter to obtain a compressed second signature value.

[0188] In another possible implementation manner, the assignment module 12 specifically includes:

[0189] A conversion unit is configured to, if the second signature value is not within the preset signature threshold range, convert the second signature value to obtain a converted second signature value, and convert the first signature verification parameter to obtain a converted first signature verification parameter.

[0190] An assignment unit is configured to assign values to preset bit positions in the converted second signature value according to the converted first signature verification parameter to obtain a compressed second signature value.

[0191] In an optional embodiment, the conversion unit converts the second signature value, specifically including: determining the converted second signature value according to the difference between a preset signature order and the second signature value. The signature order is the signature order used when signing the first transaction data.

[0192] Optionally, the conversion unit converts the first signature verification parameter, specifically including: performing a binary inversion on the first signature verification parameter to obtain the converted first signature verification parameter.

[0193] Based on any of the above embodiments, the device includes:

[0194] A threshold range determination module, configured to determine a preset signature threshold range according to a preset signature order, where the maximum value of the preset signature threshold range is less than the signature order.

[0195] The blockchain transaction processing device provided in the above embodiment determines whether the second signature value is within the preset signature threshold range, and when the second signature value is not within the preset signature threshold range, the second signature value is converted so that the converted second signature value is within the preset signature threshold range, ensuring that the preset bit of the second signature value is always a fixed value, so that assigning the first signature verification parameter to the preset bit of the second signature value will not affect the second signature value, thereby enabling the compression of the first signature verification parameter and the second signature value, shortening the length of the digital signature, and reducing transaction fees and system overhead.

[0196] Based on the above embodiment, an embodiment of the present invention further provides a blockchain transaction processing device, which is applied to a blockchain node. Please refer to Figure 7 , which is a schematic structural diagram of the second embodiment of the blockchain transaction processing device provided by the present invention. As Figure 7 shown, the device includes:

[0197] A request receiving module 21, configured to receive a transaction request sent by a blockchain wallet. The transaction request includes: second transaction data to be verified, a signature message of the second transaction data, and a verification public key of the blockchain wallet.

[0198] A length judgment module 22, configured to judge whether the length of the signature message is a first preset length or a second preset length, where the first preset length is less than the second preset length.

[0199] A signature confirmation module 23, configured to, if the length of the signature message is the first preset length, determine that the signature message includes: a third signature value and a compressed fourth signature value.

[0200] A decompression module 24, configured to decompress the compressed fourth signature value to obtain the pre-compression fourth signature value and a second signature verification parameter.

[0201] A calculation module 25, configured to calculate a first verification signature value according to the verification public key, the third signature value, the pre-compression fourth signature value, and the second signature verification parameter.

[0202] A verification module 26, configured to, if the first verification signature value is equal to the third signature value, determine that the signature message is verified successfully.

[0203] A transaction module 27, configured to perform a transaction operation using the second transaction data.

[0204] The blockchain transaction processing device provided by the above embodiment determines the signature length sent by the blockchain wallet received by the blockchain node, and when the signature length is the first preset length, decompresses the signature message, and verifies the signature message according to the fourth signature value before decompression, the second signature verification parameter, and the third signature value obtained by decompression, so as to execute a transaction operation using the second transaction data when the verification is passed. Since the blockchain node receives a compressed signature message, the length of the signature message is short, reducing transaction fees and system overhead.

[0205] In an alternative embodiment, the signature confirmation module 23 is further configured to determine that the target signature message includes: a third signature value, an uncompressed fourth signature value, and a second signature verification parameter if the length of the signature message is the second preset length.

[0206] The calculation module 25 is further configured to calculate a second verification signature value according to the verification public key, the third signature value, the fourth signature value before compression, and the second signature verification parameter if the uncompressed fourth signature value is within a preset signature threshold range.

[0207] The verification module 26 is further configured to determine that the signature message verification is passed if the second verification signature value is equal to the third signature value.

[0208] The transaction module 27 is further configured to execute a transaction operation using the second transaction data.

[0209] Optionally, the verification module 26 is further configured to determine that the signature message verification fails if the uncompressed fourth signature value is not within the preset signature threshold range.

[0210] When the length of the signature message is the second preset length, the blockchain transaction processing device provided by the above embodiment determines that the signature message is invalid if the uncompressed fourth signature value is not within the preset signature threshold range by determining whether the uncompressed fourth signature value is within the preset signature threshold range, and only verifies the signature message when the uncompressed fourth signature value is within the preset signature threshold range, avoiding incorrect verification results.

[0211] The above device is used to execute the method provided by the foregoing embodiment, and its implementation principle and technical effects are similar and will not be described herein again.

[0212] The above modules may be one or more integrated circuits configured to implement the above methods. For example: one or more Application Specific Integrated Circuits (ASICs), or, one or more microprocessors, or, one or more Field Programmable Gate Arrays (FPGAs), etc. Again, when a certain module above is implemented in the form of a processing element scheduler code, the processing element may be a general-purpose processor, such as a Central Processing Unit (CPU) or other processors that can call program code. Again, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).

[0213] Please refer to Figure 8 , which is a schematic diagram of the electronic device provided by the embodiment of the present invention. As Figure 8 shown, the electronic device 400 includes: a processor 401, a storage medium 402, and a bus. The storage medium 402 stores program instructions executable by the processor 401. When the electronic device 400 runs, the processor 401 communicates with the storage medium 402 through the bus, and the processor 401 executes the program instructions to execute the embodiments of the above blockchain transaction processing method applied to a blockchain wallet or a blockchain node.

[0214] Specifically, the steps for the server to execute the above blockchain transaction processing method applied to a blockchain wallet include:

[0215] Sign the first transaction data to be signed to generate an initial signature message, where the initial signature message includes: a first signature value, a second signature value, and a first signature verification parameter.

[0216] According to the first signature verification parameter, assign values to the preset bits in the second signature value to obtain a compressed second signature value.

[0217] Optionally, the preset bit is: the highest bit.

[0218] Send a transaction request to the blockchain node. The transaction request includes: the first transaction data, the target signature message of the first transaction data, and the verification public key of the blockchain wallet. The target signature message includes: the first signature value and the compressed second signature value.

[0219] In the blockchain transaction processing method executed by the server in the above embodiments, by assigning the first signature verification parameter to the preset bit positions in the second signature value, the target signature message only contains the compressed second signature value and the first signature value. The first signature verification parameter does not occupy extra bytes, and thus no zero bytes will be injected in the case of 256-bit alignment, shortening the length of the digital signature and reducing transaction fees and system overhead.

[0220] In a possible implementation manner, if the second signature value is within the preset signature threshold range, then according to the first signature verification parameter, the preset bit positions in the second signature value are assigned to obtain the compressed second signature value.

[0221] In another possible implementation manner, if the second signature value is not within the preset signature threshold range, the second signature value is converted to obtain the converted second signature value, and the first signature verification parameter is converted to obtain the converted first signature verification parameter; according to the converted first signature verification parameter, the preset bit positions in the converted second signature value are assigned to obtain the compressed second signature value.

[0222] In an alternative embodiment, converting the second signature value specifically includes: determining the converted second signature value according to the difference between the preset signature order and the second signature value, where the signature order is the signature order used when signing the first transaction data.

[0223] Optionally, converting the first signature verification parameter specifically includes: performing a binary inversion on the first signature verification parameter to obtain the converted first signature verification parameter.

[0224] Based on any of the above embodiments, the steps for the server to execute the above blockchain transaction processing method further include:

[0225] Determine the preset signature threshold range according to the preset signature order, where the maximum value of the preset signature threshold range is less than the signature order.

[0226] In the blockchain transaction processing method executed by the server in the above embodiments, by determining whether the second signature value is within the preset signature threshold range, and when the second signature value is not within the preset signature threshold range, by converting the second signature value, the converted second signature value is within the preset signature threshold range, ensuring that the preset bit positions of the second signature value are always fixed values, so that assigning the first signature verification parameter to the preset bit positions of the second signature value will not affect the second signature value either, thereby enabling the compression of the first signature verification parameter and the second signature value, shortening the length of the digital signature, and reducing transaction fees and system overhead.

[0227] Specifically, the steps for the server to execute the above blockchain transaction processing method applied to a blockchain node include:

[0228] Receive a transaction request sent by a blockchain wallet, where the transaction request includes: second transaction data to be verified, a signature message of the second transaction data, and a verification public key of the blockchain wallet.

[0229] Determine whether the length of the signature message is a first preset length or a second preset length, where the first preset length is less than the second preset length.

[0230] If the length of the signature message is the first preset length, determine that the signature message includes: a third signature value and a compressed fourth signature value.

[0231] Decompress the compressed fourth signature value to obtain the uncompressed fourth signature value and a second signature verification parameter.

[0232] Calculate a first verification signature value according to the verification public key, the third signature value, the uncompressed fourth signature value, and the second signature verification parameter.

[0233] If the first verification signature value is equal to the third signature value, determine that the signature message is verified successfully.

[0234] Execute a transaction operation using the second transaction data.

[0235] In the above embodiment, the blockchain transaction processing method executed by the server determines the signature length of the signature message sent by the blockchain wallet received by the blockchain node, and when the signature length is the first preset length, decompresses the signature message, and verifies the signature message according to the uncompressed fourth signature value, the second signature verification parameter, and the third signature value obtained by decompression, so as to execute a transaction operation using the second transaction data when the verification is passed. Since the blockchain node receives a compressed signature message, the length of the signature message is shorter, reducing transaction fees and system overhead.

[0236] In an alternative embodiment, if the length of the signature message is the second preset length, determine that the target signature message includes: a third signature value, an uncompressed fourth signature value, and a second signature verification parameter.

[0237] If the uncompressed fourth signature value is within a preset signature threshold range, calculate a second verification signature value according to the verification public key, the uncompressed fourth signature value, and the second signature verification parameter.

[0238] If the second verification signature value is equal to the third signature value, determine that the signature message is verified successfully.

[0239] Execute a transaction operation using the second transaction data.

[0240] Optionally, if the uncompressed fourth signature value is not within the preset signature threshold range, determine that the signature message verification fails.

[0241] In the blockchain transaction processing method executed by the server in the above embodiments, when the length of the signature message is the second preset length, by determining whether the uncompressed fourth signature value is within the preset signature threshold range, it is determined that if the uncompressed fourth signature value is not within the preset signature threshold range, the signature message is invalid, and the signature message is only verified when the uncompressed fourth signature value is within the preset signature threshold range, avoiding incorrect verification results.

[0242] Optionally, the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is run by a processor, it executes the embodiments of the blockchain transaction processing method as described above.

[0243] Specifically, the steps of the computer program executing the blockchain transaction processing method applied to the blockchain wallet include:

[0244] Sign the first transaction data to be signed to generate an initial signature message, where the initial signature message includes: a first signature value, a second signature value, and a first signature verification parameter.

[0245] According to the first signature verification parameter, assign values to the preset bits in the second signature value to obtain a compressed second signature value.

[0246] Optionally, the preset bit is: the highest bit.

[0247] Send a transaction request to the blockchain node, where the transaction request includes: the first transaction data, the target signature message of the first transaction data, and the verification public key of the blockchain wallet, and the target signature message includes: the first signature value and the compressed second signature value.

[0248] In the blockchain transaction processing method executed by the computer program in the above embodiments, by assigning the first signature verification parameter to the preset bits in the second signature value, the target signature message only includes the compressed second signature value and the first signature value, and the first signature verification parameter does not occupy extra bytes, so no zero bytes will be injected in the case of 256-bit alignment, shortening the length of the digital signature and reducing the transaction cost and system overhead.

[0249] In a possible implementation manner, if the second signature value is within the preset signature threshold range, then according to the first signature verification parameter, assign values to the preset bits in the second signature value to obtain a compressed second signature value.

[0250] In another possible implementation, if the second signature value is not within the preset signature threshold range, the second signature value is converted to obtain a converted second signature value, and the first signature verification parameter is converted to obtain a converted first signature verification parameter; according to the converted first signature verification parameter, preset bits in the converted second signature value are assigned to obtain a compressed second signature value.

[0251] In an alternative embodiment, the conversion of the second signature value specifically includes: determining the converted second signature value according to the difference between the preset signature order and the second signature value, where the signature order is the signature order used when signing the first transaction data.

[0252] Optionally, the conversion of the first signature verification parameter specifically includes: performing a binary inversion on the first signature verification parameter to obtain a converted first signature verification parameter.

[0253] Based on any of the above embodiments, the steps for the server to execute the above blockchain transaction processing method further include:

[0254] According to the preset signature order, a preset signature threshold range is determined, where the maximum value of the preset signature threshold range is less than the signature order.

[0255] In the above embodiments, the blockchain transaction processing method executed by the computer program determines whether the second signature value is within the preset signature threshold range, and when the second signature value is not within the preset signature threshold range, by converting the second signature value, the converted second signature value is within the preset signature threshold range, ensuring that the preset bits of the second signature value are always fixed values, so that assigning the first signature verification parameter to the preset bits of the second signature value will not affect the second signature value either, thereby enabling the compression of the first signature verification parameter and the second signature value, shortening the length of the digital signature, and reducing transaction fees and system overhead.

[0256] Specifically, the steps for the computer program to execute the above blockchain transaction processing method applied to a blockchain node include:

[0257] Receiving a transaction request sent by a blockchain wallet, where the transaction request includes: second transaction data to be verified, a signature message of the second transaction data, and a verification public key of the blockchain wallet.

[0258] Determining whether the length of the signature message is a first preset length or a second preset length, where the first preset length is less than the second preset length.

[0259] If the length of the signature message is the first preset length, it is determined that the signature message includes: a third signature value and a compressed fourth signature value.

[0260] Decompress the compressed fourth signature value to obtain the fourth signature value before compression and the second signature verification parameter.

[0261] Calculate the first verification signature value according to the verification public key, the third signature value, the fourth signature value before compression, and the second signature verification parameter.

[0262] If the first verification signature value is equal to the third signature value, determine that the signature message verification passes.

[0263] Execute the transaction operation using the second transaction data.

[0264] In the blockchain transaction processing method executed by the computer program in the above embodiment, the blockchain node judges the signature length sent by the received blockchain wallet, and when the signature length is the first preset length, decompresses the signature message, and according to the fourth signature value before compression, the second signature verification parameter, and the third signature value obtained by decompression, verifies the signature message, so as to execute the transaction operation using the second transaction data when the verification passes. Since the blockchain node receives the compressed signature message, the length of the signature message is shorter, reducing the transaction cost and system overhead.

[0265] In an alternative embodiment, if the length of the signature message is the second preset length, it is determined that the target signature message includes: the third signature value, the uncompressed fourth signature value, and the second signature verification parameter.

[0266] If the uncompressed fourth signature value is within the preset signature threshold range, calculate the second verification signature value according to the verification public key, the uncompressed fourth signature value, and the second signature verification parameter.

[0267] If the second verification signature value is equal to the third signature value, determine that the signature message verification passes.

[0268] Execute the transaction operation using the second transaction data.

[0269] Optionally, if the uncompressed fourth signature value is not within the preset signature threshold range, determine that the signature message verification fails.

[0270] In the blockchain transaction processing method executed by the computer program in the above embodiment, when the length of the signature message is the second preset length, by judging whether the uncompressed fourth signature value is within the preset signature threshold range, it is determined that if the uncompressed fourth signature value is not within the preset signature threshold range, the signature message is invalid, and the signature message is only verified when the uncompressed fourth signature value is within the preset signature threshold range, avoiding incorrect verification results.

[0271] In several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division. In actual implementation, there can be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of devices or units can be in electrical, mechanical or other forms.

[0272] The units described as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0273] In addition, in each embodiment of the present invention, the functional units can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above integrated units can be implemented in the form of hardware or in the form of hardware plus software functional units.

[0274] The above integrated units implemented in the form of software functional units can be stored in a computer-readable storage medium. The above software functional units stored in a storage medium include several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to execute some steps of the methods described in each embodiment of the present invention. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (English: Read-Only Memory, abbreviated as: ROM), random access memories (English: Random Access Memory, abbreviated as: RAM), magnetic disks or optical discs that can store program codes.

[0275] The above is only the specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention can easily think of changes or substitutions, which should all be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.

Claims

1. A blockchain transaction processing method, characterized in that, applied to a blockchain wallet, the method includes: Sign the first transaction data to be signed to generate an initial signature message, the initial signature message includes: a first signature value, a second signature value, and a first signature verification parameter; According to the first signature verification parameter, assign values to preset bits in the second signature value to obtain a compressed second signature value. The first signature verification parameter is a parity check parameter, and the preset bits are the bits in the second signature value whose values remain unchanged. The preset bits of the compressed second signature value store the first signature verification parameter; Send a transaction request to a blockchain node. The transaction request includes: the first transaction data, the target signature message of the first transaction data, and the verification public key of the blockchain wallet. The target signature message includes: the first signature value and the compressed second signature value.

2. The method according to claim 1, characterized in that, The step of "According to the first signature verification parameter, assign values to preset bits in the second signature value to obtain a compressed second signature value" includes: If the second signature value is within a preset signature threshold range, then according to the first signature verification parameter, assign values to the preset bits in the second signature value to obtain a compressed second signature value.

3. The method according to claim 2, characterized in that, The step of "According to the first signature verification parameter, assign values to preset bits in the second signature value to obtain a compressed second signature value" further includes: If the second signature value is not within the preset signature threshold range, convert the second signature value to obtain a converted second signature value, and convert the first signature verification parameter to obtain a converted first signature verification parameter; According to the converted first signature verification parameter, assign values to the preset bits in the converted second signature value to obtain the compressed second signature value.

4. The method according to claim 3, characterized in that, The step of "Convert the second signature value to obtain a converted second signature value" includes: Determine the converted second signature value according to a preset signature order and the difference between the second signature values. The signature order is the signature order used when signing the first transaction data.

5. The method according to claim 3, characterized in that, The step of "Convert the first signature verification parameter to obtain a converted first signature verification parameter" includes: Perform a binary negation on the first signature verification parameter to obtain the converted first signature verification parameter.

6. The method according to claim 2, characterized in that, Before the step of "According to the first signature verification parameter, assign values to preset bits in the second signature value to obtain a compressed second signature value", the method further includes: Determine the preset signature threshold range according to a preset signature order, where the maximum value of the preset signature threshold range is less than the signature order.

7. The method according to any one of claims 1-6, characterized in that, The preset bit position is: the highest bit position.

8. A blockchain transaction processing method, characterized in that, applied to a blockchain node, the method includes: Receiving a transaction request sent by a blockchain wallet, the transaction request includes: second transaction data to be verified, a signature message of the second transaction data, and a verification public key of the blockchain wallet; Judging whether the length of the signature message is a first preset length or a second preset length, wherein the first preset length is less than the second preset length; If the length of the signature message is the first preset length, it is determined that the signature message includes: a third signature value and a compressed fourth signature value; Decompressing the compressed fourth signature value to obtain a decompressed fourth signature value and a second signature verification parameter; Calculating a first verification signature value according to the verification public key, the third signature value, the decompressed fourth signature value, and the second signature verification parameter; If the first verification signature value is equal to the third signature value, it is determined that the signature message is verified; Performing a transaction operation using the second transaction data.

9. The method according to claim 8, characterized in that, The method further includes: If the length of the signature message is the second preset length, it is determined that the signature message includes: a third signature value, an uncompressed fourth signature value, and a second signature verification parameter; If the uncompressed fourth signature value is within a preset signature threshold range, calculating a second verification signature value according to the verification public key, the third signature value, the decompressed fourth signature value, and the second signature verification parameter; If the second verification signature value is equal to the third signature value, it is determined that the signature message is verified; Performing a transaction operation using the second transaction data.

10. The method according to claim 9, characterized in that, The method further includes: If the uncompressed fourth signature value is not within the preset signature threshold range, it is determined that the signature message verification fails.

11. A blockchain transaction processing device, characterized in that, applied to a blockchain wallet, the device includes: A signature generation module, configured to sign the first transaction data to be signed to generate an initial signature message, the initial signature message includes: a first signature value, a second signature value, and a first signature verification parameter; An assignment module, configured to assign values to preset bit positions in the second signature value according to the first signature verification parameter to obtain a compressed second signature value, the first signature verification parameter is a parity check parameter, the preset bit position is the bit position in the second signature value where the value remains unchanged, and the preset bit position of the compressed second signature value stores the first signature verification parameter; A request sending module, configured to send a transaction request to a blockchain node, the transaction request includes: the first transaction data, a target signature message of the first transaction data, and a verification public key of the blockchain wallet, the target signature message includes: the first signature value and the compressed second signature value.

12. A blockchain transaction processing device, characterized in that, applied to a blockchain node, the device includes: A request receiving module, configured to receive a transaction request sent by a blockchain wallet, where the transaction request includes: second transaction data to be verified, a signature message of the second transaction data, and a verification public key of the blockchain wallet; A length judgment module, configured to judge whether the length of the signature message is a first preset length or a second preset length, where the first preset length is less than the second preset length; A signature confirmation module, configured to, if the length of the signature message is the first preset length, determine that the signature message includes: a third signature value and a compressed fourth signature value; A decompression module, configured to decompress the compressed fourth signature value to obtain a pre-compression fourth signature value and a second signature verification parameter; A calculation module, configured to calculate a first verification signature value according to the verification public key, the third signature value, the pre-compression fourth signature value, and the second signature verification parameter; A verification module, configured to, if the first verification signature value is equal to the third signature value, determine that the signature message passes the verification; A transaction module, configured to execute a transaction operation using the second transaction data.

13. An electronic device, characterized in that, it includes: a processor, a storage medium, and a bus, where the storage medium stores program instructions executable by the processor. When the electronic device runs, the processor communicates with the storage medium through the bus, and the processor executes the program instructions to perform the steps of the blockchain transaction processing method according to any one of claims 1 to 10.

14. A computer-readable storage medium, characterized in that, a computer program is stored on the storage medium, and when the computer program is run by a processor, it performs the steps of the blockchain transaction processing method according to any one of claims 1 - 10.

Citation Information

Patent Citations

  • Signature public key compression method and device, computer equipment and storage medium

    CN114499860A