Blockchain transaction processing method, device, equipment and storage medium
By generating multiple public and private key pairs in the blockchain system and hierarchical permission management, the security risks caused by the loss or leakage of account private keys are solved, and high security and convenient transactions of accounts are achieved.
Patent Information
- Application Number
- CN202011303560.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-19
- Publication Date
- 2025-01-17
- Estimated Expiration
- 2040-11-19
AI Technical Summary
In blockchain systems, the loss or leakage of the private key of the account can lead to serious security risks, because the private key is the only proof of account verification, and it is difficult for the existing technology to effectively manage the permissions of the account, resulting in insufficient security and convenience.
By generating multiple public and private key pairs and determining their usage permissions based on the type of public keys, establishing a mapping relationship between the account address and the public key, realizing the hierarchical permission management of the account, allowing user equipment to use public and private key pairs with different permissions to conduct transactions sign.
It improves the security and transaction convenience of the account, reduces the frequency of private key usage and exposure risks through hierarchical permission management, and enhances the overall security of the account.
Smart Images

Figure CN112446039B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of blockchain technology, and in particular to a blockchain transaction processing method, device, equipment and storage medium. Background Art
[0002] In the blockchain system, a public-private key system is usually used to operate and manage accounts. The public key corresponds to the private key, the public key is the public part, and the private key is the non-public part. When initiating a transaction, the private key is required to sign the transaction. When the public key is used to verify the transaction, the transaction will be executed.
[0003] Currently, an account has only one public key and one private key. The private key is kept by the user himself, and the private key is the only proof of account verification. Once the private key is lost or leaked, it will bring great risks to the account security. Summary of the invention
[0004] The embodiments of the present application provide a blockchain transaction processing method, apparatus, device and storage medium, which can realize hierarchical authority management of accounts, thereby improving account security and transaction convenience. The technical solution is as follows:
[0005] In a first aspect, a blockchain transaction processing method is provided, which is applied to a blockchain system, and the method includes:
[0006] Receive an account registration request sent by a user device, where the account registration request carries an account address and n public keys, where the n public keys are public keys in n public-private key pairs generated by the user device, and n is an integer greater than or equal to 2;
[0007] Determine the type of each public key in the n public keys, the type of each public key is used to indicate the usage authority of the public-private key pair to which each public key belongs, the usage authority of some of the n public-private key pairs is account management authority, and the usage authority of another part of the public-private key pairs is general operation authority;
[0008] Generate a mapping relationship between the account address, the n public keys, and the type of each public key in the n public keys;
[0009] According to the mapping relationship, a transaction initiated by the user device using the account address is processed, and the transaction is signed using a private key in the n public-private key pairs.
[0010] In this application, after receiving an account registration request sent by a user device carrying an account address and n public keys, the blockchain system can determine the type of each of the n public keys. The public-private key pairs of different types of public keys have different usage permissions and can be used when processing different transactions. The blockchain system can generate a mapping relationship between the account address, the n public keys, and the type of each of the n public keys, and then process the transaction initiated by the user device using the account address based on the mapping relationship. In this way, hierarchical permission management of accounts can be implemented, thereby improving account security and transaction convenience.
[0011] Optionally, determining the type of each public key in the n public keys includes:
[0012] Determining the type of each of the n public keys according to a public key generation rule used when each public key is generated; or
[0013] Determining the type of each public key according to a private key generation rule used when generating a private key corresponding to each public key in the n public keys; or
[0014] The type of each public key is determined according to the number of bits of each public key in the n public keys.
[0015] Optionally, generating a mapping relationship between the account address, the n public keys, and the type of each of the n public keys includes:
[0016] Determine the account address, the n public keys, and the type of each of the n public keys as an identity identifier;
[0017] Generating a digital certificate for verifying the identity;
[0018] The method further comprises:
[0019] Sending the digital certificate to the user device, so that the user device carries the digital certificate when initiating a transaction using the account address; or
[0020] The digital certificate is stored in the blockchain to obtain the storage address of the digital certificate; the storage address of the digital certificate is sent to the user device so that the user device carries the storage address of the digital certificate when initiating a transaction using the account address.
[0021] Optionally, generating a mapping relationship between the account address, the n public keys, and the type of each of the n public keys includes:
[0022] The account address, the n public keys, and the type of each of the n public keys are correspondingly stored in a database.
[0023] Optionally, processing, according to the mapping relationship, a transaction initiated by the user device using the account address includes:
[0024] After receiving the transaction initiated by the user device using the account address, determine the target type according to the call information in the transaction, where the target type is the type of the public key corresponding to the private key used when signing the transaction;
[0025] Obtaining a public key whose type is the target type from the mapping relationship;
[0026] Use the obtained public key to verify the transaction;
[0027] If the signature verification is successful, the transaction is executed.
[0028] Optionally, before obtaining the public key of the target type from the mapping relationship, the method further includes:
[0029] Obtaining a state variable in the account data corresponding to the account address;
[0030] If the frozen type in the state variable does not include the target type, the step of obtaining a public key of the target type from the mapping relationship is performed.
[0031] Optionally, the account management authority includes one or more of a key freezing authority, a key thawing authority, a key resetting authority, a key cancellation authority, and an account freezing authority;
[0032] The general operation permissions include one or more permissions among transfer permissions, contract data query permissions, and contract configuration permissions.
[0033] In a second aspect, a blockchain transaction processing device is provided, which is applied to a blockchain system, and the device includes:
[0034] A receiving module, configured to receive an account registration request sent by a user device, wherein the account registration request carries an account address and n public keys, where the n public keys are public keys in n public-private key pairs generated by the user device, and n is an integer greater than or equal to 2;
[0035] a determination module, used to determine the type of each public key in the n public keys, the type of each public key being used to indicate the permission to use the public-private key pair to which each public key belongs, the permission to use a portion of the n public-private key pairs being account management permissions, and the permission to use another portion of the public-private key pairs being general operation permissions;
[0036] A generation module, used to generate a mapping relationship between the account address, the n public keys, and the type of each public key in the n public keys;
[0037] A processing module is used to process, according to the mapping relationship, a transaction initiated by the user device using the account address, wherein the transaction is signed using a private key in the n public-private key pairs.
[0038] Optionally, the determining module is used to:
[0039] Determining the type of each of the n public keys according to a public key generation rule used when each public key is generated; or
[0040] Determining the type of each public key according to a private key generation rule used when generating a private key corresponding to each public key in the n public keys; or
[0041] The type of each public key is determined according to the number of bits of each public key in the n public keys.
[0042] Optionally, the generating module is used to:
[0043] Determine the account address, the n public keys, and the type of each of the n public keys as an identity identifier;
[0044] Generating a digital certificate for verifying the identity;
[0045] The device further includes a sending module, wherein the sending module is configured to:
[0046] Sending the digital certificate to the user device, so that the user device carries the digital certificate when initiating a transaction using the account address; or
[0047] The digital certificate is stored in the blockchain to obtain the storage address of the digital certificate; the storage address of the digital certificate is sent to the user device so that the user device carries the storage address of the digital certificate when initiating a transaction using the account address.
[0048] Optionally, the generating module is used to:
[0049] The account address, the n public keys, and the type of each of the n public keys are correspondingly stored in a database.
[0050] Optionally, the processing module is used to:
[0051] After receiving the transaction initiated by the user device using the account address, determine the target type according to the call information in the transaction, where the target type is the type of the public key corresponding to the private key used when signing the transaction;
[0052] Obtaining a public key whose type is the target type from the mapping relationship;
[0053] Use the obtained public key to verify the transaction;
[0054] If the signature verification is successful, the transaction is executed.
[0055] Optionally, the processing module is further used for:
[0056] Obtaining a state variable in the account data corresponding to the account address;
[0057] If the frozen type in the state variable does not include the target type, the step of obtaining a public key of the target type from the mapping relationship is performed.
[0058] Optionally, the account management authority includes one or more of a key freezing authority, a key thawing authority, a key resetting authority, a key cancellation authority, and an account freezing authority;
[0059] The general operation permissions include one or more permissions among transfer permissions, contract data query permissions, and contract configuration permissions.
[0060] In a third aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the above-mentioned blockchain transaction processing method when executed by the processor.
[0061] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned blockchain transaction processing method is implemented.
[0062] In a fifth aspect, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute the steps of the above-mentioned blockchain transaction processing method.
[0063] It can be understood that the beneficial effects of the second, third, fourth and fifth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0065] Figure 1 It is a structural diagram of a blockchain system provided by an embodiment of the present application;
[0066] Figure 2 It is a schematic diagram of a blockchain provided by an embodiment of the present application;
[0067] Figure 3 It is a schematic diagram of a blockchain transaction processing system provided by an embodiment of the present application;
[0068] Figure 4 This is a flowchart of a blockchain transaction processing method provided by an embodiment of the present application;
[0069] Figure 5 It is a flowchart of another blockchain transaction processing method provided by an embodiment of the present application;
[0070] Figure 6 It is a structural schematic diagram of a blockchain transaction processing device provided in an embodiment of the present application;
[0071] Figure 7 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0072] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.
[0073] It should be understood that the "plurality" mentioned in this application refers to two or more. In addition, in order to facilitate the clear description of the technical solution of this application, the words "first" and "second" are used to distinguish the same or similar items with basically the same functions and effects. Those skilled in the art can understand that the words "first" and "second" do not limit the quantity and execution order, and the words "first" and "second" do not necessarily limit them to be different.
[0074] Before explaining the embodiments of the present application, the relevant contents of the blockchain are first explained.
[0075] Figure 1 It is a structural diagram of a blockchain system provided in an embodiment of the present application.
[0076] See also Figure 1, the blockchain system 100 refers to a system for sharing data between nodes, and the blockchain system 100 may include multiple nodes 101, and the multiple nodes 101 may refer to various clients in the blockchain system 100. Each node 101 can receive input information during normal operation, and maintain the shared data in the blockchain system 100 based on the received input information. In order to ensure the information intercommunication within the blockchain system 100, there may be an information connection between each node 101 in the blockchain system 100, and information can be transmitted between the nodes 101 through the information connection. For example, when any node 101 in the blockchain system 100 receives input information, other nodes 101 in the blockchain system 100 obtain the input information according to the consensus algorithm, and store the input information as data in the shared data, so that the data stored on all nodes 101 in the blockchain system 100 are consistent.
[0077] Each node 101 in the blockchain system 100 stores an identical blockchain. Figure 2 The blockchain consists of multiple blocks. The genesis block includes a block header and a block body. The block header stores the input information characteristic value, version number, timestamp and difficulty value, and the block body stores the input information; the next block of the genesis block takes the genesis block as the parent block, and the next block also includes a block header and a block body. The block header stores the input information characteristic value of the current block, the block header characteristic value, version number, timestamp and difficulty value of the parent block, and so on, so that the block data stored in each block in the blockchain is associated with the block data stored in the parent block, ensuring the security of the input information in the block.
[0078] The blockchain system 100 has computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. The blockchain system 100 is a distributed shared account book and database, which has the characteristics of decentralization, non-tamperability, full traceability, traceability, collective maintenance, openness and transparency. These characteristics ensure the sharing, openness, authenticity, integrity, security and reliability of the blockchain.
[0079] The system architecture involved in the embodiments of the present application is described below.
[0080] Figure 3 Schematic diagram of a blockchain transaction processing system provided by an embodiment of the present application. Figure 3 , the blockchain transaction processing system includes a user device 301 and a blockchain system 302.
[0081] User device 301 can be a desktop computer, portable computer, network server, PDA, mobile phone, tablet computer, wireless terminal device, communication device or embedded device that can be used to store user data. Blockchain system 302 can be the above Figure 1-Figure 2 The blockchain system 100 described in the embodiment. The user device 301 and the blockchain system 302 can communicate through a wired network or a wireless network.
[0082] The user device 301 can generate a public-private key pair, and the user device can use the private key in the public-private key pair to sign the transaction when initiating a transaction. After the blockchain system 302 receives the transaction initiated by the user device 301, it can use the public key in the public-private key pair to verify the transaction, and execute the transaction if the verification passes.
[0083] The user device 301 and the blockchain system 302 may perform the following Figure 4 The blockchain transaction processing method described in the embodiment is used to process transactions initiated by the user device 301 to the blockchain system 302.
[0084] The blockchain transaction processing method provided in the embodiment of the present application is explained in detail below.
[0085] Figure 4 This is a flowchart of a blockchain transaction processing method provided by an embodiment of the present application. Figure 4 , the method comprises the following steps.
[0086] Step 401: The user device generates an account address and n public-private key pairs, where n is an integer greater than or equal to 2.
[0087] The account address is used to uniquely identify the account used by the user's device.
[0088] Each of the n public-private key pairs includes a public key and a private key. A public key in a public-private key pair corresponds to a private key, that is, data encrypted with the public key can be decrypted using the private key, and data encrypted with the private key can be decrypted using the public key.
[0089] When the user device generates any one of the n public-private key pairs, it can first generate a private key according to the private key generation rule, and then generate a public key corresponding to the private key according to the private key and public key generation rule; the private key and the public key are regarded as a public-private key pair.
[0090] The private key generation rule can be set in advance. For example, the private key generation rule can be a random number generation algorithm, and the random number generation algorithm can be used to generate a random number as a private key. Of course, the private key generation rule can also be other rules, which is not limited in the embodiments of the present application.
[0091] The public key generation rule can be set in advance. The public key generation rule can be an elliptic curve public key cryptographic algorithm (including but not limited to the SM2 elliptic curve algorithm, the Secp256k1 elliptic curve algorithm, etc.), and the public key can be generated according to a private key using the elliptic curve public key cryptographic algorithm. Of course, the public key generation rule can also be other rules, which is not limited in the embodiments of the present application.
[0092] It is worth noting that the user device can determine in advance the type of the public key in a public-private key pair it wants to generate, and then generate the public-private key pair according to the key generation rule corresponding to this type (which may include at least one of the private key generation rule and the public key generation rule).
[0093] The type of the public key may indicate the usage rights of the public-private key pair to which the public key belongs. The usage rights may be divided into account management rights and one or more other general operation rights other than the account management rights.
[0094] For different public key types, the user device can set different key generation rules in advance.
[0095] In one possible approach, different types of public keys may be generated using different public key generation rules. In this approach, the key generation rule corresponding to each public key type is the public key generation rule, that is, the public key type may be distinguished based on the public key generation rule.
[0096] In another possible approach, the private keys corresponding to different types of public keys can be generated using different private key generation rules. In this approach, the key generation rule corresponding to each public key type is the private key generation rule, that is, the public key type can be distinguished based on the private key generation rule.
[0097] In another possible approach, different types of public keys have different numbers of digits. In this approach, the key generation rule corresponding to each public key type is the public key generation rule, but the public key type can be directly distinguished based on the number of digits of the public key.
[0098] Of course, the user device may also set other key generation rules, which is not limited in the embodiments of the present application.
[0099] When the user device generates an account address, it can generate the account address according to the public key with account management authority, such as by Base58 encoding the public key to obtain the account address. Of course, the user device can also generate the account address by other means, as long as it can ensure that the account address can uniquely identify the account used by the user device.
[0100] Step 402: The user device sends an account registration request to the blockchain system.
[0101] The account registration request carries the account address and n public keys, where the n public keys are public keys in n public-private key pairs generated by the user device.
[0102] Furthermore, if the user device distinguishes the public key type according to the public key generation rule, the account registration request may also carry the identifier of the public key generation rule used when generating each of the n public keys (including but not limited to the name of the public key generation rule, etc.). If the user device distinguishes the public key type according to the private key generation rule, the account registration request may also carry the identifier of the private key generation rule used when generating the private key corresponding to each of the n public keys (including but not limited to the name of the private key generation rule, etc.). If the user device distinguishes the public key type according to the attributes of the public key itself (such as the number of bits of the public key, etc.), the account registration request may not carry the public key generation rule and the private key generation rule.
[0103] Step 403: After receiving the account registration request sent by the user device, the blockchain system determines the type of each public key in the n public keys.
[0104] The way in which the blockchain system determines the type of each public key in the n public keys depends on the way in which the user device in step 401 distinguishes different types of public keys.
[0105] For example, the blockchain system may determine the type of each public key according to the public key generation rule used when each of the n public keys is generated. Alternatively, the blockchain system may determine the type of each public key according to the private key generation rule used when the private key corresponding to each of the n public keys is generated. Alternatively, the blockchain system may determine the type of each public key according to the number of digits of each of the n public keys.
[0106] Among them, when the blockchain system determines the type of each public key according to the public key generation rule adopted when generating each of the n public keys, for any one of the n public keys, the blockchain system can obtain the corresponding public key type as the type of this public key from the corresponding relationship between the stored public key generation rule identifier and the public key type according to the identifier of the public key generation rule adopted when generating this public key.
[0107] For example, for any public key among the n public keys, if the identifier of the public key generation rule used when generating this public key is "SM2 elliptic curve algorithm", then the public key type corresponding to "SM2 elliptic curve algorithm" can be obtained from the correspondence between the public key generation rule identifier and the public key type shown in Table 1 below as the account management type, and the public key type is used to indicate that the use authority of the public-private key pair to which this public key belongs is account management authority. In other words, the public-private key pair to which the public key generated using the SM2 elliptic curve algorithm belongs has account management authority.
[0108] For another example, for any public key among the n public keys, if the identifier of the public key generation rule used when generating this public key is "Secp256k1 elliptic curve algorithm", then the public key type corresponding to "Secp256k1 elliptic curve algorithm" can be obtained from the correspondence between the public key generation rule identifier and the public key type shown in Table 1 below, which is a normal operation type, and this public key type is used to indicate that the use authority of the public-private key pair to which this public key belongs is a normal operation authority. In other words, the public-private key pair to which the public key generated using the Secp256k1 elliptic curve algorithm belongs has normal operation authority.
[0109] Table 1
[0110] Public key generation rule identifier Public key type SM2 elliptic curve algorithm Account Management Type Secp256k1 elliptic curve algorithm Common operation types …… ……
[0111] In the embodiment of the present application, only the above Table 1 is used as an example to illustrate the correspondence between the public key generation rule identifier and the public key type, and the above Table 1 does not constitute a limitation on the embodiment of the present application.
[0112] Among them, when the blockchain system determines the type of each public key according to the private key generation rule used when generating the private key corresponding to each of the n public keys, for any one of the n public keys, the blockchain system can obtain the corresponding public key type as the type of this public key from the correspondence between the stored private key generation rule identifier and the public key type according to the identifier of the private key generation rule used when generating the private key corresponding to this public key.
[0113] For example, for any public key among the n public keys, if the identifier of the private key generation rule used when generating the private key corresponding to this public key is "random number generation algorithm 1", then the public key type corresponding to "random number generation algorithm 1" can be obtained from the correspondence between the private key generation rule identifier and the public key type shown in Table 2 below as the account management type, and the public key type is used to indicate that the use authority of the public-private key pair to which this public key belongs is account management authority. In other words, the public-private key pair to which the private key generated using the random number generation algorithm 1 belongs has account management authority.
[0114] For another example, for any public key among the n public keys, if the identifier of the private key generation rule used when generating the private key corresponding to this public key is "random number generation algorithm 2", then the public key type corresponding to "random number generation algorithm 2" can be obtained from the correspondence between the private key generation rule identifier and the public key type shown in Table 2 below as a normal operation type, and this public key type is used to indicate that the use authority of the public-private key pair to which this public key belongs is a normal operation authority. In other words, the public-private key pair to which the private key generated using the random number generation algorithm 2 belongs has normal operation authority.
[0115] Table 2
[0116] Private key generation rule identifier Public key type Random number generation algorithm 1 Account Management Type Random number generation algorithm 2 Common operation types …… ……
[0117] In the embodiment of the present application, only Table 2 above is used as an example to illustrate the correspondence between the private key generation rule identifier and the public key type, and Table 2 above does not constitute a limitation on the embodiment of the present application.
[0118] Among them, when the blockchain system determines the type of each public key according to the number of bits of each of the n public keys, for any public key of the n public keys, the blockchain system can obtain the corresponding public key type as the type of this public key from the corresponding relationship between the number of bits of this public key and the public key type stored according to the number of bits of this public key.
[0119] For example, for any public key among the n public keys, if the number of digits of the public key is 6, the corresponding public key type of 6 digits can be obtained from the correspondence between the number of digits of the public key and the type of the public key as shown in Table 3 below, which is the account management type. The public key type is used to indicate that the permission to use the public-private key pair to which the public key belongs is the account management permission. In other words, the public-private key pair to which the public key with 6 digits belongs has the account management permission.
[0120] For another example, for any public key among the n public keys, if the number of digits of the public key is 8, the corresponding public key type of 8 digits can be obtained from the correspondence between the number of digits of the public key and the public key type shown in Table 3 below, which is a normal operation type. The public key type is used to indicate that the permission to use the public-private key pair to which the public key belongs is a normal operation permission. In other words, the public-private key pair to which the public key with 8 digits belongs has a normal operation permission.
[0121] Table 3
[0122] Number of bits of public key Public key type 6-digit Account Management Type 8-bit Common operation types …… ……
[0123] In the embodiment of the present application, only the above Table 3 is used as an example to illustrate the correspondence between the number of public key bits and the public key type, and the above Table 3 does not constitute a limitation on the embodiment of the present application.
[0124] It is worth noting that if the user device does not adopt different key generation rules according to the type of public key when generating n public-private key pairs, that is, it does not distinguish between the types of public keys, then after the blockchain system receives the account registration request sent by the user device, the administrator of the blockchain system can set the type of each of the n public keys.
[0125] Specifically, for any one of the n public keys, when the blockchain system receives a setting instruction triggered by an administrator account to set the type of this public key, the type carried in the setting instruction can be used as the type of this public key.
[0126] The usage rights of some of the n public-private key pairs are account management rights, and the usage rights of the other public-private key pairs are general operation rights.
[0127] The account management authority is used to implement management operations related to the account. For example, the account management authority may include one or more of the following authorities: key freezing authority, key thawing authority, key resetting authority, key cancellation authority, account freezing authority, etc.
[0128] The key freezing permission can be used to freeze the public-private key pair with general operation permissions. After being frozen, the public-private key pair can no longer be used to initiate and verify transactions. The key thawing permission is used to thaw the public-private key pair with general operation permissions that was previously frozen. After being thawed, the public-private key pair can be used again to initiate and verify transactions. The key reset permission is used to reset the public-private key pair with general operation permissions, that is, reset this public-private key pair to a new public-private key pair. The key cancellation permission is used to cancel the public-private key pair with general operation permissions, that is, delete this public-private key pair. The account freezing permission is used to freeze all public-private key pairs corresponding to the account address. At this time, all public-private key pairs can no longer be used.
[0129] The general operation permission is used to implement other general operations besides account management. For example, the general operation permission may include one or more permissions such as transfer permission, contract data query permission, contract configuration permission, etc.
[0130] The transfer permission is used to transfer tokens in this account to other accounts.
[0131] Contract data refers to the input parameters when calling a smart contract and the output data obtained after the smart contract is executed. Contract data query permissions are used to query contract data.
[0132] Contract configuration permissions are used to deploy contracts, change contract source code, and modify contract status. If a contract is deployed using a public-private key pair, subsequent changes to the contract source code and contract status of this contract will also be performed using this public-private key pair. In other words, if a public-private key pair has the deployment permission for a contract, then this public-private key pair also has the contract source code change permission and contract status modification permission of this public-private key pair.
[0133] For any public key among the n public keys, if the type of the public key indicates that the usage permission of the public-private key pair to which the public key belongs is account management permission, it means that the public-private key pair can be used when performing management operations related to the account. That is, for transactions used to perform management operations related to the account, the initiation of the transaction can be realized using the private key in the public-private key pair, and the verification of the transaction can be realized using the private key in the public-private key pair.
[0134] For any public key among the n public keys, if the type of the public key indicates that the permission to use the public-private key pair to which the public key belongs is a general operation permission, it means that the public-private key pair can be used for other general operations except account management. That is, for transactions used for general operations, the initiation of the transaction can be realized by using the private key in the public-private key pair, and the verification of the transaction can be realized by using the private key in the public-private key pair.
[0135] Furthermore, after receiving the account registration request, the blockchain system can not only determine the type of each public key in the n public keys, but also set account data related to the account address, which may include the account address, balance, state variables, status and other data.
[0136] Step 404: The blockchain system generates a mapping relationship between the account address, the n public keys, and the type of each of the n public keys.
[0137] Specifically, step 404 may be implemented in the following two possible ways:
[0138] In a first possible approach, the blockchain system may determine the account address, the n public keys, and the type of each of the n public keys as an identity, and generate a digital certificate for verifying the identity.
[0139] In this way, the digital certificate can reflect the mapping relationship between the account address, the n public keys, and the type of each public key in the n public keys.
[0140] When the blockchain system generates a digital certificate for verifying the identity, the blockchain system can perform a hash operation on the identity according to a hash algorithm to obtain a summary of the identity, and then encrypt the summary using the private key of the blockchain system according to an encryption algorithm to obtain encrypted information. The blockchain system can determine the hash algorithm, the encryption algorithm, the identity, and the encrypted information as a digital certificate.
[0141] Furthermore, after the blockchain system generates the digital certificate, it can also send the digital certificate to the user device so that the user device can carry the digital certificate when initiating a transaction using the account address, so that the blockchain system can subsequently learn the mapping relationship from the digital certificate carried by the user device when initiating a transaction. In this case, the blockchain system can store the digital certificate or not.
[0142] Alternatively, the blockchain system can store the digital certificate in the blockchain and obtain the storage address of the digital certificate; send the storage address of the digital certificate to the user device so that the user device can carry the storage address of the digital certificate when initiating a transaction using the account address. In this way, the blockchain system can subsequently obtain the digital certificate according to the storage address of the digital certificate carried by the user device when initiating a transaction, and then obtain the mapping relationship from the digital certificate.
[0143] In a second possible manner, the blockchain system stores the account address, the n public keys, and the type of each of the n public keys in a database.
[0144] In this way, the corresponding storage relationship in the database can reflect the mapping relationship between the account address, the n public keys, and the type of each public key in the n public keys. The subsequent blockchain system can directly obtain this mapping relationship from the database.
[0145] Step 405: The blockchain system processes the transaction initiated by the user device using the account address according to the mapping relationship, and the transaction is signed using the private key of the n public-private key pairs.
[0146] It is worth noting that in the embodiments of the present application, hierarchical permission management of accounts is implemented by using a method in which one account corresponds to multiple public-private key pairs with different usage permissions. This method is divided into two categories according to usage permissions: account management permissions and general operation permissions. Public-private key pairs with account management permissions are used to sign and initiate transactions related to account status changes, key status changes, key resets, key cancellations, etc., and public-private key pairs with general operation permissions are used to sign and initiate transfers, contract data queries, contract configurations, and other conventional transactions. As long as the user uses the public-private key pair with account management permissions normally, the account can autonomously initiate and complete operations on account status changes, key status changes, key resets, and key cancellations.
[0147] In addition, in the embodiment of the present application, only one account address needs to be maintained to complete the hierarchical authority management of the account. When resetting the public and private key pairs with ordinary operation authority, there is no need to change the account address, which is more practical.
[0148] A transaction initiated by a user device using the account address means that the transaction initiator in the transaction is the account address.
[0149] When the user device uses the account address to initiate a transaction to the blockchain system, the user device can use the private key in one of the n public-private key pairs to sign the transaction. Depending on the usage permissions required for the transaction, the user device can use the private key in different public-private key pairs to sign the transaction. When the user device uses a private key to sign the transaction, the user device can first calculate the hash value of the transaction, and then use the private key to encrypt the hash value to obtain the signature of the transaction.
[0150] Specifically, the operation of step 405 may be: after the blockchain system receives the transaction initiated by the user device using the account address, it determines the target type according to the call information in the transaction, where the target type is the type of the public key corresponding to the private key used to sign the transaction; obtains the public key of the target type from the mapping relationship; uses the obtained public key to verify the signature of the transaction; if the signature verification passes, executes the transaction; if the signature verification fails, rejects the transaction and ends the operation.
[0151] The call information in the transaction may indicate the usage permissions required for the transaction. For example, the call information in the transaction may specify the number of tokens to be transferred, in which case the usage permissions required for the transaction are transfer permissions. Alternatively, the call information in the transaction may specify the function to be called and the call parameters, in which case the usage permissions required for the transaction may vary depending on the function called. Some functions require account management permissions (including but not limited to key freezing permissions, key thawing permissions, key reset permissions, key cancellation permissions, account freezing permissions, etc.), and some functions require general operation permissions (including but not limited to contract data query permissions, etc.). Alternatively, the call information in the transaction may specify the binary code of the contract, in which case the usage permissions required for the transaction are contract configuration permissions.
[0152] In this way, the blockchain system can determine the usage permissions required for the transaction based on the call information in the transaction, and can also determine the type of public key corresponding to the private key used to sign the transaction, that is, it can determine the target type.
[0153] Among them, when the blockchain system uses the obtained public key to verify the transaction, the blockchain system can use the obtained public key to decrypt the signature of the transaction to obtain a first hash value; calculate the hash value of the transaction as the second hash value; if the first hash value is the same as the second hash value, it is determined that the transaction verification has passed; if the first hash value is different from the second hash value, it is determined that the transaction verification has failed.
[0154] Furthermore, before the blockchain system obtains the public key of the target type from the mapping relationship, it can also first determine whether the public-private key pair containing the public key of the target type is frozen; when the public-private key pair is not frozen, the public key of the target type is obtained from the mapping relationship to verify the transaction; when the public-private key pair is frozen, the transaction is rejected and the operation is terminated.
[0155] Among them, when the blockchain system determines whether the public-private key pair where the public key of the target type is located is frozen, it can first obtain the state variable in the account data corresponding to the account address; if the freezing type in the state variable does not include the target type, it is determined that the public-private key pair where the public key of the target type is located is not frozen; if the freezing type in the state variable includes the target type, it is determined that the public-private key pair where the public key of the target type is located is frozen.
[0156] The state variable in the account data corresponding to the account address may include a freeze type, which is the type of the public key in the frozen public-private key pair. That is, if a public-private key pair corresponding to the account is frozen, the type of the public key in the public-private key pair will be added to the state variable of the account data as the freeze type. If the public-private key pair is subsequently unfrozen, the freeze type will be deleted from the state variable.
[0157] To facilitate understanding, step 405 is described below with reference to several specific examples.
[0158] The following is an explanation of the processing of a transaction initiated by a user device that requires the use of key freezing authority. This processing may include the following steps (1) to (5):
[0159] (1) The user device uses a private key signature with account management authority to initiate a transaction and sends a digital certificate. The transaction initiator in the transaction is the account address, and the function called in the call information in the transaction is a key freezing contract. The key freezing contract is used to instruct the freezing of a first type of public key, which belongs to a normal operation type.
[0160] (2) After the blockchain system receives the transaction sent by the user device, it determines, based on the call information in the transaction, that the type of the public key corresponding to the private key used to sign the transaction is the account management type.
[0161] (3) The blockchain system queries whether the freeze type in the state variable in the account data corresponding to the account address includes the account management type; if not, continue to execute the following step (4); if included, reject the transaction and end the operation.
[0162] (4) The blockchain system verifies the legitimacy of the digital certificate. If the legitimacy of the digital certificate passes the verification, the blockchain system obtains the public key corresponding to the account address and the account management type from the identity identifier contained in the digital certificate.
[0163] Among them, the operation of the blockchain system to verify the legitimacy of the digital certificate can be: the blockchain system uses the public key of the blockchain system to decrypt the encrypted information contained in the digital certificate according to the encryption algorithm contained in the digital certificate to obtain first information; according to the hash algorithm contained in the digital certificate, the identity identifier contained in the digital certificate is hashed to obtain second information; if the first information is the same as the second information, it can be determined that the legitimacy check of the digital certificate has passed; if the first information is different from the second information, it can be determined that the legitimacy check of the digital certificate has failed.
[0164] (5) The blockchain system uses the public key obtained from the digital certificate to verify the transaction. After the verification is passed, the transaction is executed to freeze the first type of public key.
[0165] When freezing a public key of the first type, the blockchain system may add the first type as a freezing type to a state variable in the account data corresponding to the account address.
[0166] In this case, if the user device uses the private key signature corresponding to the first type of public key to initiate a transaction, after receiving the transaction, the blockchain system determines that the type of the public key corresponding to the private key used to sign the transaction is the first type according to the call information in the transaction. The blockchain system queries the frozen type in the state variable in the account data corresponding to the account address, and finds that the frozen type in the state variable includes the first type, then the blockchain system rejects the transaction and ends the operation. In this way, the first type of public-private key pair cannot be used.
[0167] The following is an explanation of the processing of a transaction initiated by a user device that requires the use of a key unfreezing authority. This processing may include the following steps (1) to (5):
[0168] (1) The user device uses a private key signature with account management authority to initiate a transaction and sends a digital certificate at the same time. The transaction initiator in the transaction is the account address, and the function called in the call information in the transaction is a key thawing contract. The key thawing contract is used to instruct the thawing of the first type of public key.
[0169] (2) After the blockchain system receives the transaction sent by the user device, it determines, based on the call information in the transaction, that the type of the public key corresponding to the private key used to sign the transaction is the account management type.
[0170] (3) The blockchain system queries whether the freeze type in the state variable in the account data corresponding to the account address includes the account management type; if not, continue to execute the following step (4); if included, reject the transaction and end the operation.
[0171] (4) The blockchain system verifies the legitimacy of the digital certificate. If the legitimacy of the digital certificate passes the verification, the blockchain system obtains the public key corresponding to the account address and the account management type from the identity identifier contained in the digital certificate.
[0172] (5) The blockchain system uses the public key obtained from the digital certificate to verify the transaction. After the verification is passed, the transaction is executed to unfreeze the first type of public key.
[0173] Among them, when the blockchain system unfreezes the first type of public key, it can delete the first type of frozen type in the state variable in the account data corresponding to the account address.
[0174] In this case, if the user device uses the private key signature corresponding to the first type of public key to initiate a transaction, then after receiving the transaction, the blockchain system determines that the type of the public key corresponding to the private key used to sign the transaction is the first type according to the call information in the transaction. The blockchain system queries the freeze type in the state variable in the account data corresponding to the account address, and finds that the freeze type in the state variable does not include the first type. The blockchain system verifies the legitimacy of the digital certificate. If the legitimacy of the digital certificate passes the verification, the public key corresponding to the account address and the first type is obtained from the identity identifier contained in the digital certificate. The blockchain system uses the public key obtained from the digital certificate to verify the signature of the transaction, and executes the transaction after the verification passes.
[0175] The following is an explanation of the processing of a transaction initiated by a user device that requires the use of key reset authority. This processing may include the following steps (1) to (5):
[0176] (1) If the user device needs to reset the public-private key pair of the second type of public key, a new public-private key pair is generated according to the key generation rule corresponding to the second type, and the user device updates the private key corresponding to the second type of public key stored locally to the new private key in the new public-private key pair. The second type belongs to the normal operation type.
[0177] (2) The user device uses the private key signature with account management authority to initiate a transaction and sends a digital certificate at the same time. The transaction initiator in the transaction is the account address, the function called in the call information in the transaction is the key reset contract, and the call parameter is the new public key in the new public-private key pair. The key reset contract is used to indicate the reset of the second type of public key.
[0178] (2) After the blockchain system receives the transaction sent by the user device, it determines, based on the call information in the transaction, that the type of the public key corresponding to the private key used to sign the transaction is the account management type.
[0179] (3) The blockchain system queries whether the freeze type in the state variable in the account data corresponding to the account address includes the account management type; if not, continue to execute the following step (4); if included, reject the transaction and end the operation.
[0180] (4) The blockchain system verifies the legitimacy of the digital certificate. If the legitimacy of the digital certificate passes the verification, the blockchain system obtains the public key corresponding to the account address and the account management type from the identity identifier contained in the digital certificate.
[0181] (5) The blockchain system uses the public key obtained from the digital certificate to verify the transaction. After the verification is passed, the transaction is executed to reset the second type of public key.
[0182] When resetting the second type of public key, the blockchain system can obtain the identity from the digital certificate, and update the public key corresponding to the account address and the second type in the identity to the new public key in the call parameter. Afterwards, the blockchain system regenerates a digital certificate for verifying the identity, and sends the digital certificate to the user device.
[0183] In this case, when the user device initiates a transaction that requires the use of the usage rights corresponding to the second type, the user device uses the reset new private key to sign the transaction and carries the digital certificate newly issued by the blockchain system.
[0184] The following is an explanation of the processing of a transaction initiated by a user device that requires the use of a key to cancel the authority. This processing may include the following steps (1) to (5):
[0185] (1) If the user device needs to cancel the public-private key pair of the third type of public key, the user device deletes the public-private key pair of the third type of public key stored locally. The third type belongs to the common operation type.
[0186] (2) The user device uses the private key signature with account management authority to initiate a transaction and sends a digital certificate at the same time. The transaction initiator in the transaction is the account address, the function called in the call information in the transaction is the key cancellation contract, and the call parameter is the third type of public key. The key reset contract is used to indicate the cancellation of the third type of public key.
[0187] (2) After the blockchain system receives the transaction sent by the user device, it determines, based on the call information in the transaction, that the type of the public key corresponding to the private key used to sign the transaction is the account management type.
[0188] (3) The blockchain system queries whether the freeze type in the state variable in the account data corresponding to the account address includes the account management type; if not, continue to execute the following step (4); if included, reject the transaction and end the operation.
[0189] (4) The blockchain system verifies the legitimacy of the digital certificate. If the legitimacy of the digital certificate passes the verification, the blockchain system obtains the public key corresponding to the account address and the account management type from the identity identifier contained in the digital certificate.
[0190] (5) The blockchain system uses the public key obtained from the digital certificate to verify the transaction. After the verification is passed, the transaction is executed to cancel the third type of public key.
[0191] When the blockchain system cancels the third type of public key, it can obtain the identity from the digital certificate and delete the public key corresponding to the account address and the third type in the identity. After that, the blockchain system regenerates a digital certificate for verifying the identity and sends the digital certificate to the user device.
[0192] In this case, when the user device initiates a transaction, it needs to carry the digital certificate newly issued by the blockchain system.
[0193] The following is an explanation of the processing of a transaction initiated by a user device that requires the use of account freezing authority. This processing may include the following steps (1) to (5):
[0194] (1) The user device uses the private key signature with account management authority to initiate a transaction and sends a digital certificate at the same time. The transaction initiator in this transaction is the account address, and the function called in the call information in this transaction is the account freezing contract. The account freezing contract is used to instruct the freezing of all public keys corresponding to the account address.
[0195] (2) After the blockchain system receives the transaction sent by the user device, it determines, based on the call information in the transaction, that the type of the public key corresponding to the private key used to sign the transaction is the account management type.
[0196] (3) The blockchain system queries whether the freeze type in the state variable in the account data corresponding to the account address includes the account management type; if not, continue to execute the following step (4); if included, reject the transaction and end the operation.
[0197] (4) The blockchain system verifies the legitimacy of the digital certificate. If the legitimacy of the digital certificate passes the verification, the blockchain system obtains the public key corresponding to the account address and the account management type from the identity identifier contained in the digital certificate.
[0198] (5) The blockchain system uses the public key obtained from the digital certificate to verify the transaction. After the verification is passed, the transaction is executed to freeze all public keys corresponding to the account address.
[0199] Among them, when the blockchain system freezes all public keys corresponding to the account address, all public key types corresponding to the account address can be added as freezing types to the state variables in the account data corresponding to the account address.
[0200] In this case, all transactions initiated by the user device using the private key corresponding to the account address will be rejected by the blockchain system.
[0201] It is worth noting that after the user device uses the public-private key pair with account management authority to perform the account freezing operation, if the account needs to be unfrozen, the user device can use the public-private key pair with account management authority to perform the account unfreezing operation, or the administrator of the blockchain system can perform the account unfreezing operation. In this case, all transactions initiated by the user device using the private key corresponding to the account address will be processed normally by the blockchain system.
[0202] When the administrator of the blockchain system performs an account unfreezing operation, the administrator can use the administrator's private key signature to initiate a transaction. The transaction initiator in the transaction is the administrator's account address, and the function called in the call information in the transaction is the account unfreezing contract, and the call parameter is the account address. The account unfreezing contract is used to instruct the unfreezing of all public keys corresponding to the account address. After receiving the transaction, the blockchain system uses the administrator's public key to verify the transaction. After the verification is passed, the transaction is executed to unfreeze all public keys corresponding to the account address. When the blockchain system unfreezes all public keys corresponding to the account address, it can delete all frozen types in the state variables in the account data corresponding to the account address.
[0203] Another point worth noting is that if the user device wants to reset the public-private key pair of the public key corresponding to the account management type, the user device can generate a new public-private key pair according to the key generation rule corresponding to the account management type, and the user device updates the private key corresponding to the public key of the account management type stored locally to the new private key in the new public-private key pair. Afterwards, the user device can give the new public key in the new public-private key pair to the administrator of the blockchain system, and the administrator of the blockchain system will reset the public key of the account management type.
[0204] When the administrator of the blockchain system resets the public key of the account management type, the administrator can use the administrator's private key signature to initiate a transaction. The transaction initiator in the transaction is the administrator's account address, and the function called in the call information in the transaction is the key reset contract, and the call parameters are the account address and the new public key. The key reset contract is used to reset the public key of the account management type. After receiving the transaction, the blockchain system uses the administrator's public key to verify the transaction. After the verification is passed, the transaction is executed to reset the public key of the account management type.
[0205] In an embodiment of the present application, after receiving an account registration request sent by a user device carrying an account address and n public keys, the blockchain system can determine the type of each of the n public keys. The public-private key pairs of different types of public keys have different usage permissions and can be used when processing different transactions. The blockchain system can generate a mapping relationship between the account address, the n public keys, and the type of each of the n public keys, and then process the transaction initiated by the user device using the account address based on the mapping relationship. In this way, hierarchical permission management of accounts can be implemented, thereby improving account security and transaction convenience.
[0206] Figure 5 is a flowchart of a blockchain transaction processing method provided by an embodiment of the present application. The method is applied to a blockchain system, which can be the above Figure 1-Figure 2 The blockchain system described in the embodiment. Figure 5 , the method may include the following steps:
[0207] Step 501: Receive an account registration request sent by a user device.
[0208] The account registration request carries the account address and n public keys, where the n public keys are public keys in n public-private key pairs generated by the user device, and n is an integer greater than or equal to 2.
[0209] The relevant content of step 501 has been explained in the above steps 401 and 402, and will not be repeated in this embodiment of the present application.
[0210] Step 502: Determine the type of each public key in the n public keys.
[0211] The type of each public key is used to indicate the usage permissions of the public-private key pair to which each public key belongs. The usage permissions of some of the n public-private key pairs are account management permissions, and the usage permissions of the other public-private key pairs are general operation permissions.
[0212] The relevant contents of step 502 have been explained in the above step 403, and will not be repeated in this embodiment of the present application.
[0213] Step 503: Generate a mapping relationship between the account address, the n public keys, and the type of each public key in the n public keys.
[0214] The relevant contents of step 503 have been explained in the above step 404, and will not be repeated in this embodiment of the present application.
[0215] Step 504: According to the mapping relationship, a transaction initiated by the user device using the account address is processed, and the transaction is signed using a private key in the n public-private key pairs.
[0216] The relevant contents of step 504 have been explained in the above step 405, and will not be repeated in this embodiment of the present application.
[0217] In an embodiment of the present application, after receiving an account registration request sent by a user device carrying an account address and n public keys, the blockchain system can determine the type of each of the n public keys. The public-private key pairs of different types of public keys have different usage permissions and can be used when processing different transactions. The blockchain system can generate a mapping relationship between the account address, the n public keys, and the type of each of the n public keys, and then process the transaction initiated by the user device using the account address based on the mapping relationship. In this way, hierarchical permission management of accounts can be implemented, thereby improving account security and transaction convenience.
[0218] Figure 6 is a schematic diagram of a blockchain transaction processing device provided in an embodiment of the present application. The device can be applied to a blockchain system. The blockchain system can be Figure 1-Figure 2 Blockchain system 100 of the embodiment. Figure 6 The device includes: a receiving module 601, a determining module 602, a generating module 603 and a processing module 604.
[0219] The receiving module 601 is used to receive an account registration request sent by a user device, where the account registration request carries an account address and n public keys, where the n public keys are public keys in n public-private key pairs generated by the user device, and n is an integer greater than or equal to 2;
[0220] A determination module 602 is used to determine the type of each public key in the n public keys, where the type of each public key is used to indicate the usage rights of the public-private key pair to which each public key belongs, where the usage rights of some of the n public-private key pairs are account management rights, and the usage rights of the other public-private key pairs are general operation rights;
[0221] A generation module 603 is used to generate a mapping relationship between an account address, n public keys, and a type of each of the n public keys;
[0222] The processing module 604 is used to process the transaction initiated by the user device using the account address according to the mapping relationship, and the transaction is signed using the private key of the n public-private key pairs.
[0223] Optionally, the determination module 602 is used to:
[0224] Determine the type of each public key according to the public key generation rule used when each public key in the n public keys is generated; or
[0225] Determine the type of each public key according to the private key generation rule used when generating the private key corresponding to each public key in the n public keys; or
[0226] The type of each public key among the n public keys is determined according to the number of bits of each public key.
[0227] Optionally, the generating module 603 is used to:
[0228] Determine the account address, n public keys, and the type of each of the n public keys as an identity identifier;
[0229] Generate a digital certificate for identity verification;
[0230] The device also includes a sending module, which is used to:
[0231] Send the digital certificate to the user's device so that the user's device can carry the digital certificate when initiating a transaction using the account address; or
[0232] The digital certificate is stored in the blockchain to obtain the storage address of the digital certificate; the storage address of the digital certificate is sent to the user device so that the user device can carry the storage address of the digital certificate when initiating a transaction using the account address.
[0233] Optionally, the generating module 603 is used to:
[0234] The account address, n public keys, and the type of each of the n public keys are stored in the database accordingly.
[0235] Optionally, the processing module 604 is used to:
[0236] After receiving a transaction initiated by a user device using an account address, the target type is determined based on the call information in the transaction. The target type is the type of the public key corresponding to the private key used to sign the transaction;
[0237] Get the public key of the target type from the mapping;
[0238] Use the obtained public key to verify the transaction;
[0239] If the signature verification is passed, the transaction is executed.
[0240] Optionally, the processing module 604 is further configured to:
[0241] Get the state variables in the account data corresponding to the account address;
[0242] If the frozen type in the state variable does not include the target type, the step of obtaining a public key whose type is the target type from the mapping relationship is executed.
[0243] Optionally, the account management authority includes one or more of the following: key freezing authority, key thawing authority, key resetting authority, key cancellation authority, and account freezing authority;
[0244] General operation permissions include one or more permissions among transfer permissions, contract data query permissions, and contract configuration permissions.
[0245] In an embodiment of the present application, after receiving an account registration request sent by a user device carrying an account address and n public keys, the blockchain system can determine the type of each of the n public keys. The public-private key pairs of different types of public keys have different usage permissions and can be used when processing different transactions. The blockchain system can generate a mapping relationship between the account address, the n public keys, and the type of each of the n public keys, and then process the transaction initiated by the user device using the account address based on the mapping relationship. In this way, hierarchical permission management of accounts can be implemented, thereby improving account security and transaction convenience.
[0246] It should be noted that: the blockchain transaction processing device provided in the above embodiment only uses the division of the above-mentioned functional modules as an example when processing blockchain transactions. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0247] The functional units and modules in the above embodiments may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit, and the above integrated units may be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the embodiments of the present application.
[0248] The blockchain transaction processing device and the blockchain transaction processing method embodiment provided in the above embodiments belong to the same concept. The specific working process of the units and modules in the above embodiments and the technical effects brought about can be found in the method embodiment part and will not be repeated here.
[0249] Figure 7This is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. Figure 7 As shown, the computer device 7 includes: a processor 70, a memory 71, and a computer program 72 stored in the memory 71 and executable on the processor 70. When the processor 70 executes the computer program 72, the steps in the blockchain transaction processing method in the above embodiment are implemented.
[0250] The computer device 7 may be a general-purpose computer device or a special-purpose computer device. In a specific implementation, the computer device 7 may be a server cluster composed of multiple servers. Those skilled in the art will appreciate that Figure 7 It is only an example of the computer device 7 and does not constitute a limitation on the computer device 7. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components, such as input and output devices, network access devices, etc.
[0251] The processor 70 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.
[0252] In some embodiments, the memory 71 may be an internal storage unit of the computer device 7, such as a hard disk or memory of the computer device 7. In other embodiments, the memory 71 may also be an external storage device of the computer device 7, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device 7. Further, the memory 71 may also include both an internal storage unit and an external storage device of the computer device 7. The memory 71 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as program codes of computer programs. The memory 71 may also be used to temporarily store data that has been output or is to be output.
[0253] An embodiment of the present application also provides a computer device, which includes: at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor, and when the processor executes the computer program, the steps in any of the above-mentioned method embodiments are implemented.
[0254] An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.
[0255] An embodiment of the present application provides a computer program product, which, when executed on a computer, enables the computer to execute the steps in the above-mentioned method embodiments.
[0256] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned various method embodiments can be implemented. Among them, the computer program includes computer program code, which can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the camera / terminal device, recording medium, computer memory, ROM (Read-Only Memory), RAM (Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0257] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0258] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0259] In the embodiments provided in the present application, it should be understood that the disclosed devices / computer equipment and methods can be implemented in other ways. For example, the device / computer equipment embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as 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 mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0260] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0261] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A blockchain transaction processing method, characterized in that: Applied to a blockchain system, the method includes: Receive an account registration request sent by a user device, where the account registration request carries an account address and n public keys, where the n public keys are public keys in n public-private key pairs generated by the user device, and n is an integer greater than or equal to 2; Determine the type of each public key in the n public keys, the type of each public key is used to indicate the usage authority of the public-private key pair to which each public key belongs, the usage authority of some of the n public-private key pairs is account management authority, and the usage authority of another part of the public-private key pairs is general operation authority; Determine the account address, the n public keys, and the type of each of the n public keys as an identity identifier, and generate a digital certificate for verifying the identity identifier, wherein the digital certificate is used to reflect the mapping relationship between the account address, the n public keys, and the type of each of the n public keys; According to the mapping relationship, processing a transaction initiated by the user device using the account address, wherein the transaction is signed using a private key in the n public-private key pairs; The method further comprises: Sending the digital certificate to the user device, so that the user device carries the digital certificate when initiating a transaction using the account address; or The digital certificate is stored in the blockchain to obtain the storage address of the digital certificate; the storage address of the digital certificate is sent to the user device so that the user device carries the storage address of the digital certificate when initiating a transaction using the account address.
2. The method according to claim 1, characterized in that Determining the type of each public key in the n public keys includes: Determining the type of each of the n public keys according to a public key generation rule used when each public key is generated; or Determining the type of each public key according to a private key generation rule used when generating a private key corresponding to each public key in the n public keys; or The type of each public key is determined according to the number of bits of each public key in the n public keys.
3. The method according to claim 1, characterized in that After determining the type of each public key in the n public keys, the method further includes: The account address, the n public keys, and the type of each of the n public keys are correspondingly stored in a database, and the corresponding storage relationship in the database is used to reflect the mapping relationship between the account address, the n public keys, and the type of each of the n public keys.
4. The method according to claim 1, characterized in that The processing, according to the mapping relationship, of a transaction initiated by the user device using the account address includes: After receiving the transaction initiated by the user device using the account address, determine the target type according to the call information in the transaction, where the target type is the type of the public key corresponding to the private key used when signing the transaction; Obtaining a public key whose type is the target type from the mapping relationship; Use the obtained public key to verify the transaction; If the signature verification is successful, the transaction is executed.
5. The method according to claim 4, characterized in that Before obtaining the public key of the target type from the mapping relationship, the method further includes: Obtaining a state variable in the account data corresponding to the account address; If the frozen type in the state variable does not include the target type, the step of obtaining a public key of the target type from the mapping relationship is performed.
6. The method according to any one of claims 1 to 5, characterized in that: The account management authority includes one or more of the following: key freezing authority, key thawing authority, key resetting authority, key cancellation authority, and account freezing authority; The general operation permissions include one or more permissions among transfer permissions, contract data query permissions, and contract configuration permissions.
7. A blockchain transaction processing device, characterized in that: Applied to a blockchain system, the device comprises: A receiving module, configured to receive an account registration request sent by a user device, wherein the account registration request carries an account address and n public keys, where the n public keys are public keys in n public-private key pairs generated by the user device, and n is an integer greater than or equal to 2; a determination module, used to determine the type of each public key in the n public keys, the type of each public key being used to indicate the permission to use the public-private key pair to which each public key belongs, the permission to use a portion of the n public-private key pairs being account management permissions, and the permission to use another portion of the public-private key pairs being general operation permissions; a generation module, used to determine the account address, the n public keys, and the type of each of the n public keys as an identity identifier, and generate a digital certificate for verifying the identity identifier, wherein the digital certificate is used to reflect the mapping relationship between the account address, the n public keys, and the type of each of the n public keys; a processing module, configured to process, according to the mapping relationship, a transaction initiated by the user device using the account address, wherein the transaction is signed using a private key in the n public-private key pairs; The device further includes a sending module, wherein the sending module is configured to: Sending the digital certificate to the user device, so that the user device carries the digital certificate when initiating a transaction using the account address; or The digital certificate is stored in the blockchain to obtain the storage address of the digital certificate; the storage address of the digital certificate is sent to the user device so that the user device carries the storage address of the digital certificate when initiating a transaction using the account address.
8. A computer device, characterized in that: The computer device comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the method according to any one of claims 1 to 6 when executed by the processor.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Blockchain account processing method and apparatus, and storage medium
CN109716375A
Data security method and device based on block chains, and computer equipment
CN110458558A