Skip to content

Commit 87ed268

Browse files
committed
docs: simplify main readme and verbosity in deployment script commands
1 parent 8583a32 commit 87ed268

File tree

2 files changed

+11
-232
lines changed

2 files changed

+11
-232
lines changed

README.md

Lines changed: 0 additions & 221 deletions
Original file line numberDiff line numberDiff line change
@@ -9,224 +9,3 @@ If you just want to deploy contracts and run the relayer:
99
2. Keep the deployed addresses handy.
1010
3. Then come back to [packages/relayer](packages/relayer) and follow the quick start instructions to run the relayer.
1111
4. Run the front-end from [emailwallet.org](https://github.com/zkemail/emailwallet.org/tree/refactor/v1.1) repo
12-
13-
below is a summary:
14-
15-
## Overview
16-
17-
Email Wallet is an Ethereum contract wallet that can be controlled by sending emails. The deployment process involves two main steps:
18-
19-
1. Deploying the smart contracts
20-
2. Setting up and running the relayer service
21-
22-
## Prerequisites
23-
24-
Before starting, ensure you have the following:
25-
26-
- [Foundry](https://github.com/foundry-rs/foundry) installed for contract deployment
27-
- [Rust and Cargo](https://www.rust-lang.org/tools/install) for running the relayer
28-
- [Docker](https://docs.docker.com/get-docker/) for running the database, SMTP, and IMAP services
29-
- A private key with funds for contract deployment and relayer operations
30-
31-
## Step 1: Deploy Smart Contracts
32-
33-
### 1.1 Set Up Environment
34-
35-
Navigate to the contracts directory:
36-
37-
```sh
38-
cd packages/contracts
39-
```
40-
41-
Create a `.env` file:
42-
43-
```sh
44-
cp .env.sample .env
45-
```
46-
47-
Edit the `.env` file and set the following variables:
48-
- `PRIVATE_KEY`: Your private key for deployment
49-
- `RPC_URL`: RPC URL for the target network
50-
- `CHAIN_ID`: Chain ID of the target network
51-
- `CHAIN_NAME`: Name of the target network
52-
53-
Other default values work for Base Sepolia, but adjust them if you're deploying to a different chain.
54-
55-
#### Node
56-
use node version 18
57-
58-
if using nvm, run `nvm use` to switch to node version 18
59-
60-
```bash
61-
nvm use 18
62-
```
63-
64-
#### Build everything
65-
66-
```bash
67-
forge build --skip test --skip script
68-
```
69-
70-
### 1.2 Deploy All Contracts
71-
72-
Run the deployment script:
73-
74-
```sh
75-
source .env && \
76-
77-
forge script script/DefaultSetupScript.s.sol:Deploy \
78-
--rpc-url $RPC_URL \
79-
--chain-id $CHAIN_ID \
80-
--broadcast \
81-
-vvv
82-
```
83-
84-
You'll get a response with the addresses of all deployed contracts. Save these addresses as you'll need them for setting up the relayer.
85-
86-
Example output:
87-
```
88-
== Logs ==
89-
TokenRegistry proxy deployed at: 0xB895744454C62e9052A4332C29c4F19048054B56
90-
TokenRegistry implementation deployed at: 0xee62Ca2257E98284eEBf66c8849cA00489Ff1E03
91-
AllVerifiers implementation deployed at: 0x8350e89C182dD211180A8773cd91F79f2822BC9a
92-
ECDSAOwnedDKIMRegistry deployed at: 0xA11D302310bAd2Da10216B0FA91e5A1bca631c19
93-
Wallet implementation deployed at: 0x7a6361d28b1121EB8a030778f597A85443833cc9
94-
Oauth core deployed at: 0x50bba18c7289bf4189E2d8e5ed40Ae86be020567
95-
RelayerHandler proxy deployed at: 0x9F68880B9A760d15734872EbA3D519549C3996BB
96-
RelayerHandler implementation deployed at: 0x9e119689Fc87be723886dA2dD012bF43D66c7BA4
97-
ExtensionHandler proxy deployed at: 0x6D6bA7Ee9Ed199F67C6C26dfb3B6E56b60D9fdef
98-
<TRUNCATED>
99-
TestERC20 deployed at: 0x5635e6A652bE734F858dAA769e215cdb516eaca4
100-
EmailWalletCore proxy deployed at: 0xeA1001AE28da904744fdd5167A4EbF1f2f546fab
101-
```
102-
103-
### 1.3 Register Relayer Data
104-
105-
Before proceeding to deploy the relayer, you need to register the relayer data in the `RelayerHandler` contract.
106-
107-
Set the following environment variables:
108-
109-
```sh
110-
RPC_URL=<the RPC URL of the chain where you deployed the contracts>
111-
PRIVATE_KEY=<this is the relayer's private key>
112-
RELAYER_HANDLER=<address of the RelayerHandler contract from the previous step>
113-
RELAYER_EMAIL=<[email protected] # used for relayer communication later>
114-
RELAYER_HOSTNAME=<example.com>
115-
```
116-
117-
Then run:
118-
119-
```sh
120-
source .env && \
121-
forge script script/RegisterRelayer.s.sol --rpc-url $RPC_URL --broadcast
122-
```
123-
124-
## Step 2: Set Up and Run the Relayer
125-
126-
### 2.1 Set Up Environment
127-
128-
Navigate to the relayer directory:
129-
130-
```sh
131-
cd ../relayer
132-
```
133-
134-
Create a `.env` file:
135-
136-
```sh
137-
cp .env.example .env
138-
```
139-
140-
Update the following key variables in the `.env` file:
141-
142-
- `CORE_CONTRACT_ADDRESS`: Address of the EmailWalletCore proxy from Step 1.2
143-
- `ONBOARDING_TOKEN_ADDR`: Address of the TestERC20 from Step 1.2
144-
- `PRIVATE_KEY`: The registered relayer's private key for submitting on-chain transactions
145-
- `CHAIN_RPC_PROVIDER`, `CHAIN_RPC_EXPLORER`, `CHAIN_ID`: Set according to your target chain
146-
- `RELAYER_EMAIL_ADDR`, `RELAYER_HOSTNAME`: Fill out according to your relayer setup
147-
148-
Other variables like `CANISTER_ID`, `IC_REPLICA_URL`, `SMTP_SERVER`, and `DATABASE_URL` can use default values for local testing.
149-
150-
### 2.2 Run Docker Compose for Local Services
151-
152-
Ensure you have set proper values in `.env` for SMTP and IMAP services, then run:
153-
154-
```sh
155-
docker compose up --build -d
156-
```
157-
158-
Confirm all services are running:
159-
160-
```sh
161-
docker ps
162-
```
163-
164-
You should see output similar to:
165-
166-
```
167-
CONTAINER ID IMAGE STATUS PORTS
168-
97f6b65dd0b7 relayer-imap Up 1 second
169-
3f2fc12589c9 postgres:15 Up 1 second 0.0.0.0:5432->5432/tcp
170-
e5e7c6a7c434 relayer-smtp Up 1 second 0.0.0.0:3000->3000/tcp
171-
```
172-
173-
### 2.3 Register the Relayer On-Chain
174-
make sure you have already registered the relayer
175-
176-
### 2.4 Start the Relayer
177-
178-
Run:
179-
180-
```sh
181-
cargo run
182-
```
183-
184-
## Step 3: Testing the System
185-
186-
You can test the system by sending an email to your relayer account with a subject like:
187-
188-
```
189-
Send 1 ETH to [email protected]
190-
```
191-
192-
For the first transaction, the relayer will deploy a wallet for you, but you will need to fund it externally as the wallet will have no balance initially.
193-
194-
## Step 4: Running the Frontend (Optional)
195-
196-
For a complete experience, you can run the frontend from the [emailwallet.org](https://github.com/zkemail/emailwallet.org/tree/refactor/v1.1) repository.
197-
198-
## Troubleshooting
199-
200-
### Common Issues
201-
202-
1. **Contract Deployment Fails**: Ensure your private key has sufficient funds and the RPC URL is correct.
203-
204-
2. **Relayer Registration Fails**: Verify that you're using the correct RelayerHandler address and that your private key has permission to register.
205-
206-
3. **Relayer Service Doesn't Start**: Check the logs for errors. Common issues include:
207-
- Incorrect environment variables
208-
- Database connection problems
209-
- SMTP/IMAP configuration issues
210-
211-
4. **Emails Not Being Processed**: Verify that:
212-
- The SMTP and IMAP services are running
213-
- The relayer has the correct email credentials
214-
- The email format follows the expected pattern
215-
216-
### Getting Help
217-
218-
If you encounter issues not covered in this guide, please refer to the detailed documentation in the respective README files or open an issue on the GitHub repository.
219-
220-
## Features
221-
222-
With your Email Wallet system deployed, you can:
223-
224-
- Send ETH and ERC20 tokens to email addresses and Ethereum addresses
225-
- Execute any calldata on target contracts
226-
- Install extensions for additional functionalities
227-
- Use Uniswap extension to swap tokens
228-
- Use NFT extension to mint NFTs
229-
- Set custom DKIM Registry
230-
- Transfer wallet ownership
231-
232-
All by simply sending emails with the appropriate subject lines!

packages/contracts/README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ forge script script/DefaultSetupScript.s.sol:Deploy \
3838
--rpc-url $RPC_URL \
3939
--chain-id $CHAIN_ID \
4040
--broadcast \
41-
-vvvv
41+
-vvv
4242
```
4343

4444
You'll get a response like this:
@@ -161,7 +161,7 @@ Run the below commands to deploy each contracts. Ensure address of WETH and Unis
161161
```
162162
PRIVATE_KEY="" \
163163
forge script script/01_DeployTokenRegistry.s.sol:Deploy \
164-
-vvvv \
164+
-vvv \
165165
--rpc-url https://ethereum-sepolia.publicnode.com \
166166
--chain-id 11155111 \
167167
--broadcast \
@@ -175,7 +175,7 @@ Copy the address from log `TokenRegistry implementation deployed at: 0x9f44be9F6
175175
```
176176
PRIVATE_KEY="" \
177177
forge script script/02_DeployAllVerifiers.s.sol:Deploy \
178-
-vvvv \
178+
-vvv \
179179
--rpc-url https://ethereum-sepolia.publicnode.com \
180180
--chain-id 11155111 \
181181
--broadcast \
@@ -189,7 +189,7 @@ Copy the address from log `AllVerifiers implementation deployed at: 0x9f44be9F69
189189
```
190190
PRIVATE_KEY="" \
191191
forge script script/03_DeployDKIMRegistry.s.sol:Deploy \
192-
-vvvv \
192+
-vvv \
193193
--rpc-url https://ethereum-sepolia.publicnode.com \
194194
--chain-id 11155111 \
195195
--broadcast \
@@ -206,7 +206,7 @@ PRIVATE_KEY="" \
206206
WETH=0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9 \
207207
UNISWAP_FACTORY=0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f \
208208
forge script script/DeployUniswapTWAPOracle.s.sol:Deploy \
209-
-vvvv \
209+
-vvv \
210210
--rpc-url https://ethereum-sepolia.publicnode.com \
211211
--chain-id 11155111 \
212212
--broadcast \
@@ -221,7 +221,7 @@ Copy the address from log `UniswapTWAPOracle deployed at: 0x00000000000000000000
221221
PRIVATE_KEY="" \
222222
WETH=0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9 \
223223
forge script script/04_DeployWallet.s.sol:Deploy \
224-
-vvvv \
224+
-vvv \
225225
--rpc-url https://ethereum-sepolia.publicnode.com \
226226
--chain-id 11155111 \
227227
--broadcast \
@@ -236,7 +236,7 @@ Copy the address from log `Wallet proxy deployed at: 0x0000000000000000000000000
236236
PRIVATE_KEY="" \
237237
WETH=0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9 \
238238
forge script script/05_DeployHandlers.s.sol:Deploy \
239-
-vvvv \
239+
-vvv \
240240
--rpc-url https://ethereum-sepolia.publicnode.com \
241241
--chain-id 11155111 \
242242
--broadcast \
@@ -262,7 +262,7 @@ TOKEN_REGISTRY=0x9f44be9F69aF1e049dCeCDb2d9296f36C49Ceafb \
262262
DKIM_REGISTRY=0xbE66454b0Fa9E6b3D53DC1b0f9D21978bb864531 \
263263
PRICE_ORACLE=0xF5f40B12aa15286F0DE5610C4e29d87a97997ee7 \
264264
forge script script/06_DeployEmailWalletCore.s.sol:Deploy \
265-
-vvvv \
265+
-vvv \
266266
--rpc-url https://ethereum-sepolia.publicnode.com \
267267
--chain-id 11155111 \
268268
--broadcast \
@@ -284,7 +284,7 @@ TOKEN_REGISTRY=0x9f44be9F69aF1e049dCeCDb2d9296f36C49Ceafb \
284284
DKIM_REGISTRY=0xbE66454b0Fa9E6b3D53DC1b0f9D21978bb864531 \
285285
PRICE_ORACLE=0xF5f40B12aa15286F0DE5610C4e29d87a97997ee7 \
286286
forge script script/07_SetDefaultExtensions.s.sol:Deploy \
287-
-vvvv \
287+
-vvv \
288288
--rpc-url https://ethereum-sepolia.publicnode.com \
289289
--chain-id 11155111 \
290290
--broadcast \
@@ -305,7 +305,7 @@ Set the `SIGNER` to the address of the Ethereum wallet who will be setting the D
305305
PRIVATE_KEY="" \
306306
SIGNER=0x2f6e79a6e1a982a49ca248b70b02f76e921af400 \
307307
forge script script/DeployECDSAOwnedDKIMRegistry.s.sol:Deploy \
308-
-vvvv \
308+
-vvv \
309309
--rpc-url https://ethereum-sepolia.publicnode.com \
310310
--chain-id 11155111 \
311311
--broadcast \
@@ -329,5 +329,5 @@ forge script script/XX_UpgradeTokenRegistry.s.sol:Deploy \
329329
--rpc-url https://ethereum-sepolia.publicnode.com \
330330
--chain-id 11155111 \
331331
--broadcast \
332-
-vvvv
332+
-vvv
333333
```

0 commit comments

Comments
 (0)