Introduction

Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.

I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.

I also build and publish a variety of tools, libraries, and open-source projects.

ERC-1328 defines a URI format for initiating connections between applications and wallets through WalletConnect.

This article translates, summarizes, and expands on the following proposal.

ERC-1328 was in Review status as of January 5, 2024.

More ERC explainers:

Overview

The standard specifies how information required to connect an application to a wallet is represented in a URI. This URI can be displayed as a QR code or an application link.

A user can initiate a connection by scanning a QR code with a phone or opening a link. This simplifies interactions between applications and wallets, while the subsequent protocol and wallet approval process determine which operations are authorized.

Specification

Syntax

A WalletConnect request URI uses a defined structure and parameters to convey the information needed to initiate a connection.

  • request
    • Begins with the scheme "wc", identifying a WalletConnect connection request.
  • topic
    • A string identifying the relevant communication topic.
  • version
    • A number indicating the WalletConnect protocol version.
    • The grammar permits the version component to be omitted, although explicit versioning is important for interoperability.
  • parameters
    • Additional connection information represented as key-value pairs separated by ampersands.
  • key
    • The parameter name.
  • value
    • The parameter value.

The URI uses the following grammar:

text
request       = "wc" ":" topic [ "@" version ][ "?" parameters ]
topic         = STRING
version       = 1*DIGIT
parameters    = parameter *( "&" parameter )
parameter     = key "=" value
key           = STRING
value         = STRING

A URI following this structure can be encoded in a QR code or used as a link to initiate communication between an application and a wallet.

Semantics

The required parameters depend on the WalletConnect protocol version.

WalletConnect v1.0 (version=1)

  • key
    • A symmetric key used to encrypt messages.
  • bridge
    • The URL of the bridge server responsible for relaying messages.

WalletConnect v2.0 (version=2)

  • symKey
    • A symmetric key used to encrypt messages exchanged through the relay.
  • methods
    • JSON-RPC methods supported on the pairing topic.
  • relay-protocol
    • The transport protocol used to relay messages.
  • relay-data
    • Optional data for the relay transport.

WalletConnect v1 provides basic encryption and bridge configuration. WalletConnect v2 introduces more detailed pairing and relay configuration, including the symmetric key, supported methods, and relay protocol.

These parameters describe how the connection is established. They do not independently authorize wallet operations or guarantee that the application requesting a connection is trustworthy.

Examples

The following examples illustrate URI formats for WalletConnect v1 and v2. They are historical specification examples, not active pairing requests or credentials to use in production.

Version 1 example

text
wc:8a5e5bdc-a0e4-4702-ba63-8f1a5655744f@1?bridge=https%3A%2F%2Fbridge.walletconnect.org&key=41791102999c339c844880b23950704cc43aa840f3739e365323cda4dfa89e7a
  • wc
    • Identifies WalletConnect.
  • 8a5e5bdc-a0e4-4702-ba63-8f1a5655744f
    • Identifies the communication topic.
  • @1
    • Indicates protocol version 1.
  • bridge=https%3A%2F%2Fbridge.walletconnect.org
    • The URL-encoded address of the bridge server.
  • key=417...89e7a
    • The symmetric encryption key.

Version 2 example

text
wc:7f6e504bfad60b485450578e05678ed3e8e8c4751d3c6160be17160d63ec90f9@2?relay-protocol=irn&symKey=587d5484ce2a2a6ee3ba1962fdd7e8588e06200c46823bd18fbd67def96ad303&methods=[wc_sessionPropose],[wc_authRequest,wc_authBatchRequest]"
  • wc
    • Identifies WalletConnect.
  • 7f6e504b...ec90f9
    • Identifies the pairing topic.
  • @2
    • Indicates protocol version 2.
  • relay-protocol=irn
    • Identifies the relay transport protocol.
  • symKey=587d...d303
    • The symmetric encryption key.
  • methods=[wc_sessionPropose],[wc_authRequest,wc_authBatchRequest]
    • Lists supported JSON-RPC methods.

The second example retains the trailing quotation mark from the original article; it is illustrative and should not be copied directly into an implementation.

These URIs convey the information applications and wallets need to initiate communication. Their parameters depend on the protocol version and transport mechanism. Production implementations should use the relevant WalletConnect SDK and version-specific specification.

Rationale

The proposal replaces the JSON representation used in earlier alpha versions of WalletConnect. Interpreting JSON embedded in QR codes was considered inefficient, while a URI makes it easier for wallet applications to implement QR-code handling.

Representing connection information as a URI also allows Android applications to take advantage of the Intent system.

Instead of parsing an arbitrary JSON document and deciding what action it describes, a wallet can interpret a URI with a recognizable scheme and associated parameters. On Android, applications can register to handle particular links or data formats, enabling smoother interactions across applications.

Android Intents

Android's Intent system supports communication between applications and between components within an application. An Intent is an object describing an action to perform.

Two common uses are:

  1. Starting an activity
    • An Intent can launch an activity, such as a user-interface screen, in the same application or a different application.
    • For example, tapping a button may initiate navigation to another screen.
  2. Sending a broadcast
    • An application can use an Intent to send a message to eligible receivers.
    • Broadcasts can communicate events or device-state changes, subject to Android's permission and background-execution rules.

Intents can be explicit or implicit.

  • Explicit Intents
    • Identify the exact component, such as a particular activity or service, that should handle the request.
    • They are useful when the developer already knows the intended destination.
  • Implicit Intents
    • Describe an action and associated data without naming the destination component.
    • Android selects an appropriate eligible component based on the Intent's action and data.
    • For example, an application can request that a web page be opened without explicitly selecting a browser.

This mechanism helps applications launch appropriate activities and exchange data in response to user actions.

Compatibility

Versioning is important because WalletConnect continues to evolve and newer protocol versions can introduce different URI parameters and communication mechanisms.

Including version information enables applications and wallets to identify the intended protocol and select an appropriate implementation.

Versioning makes it possible to support multiple protocol versions, but does not guarantee backward compatibility by itself. A wallet must actually implement the requested version. The v1 examples in this article are historical and should not be treated as a recommendation to build a new v1 integration.

Security

The URI is intended to be shared between the user's devices or applications. It must not contain a wallet's private key or information that directly grants control over the user's digital assets.

However, the URI itself contains symmetric encryption material used during connection establishment. An active pairing URI must therefore be treated as sensitive session information. It should not be posted publicly, retained in analytics, or exposed in application logs.

Only share active pairing information with the intended application or wallet. A successful pairing must not be confused with approval of a session, signature, or transaction: wallets should validate and authorize requests according to the protocol and the user's decisions.

Minimizing unnecessary information in the URI and protecting its required connection parameters helps reduce unauthorized access and other security risks.

Citation

ligi (@ligi), Pedro Gomes (@pedrouid), "ERC-1328: WalletConnect URI Format [DRAFT]," Ethereum Improvement Proposals, no. 1328, August 2018. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-1328.

Conclusion

ERC-1328 defines how applications and wallets represent connection-establishment information in WalletConnect URIs. The format supports QR-code and link-based connection flows, with version-specific parameters for encrypted communication.

Questions are welcome via Twitter @cardene777.

Other publications:

https://chaldene.net/