WalletConnect allows the user to scan a QR code from the wallet app to unlock and use their wallet seamlessly in the web UI.
What is WalletConnect?
WalletConnect is an open protocol made to facilitate a secure connection between mobile cryptocurrency wallets and desktop applications, such as dapps. Transactions are made through an encrypted connection by scanning a QR code, and are confirmed on the mobile device. As the private key never leaves the user’s device, their funds are never at risk and the possibility of a hijack is very low.
WalletConnect enables Dapp developers to integrate with multiple wallets through a single implementation.
- enable users to use their mobile wallets with Dapps without having to install a browser extension
- enable users to use the wallet of their choice without worrying about which Dapps have integrated with which wallets
- simplify wallet integration for Dapp developers instead of requiring them to integrate each wallet individually
- provide flexibility to Dapp developers about which Wallet Connect bridge servers they want to use to communicate with mobile wallets
- provide control to the mobile wallet developers on how push notifications are sent to their users
How does it work?
WalletConnect connects web applications to supported mobile wallets. WalletConnect session is started by a scanning a QR code (desktop) or by clicking an application deep link (mobile).
Why Should I Use WalletConnect?
A few of the most popular options for interacting with a dapp include using a desktop browser-only extension like Metamask, or a mobile wallet/Ethereum browser like Cipher or Status. The problem with these solutions is that funds are generally ‘stuck’ on one platform, and would make it difficult to switch between mobile and desktop, unless the recovery phrase would be exported which could result in serious security implications.
Using WalletConnect with Binance API
Protocol Differences
Since we do not use Ethereum transactions, there are some differences:
- Typically
sendTransaction
is used with Ethereum transaction parameters in WalletConnect dApp integrations. But in Binance Chain’s case, instead of invoking sendTransaction in the WalletConnect flow, the new sendCustomRequest call is used instead with a method calledbnb_sign
(see below). - The external wallet provider is responsible for sending back the signature and public key of the transaction but should not broadcast the transaction itself. We have instead defined a custom
result
format in the form of stringified JSON containing the signature and public key. The reason for this is that the wallet app probably does not have access to the complete serialized binary form of the transaction (as this requires Amino encoding). - The web wallet will send back a second custom call (after
bnb_sign
) calledbnb_tx_confirmation
, which contains the boolean result of the transaction build/broadcast and any error message encountered by the web wallet during broadcasting. In a complete implementation, this confirmation callback should be responded to with a call toapproveRequest
.
Sources
This article originally appeared on lightrains.com
Leave a comment
To make a comment, please send an e-mail using the button below. Your e-mail address won't be shared and will be deleted from our records after the comment is published. If you don't want your real name to be credited alongside your comment, please specify the name you would like to use. If you would like your name to link to a specific URL, please share that as well. Thank you.
Comment via email