ERC-4527 · Stagnant · ERC · 2021-12-07
ERC-4527: QR Code transmission protocol for wallets
A standard way for watch-only wallets and air-gapped signers to exchange public keys, signing requests and signatures through (animated) QR codes using Blockchain Commons UR encoding.
What problem does it solve?
Many users keep their private keys on a device that never touches the network: a hardware wallet with a camera and screen, or an old phone in airplane mode. That offline signer still needs an online watch-only wallet to show balances, build transactions and broadcast them. The two must exchange data somehow: USB, Bluetooth, files or QR codes.
QR codes have a small attack surface, work across browsers and operating systems without drivers, and users can inspect what is being transferred. But before this proposal every vendor encoded Ethereum data in its own QR format, so a given wallet only worked with specific signers. ERC-4527 defines one flow and one encoding so any compliant wallet can pair with any compliant signer.
How it works
The flow has four steps:
- Pairing. The signer shows a QR with its extended public key and derivation path (
crypto-hdkeywith acrypto-keypath). The watch-only wallet derives addresses and tracks balances. - Request. The wallet builds unsigned data and shows it as an
eth-sign-requestQR. - Sign. The signer decodes it, shows the details to the user, signs, and displays an
eth-signatureQR. - Broadcast. The wallet scans the signature, assembles the signed transaction and sends it.
Data is CBOR-encoded and wrapped in Blockchain Commons Uniform Resources (UR). Large payloads are split across an animated sequence of QR frames using fountain codes, with a CRC32 checksum so the receiver knows the message is complete.
eth-sign-request is a CBOR map with integer keys:
| Key | Field | Notes |
|---|---|---|
| 1 | request-id |
optional UUID |
| 2 | sign-data |
the bytes to sign |
| 3 | data-type |
1 legacy tx RLP, 2 EIP-712 typed data, 3 raw bytes (e.g. EIP-191 personal_sign), 4 EIP-2718 typed tx |
| 4 | chain-id |
defaults to 1 |
| 5 | derivation-path |
which key to use |
| 6 | address |
optional, lets the signer double-check the key |
| 7 | origin |
optional, e.g. wallet name |
eth-signature returns the same request-id, a 65-byte (r, s, v) signature and an optional device origin.
Sample code
An eth-sign-request in CBOR diagnostic notation (placeholders, not real data):
{
1: 37(h'<16-byte uuid>'), / request-id /
2: h'<unsigned EIP-1559 tx bytes>', / sign-data /
3: 4, / data-type: EIP-2718 typed transaction /
4: 1, / chain-id: Ethereum Mainnet /
5: 304({ 1: [44, true, 60, true, 0, true, 0, false, 0, false] }),
/ derivation-path m/44'/60'/0'/0/0 /
6: h'<20-byte address>', / address for verification /
7: "my-wallet" / origin /
}
The CBOR bytes are then UR-encoded into one or more QR frames that start with ur:eth-sign-request/.
Things to know
- Status is Stagnant: the ERC has not advanced to Final and may change or be abandoned. Check what a given wallet or signer actually supports before relying on it.
- The spec points to the
ur-registry-ethpackage by the Keystone team as its reference implementation and test vectors. - Security relies on the signer decoding and showing the full request before signing, and on checking the optional
addressagainst its own key. A signer that blind-signs undoes the benefit. - For legacy transactions, include the chain ID so the signature gets EIP-155 replay protection.