Think in Coin | DEV Docs
  • Develop Documents
  • Networks
    • Fantom Network
      • quick-start
        • Short Guide
      • technology
        • Lachesis aBFT
        • Overview
        • Proof of Stake
        • Transaction Fees
        • FAQ
      • staking
        • Quick start
        • Overview
        • Stake on Fantom
        • Run a Validator Node
        • Run a Read-only node
        • Run a Testnet Validator
        • Troubleshooting
      • api
        • Public API endpoints
        • Getting Started
        • Installation
        • GraphQL Schema Basics
        • Schema Structure
        • Implementation Details and Notes
        • Covalent indexing and querying API
      • tutorials
        • Set up Metamask
        • Set up Metamask (testnet)
        • Deploy a Smart Contract
        • Create a Fixed-cap Asset
    • xDAI Chain
      • Welcome to xDai
      • untitled
        • About xdai
          • Projects & DApps
          • Features
          • Use Cases
          • News & Information
          • Roadmaps
          • FAQs
        • For users
          • xDai Token
          • Getting Started with xDai
          • Bridges
          • Wallets
          • Applications
          • Block Explorers
          • Governance
        • For stakers
          • STAKE Token
          • Staking on xDai
          • EasyStaking on Ethereum
          • POSDAO Staking Roadmap
        • For developers
          • Developer Resources & Tools
          • On-Chain Random Numbers
          • Install xDai Client - Run a Non-Validator Node
          • Stable Chain Network Deployment
          • Grants for building on xDai
          • Immunefi Bug Bounty
        • For validators
    • Polygon Network
      • About - Polygon
      • Technology
    • Huobi HECO Chain
      • Huobi Open Platform
    • Binance Chain
      • Create Address
      • Fees
      • Governance
      • Threshold Signature Scheme
      • Atomic Swap
      • WalletConnect
      • Wallets Support
        • WalletConnect Support
        • Trust Wallet User Guide
        • Ledger Wallet Guide
        • Trezor Wallet Guide
        • How to manage BEP8 token with Web Wallet
      • BEP8 Token Protocol
      • Binance DEX Trading
      • Binance Chain Testnet
      • Exchange Integration
      • List Instructions
    • Binance Smart Chain
      • Concepts
        • Consensus
        • Comparison
        • Genesis File
        • BC > BSC Cross-Chain
          • Mechanism
          • Cross-Chain Transfer
          • BSC Relayer
          • Oracle Module
          • Oracle Relayer
          • Relayer incentives
        • Build-in System Contract
        • Governance
      • Ecosystem
      • Gnosis
      • Binance Bridge
        • Release
        • Roadmap
        • User Guides
        • Developer
          • Widget
          • Swagger API reference
        • Partnership
        • Support
          • Customer Support
        • guides
          • Binance Bridge v2
          • Binance Bridge v1
          • Supported Assets
          • Buy BNB as Gas
    • Ethereum (ERC)
      • Ether - Introduction
        • The Ethereum Foundation
        • Community
        • History of Ethereum
        • The Homestead Release
        • What is Ethereum?
        • A platform for decentralized apps
      • The Ethereum network
        • Connecting to the Network
        • Test Networks
      • Mining
      • Contracts and Transactions
        • Account Types, Gas, and Transactions
        • Contracts
        • Accessing Contracts and Transactions
        • Dapps
        • Mix
          • Project Editor
          • Scenarios Editor
          • State Viewer
          • Transaction Explorer
          • JavaScript console
          • Transaction debugger
          • Dapps deployment
          • Code Editor
        • Ethereum Tests
          • Blockchain Tests
          • State Tests
        • Web3 Base Layer Services
    • Harmony ONE
      • developers
        • Getting Started
        • Network & Faucets
        • Deploying on Harmony
        • SDK
        • API
        • Wallets
        • Tools
        • Showcases
        • Hackathon & Bounties
        • Learn
      • network
        • Governance
        • Holders
        • Validators
        • Delegators
      • general
        • Grants
        • Introduction
          • What is Harmony?‌
          • Roadmap
          • Strategy & Architecture
          • Study Materials
          • FAQ
        • Technology
        • Horizon Bridge
        • DApps
        • Ecosystem
        • Community
    • TRON Network (TRC)
      • Introduction
      • Tron Protocol
        • Account
        • Resource Model
        • Super Representatives
          • Mechanism
          • Step to become a Candidate
          • Committee and Proposal
        • Transaction
        • Multi-Signature
          • Example Process Flow
        • Concensus
        • untitled
          • Build transaction locally
      • TRX AND TRC TOKEN
        • TRX
          • TRX Transfer
          • Query TRX balance
        • TRC-10
          • Issue TRC-10 token
          • Participate TRC-10
          • TRC-10 Transfer
          • Query TRC-10 balance
          • TRC-10 Transfer in Smart Contracts
          • Other TRC-10 Interfaces
        • TRC-20
          • Protocol Interface
          • Issuing TRC-20 tokens tutorial
          • TRC-20 Contract Interaction
        • TRC-721
  • Community
    • Github
    • Telegram DEVs
Powered by GitBook
On this page
  • What is WalletConnect?
  • How does it work?
  • Wallets with WalletConnect Support for Binance Chain
  • Get Started
  • Connecting via WalletConnect
  • Protocol Differences
  • Sequence Diagram
  • Custom Requests
  • Ending the Session

Was this helpful?

  1. Networks
  2. Binance Chain

WalletConnect

PreviousAtomic SwapNextWallets Support

Last updated 2 years ago

Was this helpful?

What is WalletConnect?

WalletConnect is an open protocol for connecting desktop Dapps to mobile Wallets using end-to-end encryption by scanning a QR code. Opening up a whole world of Dapps that were once only available to Metamask. The user can interact with any Dapp without comprising their private keys and will be notified to sign any transaction requests on their mobile.

How does it work?

WalletConnect is a simple infrastructure that can be setup by any developer. Using a Bridge server to relay the messages without having access to any of its contents. The contents are encrypted using the session data shared by the QR code between the desktop and mobile. There are libraries for Web, iOS and Android. Read more about it in our documentation introduction.

Wallets with WalletConnect Support for Binance Chain

  • List of Wallets Supporting WalletConnect on Binance Chain

Get Started

Currently the WalletConnect protocol has references implementations written in Typescript for the Client (browser/react-native/nodejs), the Bridge Server and the Push server.

To learn more about how to develop, please read the .

The Binance Chain Web Wallet supports connecting with external wallet providers via the .

WalletConnect allows the user to scan a QR code from the wallet app to unlock and use their wallet seamlessly in the web UI.

In order for this to work, some modifications to the standard WalletConnect protocol are used in the Binance Chain wallet's implementation.

See the list of wallets which support WalletConnect on Binance Chain ​

Connecting via WalletConnect

Protocol Differences

Since we do not use Ethereum transactions, there are some differences:

  • 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) called 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 approveRequest.

Sequence Diagram

This sequence diagram shows the flow of messages when the web wallet interacts with an external wallet provider via WalletConnect.

WalletConnect Protocol Sequence

Custom Requests

A custom call request adheres to this structure:

{  "id": 1,  "jsonrpc": "2.0",  "method": "method_name",  "params": [{ ... }],}

We have two custom call request formats, here are examples of them:

Example: bnb_sign

{  "method": "bnb_sign",  "params": [    {      "account_number": "34",      "chain_id": "Binance-Chain-Ganges",      "data": null,      "memo": "test",      "msgs": [        {          "inputs": [            {              "address": "tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd",              "coins": [                {                  "amount": 1000000000,                  "denom": "BNB",                },              ],            },          ],          "outputs": [            {              "address": "tbnb1ss57e8sa7xnwq030k2ctr775uac9gjzglqhvpy",              "coins": [                {                  "amount": 1000000000,                  "denom": "BNB",                },              ],            },          ],        },      ],      "sequence": "31",      "source": "1",    }  ]}

Response (approveRequest)

A response like this should be sent back from the wallet app:

{  "id": 1553682007906047,  "result": "{\"signature\":\"...\",\"publicKey\":\"...\"}"}

In result, a JSON-encoded object must be included containing the following hex-string properties: signature, publicKey.

Note that:

  • id and jsonrpc are usually pre-filled by the client SDK, so there should be no need to set this in the object yourself.

  • signature should be 64 bytes in length (128 hex chars)

  • publicKey should be 65 bytes in length (130 hex chars, non-compressed form, prefixed with 0x04)

Example: bnb_tx_confirmation

{  "method": "bnb_tx_confirmation",  "params": [    {      "ok": true,      "error": "Error message (optional)"    }  ]}

Receipt of the bnb_tx_confirmation should be confirmed by the app with approveRequest as per the WalletConnect protocol flow.

For this response, result may be empty or contain an empty JSON-encoded object:

Response (approveRequest)

A response like this should be sent back from the wallet app:

{  "id": 1553682007906050,  "result": ""}

Ending the Session

Remember to call killSession() when the user has finished using the integration from your app!

This will redirect the user back to the unlock screen in the web wallet.

Wallet providers should make use of the for their target programming language and OS. There are implementations for iOS, Android, React Native, etc.

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 call is used instead with a method called bnb_sign (see below).

official documentation
WalletConnect protocol
here
WalletConnect Client SDK
on GitHub
sendCustomRequest