A communication method and device between a decentralized application (DAPP) and a digital wallet

By directly monitoring topics on the blockchain system, symmetric keys and elliptic curve cryptography are used to generate topics between DAPP and digital wallets, solving the system complexity and cost problems caused by relying on third-party services and achieving secure and highly private communication.

CN119341828BActive Publication Date: 2025-09-12WEBANK (CHINA)
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411513459.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-28
Publication Date
2025-09-12
Estimated Expiration
2044-10-28

AI Technical Summary

Technical Problem

The communication between existing decentralized applications (DAPP) and digital wallets relies on third-party centralized services, which increases system complexity and costs, and poses a risk of communication content leakage.

Method used

By monitoring topics through the blockchain system, DAPP and digital wallets communicate directly, using symmetric keys and elliptic curve cryptography to generate topics, ensuring communication security and privacy, and avoiding dependence on third-party services.

Benefits of technology

It enables secure and private communication between DAPP and digital wallets, reduces system deployment costs, improves fault tolerance, and avoids the leakage of communication content.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119341828B_ABST
    Figure CN119341828B_ABST
Patent Text Reader

Abstract

This application provides a communication method and apparatus between a decentralized application (DAPP) and a digital wallet, including: the DAPP publishes a first message to a first topic monitored by a blockchain system; the first message carries first indication information indicating a first generated element; the DAPP obtains a second message from the first topic via the blockchain system, the second message being published to the first topic by the digital wallet; the second message carries second indication information indicating a second generated element; the second generated element is used by the digital wallet to generate a second topic monitored by the blockchain system based on the first generated element obtained by decrypting the first message; the DAPP obtains the second generated element based on decrypting the second message, and determines the second topic based on the second generated element. The DAPP then communicates with the digital wallet via the second topic. This solution enables communication between the DAPP and the digital wallet without the need for third-party services.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a communication method and device between a decentralized application (DAPP) and a digital wallet. Background Art

[0002] In the web3 world, Dapps are decentralized applications running on blockchain systems. Users interact with Dapps using digital wallets, and Dapps can request user addresses or sign transactions from digital wallets. Due to the decentralized nature of Dapps, they do not control users' assets or private keys. To enable interaction between Dapps and digital wallets, communication between them is necessary. Currently, the mainstream communication method between Dapps and digital wallets is achieved through third-party services. Both Dapps and digital wallets connect to third-party communication services and use these third-party services to transmit messages.

[0003] This type of third-party service is generally centralized. When problems occur, it will cause a large number of Dapps and digital wallets that rely on this service to malfunction. On the other hand, as a centralized message service, for application scenarios such as consortium chains, it is necessary to build or use this type of message forwarding service outside the blockchain system, which will increase costs and system complexity. Summary of the Invention

[0004] This application provides a method and device for communication between a decentralized application (DAPP) and a digital wallet, which can realize communication between DAPP and a digital wallet without the help of third-party services.

[0005] In a first aspect, embodiments of the present application provide a communication method between a decentralized application (DAPP) and a digital wallet. This method, applied to the DAPP, can be performed by a communication device between the decentralized application (DAPP) and the digital wallet. The communication device between the decentralized application (DAPP) and the digital wallet can be a terminal device or a module for a terminal device, or a server or a module for a server. This application does not limit the subject performing the method. The method comprises: the DAPP publishes a first message to a first topic monitored by a blockchain system; the first message carries first indication information indicating a first generated element; the DAPP obtains a second message from the first topic via the blockchain system; the second message is published to the first topic by the digital wallet; the second message carries second indication information indicating a second generated element; the second generated element is used by the digital wallet to generate a second topic monitored by the blockchain system based on the first generated element obtained by decrypting the first message; the DAPP decrypts the second message to obtain the second generated element, and determines the second topic based on the second generated element; the DAPP communicates with the digital wallet via the second topic.

[0006] In the above scheme, on the one hand, the second topic is determined by the first generated element corresponding to the Dapp and the second generated element corresponding to the digital wallet. The second topic is only used for communication between the Dapp and the digital wallet, and has strong privacy, so it can achieve effective communication between the Dapp and the digital wallet; on the other hand, the second topic is generated by the Dapp itself after decrypting the second message, and is not obtained from the blockchain system. Therefore, the blockchain system cannot obtain the second topic, and therefore will not maliciously pass the second topic to other clients, causing the leakage of the communication content between the Dapp and the digital wallet; even if other clients obtain the second message, it is difficult to obtain the second topic due to the first generated element and the second generated element; on the other hand, the blockchain system monitors the second topic, and the digital wallet and the Dapp themselves are also applications of the blockchain system. Therefore, the digital wallet and the Dapp can effectively communicate through the second topic monitored by the blockchain system without the need for third-party services, reducing the deployment cost brought by centralized services and improving the system's fault tolerance.

[0007] In one possible implementation method, the Dapp generates a first symmetric key and determines the first subject based on the first symmetric key; the first symmetric key and the first subject are shared with the digital wallet in a preset manner; the Dapp encrypts the first generated element based on the first symmetric key to obtain the first message.

[0008] The above scheme shares the first symmetric key and the first subject to the digital wallet in a preset manner, so that the digital wallet can obtain the first subject in a preset manner; after the digital wallet obtains the first subject, it can obtain the first message by monitoring the first subject; after the digital wallet obtains the first symmetric key, it can decrypt the first message using the first symmetric key to obtain the first generated element, and then accurately and effectively determine the second subject based on the first generated element and the second generated element.

[0009] In one possible implementation method, the Dapp generates a first public key and a first private key based on elliptic curve cryptography, and encrypts the first public key using the first symmetric key to obtain the first message; wherein the first public key and the first private key are a pair of asymmetric keys.

[0010] The above scheme can accurately and effectively determine the first message; wherein, the first public key is encrypted using the first symmetric key to obtain the first message, which enables the digital wallet to decrypt the first message to obtain the first public key after obtaining the first symmetric key, and then determine the second topic based on the first public key and the second generated element corresponding to the digital wallet, so that the second topic contains both the first public key of the Dapp and the information of the digital wallet, thereby increasing the privacy of the second topic, ensuring the security of the second topic, and further ensuring the security of the communication content between the Dapp and the digital wallet based on the second topic.

[0011] In one possible implementation method, the Dapp uses the first symmetric key to decrypt the second message to obtain a second public key; the second message is generated by the digital wallet based on the first public key and the second private key obtained by decrypting the first message; the second public key and the second private key are asymmetric keys generated by the digital wallet based on elliptic curve cryptography; determining the second subject through the second generated element includes: the Dapp determines the second symmetric key based on the second public key and the first private key; the Dapp determines the second subject based on the second symmetric key.

[0012] The above solution enables the Dapp to accurately and effectively obtain the second public key corresponding to the digital wallet and accurately generate the second subject based on the second public key and the first private key. Based on elliptic curve cryptography, it can ensure that the second subject generated by the Dapp is consistent with the second subject generated by the digital wallet. In other words, although the digital wallet does not upload the second subject to the blockchain system, the Dapp can generate the second subject based on the second message and ensure that the second subject generated by the Dapp is consistent with the second subject generated by the digital wallet, thus achieving effective communication between the Dapp and the digital wallet. The Dapp can generate the second subject based on the second message, ensuring that the second subject will not be leaked, thus ensuring the security of communication between the Dapp and the digital wallet.

[0013] In one possible implementation method, the Dapp uses the second symmetric key to encrypt the information to be communicated to determine a third message; the Dapp publishes the third message to the second topic, thereby communicating with the digital wallet.

[0014] In the above solution, Dapp encrypts the information to be communicated and publishes it to the second topic, which can ensure that the blockchain system cannot obtain the content of the information to be communicated, ensuring the security of communication between Dapp and digital wallet.

[0015] In one possible implementation method, the Dapp obtains a verification message through the second topic; the verification message includes the interface information supported by the digital wallet; the Dapp determines whether the interface information supported by the digital wallet is met; if so, the Dapp generates a verification response message for the verification message and publishes the verification response message to the second message topic.

[0016] The above scheme, by verifying the message, can, on the one hand, determine that the Dapp has monitored the second topic, and therefore can effectively communicate with the digital wallet based on the second topic; on the other hand, if the Dapp does not meet the interface information supported by the digital wallet, it can still communicate with the digital wallet, which will cause the Dapp to obtain additional information that does not meet the conditions, resulting in information leakage of the digital wallet; therefore, when the Dapp determines that it meets the interface information supported by the digital wallet, it can communicate with the digital wallet to protect the information of the digital wallet.

[0017] In a second aspect, embodiments of the present application provide a communication method between a decentralized application (DAPP) and a digital wallet, applicable to the digital wallet. This method can be performed by a communication device between the decentralized application (DAPP) and the digital wallet, which can be a terminal device or a module for a terminal device, or a server or a module for a server. This application does not limit the execution entity of this method. The method includes: the digital wallet obtains a first message from a first topic via a blockchain system, the first message being published to the first topic by the DAPP; the first message carries first indication information indicating a first generated element; the digital wallet obtains the first generated element based on the decrypted first message, and generates a second topic based on the first and second generated elements; the digital wallet obtains a second message based on the second topic and publishes the second message to the first topic; and the digital wallet communicates with the DAPP via the second topic.

[0018] In the above scheme, on the one hand, the second topic is determined by the first generated element corresponding to the Dapp and the second generated element corresponding to the digital wallet. The second topic is only used for communication between the Dapp and the digital wallet, and has strong privacy, thus enabling effective communication between the Dapp and the digital wallet. On the other hand, the blockchain system monitors the second topic. The digital wallet and the Dapp are also applications of the blockchain system. Therefore, the digital wallet and the Dapp can communicate effectively through the second topic monitored by the blockchain system without the need for third-party services, reducing the deployment cost brought by centralized services and improving the system's fault tolerance.

[0019] In one possible implementation method, the digital wallet obtains the first symmetric key and the first subject in a preset manner; the first symmetric key is generated by the Dapp.

[0020] In the above scheme, after the digital wallet obtains the first topic, it can obtain the first message by monitoring the first topic; after the digital wallet obtains the first symmetric key, it can decrypt the first message with the first symmetric key to obtain the first generated element, and then accurately and effectively determine the second topic based on the first generated element and the second generated element. In one possible implementation method, the digital wallet decrypts the first message based on the first symmetric key to obtain the first public key; the first public key is the public key in the asymmetric key generated by the Dapp based on elliptic curve cryptography; the digital wallet generates the second public key and the second private key based on elliptic curve cryptography, and generates the second symmetric key based on the first public key and the second private key; wherein, the second public key and the second private key are a pair of asymmetric keys; the digital wallet determines the second topic based on the second symmetric key.

[0021] The above solution can accurately and effectively determine the second topic. Based on elliptic curve cryptography, it can ensure that the second topic generated by the Dapp is consistent with the second topic generated by the digital wallet, realizing effective communication between the Dapp and the digital wallet.

[0022] In one possible implementation method, the digital wallet uses the first symmetric key to encrypt the second public key to obtain the second message; wherein, the second public key is the public key corresponding to the second private key in the second subject.

[0023] The above scheme can accurately and effectively determine the second message; and can enable Dapp to obtain the second public key by decrypting the received second message according to the first symmetric key, thereby accurately and effectively determining the second topic.

[0024] In one possible implementation method, the digital wallet uses the second symmetric key to encrypt the information to be communicated to determine the fourth message; the digital wallet publishes the fourth message to the second topic, thereby communicating with the Dapp.

[0025] In the above solution, the digital wallet encrypts the information to be communicated and publishes it to the second topic, which can ensure that the blockchain system cannot obtain the content of the information to be communicated, thereby ensuring the security of communication between Dapp and digital wallet.

[0026] In a possible implementation method, the digital wallet publishes a verification message to a second topic, where the verification message includes interface information supported by the digital wallet.

[0027] In the above scheme, if the digital wallet receives a response message from Dapp indicating that the verification is successful, it is determined that Dapp has been monitoring the second topic, and thus effective communication between the digital wallet and Dapp can be achieved; if the digital wallet does not receive a response message from Dapp, it means that Dapp and the digital wallet have not been able to establish effective communication; if the digital wallet receives a response message from Dapp indicating that the verification is unsuccessful, it means that Dapp does not support the interface information corresponding to the digital wallet, and communication between Dapp and the digital wallet is impossible; in summary, the digital wallet publishes the verification message to the second topic, which enables effective communication between the digital wallet and Dapp.

[0028] In a third aspect, an embodiment of the present application provides a communication device between a decentralized application (DAPP) and a digital wallet, comprising: a transceiver unit and a processing unit. The transceiver unit is used to publish a first message to a first topic monitored by a blockchain system; the first message carries first indication information indicating a first generated element; a second message is obtained from the first topic through the blockchain system, and the second message is published by the digital wallet to the first topic; the second message carries second indication information indicating a second generated element; the second generated element is used by the digital wallet to generate a second topic monitored by the blockchain system based on the first generated element obtained by decrypting the first message; communicate with the digital wallet through the second topic; the processing unit is used to obtain the second generated element based on the decryption of the second message, and determine the second topic through the second generated element.

[0029] In one possible implementation method, the processing unit is configured to generate a first symmetric key and determine the first subject based on the first symmetric key; the first symmetric key and the first subject are shared with the digital wallet in a preset manner; and the first generated element is encrypted based on the first symmetric key to obtain the first message.

[0030] In one possible implementation method, the processing unit is used to generate a first public key and a first private key based on elliptic curve cryptography, and encrypt the first public key using the first symmetric key to obtain the first message; wherein the first public key and the first private key are a pair of asymmetric keys.

[0031] In one possible implementation method, the processing unit is used to decrypt the second message using the first symmetric key to obtain a second public key; the second message is generated by the digital wallet based on the first public key and the second private key obtained by decrypting the first message; the second public key and the second private key are asymmetric keys generated by the digital wallet based on elliptic curve cryptography; the processing unit is used to determine the second symmetric key based on the second public key and the first private key; and determine the second subject based on the second symmetric key.

[0032] In one possible implementation method, the processing unit is used to encrypt the information to be communicated using the second symmetric key to determine the third message; the transceiver unit is used to publish the third message to the second topic, thereby communicating with the digital wallet.

[0033] In one possible implementation method, the transceiver unit is used to obtain a verification message through the second topic; the verification message includes the interface information supported by the digital wallet; the Dapp determines whether the interface information supported by the digital wallet is met; if so, the Dapp generates a verification response message for the verification message and publishes the verification response message to the second message topic.

[0034] In a fourth aspect, an embodiment of the present application provides a communication device between a decentralized application (DAPP) and a digital wallet, comprising: a transceiver unit and a processing unit. The transceiver unit is configured to obtain a first message from a first topic via a blockchain system, where the first message is published by the DAPP to the first topic; the first message carries first indication information indicating a first generated element; obtain a second message based on a second topic and publish the second message to the first topic; communicate with the DAPP via the second topic; and the processing unit is configured to obtain the first generated element based on the decrypted first message and generate the second topic based on the first generated element.

[0035] In one possible implementation method, the processing unit is used to obtain a first symmetric key and the first subject in a preset manner; the first symmetric key is generated by the Dapp.

[0036] In one possible implementation method, the processing unit is configured to decrypt the first message based on the first symmetric key to obtain a first public key; the first public key is the public key in the asymmetric key generated by the Dapp based on elliptic curve cryptography; the digital wallet generates a second public key and a second private key based on elliptic curve cryptography, and generates a second symmetric key based on the first public key and the second private key; wherein the second public key and the second private key are a pair of asymmetric keys; the digital wallet determines the second subject based on the second symmetric key.

[0037] In one possible implementation method, the processing unit is used to use the first symmetric key to encrypt the second public key to obtain the second message; wherein, the second public key is the public key corresponding to the second private key in the second subject.

[0038] In one possible implementation method, the processing unit is used to encrypt the information to be communicated using the second symmetric key to determine the fourth message; the transceiver unit is used to publish the fourth message to the second topic, thereby communicating with the Dapp.

[0039] In a possible implementation method, the transceiver unit is used to publish a verification message to a second topic, where the verification message includes interface information supported by the digital wallet.

[0040] In a fifth aspect, an embodiment of the present application further provides a computing device, including:

[0041] a memory for storing program instructions;

[0042] The processor is used to call the program instructions stored in the memory, and execute any method for implementing the above-mentioned first aspect or any method for implementing the above-mentioned second aspect according to the obtained program instructions.

[0043] In a sixth aspect, an embodiment of the present application further provides a computer-readable storage medium storing computer-readable instructions. When a computer reads and executes the computer-readable instructions, any method of the above-mentioned first aspect or any method of the above-mentioned second aspect is implemented.

[0044] In the seventh aspect, an embodiment of the present application provides a computer program product, including a computer program that can be executed by a computer device. When the program is run on the computer device, the computer device executes any method for implementing the above-mentioned first aspect, or executes any method for implementing the above-mentioned second aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 A system architecture diagram of a communication method between a decentralized application (DAPP) and a digital wallet provided in an embodiment of the present application;

[0046] Figure 2 A flowchart of a communication method between a decentralized application (DAPP) and a digital wallet provided in an embodiment of the present application;

[0047] Figure 3 A schematic diagram of a process for determining a first message provided in an embodiment of the present application;

[0048] Figure 4 A flowchart of a communication method between a decentralized application (DAPP) and a digital wallet provided in an embodiment of the present application;

[0049] Figure 5 A flowchart of a communication method between a decentralized application (DAPP) and a digital wallet provided in an embodiment of the present application;

[0050] Figure 6 A schematic diagram of a process for determining a second topic provided in an embodiment of the present application;

[0051] Figure 7 A flowchart of a communication method between a decentralized application (DAPP) and a digital wallet provided in an embodiment of the present application;

[0052] Figure 8 A flowchart of a communication method between a decentralized application (DAPP) and a digital wallet provided in an embodiment of the present application;

[0053] Figure 9 A flowchart of a communication method between a decentralized application (DAPP) and a digital wallet provided in an embodiment of the present application;

[0054] Figure 10 A schematic diagram of the structure of a communication device between a decentralized application (DAPP) and a digital wallet provided in an embodiment of the present application;

[0055] Figure 11 A schematic diagram of the structure of a communication device between a decentralized application (DAPP) and a digital wallet provided in an embodiment of the present application. DETAILED DESCRIPTION

[0056] Figure 1 A system architecture diagram of a communication method between a decentralized application (DAPP) and a digital wallet provided in an embodiment of the present application, including a DAPP terminal, a blockchain system, and a digital wallet; wherein the blockchain system includes at least one blockchain node, and the DAPP terminal and the digital wallet are respectively connected to any blockchain node in the blockchain system; the DAPP terminal and the digital wallet can be connected to the same blockchain node or to different blockchain nodes, which is not limited in this application.

[0057] In the web3 world, Dapps are decentralized applications, typically based on blockchains. They don't hold users' private keys. Like traditional applications, Dapps provide users with functionality or utilities. The user's private keys are stored in a wallet application. When a user interacts with a Dapp, the Dapp may request authentication, transaction signatures, and other operations. This requires communication between the Dapp and the user's wallet. Due to the decentralized nature of Dapps, this communication requires a third-party service.

[0058] In the Web3 space, a digital wallet is a tool used to store and manage a user's cryptocurrency and interact with the blockchain.

[0059] Optionally, any two blockchain nodes support a p2p (peer-to-peer) network and a message transmission protocol based on topic addressing (such as the amop protocol); wherein the amop protocol implements message transmission between blockchain nodes using topic addressing, so that clients listening to the same topic can pass messages.

[0060] Figure 2 This is a flowchart of a communication method between a decentralized application (DAPP) and a digital wallet, provided in an embodiment of the present application. This method is applied to the DAPP side. This method can be executed by a communication device between the decentralized application (DAPP) and the digital wallet. The communication device between the decentralized application (DAPP) and the digital wallet can be a terminal device or a module for a terminal device, or a server or a module for a server. This application does not limit the execution entity of this method.

[0061] The method comprises the following steps:

[0062] Step 201: The Dapp publishes a first message to a first topic monitored by the blockchain system.

[0063] The first message carries first indication information indicating a first generated element.

[0064] In one possible implementation method, before the Dapp publishes a first message to a first topic monitored by the blockchain system, the method further includes: the Dapp sends a first connection request to the first blockchain node; the first connection request is used by the Dapp to request to establish a connection with the first blockchain node; the first blockchain node is any node of the blockchain system; and the Dapp receives an indication of successful connection sent by the first blockchain node.

[0065] In one possible implementation, the Dapp generates a first topic and instructs the first blockchain node to listen to the first topic. The first topic represents the topic of a message queue that the blockchain node listens to, enabling messages to be passed between clients listening to the first topic. The message queue resides in the blockchain system or another system connected to the blockchain system, though this application does not limit this.

[0066] In one possible implementation method, the first blockchain node synchronizes the event of the Dapp listening to the first topic to other blockchain nodes, so that other blockchain nodes can know the association between the Dapp and the first topic. That is to say, even if there are other applications connected to the first blockchain node, but the other applications are not related to the first topic, after the first blockchain node obtains the message by listening to the first topic, it will not pass the message corresponding to the first message to other applications.

[0067] In one possible implementation, the first blockchain node synchronizes the first message to other blockchain nodes that are listening for the first message. If no other blockchain nodes are listening for the first message, the first blockchain node stores the first message locally.

[0068] In one possible implementation, the first generated element is used to indicate the Dapp-side element that determines the second theme. The second theme is determined by the elements of the Dapp and the digital wallet, making it impossible for other clients to crack the second theme, ensuring the security of communication between the Dapp and the digital wallet.

[0069] Optionally, the first generated element is a key generated by the Dapp end.

[0070] In step 202, the Dapp obtains a second message from the first topic through the blockchain system.

[0071] The second message is published by the digital wallet to the first topic; the second message carries second indication information indicating a second generated element; the second generated element is used by the digital wallet to generate a second topic monitored by the blockchain system based on the first generated element obtained by decrypting the first message.

[0072] In one possible implementation method, the first blockchain node obtains the second message by monitoring the first topic and sends the second message to the Dapp.

[0073] In one possible implementation method, the second generated element is used to indicate an element of a digital wallet end that determines the second theme.

[0074] Optionally, the second generated element is a key generated by the digital wallet.

[0075] In step 203, the Dapp obtains the second generated element based on decrypting the second message, and determines the second topic through the second generated element.

[0076] The second topic is used to represent another topic of the message queue monitored by the blockchain node, so that messages can be transmitted between clients monitoring the second topic.

[0077] In one possible implementation method, the Dapp instructs the first blockchain node to monitor the second topic.

[0078] In one possible implementation method, the first blockchain node synchronizes the Dapp's monitoring of the second topic to other blockchain nodes. In step 204, the Dapp communicates with the digital wallet via the second topic.

[0079] In one possible implementation method, the Dapp encrypts the content to be communicated and publishes it to the second topic; the first blockchain node synchronizes the encrypted content to be communicated to other blockchain nodes that monitor the second topic.

[0080] In the above scheme, on the one hand, the second topic is determined by the first generated element corresponding to the Dapp and the second generated element corresponding to the digital wallet. The second topic is only used for communication between the Dapp and the digital wallet, and has strong privacy, so it can achieve effective communication between the Dapp and the digital wallet; on the other hand, the second topic is generated by the Dapp itself after decrypting the second message, and is not obtained from the blockchain system. Therefore, the blockchain system cannot obtain the second topic, and therefore will not maliciously pass the second topic to other clients, causing the leakage of the communication content between the Dapp and the digital wallet; even if other clients obtain the second message, it is difficult to obtain the second topic due to the first generated element and the second generated element; on the other hand, the blockchain system monitors the second topic, and the digital wallet and the Dapp themselves are also applications of the blockchain system. Therefore, the digital wallet and the Dapp can effectively communicate through the second topic monitored by the blockchain system without the need for third-party services, reducing the deployment cost brought by centralized services and improving the system's fault tolerance.

[0081] In one embodiment, the above step 201 further includes determining the first topic and the first message. Figure 3 As shown, the following steps are included:

[0082] In step 301, the Dapp generates a first symmetric key and determines the first subject according to the first symmetric key.

[0083] The first symmetric key and the first subject are shared to the digital wallet in a preset manner.

[0084] In one possible implementation method, the Dapp generates a first symmetric key locally, and the first symmetric key is used to symmetrically encrypt messages sent to the blockchain p2p network.

[0085] In one possible implementation method, the first symmetric key is hashed to obtain the first subject. This application does not limit the hash algorithm. Of course, this application can also determine the first subject in other ways, such as re-encrypting the first symmetric key to obtain the first subject, or randomly generating characters of a certain length as the first subject. This application does not limit the method for determining the first subject. The determination of the first subject is to enable the digital wallet to obtain the first message by monitoring the first subject, and the Dapp to obtain the second message by monitoring the first subject; after the Dapp and the digital wallet determine to communicate through the second subject, the first subject can be destroyed.

[0086] In one possible implementation method, an access link is generated based on the first symmetric key and the first subject, and the access link is displayed. The access link includes, but is not limited to, a QR code or a uniform resource locator (URL). The digital wallet obtains the first symmetric key and the first subject by scanning the QR code or clicking the URL.

[0087] The digital wallet can obtain the first topic by scanning the QR code or clicking the URL. Of course, other clients can also obtain the first topic by scanning the QR code or clicking the URL. Therefore, other clients may also monitor the first topic. If the digital wallet and the Dapp are always communicating on the first topic, other clients may obtain the communication content between the digital wallet and the Dapp, resulting in the privacy leakage of the digital wallet and the Dapp. Therefore, the digital wallet and the Dapp of this application communicate on the second topic. Other clients cannot obtain the second topic and therefore cannot obtain the communication content between the digital wallet and the Dapp.

[0088] In step 302 , the Dapp encrypts the first generated element based on the first symmetric key to obtain the first message.

[0089] In one possible implementation method, the Dapp generates a first public key and a first private key based on elliptic curve cryptography, and encrypts the first public key using the first symmetric key to obtain the first message; wherein the first public key and the first private key are a pair of asymmetric keys; and the first generated element corresponds to the first public key.

[0090] Optionally, the asymmetric key pair here is generated using an elliptic curve cryptography algorithm, for example, the ed25519 curve can be used. Assuming that the generator of the curve is G, then sk1·G=pk1; where sk1 is the first private key and pk1 is the first public key.

[0091] The above scheme shares the first symmetric key and the first subject to the digital wallet in a preset manner, so that the digital wallet can obtain the first subject in a preset manner; after the digital wallet obtains the first subject, it can obtain the first message by monitoring the first subject; after the digital wallet obtains the first symmetric key, it can decrypt the first message using the first symmetric key to obtain the first generated element, and then accurately and effectively determine the second subject based on the first generated element and the second generated element.

[0092] In one embodiment, after the Dapp obtains the second message, the following steps are further included: Figure 4 As shown:

[0093] Step 401: The Dapp uses the first symmetric key to decrypt the second message to obtain a second public key.

[0094] The second message is generated by the digital wallet based on the first public key and the second private key obtained by decrypting the first message; the second public key and the second private key are asymmetric keys generated by the digital wallet based on elliptic curve cryptography.

[0095] In step 402, the Dapp determines a second symmetric key based on the second public key and the first private key.

[0096] In one possible implementation method, Dapp determines the second symmetric key by calculating sp2=sk1·pk2=sk1·sk2·G; wherein sp2 is the second symmetric key, sk1 is the first private key, pk2 is the second public key, and sk2 is the second private key.

[0097] Step 403: The Dapp determines the second topic based on the second symmetric key.

[0098] In one possible implementation method, the second symmetric key is hashed to obtain the second subject. This application does not limit the hash algorithm. Of course, this application can also determine the second subject by other means, but the second subject determined by the Dapp must be consistent with the second subject determined by the digital wallet.

[0099] Step 404: The Dapp communicates with the digital wallet through the second topic.

[0100] The above solution enables the Dapp to accurately and effectively obtain the second public key corresponding to the digital wallet and accurately generate the second subject based on the second public key and the first private key. Based on elliptic curve cryptography, it can ensure that the second subject generated by the Dapp is consistent with the second subject generated by the digital wallet. In other words, although the digital wallet does not upload the second subject to the blockchain system, the Dapp can generate the second subject based on the second message and ensure that the second subject generated by the Dapp is consistent with the second subject generated by the digital wallet, thus achieving effective communication between the Dapp and the digital wallet. The Dapp can generate the second subject based on the second message, ensuring that the second subject will not be leaked, thus ensuring the security of communication between the Dapp and the digital wallet.

[0101] In one possible implementation, the Dapp uses the second symmetric key to encrypt the information to be communicated, determining a third message. The Dapp then publishes the third message to the second topic, thereby communicating with the digital wallet. Upon receiving the third message, the first blockchain node synchronizes it with other blockchain nodes monitoring the second topic. This solution, in which the Dapp encrypts the information to be communicated and publishes it to the second topic, ensures that the blockchain system cannot access the content of the information to be communicated, thus ensuring the security of communication between the Dapp and the digital wallet.

[0102] In one embodiment, before the Dapp communicates with the digital wallet through the second topic, the process further includes: the Dapp obtains a verification message through the second topic; the verification message includes the interface information supported by the digital wallet; the Dapp determines whether the interface information supported by the digital wallet is satisfied; if satisfied, the Dapp generates a verification response message for the verification message, and publishes the verification response message to the second topic. Subsequently, the Dapp communicates with the digital wallet through the second topic.

[0103] If not, the Dapp generates a verification failure response message for the verification message and publishes the verification failure response message to the second message topic. The digital wallet receives the verification failure response message and stops communicating with the Dapp.

[0104] The above scheme, by verifying the message, can, on the one hand, determine that the Dapp has monitored the second topic, and therefore can effectively communicate with the digital wallet based on the second topic; on the other hand, if the Dapp does not meet the interface information supported by the digital wallet, it can still communicate with the digital wallet, which will cause the Dapp to obtain additional information that does not meet the conditions, resulting in information leakage of the digital wallet; therefore, when the Dapp determines that it meets the interface information supported by the digital wallet, it can communicate with the digital wallet to protect the information of the digital wallet.

[0105] In a possible implementation method, if the second theme and / or the first theme expires, the second theme and / or the first theme are regenerated.

[0106] Figure 5 This is a flow chart of a communication method between a decentralized application (DAPP) and a digital wallet, provided in an embodiment of the present application. This method is applied to a digital wallet. This method can be executed by a communication device between the decentralized application (DAPP) and the digital wallet. The communication device between the decentralized application (DAPP) and the digital wallet can be a terminal device or a module for a terminal device, or a server or a module for a server. This application does not limit the execution entity of this method.

[0107] The method comprises the following steps:

[0108] In step 501, the digital wallet obtains a first message from a first topic through a blockchain system.

[0109] Among them, the first message is published by the Dapp to the first topic; the first message carries first indication information indicating the first generated element.

[0110] In one possible implementation method, before the digital wallet receives the first message, the method further includes: the digital wallet sending a second connection request to the second blockchain node; the second connection request is used by the digital wallet to request establishment of a connection with the second blockchain node; the first blockchain node is any node in the blockchain system; and the digital wallet receives a successful connection indication from the second blockchain node. The first blockchain node and the second blockchain node can be the same blockchain node or different blockchain nodes, which is not limited in this application. However, the first blockchain node and the second blockchain node must be located in the same blockchain system.

[0111] In one possible implementation, the digital wallet obtains the first symmetric key and the first subject through a preset method; the first symmetric key is generated by the Dapp. Exemplarily, the digital wallet obtains the first symmetric key and the first subject by scanning a QR code generated by the Dapp.

[0112] In one possible implementation method, after the digital wallet obtains the first topic, the digital wallet instructs the second blockchain node to listen to the first topic and obtain the first message by listening to the first topic.

[0113] In one possible implementation method, the second blockchain node synchronizes the event of the digital wallet monitoring the first topic to other blockchain nodes.

[0114] In step 502 , the digital wallet obtains the first generated element based on the decrypted first message, and generates a second theme based on the first generated element and the second generated element.

[0115] Step 503: The digital wallet obtains a second message according to the second topic, and publishes the second message to the first topic.

[0116] In one possible implementation method, after the digital wallet determines the second topic, the digital wallet instructs the second blockchain node to monitor the second topic.

[0117] In one possible implementation method, the second blockchain node synchronizes the event of the digital wallet monitoring the second topic to other blockchain nodes.

[0118] Step 504: The digital wallet communicates with the Dapp through the second topic.

[0119] In one possible implementation method, the digital wallet encrypts the content to be communicated and publishes it to the second topic; the second blockchain node synchronizes the encrypted content to be communicated to other blockchain nodes that monitor the second topic.

[0120] In the above scheme, on the one hand, the second topic is determined by the first generated element corresponding to the Dapp and the second generated element corresponding to the digital wallet. The second topic is only used for communication between the Dapp and the digital wallet, and has strong privacy, so it can achieve effective communication between the Dapp and the digital wallet; on the other hand, the blockchain system monitors the second topic, and the digital wallet and the Dapp itself are also applications of the blockchain system. Therefore, the digital wallet and the Dapp can communicate effectively through the second topic monitored by the blockchain system without the need for third-party services, which reduces the deployment cost brought by centralized services and improves the fault tolerance of the system. In one embodiment, the above step 502 includes the following steps. The method is as follows: Figure 6 shown.

[0121] Step 601: The digital wallet decrypts the first message according to the first symmetric key to obtain a first public key.

[0122] The first public key is the public key in the asymmetric key generated by the Dapp based on elliptic curve cryptography.

[0123] In one possible implementation, after the digital wallet obtains the first symmetric key and the first topic through a preset method, the digital wallet instructs the second blockchain node to monitor the first topic. Since the second blockchain node also monitors the first topic, it can obtain the first message in the first topic. The second blockchain node sends the first message to the digital wallet. After receiving the first message, the digital wallet decrypts the first message using the first symmetric key to obtain the first public key. In this solution, after obtaining the first topic, the digital wallet can obtain the first message by monitoring the first topic. After obtaining the first symmetric key, the digital wallet can decrypt the first message using the first symmetric key to obtain the first generated element, and then accurately and effectively determine the second topic based on the first and second generated elements.

[0124] In step 602, the digital wallet generates a second public key and a second private key based on elliptic curve cryptography, and generates a second symmetric key according to the first public key and the second private key.

[0125] The second public key and the second private key are a pair of asymmetric keys.

[0126] Optionally, the second public-private key pair uses the same elliptic curve as Dapp, then sk2·G=pk2, where the generator of the curve is G, sk2 is the second private key, and pk2 is the second public key.

[0127] Optionally, the digital wallet determines the second symmetric key by calculating sp2=sk2·pk1=sk2·sk1·G; wherein sp2 is the second symmetric key, sk2 is the second private key, pk1 is the first public key, sk2 is the second private key, and sk1 is the first private key.

[0128] Step 603: The digital wallet determines the second subject according to the second symmetric key.

[0129] In one possible implementation method, the second symmetric key is hashed to obtain the second subject. This application does not limit the hash algorithm. Of course, this application can also determine the second subject by other means, but the second subject determined by the Dapp must be consistent with the second subject determined by the digital wallet.

[0130] The above solution can accurately and effectively determine the second topic. Based on elliptic curve cryptography, it can ensure that the second topic generated by the Dapp is consistent with the second topic generated by the digital wallet, realizing effective communication between the Dapp and the digital wallet.

[0131] In one possible implementation method, after determining the second topic in step 603 above, the digital wallet uses the first symmetric key to encrypt the second public key to obtain the second message; wherein the second public key is the public key corresponding to the second private key in the second topic.

[0132] In one possible implementation, the digital wallet publishes the second message to the first topic to communicate with the Dapp. After receiving the second message, the second blockchain node synchronizes the second message to other blockchain nodes that monitor the first topic.

[0133] In one possible implementation, the digital wallet communicates with the Dapp via the second topic, including: encrypting the communication information using the second symmetric key to determine a fourth message; and publishing the fourth message to the second topic, thereby communicating with the Dapp. The second blockchain node synchronizes the fourth message to other blockchain nodes monitoring the second topic. This solution, by encrypting the communication information before publishing it to the second topic, ensures that the blockchain system cannot access the content of the communication information, thus ensuring the security of communication between the Dapp and the digital wallet.

[0134] In one embodiment, before the digital wallet communicates with the Dapp via the second topic, the digital wallet further includes: publishing a verification message to the second topic, wherein the verification message includes information about interfaces supported by the digital wallet. If the digital wallet receives a response message generated by the Dapp indicating that the verification message is successful, the Dapp subsequently communicates with the digital wallet via the second topic. If the digital wallet receives a response message generated by the Dapp indicating that the verification message is unsuccessful, the digital wallet stops communicating with the Dapp.

[0135] In the above scheme, if the digital wallet receives a response message from Dapp indicating that the verification is successful, it is determined that Dapp has been monitoring the second topic, and thus effective communication between the digital wallet and Dapp can be achieved; if the digital wallet does not receive a response message from Dapp, it means that Dapp and the digital wallet have not been able to establish effective communication; if the digital wallet receives a response message from Dapp indicating that the verification is unsuccessful, it means that Dapp does not support the interface information corresponding to the digital wallet, and communication between Dapp and the digital wallet is impossible; in summary, the digital wallet publishes the verification message to the second topic, which enables effective communication between the digital wallet and Dapp.

[0136] Figure 7A flow chart of a communication method between a decentralized application (DAPP) and a digital wallet provided in an embodiment of the present application, applied to a first blockchain node, comprising the following steps:

[0137] Step 701: The first blockchain node receives a first monitoring request sent by a Dapp.

[0138] The first monitoring request is used to instruct the first blockchain node to monitor a first topic. The first topic is used to represent the topic of the message queue monitored by the blockchain node, so that messages can be transmitted between clients monitoring the first topic.

[0139] In one possible implementation method, the first blockchain node synchronizes the events of the Dapp monitoring the first topic to other blockchain nodes.

[0140] In one possible implementation method, before the first blockchain node receives the first monitoring request sent by the Dapp, the method further includes: the Dapp sends a first connection request to the first blockchain node; the first connection request is used by the Dapp to request to establish a connection with the first blockchain node; and the first blockchain node sends an indication of a successful connection to the Dapp.

[0141] Optionally, if the connection fails, the first blockchain node sends an indication of the connection failure to the Dapp.

[0142] Step 702: The first blockchain node receives a first message sent by the Dapp.

[0143] The first message carries first indication information indicating a first generated element.

[0144] In one possible implementation, the first blockchain node synchronizes the first message to other blockchain nodes that are listening for the first message. If no other blockchain nodes are listening for the first message, the first blockchain node stores the first message locally.

[0145] Step 703: The first blockchain node obtains the second message by monitoring the first topic.

[0146] In one possible implementation method, the first blockchain node obtains the second message by monitoring the first topic; at the same time, it checks and finds that the Dapp is associated with the first topic, so it forwards the second message to the Dapp.

[0147] Step 704: The first blockchain node forwards the second message to the Dapp.

[0148] Step 705: The first blockchain node receives the second monitoring request sent by the Dapp.

[0149] The second monitoring request is used to instruct the first blockchain node to monitor the second topic.

[0150] In one possible implementation method, the first blockchain node discovers the encrypted information to be communicated by the Dapp by monitoring the second topic, and the first blockchain node synchronizes the encrypted information to be communicated to other blockchain nodes monitoring the second topic.

[0151] In one possible implementation method, the first blockchain node discovers the message synchronized by other blockchain nodes by monitoring the second topic, and then forwards the message to the Dapp.

[0152] Figure 8 A flow chart of a communication method between a decentralized application (DAPP) and a digital wallet provided in an embodiment of the present application, applied to a second blockchain node, comprising the following steps:

[0153] Step 801: The second blockchain node receives a third monitoring request sent by the digital wallet.

[0154] The third monitoring request is used to instruct the second blockchain node to monitor the first topic. The first topic is used to represent the topic of the message queue monitored by the blockchain node, so that messages can be transmitted between clients monitoring the first topic.

[0155] In one possible implementation method, the second blockchain node synchronizes the events of the digital wallet monitoring the first topic to other blockchain nodes.

[0156] In one possible implementation method, before the second blockchain node receives the third monitoring request sent by the digital wallet, it also includes: the digital wallet sends a second connection request to the second blockchain node; the second connection request is used by the digital wallet to request to establish a connection with the second blockchain node; the second blockchain node sends an indication of successful connection to the digital wallet.

[0157] Optionally, if the connection fails, the second blockchain node sends an indication of the connection failure to the digital wallet.

[0158] In step 802, the second blockchain node obtains the first message by monitoring the first topic.

[0159] The first message carries first indication information indicating a first generated element.

[0160] In one possible implementation method, after the second blockchain node obtains the first message, it forwards the first message to the digital wallet based on the association between the digital wallet and the first topic.

[0161] Step 803: The second blockchain node receives the second message sent by the digital wallet.

[0162] In one possible implementation method, the second blockchain node synchronizes the second message to other blockchain nodes that monitor the first topic.

[0163] Step 804: The second blockchain node receives the fourth monitoring request sent by the digital wallet.

[0164] The fourth monitoring request is used to instruct the second blockchain node to monitor the second topic.

[0165] In one possible implementation method, the second blockchain node discovers the encrypted information to be communicated by the digital wallet by monitoring the second topic, and the second blockchain node synchronizes the encrypted information to be communicated to other blockchain nodes monitoring the second topic.

[0166] In one possible implementation method, the second blockchain node discovers the message synchronized by other blockchain nodes by monitoring the second topic, and then forwards the message to the digital wallet.

[0167] Figure 9 A flow chart of a communication method between a decentralized application (DAPP) and a digital wallet provided in an embodiment of the present application, which is applied to the interaction process between a digital wallet and a DAPP, includes the following steps:

[0168] In step 901, the Dapp and the digital wallet respectively establish connections with the blockchain system.

[0169] In one possible implementation, the Dapp establishes a connection with a first blockchain node of the blockchain system, and the digital wallet establishes a connection with a second blockchain node of the blockchain system. This application does not limit the time and order in which the Dapp and the digital wallet establish connections with the blockchain system.

[0170] In step 902, the Dapp generates a first symmetric key and determines the first subject according to the first symmetric key.

[0171] In one possible implementation method, the Dapp instructs the first blockchain node to monitor the first topic.

[0172] In step 903, the Dapp generates a first public key and a first private key based on elliptic curve cryptography, and encrypts the first public key using the first symmetric key to obtain the first message.

[0173] Step 904: The Dapp publishes a first message to a first topic monitored by the blockchain system.

[0174] In step 905, the digital wallet obtains the first symmetric key and the first subject in a preset manner.

[0175] In one possible implementation method, the digital wallet instructs the second blockchain node to monitor the first topic.

[0176] In step 906, the digital wallet obtains a first message from the first topic through the blockchain system.

[0177] Step 907: The digital wallet decrypts the first message according to the first symmetric key to obtain a first public key.

[0178] In step 908, the digital wallet generates a second public key and a second private key based on elliptic curve cryptography, and generates a second symmetric key according to the first public key and the second private key.

[0179] Step 909: The digital wallet determines the second subject according to the second symmetric key.

[0180] In one possible implementation method, the digital wallet instructs the second blockchain node to monitor the second topic.

[0181] In step 910, the digital wallet encrypts the second public key using the first symmetric key to obtain the second message.

[0182] In step 911, the digital wallet publishes a second message to the first topic monitored by the blockchain system.

[0183] In step 912, the Dapp obtains a second message from the first topic through the blockchain system.

[0184] In step 913, the Dapp decrypts the second message using the first symmetric key to obtain a second public key.

[0185] In step 914, the Dapp determines a second symmetric key based on the second public key and the first private key.

[0186] Step 915: The Dapp determines the second topic based on the second symmetric key.

[0187] In one possible implementation method, the Dapp instructs the first blockchain node to monitor the second topic.

[0188] Step 916: The Dapp communicates with the digital wallet through the second topic.

[0189] The following describes steps 901 to 916 using a specific embodiment.

[0190] Assume that a decentralized application (Dapp) needs to communicate securely with a digital wallet (Wallet). Dapp and Wallet are respectively connected to blockchain node 1 and blockchain node 2 (or they can be connected to the same blockchain node, and the two blockchain nodes belong to the same blockchain network). Blockchain node 1 and blockchain node 2 support p2p network and topic-addressed message transmission protocol (such as amop protocol).

[0191] Step 1: Dapp connects to blockchain node 1.

[0192] Optionally, websockets or TLS are used to implement secure communication between the blockchain node and the Dapp. If the blockchain node allows the connection, a connection success message is returned, otherwise a connection failure message is returned.

[0193] Optionally, services that are allowed to use the blockchain network to transmit messages can be controlled through certificates or other verification methods, which is necessary in consortium chain scenarios.

[0194] Step 2: Dapp generates the first symmetric key sp1 locally. This symmetric key is used to symmetrically encrypt messages sent to the blockchain p2p network.

[0195] Optionally, a hash (eg, sha2-512) is calculated for sp1 to obtain the first topic Topic-sp1 corresponding to sp1.

[0196] Step 3: Dapp generates an asymmetric key pair sk1 and pk1, where sk1 is the first private key and pk1 is the first public key. It uses the symmetric key sp1 to encrypt pk1 to generate the first message msg1, and sends msg1 to blockchain node 1 and the first topic Topic-sp1.

[0197] Optionally, the asymmetric key pair here is generated using an elliptic curve cryptography algorithm, for example, the ed25519 curve can be used. Assuming that the generator of the curve is G, then sk1·G=pk1

[0198] Step 4: Blockchain node 1 receives the message that Dapp is monitoring Topic-sp1. Based on the amop protocol, it sends the monitoring status of blockchain node 1 to other nodes in the p2p network.

[0199] Step 5: Blockchain node 1 receives msg1, searches and finds that no other node in the p2p network is listening to topic-sp1, and caches msg1 locally.

[0200] Step 6: The digital wallet connects to blockchain node 2.

[0201] Optionally, use websockets or tls to achieve secure communication between the blockchain node and the digital wallet. If the blockchain node allows the connection, it returns a connection success, otherwise it returns a connection failure.

[0202] Step 7: The digital wallet obtains sp1 and the first topic Topic-sp1 from the Dapp.

[0203] Optionally, in actual scenarios, the Dapp can encode the above information to generate a QR code, which can be scanned by the wallet.

[0204] Step 8: The digital wallet sends a request to monitor Topic-sp1 to blockchain node 2.

[0205] Step 9: Blockchain node 2 receives the request from the digital wallet to monitor Topic-sp1. Based on the amop protocol, the blockchain node 2 sends the status of monitoring Topic-sp1 to other nodes in the p2p network.

[0206] Step 10: Blockchain node 1 receives the notification from blockchain node 2 that it is monitoring Topic-sp1, and sends msg1 to blockchain node 2.

[0207] In step 11, blockchain node 2 sends msg1 received from blockchain node 1 to the digital wallet, and the digital wallet receives msg1 sent by Dapp in Topic-sp1.

[0208] Step 12: The digital wallet decrypts msg1 using the symmetric key sp1 and obtains pk1 after decryption.

[0209] Step 13: The digital wallet locally generates an asymmetric key pair sk2 and pk2.

[0210] Where sk2 is the second private key and pk2 is the second public key.

[0211] Optionally, the second public-private key pair here uses the same elliptic curve as Dapp, then sk2·G=pk2.

[0212] Step 14: The digital wallet calculates sp2 = sk2·pk1 = sk2·sk1·G, using sp2 as the symmetric encryption key. The hash of sp2 is calculated to obtain the second topic Topic-sp2 corresponding to sp2.

[0213] Optionally, the symmetric encryption algorithm may adopt RSA.

[0214] Step 15: The digital wallet uses sp1 to encrypt the public key pk2 to obtain the second message msg2, and sends msg2 to the blockchain node 2 and the first topic Topic-sp1.

[0215] In step 16, after blockchain node 2 receives msg2, it queries the node that monitors Topic-sp1 in the p2p network based on the amop protocol, finds that blockchain node 1 monitors Topic-sp1, and sends msg2 to blockchain node 1.

[0216] Step 17: The digital wallet sends a second topic monitoring request to blockchain node 2 to monitor the second topic Topic-sp2.

[0217] Step 18: The digital wallet sends a verification message, namely a hello message, to Topic-sp2. The hello message is encrypted using sp2 and may include information such as the interfaces supported by the wallet.

[0218] Step 19: Dapp receives the digital package and sends it to Topic-sp1's msg2. It uses sp1 to decrypt the message msg2 and obtains pk2.

[0219] Step 20: Dapp calculates sp2 = sk1·pk2 = sk1·sk2·G, calculates the hash of sp2 and obtains the second topic Topic-sp2 corresponding to sp2.

[0220] Step 21: Dapp sends a second topic monitoring request to blockchain node 1, monitors the second topic Topic-sp2, and receives a hello message from the digital wallet after monitoring.

[0221] In step 22, blockchain node 1 sends the status of monitoring Topic-sp2 to other blockchain nodes in the p2p network based on amop.

[0222] In step 23, blockchain node 2 discovers that blockchain node 1 is monitoring Topic-sp2, and sends the hello message sent by the wallet to Topic-sp2 to blockchain node 1.

[0223] In step 24, blockchain node 1 sends the hello message sent by the digital wallet to Dapp, and Dapp sends a response message to the second topic Topic-sp2. The response message is encrypted using sp2.

[0224] Step 25: The digital wallet receives the response message sent by Dapp, and the link is successfully established. Next, Dapp and the digital wallet can communicate securely on the second topic, Topic-sp2.

[0225] The following is a specific example to illustrate how a Dapp and a wallet can communicate securely on the second topic, Topic-sp2. The method includes the following steps:

[0226] Step 30: Dapp sends a signature request signRequest1, which contains the transaction that needs to be signed. Dapp uses sp2 to encrypt the message package and sends the encrypted message package to Topic-sp2.

[0227] In step 31, blockchain node 1 receives signRequest1 from the Dapp to Topic-sp2. Since the message is encrypted, blockchain node 1 does not know the message content, thus preventing blockchain node 1 from tampering with the message content. Blockchain node 1 finds that blockchain node 2 is monitoring Topic-sp2 and sends signRequest1 to blockchain node 2.

[0228] In step 32, blockchain node 2 receives signRequest1 of Topic-sp2 and finds that the digital wallet monitors Topic-sp2, so it sends signRequest1 to the digital wallet.

[0229] Step 33: The digital wallet receives signRequest1 and prompts the user that a signature request has been received. If the user agrees to sign, the digital wallet uses the key to sign the content of signRequest1 and encapsulates it into signResponse1. After encrypting it with sp2, the digital wallet sends signResponse1 to Topic-sp2.

[0230] In step 34, blockchain node 2 receives signResponse1 from Topic-sp2 and checks the blockchain nodes that are monitoring Topic-sp2. Although blockchain node 2 is monitoring Topic-sp2, it does not send duplicate messages to the digital wallet because it only monitors the digital wallet. It finds that blockchain node 1 is monitoring Topic-sp2, so it sends signResponse1 to blockchain node 1.

[0231] Step 35: Blockchain node 1 receives signResponse1 from Topic-sp2 and finds that Dapp is monitoring Topic-sp2, so it sends signResponse1 to Dapp.

[0232] Step 36: Dapp receives signResponse1, gets the signed transaction and sends it to the blockchain.

[0233] Based on the same technical concept, Figure 10 The embodiment of the present application shows a communication device 1000 between a decentralized application DAPP and a digital wallet. Figure 10 As shown, it includes: a transceiver unit 1001 and a processing unit 1002.

[0234] In the first embodiment, the transceiver unit 1001 is used to publish a first message to a first topic monitored by the blockchain system; the first message carries first indication information indicating a first generated element; a second message is obtained from the first topic through the blockchain system, and the second message is published by the digital wallet to the first topic; the second message carries second indication information indicating a second generated element; the second generated element is used by the digital wallet to generate a second topic monitored by the blockchain system based on the first generated element obtained by decrypting the first message; communicating with the digital wallet through the second topic; the processing unit 1002 is used to obtain the second generated element based on decrypting the second message, and determine the second topic through the second generated element.

[0235] In one possible implementation method, the processing unit 1002 is used to generate a first symmetric key and determine the first subject based on the first symmetric key; the first symmetric key and the first subject are shared with the digital wallet in a preset manner; and the first generated element is encrypted based on the first symmetric key to obtain the first message.

[0236] In one possible implementation method, the processing unit 1002 is used to generate a first public key and a first private key based on elliptic curve cryptography, and encrypt the first public key using the first symmetric key to obtain the first message; wherein the first public key and the first private key are a pair of asymmetric keys.

[0237] In one possible implementation method, the processing unit 1002 is used to decrypt the second message using the first symmetric key to obtain a second public key; the second message is generated by the digital wallet based on the first public key and the second private key obtained by decrypting the first message; the second public key and the second private key are asymmetric keys generated by the digital wallet based on elliptic curve cryptography; the processing unit 1002 is used to determine the second symmetric key based on the second public key and the first private key; and determine the second subject based on the second symmetric key.

[0238] In one possible implementation method, the processing unit 1002 is used to encrypt the information to be communicated using the second symmetric key to determine the third message; the transceiver unit 1001 is used to publish the third message to the second topic, thereby communicating with the digital wallet.

[0239] In one possible implementation method, the transceiver unit 1001 is used to obtain a verification message through the second topic; the verification message includes the interface information supported by the digital wallet; the Dapp determines whether the interface information supported by the digital wallet is met; if so, the Dapp generates a verification response message for the verification message and publishes the verification response message to the second message topic.

[0240] In a second embodiment, the transceiver unit 1001 is used to obtain a first message from a first topic through a blockchain system, where the first message is published by the Dapp to the first topic; the first message carries first indication information indicating a first generated element; a second message is obtained according to a second topic, and the second message is published to the first topic; the second message is communicated with the Dapp through the second topic; the processing unit 1002 is used to obtain the first generated element based on the decrypted first message, and generate the second topic based on the first generated element.

[0241] In a possible implementation method, the processing unit 1002 is used to obtain a first symmetric key and the first subject in a preset manner; the first symmetric key is generated by the Dapp.

[0242] In one possible implementation method, the processing unit 1002 is used to decrypt the first message according to the first symmetric key to obtain a first public key; the first public key is the public key in the asymmetric key generated by the Dapp based on elliptic curve cryptography; the digital wallet generates a second public key and a second private key based on elliptic curve cryptography, and generates a second symmetric key according to the first public key and the second private key; wherein the second public key and the second private key are a pair of asymmetric keys; the digital wallet determines the second subject according to the second symmetric key.

[0243] In one possible implementation method, the processing unit 1002 is used to use the first symmetric key to encrypt the second public key to obtain the second message; wherein, the second public key is the public key corresponding to the second private key in the second subject.

[0244] In one possible implementation method, the processing unit 1002 is used to encrypt the information to be communicated using the second symmetric key to determine the fourth message; the transceiver unit 1001 is used to publish the fourth message to the second topic, thereby communicating with the Dapp.

[0245] In a possible implementation method, the transceiver unit 1001 is configured to publish a verification message to a second topic, where the verification message includes interface information supported by the digital wallet.

[0246] Based on the same technical concept, the embodiment of the present application provides a communication device 1100 between a decentralized application DAPP and a digital wallet. The communication device 1100 between a decentralized application DAPP and a digital wallet can be a computing device, for example. Figure 11 As shown, a communication device 1100 between a decentralized application DAPP and a digital wallet includes at least one processor 1101 and a memory 1102 connected to the at least one processor. The specific connection medium between the processor 1101 and the memory 1102 is not limited in the embodiment of the present application. Figure 11 For example, the processor 1101 and the memory 1102 are connected via a bus. The bus can be divided into an address bus, a data bus, a control bus, and the like.

[0247] In an embodiment of the present application, the memory 1102 stores instructions that can be executed by at least one processor 1101. The at least one processor 1101 can execute the above-mentioned communication method between a decentralized application DAPP and a digital wallet by executing the instructions stored in the memory 1102.

[0248] Among them, the processor 1101 is a control center of the communication device 1100 between a decentralized application DAPP and a digital wallet. It can use various interfaces and lines to connect various parts of the computer equipment, and perform resource settings by running or executing instructions stored in the memory 1102 and calling data stored in the memory 1102. Optionally, the processor 1101 may include one or more determination units. The processor 1101 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, etc., and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 1101. In some embodiments, the processor 1101 and the memory 1102 can be implemented on the same chip. In some embodiments, they can also be implemented separately on independent chips.

[0249] The processor 1101 can be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application-specific integrated circuit (ASIC), a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, and can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in conjunction with the embodiments of the present application can be directly embodied as being executed by a hardware processor, or can be executed by a combination of hardware and software modules in the processor.

[0250] Memory 1102 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. Memory 1102 may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (Random Access Memory, RAM), a static random access memory (Static Random Access Memory, SRAM), a programmable read-only memory (Programmable Read Only Memory, PROM), a read-only memory (Read Only Memory, ROM), an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic memory, a disk, an optical disk, etc. Memory 1102 is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 1102 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.

[0251] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer-executable program. The computer-executable program is used to enable a computer to execute a communication method between a decentralized application DAPP and a digital wallet listed in any of the above methods.

[0252] An embodiment of the present application provides a computer program product, including a computer program executable by a computer device. When the program is run on the computer device, the computer device executes a communication method between a decentralized application DAPP and a digital wallet listed in any of the above methods.

[0253] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0254] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0255] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0256] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0257] Obviously, those skilled in the art may make various changes and modifications to this application without departing from the spirit and scope of this application. Thus, if these modifications and variations of this application fall within the scope of the claims of this application and their equivalents, this application is intended to include these modifications and variations.

Claims

1. A communication method between a decentralized application (Dapp) and a digital wallet, characterized in that: include: The Dapp publishes a first message to a first topic monitored by the blockchain system; The first message carries first indication information indicating a first generated element; The Dapp obtains a second message from the first topic through the blockchain system, where the second message is published by the digital wallet to the first topic; the second message carries second indication information indicating a second generated element; The second generated element is used by the digital wallet to generate a second topic monitored by the blockchain system based on the first generated element obtained by decrypting the first message; The Dapp decrypts the second message using the first symmetric key to obtain a second public key; The second message is generated by the digital wallet based on the first public key and the second private key obtained by decrypting the first message; the second public key and the second private key are asymmetric keys generated by the digital wallet based on elliptic curve cryptography; The Dapp determines a second symmetric key based on the second public key and the first private key; The Dapp determines the second topic based on the second symmetric key; The Dapp communicates with the digital wallet through the second topic.

2. The method according to claim 1, wherein Before the Dapp publishes the first message to the first topic monitored by the blockchain system, it also includes: The Dapp generates the first symmetric key and determines the first subject based on the first symmetric key; the first symmetric key and the first subject are shared with the digital wallet in a preset manner; The Dapp encrypts the first generated element based on the first symmetric key to obtain the first message.

3. The method according to claim 2, wherein The Dapp encrypts the first generated element based on the first symmetric key to obtain the first message, including: The Dapp generates the first public key and the first private key based on elliptic curve cryptography, and encrypts the first public key using the first symmetric key to obtain the first message; wherein the first public key and the first private key are a pair of asymmetric keys.

4. The method according to claim 1, wherein The Dapp communicates with the digital wallet through the second topic, including: The Dapp encrypts the information to be communicated using the second symmetric key to determine the third message; The Dapp publishes the third message to the second topic, thereby communicating with the digital wallet.

5. The method according to any one of claims 1 to 4, characterized in that Before the Dapp communicates with the digital wallet through the second topic, the method further includes: The Dapp obtains a verification message through the second topic; the verification message includes interface information supported by the digital wallet; The Dapp determines whether the interface information supported by the digital wallet is met; if so, the Dapp generates a verification pass response message for the verification message and publishes the verification pass response message to the second message topic.

6. A communication method between a decentralized application (Dapp) and a digital wallet, characterized in that: include: The digital wallet obtains a first message from a first topic through the blockchain system, where the first message is published by the Dapp to the first topic; The first message carries first indication information indicating a first generated element; Decrypting the first message by the digital wallet using the first symmetric key to obtain a first public key; The first public key is the public key in the asymmetric key generated by the Dapp based on elliptic curve cryptography; The digital wallet generates a second public key and a second private key based on elliptic curve cryptography, and generates a second symmetric key based on the first public key and the second private key; wherein the second public key and the second private key are a pair of asymmetric keys; The digital wallet determines a second subject based on the second symmetric key; The digital wallet obtains a second message according to the second topic, and publishes the second message to the first topic; The digital wallet communicates with the Dapp through the second topic.

7. The method according to claim 6, wherein Before the digital wallet obtains the first message from the first topic through the blockchain system, the method further includes: The digital wallet obtains the first symmetric key and the first subject in a preset manner; the first symmetric key is generated by the Dapp.

8. The method according to claim 6, wherein The digital wallet obtains a second message according to the second topic, including: The digital wallet encrypts the second public key using the first symmetric key to obtain the second message; wherein the second public key is the public key corresponding to the second private key in the second subject.

9. The method according to claim 8, wherein The digital wallet communicates with the Dapp through the second topic, including: The digital wallet encrypts the information to be communicated using the second symmetric key to determine a fourth message; The digital wallet publishes the fourth message to the second topic, thereby communicating with the Dapp.

10. The method according to any one of claims 6 to 9, characterized in that include: The digital wallet publishes a verification message to a second topic, where the verification message includes interface information supported by the digital wallet.

11. A communication device between a decentralized application (Dapp) and a digital wallet, characterized in that: Including transceiver unit and processing unit: The transceiver unit is configured to publish a first message to a first topic monitored by the blockchain system; the first message carries first indication information indicating a first generated element; obtain a second message from the first topic through the blockchain system, the second message being published by the digital wallet to the first topic; the second message carries second indication information indicating a second generated element; The second generated element is used by the digital wallet to generate a second topic monitored by the blockchain system based on the first generated element obtained by decrypting the first message; and communicate with the digital wallet through the second topic; The processing unit is configured to decrypt the second message using the first symmetric key to obtain a second public key; The second message is generated by the digital wallet based on the first public key and the second private key obtained by decrypting the first message; the second public key and the second private key are asymmetric keys generated by the digital wallet based on elliptic curve cryptography; the Dapp determines the second symmetric key based on the second public key and the first private key; and determines the second subject based on the second symmetric key.

12. A communication device between a decentralized application (Dapp) and a digital wallet, characterized in that: Including transceiver unit and processing unit: The transceiver unit is configured to obtain a first message from a first topic through a blockchain system, where the first message is published by the Dapp to the first topic; the first message carries first indication information indicating a first generated element; obtain a second message based on a second topic, and publish the second message to the first topic; and communicate with the Dapp through the second topic; The processing unit is configured to decrypt the first message according to the first symmetric key to obtain a first public key; The first public key is the public key in the asymmetric key generated by the Dapp based on elliptic curve cryptography; A second public key and a second private key are generated based on elliptic curve cryptography, and a second symmetric key is generated based on the first public key and the second private key; wherein the second public key and the second private key are a pair of asymmetric keys; and a second subject is determined based on the second symmetric key.

13. A computing device, characterized in that include: a memory for storing program instructions; A processor is configured to call the program instructions stored in the memory, and execute the method according to any one of claims 1 to 5, or execute the method according to any one of claims 6 to 10 according to the obtained program instructions.

14. A computer-readable storage medium, characterized in that The method comprises computer-readable instructions, and when a computer reads and executes the computer-readable instructions, the method according to any one of claims 1 to 5 or the method according to any one of claims 6 to 10 is implemented.

Citation Information

Patent Citations

  • Message processing method and device, product, equipment and medium

    CN116980115A