Communication method and device between decentralized application DAPP and digital wallet

Through the use of theme messages in the blockchain system, DAPP and digital wallets have achieved decentralized communication methods, solving the complexity and cost of relying on third -party services, and improving the fault tolerance and security of the system.

CN119341828AActive Publication Date: 2025-01-21WEBANK (CHINA)
View PDF 9 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Communication between existing DAPPs and digital wallets relies on third-party centralized services, which leads to increased system complexity and cost. When third-party service problems arise, a large number of DAPPs and digital wallets will not work properly.

Method used

By publishing and listening to specific themes in the blockchain system, DAPP and digital wallets can directly communicate without relying on third -party services. Specific steps include the theme of DAPP released the first message to the blockchain system monitoring. The digital wallet generates the second theme based on the generating element generated by the first message. DAPP and digital wallets communicate through the second theme.

Benefits of technology

It realizes decentralized communication between DAPP and digital wallets, reduces the deployment costs caused by centralized services, improves system fault tolerance, and enhances the privacy and security of communication.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119341828A_ABST
    Figure CN119341828A_ABST
Patent Text Reader

Abstract

The invention provides a communication method and device between a decentralized application DAPP and a digital wallet. The method comprises the steps that the DAPP issues a first message to a first theme monitored by a block chain system; the first message carries first indication information indicating a first generation element; the Dapp obtains a second message from the first theme through the block chain system, wherein the second message is published to the first theme by the digital wallet; the second message carries second indication information for indicating a second generation element; the second generation element is used for the digital wallet to generate a second theme monitored by the block chain system based on the first generation element obtained by decrypting the first message; and the Dapp obtains a second generation element based on decryption of the second message, and determines a second theme through the second generation element, and the Dapp communicates with the digital wallet through the second theme. According to the scheme, communication between the DAPP and the digital wallet can be realized without the help of third-party service.
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 field, Dapp is a decentralized application running on the blockchain system. Users use digital wallets to interact with Dapp, and Dapp can request digital wallets to obtain user addresses or sign transactions. Due to the decentralized nature of Dapp, it does not control the user's assets or private keys. In order to achieve interaction between Dapp and digital wallets, it is necessary to enable communication between Dapp and digital wallets. The current mainstream communication method between Dapp and digital wallets is achieved through third-party services. Both Dapp and digital wallets connect to third parties that provide communication services and use third-party services to transmit messages.

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

[0004] The present application provides a communication method and device between a decentralized application DAPP and a digital wallet, which can realize communication between DAPP and a digital wallet without the help of a third-party service.

[0005] In the first aspect, the embodiment of the present application provides a communication method between a decentralized application DAPP and a digital wallet, which is applied to the Dapp side. The method can be executed by a communication device between a decentralized application DAPP and a digital wallet, and 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 subject of the method. The method includes: the Dapp publishes a first message to a first topic monitored by a blockchain system; the first message carries a first indication information indicating a first generated element; the Dapp obtains a second message 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 a 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 through the second generated element; the Dapp communicates with the digital wallet through 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 communicate effectively through the second topic monitored by the blockchain system without the help of third-party services, reducing the deployment cost brought by centralized services and improving the system fault tolerance.

[0007] In a 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 to 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 by 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 a possible implementation method, the Dapp generates a first public key and a first private key based on elliptic curve cryptography, and uses the first symmetric key to encrypt the first public 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, so that the digital wallet can decrypt the first message to obtain the first public key after obtaining the first symmetric key, and then determine the second topic according to the second generated element corresponding to the first public key and 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 then ensuring the security of the communication content between the Dapp and the digital wallet based on the second topic.

[0011] In a 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; the second subject is determined by the second generated element, including: 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 scheme enables Dapp to accurately and effectively obtain the second public key corresponding to the digital wallet, and accurately generate the second topic based on the second public key and the first private key; based on elliptic curve cryptography, it can ensure that the second topic generated by Dapp is consistent with the second topic generated by the digital wallet, that is, although the digital wallet does not upload the second topic to the blockchain system, Dapp can generate the second topic by itself according to the second message, and ensure that the second topic generated by Dapp is consistent with the second topic generated by the digital wallet, which can achieve effective communication between Dapp and the digital wallet. Dapp can generate the second topic by itself according to the second message, ensuring that the second topic will not be leaked, and ensuring the security of communication between Dapp and the digital wallet.

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

[0014] In the above scheme, 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, thereby ensuring the security of communication between Dapp and digital wallet.

[0015] In a 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, through verification messages, can determine, on the one hand, that Dapp has listened to the second topic, and therefore can communicate effectively with the digital wallet based on the second topic; on the other hand, if Dapp does not meet the interface information supported by the digital wallet, it can still communicate with the digital wallet, which will cause Dapp to obtain additional information that does not meet the conditions, resulting in information leakage of the digital wallet; therefore, when 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 the second aspect, the embodiment of the present application provides a communication method between a decentralized application DAPP and a digital wallet, which is applied to the digital wallet side. The method can be executed by a communication device between the decentralized application DAPP and the digital wallet, and 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 subject of the method. The method includes: the digital wallet obtains a first message from a first topic through a blockchain system, and the first message is published by the Dapp to the first topic; the first message carries a 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 generated element and the second generated element; 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.

[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, 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 themselves 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 help of third-party services, which reduces the deployment cost brought by centralized services and improves the system fault tolerance.

[0019] In a 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 by 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 a possible implementation method, the digital wallet decrypts the first message according to 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 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 topic according to the second symmetric key.

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

[0022] In a 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 scheme, 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, and 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 listening to the second topic, so 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 can achieve effective communication between the digital wallet and Dapp.

[0028] In the third aspect, the embodiment of the present application provides a communication device between a decentralized application DAPP and a digital wallet, including: 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 a 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 a 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 decrypting the second message, and determine the second topic through the second generated element.

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

[0030] In a possible implementation method, a 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 a possible implementation method, the processing unit is used to use 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; 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 a 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 a 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 satisfied; if satisfied, 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 used to obtain a first message from a first topic through a blockchain system, wherein 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 according to a second topic, and publish the second message to the first topic; communicate with the Dapp through the second topic; the processing unit 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.

[0035] In a 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 a possible implementation method, the processing unit is used to decrypt the first message according to the first symmetric key to obtain a first public key; the first public key is a 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.

[0037] In a possible implementation method, a processing unit is used to encrypt 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.

[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, and 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 according to the obtained program instructions, or execute any method for implementing the above-mentioned second aspect.

[0043] In a sixth aspect, an embodiment of the present application further provides a computer-readable storage medium, in which computer-readable instructions are stored. When a computer reads and executes the computer-readable instructions, any method of the above-mentioned first aspect is implemented, 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 executable 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 flow chart 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 flow chart 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 flow chart 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 subject provided in an embodiment of the present application;

[0051] Figure 7 A flow chart 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 flow chart of a communication method between a decentralized application DAPP and a digital wallet provided in an embodiment of the present application;

[0053] Fig. 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;

[0054] Fig.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] Fig.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 the present application.

[0057] In the web3 field, Dapp is a type of decentralized application, usually based on blockchain, which does not hold the user's key. Like traditional applications, Dapp provides some functions or utilities to its users. The corresponding user's key is stored in the wallet application. When the user interacts with Dapp, Dapp will request the user to perform identity authentication, transaction signature and other operations. At this time, communication between Dapp and the user's wallet is required to complete the above operations. Due to the decentralized characteristics of Dapp, the communication between the wallet and Dapp requires a third-party service to complete.

[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 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 the Dapp side, the 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. The present application does not limit the execution subject of the 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 a possible implementation method, before the Dapp publishes a first message to the first topic monitored by the blockchain system, it also 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; the Dapp receives an indication of a successful connection sent by the first blockchain node.

[0065] In a possible implementation method, the Dapp generates a first topic and instructs the first blockchain node to listen to the first topic; the first topic is used to represent the topic of the message queue listened to by the blockchain node, so that messages can be transmitted between clients listening to the first topic. The message queue is located in the blockchain system or other systems connected to the blockchain system, and 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 method, the first blockchain node synchronizes the first message to other blockchain nodes that monitor the first message. If no other blockchain node monitors the first message, the first blockchain node stores the first message locally.

[0068] In a possible implementation method, the first generated element is used to indicate the element of the Dapp side that determines the second theme. The second theme is jointly determined by the elements of the Dapp side and the digital wallet side, so that the second theme cannot be cracked by other clients, ensuring the security of communication between the Dapp side and the digital wallet side.

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

[0070] Step 202: The Dapp obtains a second message from the first topic through the blockchain system.

[0071] Among them, 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 a 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] 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 listen to the second topic.

[0078] In a possible implementation method, the first blockchain node synchronizes the event of the Dapp monitoring the second topic to other blockchain nodes. Step 204, the Dapp communicates with the digital wallet through 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 communicate effectively through the second topic monitored by the blockchain system without the help of third-party services, reducing the deployment cost brought by centralized services and improving the system 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] 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, and the present application does not limit the hash algorithm. Of course, the present 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, and the present application does not limit the method for determining the first subject. The determination of the first subject is for the digital wallet to obtain the first message by listening to the first subject, and the Dapp to obtain the second message by listening to 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 a possible implementation method, an access link is generated according to 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 and 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 Dapp have been communicating on the first topic, other clients may obtain the communication content between the digital wallet and Dapp, resulting in the privacy leakage of the digital wallet and Dapp. Therefore, the digital wallet and Dapp of this application communicate on the second topic, and other clients cannot obtain the second topic, and thus cannot obtain the communication content between the digital wallet and Dapp.

[0088] Step 302: The Dapp encrypts the first generated element based on the first symmetric key to obtain the first message.

[0089] In a possible implementation method, the Dapp generates a first public key and a first private key based on elliptic curve cryptography, and uses the first symmetric key to encrypt the first public 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 may be used. Assuming that the generator of the curve is G, sk1·G=pk1; wherein 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 by 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] Among them, 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] 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, and the present application does not limit the hash algorithm. Of course, the present application can also determine the second subject in other ways, 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 scheme enables Dapp to accurately and effectively obtain the second public key corresponding to the digital wallet, and accurately generate the second topic based on the second public key and the first private key; based on elliptic curve cryptography, it can ensure that the second topic generated by Dapp is consistent with the second topic generated by the digital wallet, that is, although the digital wallet does not upload the second topic to the blockchain system, Dapp can generate the second topic by itself according to the second message, and ensure that the second topic generated by Dapp is consistent with the second topic generated by the digital wallet, which can achieve effective communication between Dapp and the digital wallet. Dapp can generate the second topic by itself according to the second message, ensuring that the second topic will not be leaked, and ensuring the security of communication between Dapp and the digital wallet.

[0101] In a possible implementation method, the Dapp uses the second symmetric key to encrypt the information to be communicated and determine the third message; the Dapp publishes the third message to the second topic, thereby communicating with the digital wallet. After receiving the third message, the first blockchain node synchronizes the third message to other blockchain nodes that monitor the second topic. In this solution, the 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, thereby 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, it also 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 response message for the verification message, and publishes the verification response message to the second message 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, through verification messages, can determine, on the one hand, that Dapp has listened to the second topic, and therefore can communicate effectively with the digital wallet based on the second topic; on the other hand, if Dapp does not meet the interface information supported by the digital wallet, it can still communicate with the digital wallet, which will cause Dapp to obtain additional information that does not meet the conditions, resulting in information leakage of the digital wallet; therefore, when 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 are expired, the second theme and / or the first theme are regenerated.

[0106] Figure 5 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 a digital wallet end, and the method can be executed by a communication device between the decentralized application DAPP and the digital wallet, and 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. The present application does not limit the execution subject of the method.

[0107] The method comprises the following steps:

[0108] 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 a first generated element.

[0110] In a possible implementation method, before the digital wallet obtains the first message, 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 first blockchain node is any node of the blockchain system; the digital wallet receives the indication information of successful connection sent by the second blockchain node. Among them, 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 a 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. Exemplarily, the digital wallet obtains the first symmetric key and the first subject by scanning a QR code generated by the Dapp.

[0112] In a 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 obtains 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] 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 listen to 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 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 help of third-party services, which reduces the deployment cost brought by centralized services and improves the system fault tolerance. 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] Among them, the first public key is the public key in the asymmetric key generated by the Dapp based on elliptic curve cryptography.

[0123] In a possible implementation method, after the digital wallet obtains the first symmetric key and the first topic in a preset manner, the digital wallet instructs the second blockchain node to monitor the first topic; since the second blockchain node also monitors the first topic, the first message in the first topic can be obtained. The second blockchain node sends the first message to the digital wallet. After receiving the first message, the digital wallet decrypts the first message according to the first symmetric key to obtain the first public key. In this solution, 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 by the first symmetric key to obtain the first generated element, and then accurately and effectively determine the second topic according to the first generated element and the second generated element.

[0124] 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, and the present application does not limit the hash algorithm. Of course, the present application can also determine the second subject in other ways, but the second subject determined by the Dapp must be consistent with the second subject determined by the digital wallet.

[0130] The above scheme can accurately and effectively determine the second topic. Based on elliptic curve cryptography, it can ensure that the second topic generated by Dapp is consistent with the second topic generated by the digital wallet, and realize effective communication between Dapp and 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 a possible implementation method, 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 a possible implementation method, the digital wallet communicates with the Dapp through the second topic, including: the digital wallet uses the second symmetric key to encrypt the information to be communicated and determine the fourth message; the digital wallet publishes the fourth message to the second topic, thereby communicating with the Dapp. The second blockchain node synchronizes the fourth message to other blockchain nodes that monitor the second topic. In this 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 the Dapp and the digital wallet.

[0134] In one embodiment, before the digital wallet communicates with the Dapp through the second topic, it also includes: the digital wallet publishes a verification message to the second topic, and the verification message includes the interface information supported by the digital wallet. If the digital wallet receives a response message generated by the Dapp indicating that the verification message has passed, subsequently, the Dapp communicates with the digital wallet through the second topic. If the digital wallet receives a response message generated by the Dapp indicating that the verification message has failed, 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 listening to the second topic, so 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 can achieve 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, the method 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 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.

[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 a possible implementation method, before the first blockchain node receives the first monitoring request sent by the Dapp, it also 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 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 method, the first blockchain node synchronizes the first message to other blockchain nodes that monitor the first message. If no other blockchain node monitors 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 is checked and found that the Dapp is associated with the first topic, so the second message is forwarded 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, after the first blockchain node discovers the message synchronized by other blockchain nodes by listening to the second topic, it 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, the method 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 event of the digital wallet monitoring the first topic to other blockchain nodes.

[0156] In a 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] 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 a possible implementation method, after the second blockchain node obtains the first message, it forwards the first message to the digital wallet according to 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, after the second blockchain node discovers the message synchronized by other blockchain nodes by listening to the second topic, it forwards the message to the digital wallet.

[0167] Fig. 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 is applied to the interaction process between a digital wallet terminal and DAPP. The method includes the following steps:

[0168] Step 901: The Dapp and the digital wallet establish connections with the blockchain system respectively.

[0169] In one possible implementation method, the Dapp establishes a connection with the first blockchain node of the blockchain system, and the digital wallet establishes a connection with the 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] Step 902: The Dapp generates a first symmetric key and determines the first subject based on the first symmetric key.

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

[0172] Step 903: The Dapp generates a first public key and a first private key based on elliptic curve cryptography, and uses the first symmetric key to encrypt the first public 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] 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 listen to the first topic.

[0176] 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] 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 listen to the second topic.

[0181] Step 910: The digital wallet uses the first symmetric key to encrypt the second public key to obtain the second message.

[0182] Step 911: The digital wallet publishes a second message to the first topic monitored by the blockchain system.

[0183] Step 912: The Dapp obtains a second message from the first topic through the blockchain system.

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

[0185] 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 listen to 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 linked to blockchain node 1 and blockchain node 2 (or they can be linked 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, use websockets or transport layer security protocol tls to achieve secure communication between blockchain node and Dapp. If the blockchain node allows the connection, it returns a connection success, otherwise it returns a connection failure.

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

[0194] Step 2: Dapp generates the first symmetric key sp1 locally, which 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, encrypts pk1 with the symmetric key sp1 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, the status that blockchain node 1 is monitoring topic-sp1 is sent 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 Dapp.

[0203] Optionally, in actual scenarios, 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 to monitor Topic-sp1 sent by the digital wallet, and based on the amop protocol, sends the status of blockchain node 2 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 monitors Topic-sp1, and sends msg1 to blockchain node 2.

[0207] 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 uses the symmetric key sp1 to decrypt msg1 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, sp2 is used as the symmetric encryption key, and 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] 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, i.e., a hello message, to Topic-sp2. The hello message is encrypted using sp2. The hello message may contain 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, uses sp1 to decrypt message msg2, and obtains pk2.

[0219] Step 20, Dapp calculates sp2=sk1·pk2=sk1·sk2·G, calculates the hash of sp2 to obtain 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 sent by the digital wallet after monitoring.

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

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

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

[0224] Step 25: The digital wallet receives the response message sent by Dapp, and the link is established successfully. 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 Dapp and 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] Step 31, blockchain node 1 receives signRequest1 sent by Dapp to Topic-sp2. Since it is encrypted data, blockchain node 1 does not know the message content, so it can prevent blockchain node 1 from tampering with the message content. Blockchain node 1 finds that blockchain node 2 monitors Topic-sp2 and sends signRequest1 to blockchain node 2.

[0228] Step 32, blockchain node 2 receives signRequest1 of Topic-sp2, finds that the digital wallet monitors Topic-sp2, and then 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, signResponse1 is sent to Topic-sp2.

[0230] Step 34, blockchain node 2 receives signResponse1 of Topic-sp2, checks the blockchain nodes that monitor Topic-sp2, and although blockchain node 2 monitors Topic-sp2, it will not send it repeatedly to the digital wallet because it only monitors the digital wallet. It is found that blockchain node 1 monitors Topic-sp2, so signResponse1 is sent to blockchain node 1.

[0231] Step 35, blockchain node 1 receives signResponse1 of Topic-sp2, finds that Dapp monitors Topic-sp2, and 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, Fig.10 The communication device 1000 between a decentralized application DAPP and a digital wallet provided in an embodiment of the present application is exemplarily shown. Fig.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; communicate 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 a 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 to the digital wallet in a preset manner; the first generated element is encrypted based on the first symmetric key to obtain the first message.

[0236] In a 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 use the first symmetric key to encrypt the first public key to obtain the first message; wherein the first public key and the first private key are a pair of asymmetric keys.

[0237] In a 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 a 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 a 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 met, the Dapp generates a verification response message for the verification message, and publishes the verification response message to the second message topic.

[0240] In the 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 communication with the Dapp is performed 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 a 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 a 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 a 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 used 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, for example, a computing device. Fig.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. Fig.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, etc.

[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 a communication device 1100 between a decentralized application DAPP and a digital wallet, which 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, and 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, 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 may be implemented on the same chip, and in some embodiments, they may also be implemented separately on separate chips.

[0249] 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, a discrete hardware component, and can implement or execute the 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, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware processor for execution, or can be executed by a combination of hardware and software modules in the processor.

[0250] Memory 1102, as a non-volatile computer-readable storage medium, 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 flash memory, hard disk, multimedia card, card-type memory, random access memory (Random Access Memory, RAM), static random access memory (Static Random Access Memory, SRAM), programmable read-only memory (Programmable Read Only Memory, PROM), read-only memory (Read Only Memory, ROM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), magnetic memory, disk, 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, and 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 may be provided as methods, systems, or computer program products. Therefore, the present application may 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 may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include 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 box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes 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 capable of directing a computer or other programmable data processing device to operate 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 A 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 operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions 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 can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also 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 obtains the second generated element based on decrypting the second message, and determines the second topic through the second generated element; The Dapp communicates with the digital wallet through the second topic.

2. The method according to claim 1, characterized in that Before the Dapp publishes the first message to the first topic monitored by the blockchain system, it also includes: The Dapp generates a first symmetric key, and determines the first subject according to the first symmetric key; the first symmetric key and the first subject are shared to 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, characterized in that The Dapp encrypts the first generated element based on the first symmetric key to obtain the first message, including: The Dapp generates a first public key and a first private key based on elliptic curve cryptography, and uses the first symmetric key to encrypt the first public 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 3, characterized in that Obtaining the second generated element based on decrypting the second message includes: 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 theme through the second generation element includes: The Dapp determines a second symmetric key according to the second public key and the first private key; The Dapp determines the second topic according to the second symmetric key.

5. The method according to claim 4, characterized in that The Dapp communicates with the digital wallet through the second topic, including: The Dapp uses the second symmetric key to encrypt the information to be communicated and determine the third message; The Dapp publishes the third message to the second topic, thereby communicating with the digital wallet.

6. The method according to any one of claims 1 to 5, characterized in that: Before the Dapp communicates with the digital wallet through the second topic, it also 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 satisfied; if satisfied, the Dapp generates a verification response message for the verification message, and publishes the verification response message to the second message topic.

7. 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 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; The digital wallet obtains the first generated element based on the decrypted first message, and generates a second subject based on the first generated element and the second generated element; 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 via the second topic.

8. The method according to claim 7, characterized in that Before the digital wallet obtains the first message from the first topic through the blockchain system, the digital wallet 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.

9. The method according to claim 8, characterized in that 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, including: The digital wallet decrypts the first message according to the first symmetric key to obtain a first public key; the first public key is a 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.

10. The method according to claim 9, characterized in that The digital wallet obtains a second message according to the second topic, including: 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.

11. The method according to claim 10, characterized in that 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.

12. The method according to any one of claims 7 to 11, 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.

13. 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 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; obtain a second message from the first topic through the blockchain system, 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; and communicate with the digital wallet through the second topic; The processing unit is used to obtain the second generated element based on decrypting the second message, and determine the second subject through the second generated element.

14. A communication method between a decentralized application Dapp and a digital wallet, characterized in that: Including transceiver unit and processing unit: The transceiver unit 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; obtain a second message according to a second topic, and publish the second message to the first topic; communicate with the Dapp through the second topic; The processing unit 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.

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

16. A computer-readable storage medium, characterized in that: The method comprises computer-readable instructions. When a computer reads and executes the computer-readable instructions, the method according to any one of claims 1 to 6 or the method according to any one of claims 7 to 12 is implemented.

Citation Information

Patent Citations

  • Method, medium, device and block chain system for automatically importing account private key of block chain wallet

    CN109146481A

  • Short link message monitoring method and device based on block chain

    CN110098979A

  • Application system and method based on blockchain DAPP

    CN111401872A

  • Block chain data processing method and device, equipment and medium

    CN112560078A

  • Block chain message transmission method and device, client and storage medium

    CN114205093A