Veylor

Veylor is a Shielded wallet which supports Shielded USD and Zec with a built in Atomic bridge

Veylor

Created At

ETHGlobal Mumbai

Project Description

Veylor is a shielded wallet that lets users hold Shielded USD (in Railgun) and shielded ZEC (on Zcash). It moves value between the two chains over a novel trustless, atomic bridge. The wallet is non-custodial and built with a specific focus on CROPS.

We built the bridge because, as far as we know, no bridge to shielded ZEC is trustless today. Exchanges and wrapped ZEC hold your funds. Cross-chain swap networks rely on validators or a bridge you have to trust. So today, moving between shielded ZEC and Ethereum means either handing your funds to someone or giving up privacy on the Zcash side. A shielded Zcash bridge comes with uniques chanllenges which we have tacked head one with CROPS in mind.

Here's how a swap from ZEC to USD works. The wallet and a market maker each hold half of a spend key. Together the halves control a fresh shielded Zcash address, and neither side can spend from it alone. The maker locks the USDC in our contract on Ethereum, and the wallet deposits its ZEC to the shared address. To get paid, the wallet reveals its half on Ethereum. The contract checks it on the Pallas curve and pays the USDC into the user's Railgun balance, and the maker then uses the revealed half to sweep the ZEC. Time windows in the contract decide who may act when, so each side ends up with either the trade or their money back. It works the other way too, from USD to ZEC, with the USDC escrowed straight from Railgun. The contract is live on Ethereum mainnet and Sepolia.

At the hackathon we went after the two places where users still leaked or depended on us.

The first is frames, so you don't need our relayer. Getting paid takes an Ethereum transaction, and the fresh key each swap uses has no ETH for gas, so until now our relayer sent claims for users. A relayer can refuse a claim or go down. With EIP-8141 frame transactions, the swap's own key sends its claim straight to the alternative mempool, and a sponsor contract pays the gas. The sponsor reads the swap from our contract to decide whether to pay. The normal mempool forbids that kind of read, and the alternative mempool allows it once the sponsor has staked. We showed both. The same claim was refused by the normal mempool, refused by the alt mempool while the sponsor was unstaked, and accepted once it staked. Then we ran a full swap of real testnet ZEC this way. Frame transactions only exist on the EF's devnet for now, and it has no Railgun, so there the claim pays a plain address. On Sepolia and mainnet, claims still go through the relayer until EIP-8141 ships.

The second is Anon-RPC, so syncing doesn't give you away. The wallet reads Ethereum all the time, checking its swaps and syncing its Railgun notes. Before, the RPC provider saw the phone's IP next to every address and swap it looked up, and Tor was a setting that was off by default. Now every Ethereum read on Android goes through the EF's Anon-RPC by default, over Tor or the Nox mixnet. If that route is down, the wallet refuses rather than falling back to a direct connection

There are still things it doesn't hide. The maker sees each swap's amount and timing, and the Zcash server (lightwalletd) sees your IP when you sync unless Tor is on.

Veylor and the bridge existed before ETHGlobal Mumbai. Veylor is our fork of the open-source Vizor wallet, which is why that repo lists upstream contributors. The two features we're submitting were built during the hackathon, each on its own branch. Frames is zecSwap PR #35 (https://github.com/JustZappIt/zecSwap/pull/35), 7 commits on Nov 6. Anon-RPC is Veylor's feature/anon-rpc branch (https://github.com/ChinmayGopal931/vizor-fork/compare/eb465f3dd9d9...feature/anon-rpc), 17 commits on Nov 5 and 6.

How it's Made

Veylor is a Flutter app with a Rust core, connected through flutter_rust_bridge. The Zcash side is a light wallet built on librustzcash that syncs from lightwalletd, and everything that touches keys or swaps is written in Rust.

The bridge is our zecSwap protocol. Every swap gets a fresh key derived from the wallet seed. The deposit address's spend key is split between the user and the market maker, and each side proves it knows its half before anyone deposits. The contract is written in Solidity and built with Foundry. It checks a revealed half against its public key using Pallas curve arithmetic we wrote in Solidity, which is how Ethereum can verify a Zcash key, and it pays out into Railgun through a separate vault for each swap. Time windows in the contract make sure only one side can reveal at any moment. We tested it with stateful fuzzing and mutation testing. The maker is a Rust service built on axum and SQLite, with a watchtower that follows both chains, and it sweeps the ZEC by signing a PCZT with the combined key. Users who have no ETH get their claims sent by our relayer, which on mainnet goes through Flashbots Protect so the secret stays private until the claim is mined.

For frames we wrote an EIP-8141 frame transaction encoder in Rust. The devnet runs an older draft than the EIP text, so we generated test vectors from the alt mempool workshop's TypeScript library and matched them byte for byte. The sponsor is a Solidity contract built on the workshop's helpers for the new APPROVE and TXPARAM opcodes. It only pays when the swap exists with exactly those terms and is still open, when it's our maker's swap, when the sender is the swap's own key on its first transaction, and when the whole transaction costs at most 0.005 ETH. It staked 0.012 ETH in the devnet's staking registry, and that stake is what lets the alt mempool accept it reading our contract during validation. Its checks use about 33k of the 100k gas budget and never read the clock. Foundry doesn't know EIP-8141 yet, so our 18 tests stand in for the opcode helpers with vm.etch, including a fuzz test showing that ETH only ever leaves the sponsor as gas. Before writing any client code we ran a small Node and viem probe that measured what the new opcodes really return on the devnet and ran the three-way mempool test. The client signs deterministically, so a restart resends exactly the same bytes. It resends every five minutes to match the mempool's expiry, never estimates gas because an estimate would show a node the secret early, and watches the swap's state instead of receipts because alloy can't decode the new transaction type yet.

For Anon-RPC, a hidden WebView page runs the EF's official browser harness. The harness reads the worker's hash from a contract on Ethereum and won't run a bundle that doesn't match it, and the worker runs in a null-origin sandbox. The default route is tor-js, which is Tor's Rust implementation (Arti) compiled to WebAssembly. It builds circuits on the phone and reaches Tor over WebRTC through a gateway. Nox, a Sphinx mixnet, is the second route on testnet. Rust is the only way out for Ethereum reads. The swap engine calls it directly, and the Railgun page's providers point at a loopback relay that Rust serves. Each account gets its own isolation key, so two accounts' reads leave on separate circuits, and if no route is up the reads are refused rather than sent direct.

Both partner technologies did real work for us. Anon-RPC gave us an anonymity network we didn't have to build, and because its workers are pinned by hash we don't have to trust the bundle we load. The alt mempool made the sponsored claim possible at all, since the normal mempool won't let a paymaster read another contract.

A few things were hackier than we expected. A claim's receipt shows only half the storage gas it really needs while it runs, because a refund from a later frame gets subtracted from it, so gas limits copied from receipts would have broken the claim halfway with the secret already public. The devnet's gateway mempool had no peers all day, with 21 transactions stuck in it, so we send straight to the miner's mempool node, which runs the same rules. The EF's demo Tor gateway never connected for us, so a teammate ran our own, and with it Tor comes up in about five seconds. Android's WebView put three walls between the page and the loopback relay. New Android versions silently drop plain http, so we allow it for 127.0.0.1 only, and we also had to allow mixed content and bypass the page's proxy for loopback. Workers that use the browser's fetch hit a CORS wall from the null-origin sandbox, and Tor and Nox only get around it because they reach their networks over WebRTC. On mobile data, carrier NAT blocks the WebRTC traffic, so for now it only works on Wi-Fi.

background image mobile

Join the mailing list

Get the latest news and updates