Canary

Canary sounds the alarm on address leaks, blocks culprits, and keeps your reads private.

Canary

Created At

ETHGlobal Mumbai

Project Description

Canary — Privacy I

Your wallet protects your private keys, but it doesn't necessarily protect your wallet address when you interact with decentralised applications.

Dapps built with wagmi and viem send blockchain reads such as balanceOf(you), allowances, and positions directly from your browser to their RPC providers. Many also send your wallet address to analytics platforms and third-party trackers, where it can be associated with your IP address. Your wallet's RPC settings do not control this frontend traffic.

A USENIX Security 2023 study found that 211 of 616 dapps leaked wallet addresses to third parties. Our own scans of five leading dapps identified 12 third parties receiving wallet addresses.

Canary is a browser extension that protects users across dapps without requiring a fork, integration, or changes to the dapp's code.

Private reads

Canary routes the dapp's supported Ethereum RPC reads through the Ethereum Foundation's Anon-RPC over Tor. Instead of connecting directly to the dapp's RPC provider, supported reads travel through an anonymous network path. The RPC endpoint sees a Tor exit address rather than your original IP address.

Leaks blocked

Protecting RPC requests alone isn't enough. A dapp can still expose your wallet address through unrelated third-party requests. Canary detects and blocks requests carrying your address across the communication channels available to a page, including Fetch, XMLHttpRequest (XHR), WebSocket, beacons, and tracking pixels.

Measured coverage

Canary measures what happens to every inspected request and classifies it as:

  • Protected: Routed through Anon-RPC.
  • Blocked: Prevented from reaching its destination.
  • Exposed: Reached a destination without the intended protection.
  • Not inspected: Could not be reliably inspected or classified.

Each request also receives a receipt documenting what the relevant endpoints observed with and without Canary.

Making Tor fast enough for a dapp

Privacy protection is only useful if the application remains responsive. We measured where the latency comes from and optimised the request pipeline, circuit management, and gateway infrastructure.

Batching, caching and deduplication: Canary groups reads arriving within 15 ms into a single JSON-RPC batch. It caches values that do not change, such as chain IDs and deployed contract code, briefly caches block numbers, and deduplicates identical requests already in flight. On app.uniswap.org, 20 of 24 RPC calls were exact duplicates.

  • 20 sequential reads went from 43–55 seconds to 1.6–2.1 seconds when batched.
  • On a real dashboard firing 20 reads simultaneously, the page settled in 1.7 seconds instead of 3.2 seconds.
  • All 80 answers were returned instead of 73.

Pre-warmed Tor circuits: Canary maintains a separate Tor circuit for each wallet address. The first read on a new circuit initially took approximately 2.0 seconds, compared with 1.15 seconds for subsequent reads. Canary now builds the circuit as soon as it learns the wallet address, before the dapp makes its first request.

Hedged reads: If a read receives no response within three seconds, Canary sends it again through a fresh circuit. The new circuit maintains the same per-address isolation, helping prevent a slow relay or gateway from stalling the application.

Faster startup: The extension includes a Tor directory snapshot, saving approximately 11–13 seconds on first startup compared with using EF's gateway.

Our own gateways: EF's demonstration gateway initially took 18–43 seconds to start Tor and stopped working on 6 November. We deployed our own public gateways, bringing Tor startup time down to approximately four seconds. Today, a warm private read takes approximately 0.85 seconds.

What we found in EF's tor-js

While profiling Anon-RPC, we identified several performance and reliability issues in EF's tor-js implementation. We developed two patches intended for upstream integration and implemented an additional recovery improvement within Canary.

1. Connection reuse: Previously, tor-js closed its connection after every request using Connection: close. Every read therefore had to establish a new Tor stream, a new TCP connection from the exit, and a new TLS handshake, adding approximately one second of overhead. Our keep-alive patch reuses connections while maintaining strict address-level isolation: a connection belonging to one address is never reused for another.

  • Warm reads improved from 827 ms to 234 ms.
  • With per-address circuit isolation, reads improved from 1,140 ms to 203 ms.
  • 20 parallel reads improved from 2.0 seconds to 0.98 seconds.

2. Detecting dead gateways: Previously, when a gateway died without properly closing its connection, tor-js only detected the failure after the WebRTC connection timed out. Until then, circuits and reads using that gateway could remain stuck. Our liveness patch checks gateways that have gone quiet and removes them after two missed checks.

  • Each gateway failure now causes one failed read instead of two.
  • Recovery time improved from 17–31 seconds to 10.5–14 seconds in five of six tests.

3. Faster recovery after gateway failure: After a gateway failed, Tor continued assigning an address to its circuit through the dead gateway. Consequently, every subsequent read had to wait for the three-second hedge. We fixed this within Canary: when a hedge succeeds through a new circuit, that working circuit becomes the address's circuit for subsequent reads. Recovered reads improved from approximately 4.2 seconds to 0.8 seconds.

4. EF gateway reliability: EF's demonstration gateway could not reliably reach Tor guard relays and, on 6 November, stopped completing connections. This requires a fix from EF's gateway operator. Canary therefore runs its own gateways, retaining EF's gateway as an optional fallback.

Upstream integration: The Anon-RPC worker is pinned on-chain by its hash. This means the two tor-js patches cannot simply be shipped inside Canary; they need to be integrated upstream first. Our builds are reproducible: an unpatched tor-js build produces exactly the hash of the currently deployed on-chain worker.

ENSv2 privacy promises

Canary also makes a dapp's privacy promises independently verifiable. A dapp publishes the parties that should receive its wallet address in an ENSv2 text record called privacy.manifest. Canary's independent verifier scans the dapp, compares its observed traffic against the declared manifest, and publishes a cryptographically signed verdict.

The verifier receives permission to modify only the verdict record through ENSv2 Enhanced Access Control. This allows it to publish findings without receiving control over the dapp's other ENS records. The dapp can revoke that permission, and Canary can detect the revocation.

Most dapps will never publish their own manifests. For these applications, Canary maintains signed privacy labels under its ENS namespace, such as app-aave-com.labels.canary.eth. These labels contain the verifier's findings and are displayed by the extension when the dapp accesses the user's wallet address.

Canary Swap

We built Canary Swap to demonstrate a privacy-preserving alternative to conventional Uniswap integrations. app.uniswap.org sends the user's wallet address to its quote server as the swapper parameter before the user signs anything. Canary Swap takes a different approach: it obtains quotes directly from the Uniswap v4 Quoter on-chain, without including the user's wallet address in the request.

AI agents

The same privacy problem applies to autonomous AI agents. Their blockchain reads can reveal their strategy before they execute a trade.

Canary extends its Anon-RPC infrastructure to agents through a local gateway and SDK. Each agent receives an ENSv2 name whose privacy.manifest defines the policy enforced by its gateway. The gateway retrieves the policy, routes the agent's reads through Anon-RPC, and publishes signed reports describing where its traffic went.

This provides agents with policy-controlled access and a verifiable record of their network activity.

Results

  • Address leaks: Across five leading dapps, third parties receiving wallet addresses went from 12 to 0.
  • RPC coverage: On 1inch with a wallet connected, 237 RPC calls went through Anon-RPC, with none held back.
  • Batching: 20 reads improved from 43–55 seconds sequentially to 1.6–2.1 seconds batched.
  • Tor startup: Improved from 18–43 seconds through EF's demonstration gateway to approximately four seconds using our own gateways.
  • Connection reuse: A warm private read improved from 827 ms to 234 ms with our tor-js keep-alive patch.

Live deployments

  • LeakyDash: A deliberately leaky demonstration dapp.
  • Canary Swap: A privacy-preserving swap application deployed on Vercel.
  • 12 ENSv2 names: Deployed on Ethereum Sepolia.
  • Public Tor gateways: Our own gateway infrastructure supporting Canary's anonymous RPC connections.

How it's Made

Canary is a Chrome extension written in TypeScript. It runs on a shared core library that also powers our agent gateway and SDK.

Before the page's own code runs, Canary injects a script into every frame that wraps the page's network APIs, including fetch, XHR, WebSocket and beacons. It examines outgoing requests and passes JSON-RPC calls to the extension's background worker. The worker decides what happens next: handle the request privately, block it, or allow it while recording what was sent. This gives Canary a per-tab record of what each party received, both with and without protection.

Some requests, such as tracking pixels and script tags, cannot be intercepted through these APIs. For those, Canary uses browser-level blocking rules to catch URLs containing the wallet address, including the different formats commonly used by trackers. The popup and dashboard are built with React.

Ethereum Foundation Anon-RPC and tor-js

Canary's private connection uses the Ethereum Foundation's Anon-RPC worker, powered by tor-js, a WebAssembly build of Arti, the Rust Tor client. It creates Tor circuits directly in the browser and connects to relays through a gateway using WebRTC.

Before the worker runs, Canary resolves it from an on-chain registry and checks its hash. It runs inside a null-origin sandbox in an offscreen document, separate from both the webpage and the extension's privileged APIs. This lets Canary run a real Tor client in the browser without asking users to install anything or requiring dapps to change their code.

Canary does not simply forward a dapp's reads to its original RPC provider. Those provider URLs often contain API keys that identify the dapp. Instead, Canary handles supported read calls using a public endpoint for the correct chain. The dapp's original provider never receives those requests, and the RPC endpoint sees a Tor exit rather than the user's IP address. Each wallet address gets its own Tor circuit, keeping requests from different addresses separated.

Getting Tor fast enough for everyday dapp usage took a significant amount of engineering. While profiling requests, we found that tor-js closed its connection after every request. That meant each read had to open a new Tor stream and complete another TLS handshake.

We improved the request pipeline in a few ways. Canary batches, caches and removes duplicate reads, reducing twenty individual reads from roughly 50 seconds to around two seconds. It also starts building a Tor circuit as soon as it learns a wallet address and retries stalled reads through a fresh circuit.

We also contributed two patches to tor-js:

  • HTTP keep-alive within each circuit, which reduced a warm read from 827 ms to 234 ms.
  • A gateway liveness check that detects when a gateway silently stops responding, preventing circuits from hanging indefinitely.

Another issue appeared during failover. Even after switching gateways, tor-js could continue routing an address through the dead gateway. We handle that recovery inside Canary. When the Ethereum Foundation's demo gateway stopped working during the hackathon, we set up and ran our own gateways instead.

Answering requests on the correct chain

Replacing an RPC provider only works if Canary knows which blockchain that provider serves. Getting this wrong would mean returning data from the wrong chain.

Canary first checks well-known provider URLs and then asks the endpoint directly over Tor. Some dapps use their own servers that do not accept Tor connections. We encountered this with 1inch, so in that case the page contacts the server directly with a request that does not contain a wallet address.

Canary also does not assume that a wallet's currently selected chain is the only one the dapp uses. Real applications often read from several chains at the same time, so each endpoint needs to be handled independently.

ENSv2

We use ENSv2 to make privacy promises public and independently verifiable.

A dapp's ENS name stores its privacy manifest, which describes who should receive the user's wallet address. It also stores a signed verdict from an independent verifier describing what the site actually does. The website and its ENS name reference each other, giving users a way to check that the records belong to the site they are visiting.

Our scanner loads a site with and without Canary using Playwright, mitmproxy and a fake wallet containing a synthetic address. It records which services receive that address and compares the observed traffic with the site's manifest. The verifier then signs the result and publishes it to the ENS name.

ENSv2's role-based permissions let us give the verifier a key that can update one specific record, without giving it control over the rest of the name. This means a compromised verifier cannot change the dapp's privacy manifest. Its permission can also be revoked, and readers can check whether the key still has permission.

For dapps that have not published a manifest, Canary creates signed labels under its own ENS namespace. This gives users access to the results of our scans even when a site has not published its own privacy information.

We use the same approach for AI agents. An agent's ENS manifest defines the privacy policy its gateway must enforce, and the gateway publishes signed reports about the traffic it handles.

The extension also checks these ENS records through the ENS Universal Resolver over Anon-RPC. This means checking a site's privacy information does not reveal to the RPC provider which site the user is visiting.

Uniswap v4

Canary Swap demonstrates how a private trading flow can work without sending a wallet address to a quote server.

It gets quotes using the Uniswap v4 Quoter and StateView through ordinary contract calls that do not include the user's address. Trades are executed through the Universal Router with Permit2 on our own v4 pool on Sepolia.

The page also shows the network requests made while generating a quote. Its ENSv2 name contains a verified privacy manifest, so Canary can show that the observed requests match the site's declared policy.

Our example AI agent can perform the same swap through the Canary gateway, with its signed transaction broadcast over Anon-RPC.

AI agents

The agent gateway runs the same Anon-RPC worker inside headless Chrome. It exposes a JSON-RPC endpoint and an HTTP(S) proxy, so an agent can use it by changing its RPC URL and proxy settings rather than changing its underlying implementation.

We also built a TypeScript SDK with a viem transport, an ethers provider and an LLM pseudonymizer. The pseudonymizer replaces wallet addresses in prompts with placeholders before they are sent to an LLM.

Some of the less obvious engineering work

A few problems required solutions beyond the main request pipeline.

Switching wallet accounts safely: When a user switches accounts, Canary temporarily holds the wallet's account announcement until the blocking rule for the new address is installed. This prevents the new address from reaching a tracker before protection is ready.

Handling eth_accounts locally: Remote RPC nodes do not hold wallet keys, so their response to eth_accounts would be empty. Canary handles this call locally instead of sending it to a remote endpoint.

Running gateways with UDP support: The tor-js gateways need inbound UDP for WebRTC and QUIC. We could not find a free hosting provider that supported this setup, so we run our gateways in Docker behind a UDP tunnel, with the Ethereum Foundation's gateway available as a fallback.

Failing closed: If the private connection stops working, Canary returns an error rather than silently sending reads through the normal connection. Users can choose to allow direct access for a particular site.

background image mobile

Join the mailing list

Get the latest news and updates

Canary | ETHGlobal