A smart contract wallet controlled using emails.
Email Wallet is an Ethereum contract wallet that can be controlled by sending emails. The contract validates the authenticity of emails by verifying the ZK Proof of DKIM signature of the email. This ensures email is generated by the user without leaking user's email address on-chain.
For documentation on our email wallet extension click here
This is first proposed at ICBC2023[1].
✓ Send ETH to email address and Ethereum addresses.
Send 1 ETH to friend@domain.com
Send 2.5 ETH to 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266
✓ Send ERC20 to email address and Ethereum addresses.
Send 1.5 DAI to friend@skiff.com
Send 21.14 DAI to 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266
✓ Execute any calldata on a target contract
Execute 0xba7676a8.....
✓ Install extensions for additional functionalities. Extensions can be developed for any DeFi protocols.
Install extension Uniswap
Remove extension Uniswap
✓ Use Uniswap extension to swap tokens.
Swap 1 ETH to DAI
Swap 1 DAI to ETH
✓ Use NFT extension to mint NFTs.
NFT Send 1337 of Punks to recipient@domain.com
(and more)✓ Use custom DKIM Registry for complete control.
DKIM registry set to 0x1ababab111...
✓ Set email wallet to a new owner. New owner (EOA) can control the wallet by executing any calldata on a target contract.
Exit Email Wallet. Set owner to 0x1ababab111...
Emails you send are (usually) signed using a private key controlled by your email domain server according to a DKIM protocol. This signature is included in the headers section of the email.
Email Wallet verify the DKIM signature of an email to ensure the mail was sent by the user and the contents are not forged. Instead of verifying the signature directly on-chain, a zk proof of signature is created (by a permissionless entity called Relayer) and verified on-chain.
ZK circuit also helps to hide the sender's email address and the recipient's email address on-chain.
Here is how a typical interaction with the wallet looks like:
This is a simplified flow, but underneath we use many parameters to ensure security and make the Relayer permissionless. You can read a more detailed spec on Saleel's blog.
This is a mono-repo that contains the circom circuits, smart contracts, the relayer and a prover server.
packages/circuits
contains the circom circuits, tests, scripts to generate zkeys, vkeys, and helper functions to generate circuit inputs.packages/contracts
contains the solidity contracts, tests, and scripts to deploy the wallet.packages/relayer
contains the relayer code - relayer listens to IMAP server, generate proof using prover server, and call the contract.packages/prover
contains the prover server code - prover server receives generates ZK proof for all circuits based on the inputs received from the relayer.packages/utils
contains helper functions to help parse emails, and prove circuits.packages/subgraph
indexes events generated by circuits- mainly used by the Relayer for PSI communication.packages/scripts
contains scripts to generate data for the registry contracts.packages/frontend
contains the UI to generate emails./packages
├── /circuits
├──── /src # Circom circuits.
├──── /build # Compiled circuits.
├──── /helpers # Helper functions to generate circuit input.
├──── /scripts # CLI scripts to generate input, zkeys.
├──── /test # Circom tests for circuit
├
├── /contracts
├──── /src # Solidity contracts.
├──── /test # Solidity tests for contracts.
├──── /script # Scripts to deploy wallet.
├
├── /relayer
├──── /src # Relayer code.
├──── /eml_templates # eml templates.
saved here.
├── /prover # Prover server code.
├
├── /scripts # scripts for registry contracts
├
├── /frontend # UI to generate emails
├
├── /utils
├──── /src # Helper functions for email parsing, proving circuits, etc.
├
├── /subgraph # indexing and querying events generated by circuits.
In directory docs/
, run:
cargo install mdbook
And to serve the website:
mdbook serve
☆ Built using zk-email ☆