Open protocol for connecting Wallets to Dapps
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
Since we do not use Ethereum transactions, there are some differences:
sendTransactionis 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 called
- 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
resultformat 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_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 to