Blockchain cross-chain method, system and device, electronic device, storage medium
Through the cross-chain method of using proxy smart contracts and server-side private key signatures on the server, the risk of user private keys being exposed in the cross-chain processing of alliance chains is solved, the security of cross-chain services is improved, and the security of private keys is ensured. sex.
Patent Information
- Application Number
- CN202210331858.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-30
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2042-03-30
AI Technical Summary
In the cross-chain processing of the alliance chain, the user's private key is stored on a centralized cross-chain system, which increases the risk of private key exposure and affects security.
By implementing a cross-chain method on the server, using proxy smart contracts and server-side private key signatures, a business transaction request is initiated to the sub-target blockchain, avoiding the use of user private keys, and ensuring that the server executes business transaction requests after user authorization.
It effectively avoids the risk of user private key leakage, improves the security of cross-chain services, and ensures that the security of user private keys is not exposed.
Smart Images

Figure CN114677137B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of blockchain technology, and in particular to a blockchain cross-chain method, system and device, electronic device, and computer-readable storage medium. Background Art
[0002] The cross-chain of the alliance chain mainly solves two problems: one is the atomic exchange problem of accounts on different alliance chains; the other is the access problem of indirect chains. In related technologies, users pass their private keys and account addresses on multiple blockchains to the cross-chain system through the cross-chain client. After the user initiates a business request involving multiple blockchains to the cross-chain system through the cross-chain client, the cross-chain system can call the contract with the user's private key signature on each blockchain based on the saved multiple sets of private keys and account addresses to operate the user account, thereby executing business involving multiple blockchains.
[0003] However, user private keys are stored in a centralized cross-chain system, increasing the risk of user private keys being exposed. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a blockchain cross-chain method, system and device, electronic device, and computer-readable storage medium for achieving cross-chain without providing a private key.
[0005] On the one hand, the present application provides a blockchain cross-chain method, which is applied to the server, including:
[0006] In response to a service request initiated for a target service, determining at least two sub-target blockchains related to the target service;
[0007] For each sub-target blockchain, a business transaction request is initiated to the proxy smart contract on the sub-target blockchain; wherein the business transaction request includes a server private key signature, and the server private key signature is used on the proxy smart contract to prove that the server is authorized by the user who initiated the business request;
[0008] Return the business processing results returned by the proxy smart contracts on the at least two sub-target blockchains to the source of the business request.
[0009] In one embodiment, initiating a business transaction request to the proxy smart contract on the sub-target blockchain includes:
[0010] Determine the proxy smart contract and business processing parameters corresponding to the sub-target blockchain and the target business;
[0011] According to the server private key of the sub-target blockchain, the service processing parameter is encrypted by the server to obtain the server private key signature corresponding to the sub-target blockchain;
[0012] The business transaction request is constructed according to the business processing parameters and the server private key signature, and the business transaction request is initiated to the proxy smart contract on the sub-target blockchain.
[0013] In one embodiment, the target business indicates a processing order of the at least two sub-target blockchains;
[0014] For each sub-target blockchain, initiating a business transaction request to the proxy smart contract on the sub-target blockchain includes:
[0015] According to the processing order, the business transaction request is initiated to the proxy smart contracts on the at least two sub-target blockchains.
[0016] In one embodiment, initiating the business transaction request to the proxy smart contracts on the at least two sub-target blockchains according to the processing order includes:
[0017] Determine, according to the processing order, a front sub-target blockchain and a rear sub-target blockchain among the at least two sub-target blockchains;
[0018] Initiate a first business transaction request to the proxy smart contract on the first sub-target blockchain;
[0019] Obtain the business processing result returned by the proxy smart contract on the first sub-target blockchain;
[0020] A second business transaction request is constructed based on the business processing result, and the second business transaction request is initiated to the proxy smart contract on the subsequent sub-target blockchain.
[0021] In one embodiment, before determining at least two sub-target blockchains related to the target business in response to the business request initiated for the target business, the method further includes:
[0022] In response to the authorization instruction on each sub-target blockchain, an authorization transaction request is parsed from the authorization instruction; wherein the authorization transaction request includes the address of the server on the sub-target blockchain, business processing parameters, and the user private key signature of the initiator of the authorization instruction;
[0023] For each sub-target blockchain, send an authorization transaction request corresponding to the sub-target blockchain to the proxy smart contract on the sub-target blockchain, so that the proxy smart contract performs authorization based on the address of the server, the business processing parameters and the user private key signature;
[0024] Return the authorization result returned by the proxy smart contract on each sub-target blockchain to the source of the authorization instruction.
[0025] On the one hand, the present application provides a blockchain cross-chain system, including:
[0026] The client is used to send a service request corresponding to the target service in response to an initiation operation for the target service; and receive a service processing result corresponding to the service request;
[0027] The server is connected to the client and is used to respond to a business request initiated for a target business, determine at least two sub-target blockchains related to the target business; for each sub-target blockchain, initiate a business transaction request to the proxy smart contract on the sub-target blockchain; wherein the business transaction request includes a server private key signature, and the server private key signature is used on the proxy smart contract to prove that the server is authorized by the user who initiated the business request; and return the business processing results returned by the proxy smart contracts on the at least two sub-target blockchains to the client.
[0028] In one embodiment,
[0029] The client is further used to construct an authorization transaction request based on the user private key corresponding to each sub-target blockchain; initiate an authorization instruction including the authorization transaction request for each sub-target blockchain, and send the authorization instruction; delete the user private key corresponding to each sub-target blockchain; receive the authorization result corresponding to each sub-target blockchain;
[0030] The server is used to respond to the authorization instruction on each sub-target blockchain and parse the authorization transaction request from the authorization instruction; wherein the authorization transaction request includes the address of the server on the sub-target blockchain, business processing parameters, and the user private key signature of the initiator of the authorization instruction; for each sub-target blockchain, send the authorization transaction request corresponding to the sub-target blockchain to the proxy smart contract on the sub-target blockchain, so that the proxy smart contract performs authorization based on the address of the server, the business processing parameters and the user private key signature; return the authorization result returned by the proxy smart contract on each sub-target blockchain to the source of the authorization instruction.
[0031] On the other hand, the present application also provides a blockchain cross-chain device, which is applied to the server, including:
[0032] A determination module, configured to determine, in response to a service request initiated for a target service, at least two sub-target blockchains related to the target service;
[0033] An initiating module, for initiating a business transaction request to a proxy smart contract on each sub-target blockchain; wherein the business transaction request includes a server private key signature, and the server private key signature is used on the proxy smart contract to prove that the server is authorized by the user who initiated the request;
[0034] The return module is used to return the business processing results returned by the proxy smart contracts on the at least two sub-target blockchains to the source of the business request.
[0035] Furthermore, the present application also provides an electronic device, the electronic device comprising:
[0036] processor;
[0037] a memory for storing processor-executable instructions;
[0038] Wherein, the processor is configured to execute the above-mentioned blockchain cross-chain method.
[0039] In addition, the present application also provides a computer-readable storage medium, which stores a computer program, and the computer program can be executed by a processor to complete the above-mentioned blockchain cross-chain method.
[0040] In the present application scheme, when it is determined that the target business in the business request is related to at least two sub-target blockchains, the server of the cross-chain system can initiate a business transaction request to the proxy smart contract on the sub-target blockchain for each sub-target blockchain; wherein the business transaction request includes a server private key signature, and the server private key signature is used on the proxy smart contract to prove that the server is authorized by the user; the server can return the business processing results corresponding to at least two sub-target blockchains to the source of the business request;
[0041] When processing business across chains, since the server is authorized by the user on each sub-target blockchain, the server private key signature can instruct the proxy smart contract to process business transaction requests; since the server does not need to use the user's private key, the risk of user private key leakage is avoided, thereby improving the security of cross-chain business. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solution of the embodiments of the present application, the drawings required for use in the embodiments of the present application are briefly introduced below.
[0043] Figure 1 A schematic diagram of an application scenario of a blockchain cross-chain method provided in an embodiment of the present application;
[0044] Figure 2 A schematic diagram of the cross-chain interaction of blockchains of related technologies;
[0045] Figure 3 A schematic diagram of the structure of an electronic device provided in one embodiment of the present application;
[0046] Figure 4 A flowchart of a blockchain cross-chain method provided in one embodiment of the present application;
[0047] Figure 5 An embodiment of the present application provides Figure 4 Detailed flow chart of step 420;
[0048] Figure 6 Another embodiment of the present application provides Figure 4 Detailed flow chart of step 420;
[0049] Figure 7 A schematic diagram of a user authorization process provided in an embodiment of the present application;
[0050] Figure 8 A schematic diagram of cross-chain blockchain interaction provided in one embodiment of the present application;
[0051] Fig. 9 A block diagram of a blockchain cross-chain device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0052] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0053] Similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0054] Figure 1 Schematic diagram of the application scenario of the blockchain cross-chain method provided in the embodiment of this application. Figure 1 As shown, the application scenario includes a client 30, a server 40, multiple nodes 50 equipped with blockchain 1, and multiple nodes 60 equipped with blockchain 2; the client 30 can be a user terminal such as a host, a mobile phone, a tablet computer, etc., which is used to send business requests involving cross-chain processing to the server 40; the nodes 50 and 60 can be servers or hosts; the server 40 can be a server, a server cluster or a cloud computing center, which can interact with the nodes 50 and 60 to process business requests involving blockchain 1 and blockchain 2.
[0055] See also Figure 2 , which is a schematic diagram of the cross-chain interaction of blockchains in related technologies, such as Figure 2As shown, the interaction is divided into the registration phase and the cross-chain phase.
[0056] In the registration phase: the client can execute step S201 to initiate user registration to the server based on the private key and account address provided by the user. Here, the client can provide the server with the user's private key and account address in blockchain 1, as well as the user's private key and account address in blockchain 2. The server can execute step S202 to record the private key and account address provided by the client. Further, the server can execute step S203 to allocate a cross-chain account to the user and return it to the client.
[0057] In the cross-chain stage: the client can execute step S204 to initiate a business request to the server through the cross-chain account. The business indicated by the business request involves blockchain 1 and blockchain 2. The server can determine the private key and account address of the business request initiator based on the cross-chain account, and execute step S205 to call the contract to operate the user account with the user private key and account address on blockchain 1 according to business requirements. Blockchain 1 can execute step S206 to return the business processing result to the server. The server can execute step S207 to call the contract to operate the user account with the user private key and account address on blockchain 2 according to business requirements. Blockchain 2 can execute step S208 to return the business processing result to the server. After the server obtains the business processing results of blockchain 1 and blockchain 2, it can execute step S209 to return the business processing result to the client.
[0058] It can be seen that the relevant technology needs to provide the user's private keys and account addresses on multiple blockchains to the server of the cross-chain system during the registration stage, which poses a risk of user private keys being exposed and has low security.
[0059] like Figure 3 As shown, this embodiment provides an electronic device 1, including: at least one processor 11 and a memory 12, Figure 3 A processor 11 is taken as an example. The processor 11 and the memory 12 are connected via a bus 10. The memory 12 stores instructions that can be executed by the processor 11. The instructions are executed by the processor 11 so that the electronic device 1 can execute all or part of the process of the method in the following embodiment. In one embodiment, the electronic device 1 can be the above-mentioned server 40, which is used to execute the blockchain cross-chain method.
[0060] The memory 12 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable red-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, disk or optical disk.
[0061] The present application also provides a computer-readable storage medium, which stores a computer program. The computer program can be executed by the processor 11 to complete the blockchain cross-chain method provided by the present application.
[0062] See also Figure 4 , is a flowchart of a blockchain cross-chain method provided in an embodiment of the present application, such as Figure 4 As shown, the method may include the following steps 410 to 430.
[0063] Step 410: In response to a business request initiated for a target business, determine at least two sub-target blockchains related to the target business.
[0064] Among them, the target business is the business that needs to be executed through smart contracts on at least two blockchains; the sub-target blockchain is the blockchain that contains the smart contract for executing the target business.
[0065] The server can receive a business request corresponding to the target business from the client, and determine at least two sub-target blockchains related to the target business according to the specific content of the target business. For example, if the target business is to write the user's personal data into blockchain 1 and blockchain 2, then blockchain 1 and blockchain 2 are both sub-target blockchains.
[0066] Step 420: For each sub-target blockchain, initiate a business transaction request to the proxy smart contract on the sub-target blockchain; wherein the business transaction request includes a server private key signature, and the server private key signature is used on the proxy smart contract to prove that the server is authorized by the user who initiated the business request.
[0067] Here, the proxy smart contract is used to proxy the server to call the business blockchain on the blockchain to execute specific business. Each sub-target blockchain has a corresponding proxy smart contract, and the server is authorized in each proxy smart contract, so that the server can operate the user account on the sub-target blockchain.
[0068] For each sub-target blockchain, the server constructs a corresponding business transaction request based on the business content corresponding to the sub-target blockchain. The business transaction request is represented in the form of a transaction on the blockchain. The business transaction request carries the server private key signature, which is used to prove that the business transaction request is sent by the server. The server has different addresses and private keys on different sub-target blockchains. When constructing a business transaction request for any sub-target blockchain, the server can generate a server private key signature based on the private key corresponding to the sub-target blockchain.
[0069] Exemplarily, the sub-target blockchain includes blockchain 1 and blockchain 2, and the server has addresses and private keys in both blockchain 1 and blockchain 2. When generating a business transaction request for blockchain 1, the server can generate a server private key signature based on its private key in blockchain 1; when generating a business transaction request for blockchain 2, the server can generate a server private key signature based on its private key in blockchain 2.
[0070] After receiving a business transaction request, the proxy smart contract on each sub-target blockchain can decrypt the server's private key signature based on the server's public key on the sub-target blockchain, and determine whether the business transaction request is sent by the server based on the decryption result. On the one hand, if not, it means that the business transaction request is forged and can be ignored. On the other hand, if yes, the proxy smart contract can determine whether the server is authorized by the user.
[0071] Exemplarily, after any user authorizes the server so that the server can operate the user account on the blockchain, the proxy smart contract can record the mapping relationship between the server address and the user address on the blockchain. When determining that the business transaction request is not forged, the proxy smart contract can search for the server address in multiple recorded mapping relationships, and when the server address is found, it is determined that the server is authorized. Since the same server may be authorized by multiple users, in this case, the business transaction request constructed by the server can include the address of the user who initiated the business request. The proxy smart contract can check whether there is a mapping relationship between the user address and the server address. If it is found, it means that the user address indicates that the user has authorized the server.
[0072] After confirming that the server has been authorized by the user, the proxy smart contract can accept the server's operations on the user account on the sub-target blockchain, thereby executing the business indicated by the business transaction request and returning the business processing results to the server.
[0073] Exemplarily, user A initiates a business request for a target business, and the target business is to count the account balance of user A on blockchain 1 and the account balance of user A on blockchain 2. After receiving the business request, the server can send a business transaction request to the proxy smart contract of blockchain 1 and the proxy smart contract of blockchain 2 respectively. The proxy smart contract of blockchain 1 determines that the business transaction request is not forged based on the server private key signature in the business transaction request, and then determines whether the mapping relationship between the server address and the address of user A has been recorded. If so, the server can be allowed to operate the user account of user A on blockchain 1 to obtain the account balance of user A on blockchain 1. The proxy smart contract of blockchain 1 can return the account balance to the server. Similarly, the proxy smart contract of blockchain 2 can return the account balance of user A on blockchain 2 to the server.
[0074] Step 430: Return the business processing results returned by the proxy smart contracts on at least two sub-target blockchains to the source of the business request.
[0075] After obtaining the business processing results returned by the proxy smart contracts on all sub-target blockchains, the server can send the business processing results to the source of the business request. The client that sent the business request can receive the above business processing results and display the business processing results to the user.
[0076] Through the above measures, when it comes to cross-chain target business, the server authorized by the user can initiate a business transaction request to the proxy smart contract on each sub-target blockchain based on the server private key signature, thereby executing the target business; the server does not need to save and use the user's private key on the blockchain, avoiding the risk of user private key leakage.
[0077] In one embodiment, see Figure 5 An embodiment of the present application provides Figure 4 The detailed flow chart of step 420 is as follows: Figure 5 As shown, when a business transaction request is initiated to the proxy smart contract on each sub-target blockchain, the following steps 510 to 530 may be executed.
[0078] Step 510: Determine the proxy smart contract and business processing parameters corresponding to the sub-target blockchain and the target business.
[0079] Here, the business processing parameters may include the contract address of the business smart contract that executes the specific business, as well as the function name and function parameters of the function used in the business smart contract to execute the business.
[0080] After determining the sub-target blockchain related to the target business, the server can respectively determine the proxy smart contract and business processing parameters corresponding to each sub-target blockchain and the target business.
[0081] For example, the server can record in advance the blockchains related to various businesses, the contract addresses of the proxy smart contracts on each blockchain, the contract addresses of the business smart contracts, the function names, and the function parameters. After receiving the business request corresponding to the target business, the server can search for several sub-target blockchains related to the target business, the contract addresses of the proxy smart contracts on each sub-target blockchain, the contract addresses of the business smart contracts, the function names, and the function parameters.
[0082] For example, the business request may include the blockchain related to the target business, the contract address of the proxy smart contract on each blockchain, the contract address of the business smart contract, the function name, and the function parameters. After the server parses the business request, it can obtain the contract address of the proxy smart contract on each sub-target blockchain, the contract address of the business smart contract, the function name, and the function parameters.
[0083] Step 520: Encrypt the business processing parameters according to the server private key of the server in the sub-target blockchain, and obtain the server private key signature corresponding to the sub-target blockchain.
[0084] Step 530: Construct a business transaction request based on the business processing parameters and the server private key signature, and initiate the business transaction request to the proxy smart contract on the sub-target blockchain.
[0085] For each sub-target blockchain, the server can encrypt the contract address, function name, and function parameters of the business smart contract on the target blockchain based on its own server private key in the sub-target blockchain, thereby obtaining the server private key signature corresponding to the sub-target blockchain.
[0086] For each sub-target blockchain, the server can package the business processing parameters and the server private key signature corresponding to the business processing parameters to generate a business transaction request. The server can initiate a business transaction request to the proxy smart contract on the sub-target blockchain based on the contract address of the proxy smart contract.
[0087] The proxy smart contract on the sub-target blockchain receives the business transaction request, and after verifying the authenticity of the business transaction request based on the server private key signature, it can call the function indicated by the function name on the business smart contract to execute the business based on the contract address, function name, and function parameters of the business smart contract in the business transaction request.
[0088] In one embodiment, the target business indicates a processing order of at least two sub-target blockchains related to the target business.
[0089] In this embodiment, when initiating a business transaction request, the server can initiate a business transaction request to the proxy smart contracts on the at least two sub-target blockchains according to the processing order.
[0090] Exemplarily, user A initiates a business request for a target business, and the target business is to record the first part of user A's personal information on blockchain 1 and the second part of user A's personal information on blockchain 2, and the target business indicates that the first part of personal information should be recorded first, and then the second part of personal information should be recorded. The server can first initiate a business transaction request to the proxy smart contract on blockchain 1, and the business transaction request includes the first part of user A's personal information. If the proxy smart contract on blockchain 1 returns a business processing result indicating successful processing, the server can continue to initiate a business transaction request to the proxy smart contract on blockchain 2, and the business transaction request includes the second part of user A's personal information.
[0091] Through the above measures, when different sub-target blockchains have a sequence in processing the target business, the server can initiate business transaction requests in sequence according to the processing sequence, thereby ensuring that the target business can be executed normally.
[0092] In one embodiment, see Figure 6 , provided in another embodiment of the present application Figure 4 The detailed flow chart of step 420 is as follows: Figure 6 As shown, when a business transaction request is initiated to the proxy smart contract on each sub-target blockchain, the following steps 610 to 640 may be executed.
[0093] Step 610: Determine the front sub-target blockchain and the back sub-target blockchain of at least two sub-target blockchains according to the processing order.
[0094] Here, the earlier sub-target blockchain is the sub-target blockchain with an earlier processing order among the two sub-target blockchains; the later sub-target blockchain is the sub-target blockchain with a later processing order among the two sub-target blockchains.
[0095] The first sub-target blockchain and the second sub-target blockchain are relative concepts. For example, the target business is related to blockchain 1, blockchain 2, and blockchain 3, and the processing order is blockchain 1, blockchain 2, and blockchain 3. At this time, blockchain 1 is the first sub-target blockchain of blockchain 2, and blockchain 2 is the second sub-target blockchain of blockchain 1; blockchain 2 is the first sub-target blockchain of blockchain 3, and blockchain 3 is the second sub-target blockchain of blockchain 2.
[0096] Step 620: Initiate a first business transaction request to the proxy smart contract on the first sub-target blockchain.
[0097] Step 630: Obtain the business processing result returned by the proxy smart contract on the previous sub-target blockchain.
[0098] Step 640: Construct a second business transaction request based on the business processing result, and initiate the second business transaction request to the proxy smart contract on the subsequent sub-target blockchain.
[0099] Here, the first business transaction request is a business transaction request sent to the front sub-target blockchain. The second business transaction request is a business transaction request sent to the back sub-target blockchain.
[0100] In this embodiment, there is data transferred between the front sub-target blockchain and the back sub-target blockchain. After the server initiates a first business transaction request to the proxy smart contract on the front sub-target blockchain and obtains the business processing result corresponding to the first business transaction request, the server can parse the data to be transferred to the back sub-target blockchain from the business processing result. The server can construct a second business transaction request based on the data and initiate the second business transaction request to the proxy smart contract on the back sub-target blockchain.
[0101] Exemplarily, the target business is related to blockchain 1, blockchain 2, and blockchain 3, and the processing order is blockchain 1, blockchain 2, and blockchain 3. The server initiates a business transaction request to the proxy smart contract on blockchain 1 to obtain the first business processing result. The server obtains the data to be passed to blockchain 2 from the first business processing result, and constructs a business transaction request initiated to the proxy smart contract on blockchain 2 with the data, thereby obtaining the second business processing result. The server obtains the data to be passed to blockchain 3 from the second business processing result, and constructs a business transaction request initiated to the proxy smart contract on blockchain 3 with the data, thereby obtaining the third business processing result.
[0102] In one embodiment, see Figure 7 , is a schematic diagram of a user authorization process provided by an embodiment of the present application, such as Figure 7 As shown, the method may include the following steps 710 to 730.
[0103] Step 710: In response to the authorization instruction in each sub-target blockchain, parse the authorization transaction request from the authorization instruction; wherein the authorization transaction request includes the address of the server on the sub-target blockchain, business processing parameters, and the user private key signature of the initiator of the authorization instruction.
[0104] Here, the business processing parameters may include the contract address of the business smart contract that executes the specific business, as well as the function name and function parameters of the function used in the business smart contract to execute the business.
[0105] The server can receive the authorization instruction from the user on each sub-target blockchain from the client, and the authorization instruction instructs the server to perform the authorization task. The server can respond to the authorization instruction and parse the authorization transaction request from it.
[0106] Step 720: For each sub-target blockchain, send an authorization transaction request corresponding to the sub-target blockchain to the proxy smart contract on the sub-target blockchain, so that the proxy smart contract performs authorization based on the server address, business processing parameters and user private key signature.
[0107] After parsing the authorization transaction request corresponding to each sub-target blockchain, the server can send the authorization transaction request to the proxy smart contract on the sub-target blockchain. Here, the server can parse the identifier of the sub-target blockchain and the contract address of the proxy smart contract from the authorization instruction, and then send the authorization transaction request to the proxy smart contract on the sub-target blockchain corresponding to the identifier.
[0108] After receiving the authorization transaction request, the proxy smart contract can decrypt the user's private key signature in the authorization transaction request based on the user's public key in the sub-target blockchain, and determine whether the authorization transaction request is sent by the user himself based on the decryption result. On the one hand, if not, it means that the authorization transaction request is forged and can be ignored. On the other hand, if yes, the proxy smart contract can determine that the user has authorized the server, and the authorized server can operate the data related to the business processing parameters on the user's account. The proxy smart contract can return the authorization result indicating successful authorization to the server.
[0109] Step 730: Return the authorization result returned by the proxy smart contract on each sub-target blockchain to the source of the authorization instruction.
[0110] For any sub-target blockchain, after the server receives the authorization result returned by the proxy smart contract on the sub-target blockchain, it can return the authorization result to the client that sent the authorization instruction, so that the client can display the authorization result to the user. After returning the authorization results of all sub-target blockchains related to the target business to the client, the server can subsequently execute the target business according to its own server private key signature.
[0111] Through the above measures, before executing the business request, an authorization transaction request is initiated to the proxy smart contract on each sub-target blockchain, so that the proxy smart contract executes the user's authorization to the server based on the authorization transaction request, so that the server does not need to use the user's private key when executing the business, avoiding the risk of private key leakage.
[0112] The present application also provides a blockchain cross-chain system, which may include a client and a server, and the client and the server are connected via wired or wireless means.
[0113] The client can be a user terminal equipped with a cross-chain system client application. The user can initiate an operation for the target business on the client, and the client can respond to the initiation of the operation by sending a business request for the target business. Here, the target business involves at least two sub-target blockchains.
[0114] Exemplarily, the client may call an interface corresponding to the target service on the server to initiate a service request.
[0115] The server can be a server, server cluster or cloud computing center equipped with a cross-chain system, which is used to respond to the service request initiated for the target business and determine at least two sub-target blockchains related to the target business. For each sub-target blockchain, a business transaction request is initiated to the proxy smart contract on the sub-target blockchain; wherein the business transaction request includes a server private key signature, and the server private key signature is used on the proxy smart contract to prove that the server is authorized by the user who initiated the service request. Return the business processing results returned by the proxy smart contract on at least two sub-target blockchains to the client.
[0116] The processing flow of the service request by the server is described in detail above and will not be repeated here. After the service processing result is returned by the server, the client can receive the service processing result corresponding to the service request, and the processing result can indicate whether the target service is successfully processed.
[0117] It can be seen that when the business request is initiated, neither the client nor the server uses the user's private key. Instead, the target business is executed on multiple sub-target blockchains by signing with the server's private key to prove that the server is authorized.
[0118] In one embodiment, before initiating a service request, the client is further used to construct an authorization transaction request based on a user private key corresponding to each sub-target blockchain. Initiate an authorization instruction including an authorization transaction request for each sub-target blockchain, and send the authorization instruction. Delete the user private key corresponding to each sub-target blockchain. Receive the authorization result corresponding to each sub-target blockchain.
[0119] The client can obtain the blockchain identifier, user private key, server address, proxy smart contract address and business processing parameters of each sub-target blockchain. For each sub-target blockchain, the client can encrypt the server address and business processing parameters corresponding to the sub-target blockchain according to the user private key corresponding to the sub-target blockchain to obtain the user private key signature.
[0120] For each sub-target blockchain, the client can construct an authorization transaction request based on the user private key signature, server address, and business processing parameters corresponding to the sub-target blockchain. The authorization transaction request is expressed in the form of a transaction on the blockchain. The client can construct an authorization instruction based on the authorization transaction request, the proxy smart contract address on the sub-target blockchain, and the blockchain identifier. The authorization instruction indicates that an authorization transaction request is sent to the proxy smart contract corresponding to the proxy smart contract address on the sub-target blockchain corresponding to the blockchain identifier.
[0121] The client can send the authorization instruction corresponding to each sub-target blockchain to the server, and can receive the authorization result later. The authorization result can indicate whether the authorization is successful. In addition, after constructing the authorization transaction request corresponding to any sub-target blockchain, the client can delete the user private key corresponding to the sub-target blockchain, thereby avoiding the risk of user private key leakage on the client.
[0122] The server is used to respond to the authorization instruction on each sub-target blockchain and parse the authorization transaction request from the authorization instruction; wherein the authorization transaction request includes the address of the server on the sub-target blockchain, business processing parameters, and the user private key signature of the initiator of the authorization instruction. For each sub-target blockchain, the authorization transaction request corresponding to the sub-target blockchain is sent to the proxy smart contract on the sub-target blockchain, so that the proxy smart contract performs authorization based on the address, business processing parameters and user private key signature of the server. The authorization result returned by the proxy smart contract on each sub-target blockchain is returned to the source of the authorization instruction.
[0123] The server's processing flow for authorization transaction requests is detailed in the previous article and will not be repeated here.
[0124] It can be seen that after the authorization process proves that the user has authorized the server through the user's private key signature, the client can delete the user's private key, and the user's private key does not need to be used in subsequent processes, thereby greatly improving security.
[0125] See also Figure 8 , is a schematic diagram of the blockchain cross-chain interaction provided by an embodiment of the present application, such as Figure 8 As shown, the interaction is divided into the authorization stage and the cross-chain stage.
[0126] In the authorization phase: the client can execute step S801 to send the authorization instruction in blockchain 1, which instructs the server to send an authorization transaction request to blockchain 1. The server can execute step S802 to send the authorization transaction request in the authorization instruction to blockchain 1, which instructs the server to authorize so that the server can subsequently operate the user account on blockchain 1. Blockchain 1 can execute step S803 to return the authorization result to the server after authorization. The server can execute step S804 to return the authorization result corresponding to blockchain 1 to the client.
[0127] The client can execute step S805 to send the authorization instruction in blockchain 2, which instructs the server to send an authorization transaction request to blockchain 2. The server can execute step S806 to send the authorization transaction request in the authorization instruction to blockchain 2, which instructs the server to authorize so that the server can subsequently operate the user account on blockchain 2. Blockchain 2 can execute step S807 to return the authorization result to the server after authorization. The server can execute step S808 to return the authorization result corresponding to blockchain 2 to the client.
[0128] In the cross-chain stage: the client can execute step S809 to send a business request to the server, and the business request involves blockchain 1 and blockchain 2. The server can execute step S810 to call the contract on blockchain 1 to operate the user account with the server private key signature according to business requirements. Blockchain 1 can execute step S811 to return the business processing result to the server after processing the business. The server can execute step S812 to call the contract on blockchain 2 to operate the user account with the server private key signature according to business requirements. Blockchain 2 can execute step S813 to return the business processing result to the server after processing the business. The server can execute step S814 to return the business processing result corresponding to the business request to the client.
[0129] Fig. 9 is a block diagram of a blockchain cross-chain device according to an embodiment of the present invention. Fig. 9 As shown, the device may include:
[0130] A determination module 910 is used to determine at least two sub-target blockchains related to the target business in response to a business request initiated for the target business;
[0131] The initiating module 920 is used to initiate a business transaction request to the proxy smart contract on each sub-target blockchain; wherein the business transaction request includes the server private key signature, and the server private key signature is used on the proxy smart contract to prove that the server is authorized by the user who initiates the request;
[0132] The return module 930 is used to return the business processing results returned by the proxy smart contracts on the at least two sub-target blockchains to the source of the business request.
[0133] The implementation process of the functions and effects of each module in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned blockchain cross-chain method, which will not be repeated here.
[0134] In several embodiments provided in the present application, the disclosed devices and methods may also be implemented in other ways. The device embodiments described above are merely schematic, for example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to the multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram may represent a module, a program segment or a part of a code, and a module, a program segment or a part of a code contains one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the box may also occur in an order different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they may sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of boxes in the block diagram and / or the flowchart, can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0135] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0136] If the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program codes.
Claims
1. A blockchain cross-chain method, applied to a server, characterized in that: include: In response to a service request initiated for a target service, determining at least two sub-target blockchains related to the target service; For each sub-target blockchain, a business transaction request is initiated to the proxy smart contract on the sub-target blockchain; the business transaction request includes a server private key signature and the address of the user who initiated the business request, and the server private key signature and the user address are used on the proxy smart contract to prove that the server is authorized by the user who initiated the business request to operate the user account on the sub-target blockchain; Returning the business processing results returned by the proxy smart contracts on the at least two sub-target blockchains to the source of the business request; Among them, the server private key signature and the user's address are used on the proxy smart contract to prove that the server has been authorized by the user who initiated the business request, including: decrypting the server private key signature based on the server's public key on the sub-target blockchain, and judging whether the business transaction request is sent by the server based on the decryption result; if so, the proxy smart contract searches for whether there is a mapping relationship between the user address and the server address. If found, it proves that the server has been authorized by the user who initiated the business request.
2. The method according to claim 1, characterized in that The initiating a business transaction request to the proxy smart contract on the sub-target blockchain includes: Determine the proxy smart contract and business processing parameters corresponding to the sub-target blockchain and the target business; According to the server private key of the sub-target blockchain, the service processing parameter is encrypted by the server to obtain the server private key signature corresponding to the sub-target blockchain; The business transaction request is constructed according to the business processing parameters and the server private key signature, and the business transaction request is initiated to the proxy smart contract on the sub-target blockchain.
3. The method according to claim 1, characterized in that The target business indicates the processing order of the at least two sub-target blockchains; For each sub-target blockchain, initiating a business transaction request to the proxy smart contract on the sub-target blockchain includes: According to the processing order, the business transaction request is initiated to the proxy smart contracts on the at least two sub-target blockchains.
4. The method according to claim 3, characterized in that Initiating the business transaction request to the proxy smart contracts on the at least two sub-target blockchains according to the processing order includes: Determine, according to the processing order, a front sub-target blockchain and a rear sub-target blockchain among the at least two sub-target blockchains; Initiate a first business transaction request to the proxy smart contract on the first sub-target blockchain; Obtain the business processing result returned by the proxy smart contract on the first sub-target blockchain; A second business transaction request is constructed based on the business processing result, and the second business transaction request is initiated to the proxy smart contract on the subsequent sub-target blockchain.
5. The method according to claim 1, characterized in that Before determining at least two sub-target blockchains related to the target business in response to the business request initiated for the target business, the method further includes: In response to the authorization instruction on each sub-target blockchain, an authorization transaction request is parsed from the authorization instruction; wherein the authorization transaction request includes the address of the server on the sub-target blockchain, business processing parameters, and the user private key signature of the initiator of the authorization instruction; For each sub-target blockchain, send an authorization transaction request corresponding to the sub-target blockchain to the proxy smart contract on the sub-target blockchain, so that the proxy smart contract performs authorization based on the address of the server, the business processing parameters and the user private key signature; Return the authorization result returned by the proxy smart contract on each sub-target blockchain to the source of the authorization instruction.
6. A blockchain cross-chain system, characterized in that: include: The client is used to send a service request corresponding to the target service in response to an initiation operation for the target service; Receiving a business processing result corresponding to the business request; A server, connected to the client, configured to respond to a service request initiated for a target service and determine at least two sub-target blockchains related to the target service; For each sub-target blockchain, a business transaction request is initiated to the proxy smart contract on the sub-target blockchain; the business transaction request includes a server private key signature and the address of the user who initiated the business request, and the server private key signature and the user address are used on the proxy smart contract to prove that the server is authorized by the user who initiated the business request to operate the user account on the sub-target blockchain; Returning to the client the business processing results returned by the proxy smart contracts on the at least two sub-target blockchains; Among them, the server private key signature and the user's address are used on the proxy smart contract to prove that the server has been authorized by the user who initiated the business request, including: decrypting the server private key signature based on the server's public key on the sub-target blockchain, and judging whether the business transaction request is sent by the server based on the decryption result; if so, the proxy smart contract searches for whether there is a mapping relationship between the user address and the server address. If found, it proves that the server has been authorized by the user who initiated the business request.
7. The system according to claim 6, characterized in that The client is further configured to construct an authorization transaction request based on a user private key corresponding to each sub-target blockchain; initiate an authorization instruction including the authorization transaction request for each sub-target blockchain, and send the authorization instruction; Delete the user private key corresponding to each sub-target blockchain; Receive authorization results corresponding to each sub-target blockchain; The server is used to respond to the authorization instruction on each sub-target blockchain and parse the authorization transaction request from the authorization instruction; wherein the authorization transaction request includes the address of the server on the sub-target blockchain, business processing parameters, and the user private key signature of the initiator of the authorization instruction; for each sub-target blockchain, send the authorization transaction request corresponding to the sub-target blockchain to the proxy smart contract on the sub-target blockchain, so that the proxy smart contract performs authorization based on the address of the server, the business processing parameters and the user private key signature; return the authorization result returned by the proxy smart contract on each sub-target blockchain to the source of the authorization instruction.
8. A blockchain cross-chain device, applied to a server, characterized in that: include: A determination module, configured to determine, in response to a service request initiated for a target service, at least two sub-target blockchains related to the target service; An initiating module is used to initiate a business transaction request to the proxy smart contract on each sub-target blockchain; the business transaction request includes a server private key signature and an address of a user who initiates the business request, and the server private key signature and the user address are used on the proxy smart contract to prove that the server is authorized by the user who initiates the request to operate the user account on the sub-target blockchain; A return module, used to return the business processing results returned by the proxy smart contracts on the at least two sub-target blockchains to the source of the business request; Among them, the server private key signature and the user's address are used on the proxy smart contract to prove that the server has been authorized by the user who initiated the business request, including: decrypting the server private key signature based on the server's public key on the sub-target blockchain, and judging whether the business transaction request is sent by the server based on the decryption result; if so, the proxy smart contract searches for whether there is a mapping relationship between the user address and the server address. If found, it proves that the server has been authorized by the user who initiated the business request.
9. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing processor-executable instructions; Wherein, the processor is configured to execute the blockchain cross-chain method described in any one of claims 1-5.
10. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and the computer program can be executed by a processor to complete the blockchain cross-chain method described in any one of claims 1-5.
Citation Information
Patent Citations
Blockchain-based data processing method, device and blockchain node network
CN108305056A
Trans-chain user identity and digital asset management system
CN108880794A
Transaction processing method of block chain, client and block chain network
CN109785136A
Block chain verification code application method and device and storage medium
CN109961292A
Double-agent cross-domain authentication system based on identification password and alliance chain
CN110177109A
