You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: passkey-wallet-app/DEPLOYMENT_SCRIPT.md
+22-6Lines changed: 22 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,11 +2,13 @@
2
2
3
3
## Overview
4
4
5
-
This script allows you to deploy a smart account using an EOA (Externally Owned Account) with Sepolia ETH, instead of relying on the bundler to deploy it.
5
+
This script allows you to deploy a smart account using an EOA (Externally Owned Account) with Sepolia ETH,
6
+
instead of relying on the bundler to deploy it.
6
7
7
8
## Why Use This?
8
9
9
10
The bundler's counterfactual deployment can fail with `AA13 initCode failed or OOG` errors. Using this script, you can:
11
+
10
12
- Deploy the account from an EOA that you control
11
13
- Verify the deployment succeeded
12
14
- Then use the account normally in the app
@@ -20,6 +22,7 @@ cp .env.example .env
20
22
```
21
23
22
24
Edit `.env` and add your private key:
25
+
23
26
```
24
27
DEPLOYER_PRIVATE_KEY=0x... # Your EOA private key (must have Sepolia ETH)
25
28
```
@@ -29,11 +32,13 @@ DEPLOYER_PRIVATE_KEY=0x... # Your EOA private key (must have Sepolia ETH)
29
32
### 2. Get Your Passkey Data
30
33
31
34
After creating a passkey in the app, check the browser console for:
Public Key X: 0x44adf115f2c6a670d535c8d2735e0c853688404ef8643b67e479fa3cd3531377
@@ -67,6 +72,7 @@ node deploy-account.js \
67
72
## Output
68
73
69
74
Successful deployment:
75
+
70
76
```
71
77
🚀 Deploying Smart Account...
72
78
@@ -93,42 +99,52 @@ Account Address: 0x...
93
99
## After Deployment
94
100
95
101
Once deployed, you can:
102
+
96
103
1.**Refresh the app** - Your account will show as deployed
97
104
2.**Send transactions** - No more `AA20 account not deployed` errors
98
105
3.**Use the app normally** - All features work!
99
106
100
107
## Troubleshooting
101
108
102
109
### "DEPLOYER_PRIVATE_KEY not found"
110
+
103
111
- Make sure you created `.env` file
104
112
- Check the private key starts with `0x`
105
113
106
114
### "Deployer has no ETH"
115
+
107
116
- Fund your deployer address with Sepolia ETH
108
-
- Get from: https://sepoliafaucet.com/
117
+
- Get from: <https://sepoliafaucet.com/>
109
118
110
119
### "Account already deployed"
120
+
111
121
- The account is already deployed! You can use it in the app
112
122
- No need to deploy again
113
123
114
124
### "Deployment failed"
125
+
115
126
- Check gas prices aren't too high
116
127
- Verify the contract addresses are correct
117
128
- Ensure your passkey data is correct (credential ID, public keys)
118
129
119
130
## Important Notes
120
131
121
-
1.**Origin Must Match**: The script uses `http://localhost:3000` as the origin. If you're using a different origin in the app, update line 90 in `deploy-account.js`.
132
+
1.**Origin Must Match**: The script uses `http://localhost:3000` as the origin.
133
+
If you're using a different origin in the app, update line 90 in `deploy-account.js`.
122
134
123
-
2.**One-Time Operation**: You only need to deploy the account once. After that, it exists on-chain forever (for that specific passkey).
135
+
2.**One-Time Operation**: You only need to deploy the account once. After that,
136
+
it exists on-chain forever (for that specific passkey).
124
137
125
138
3.**Gas Costs**: Deployment costs approximately 0.005-0.01 ETH on Sepolia.
126
139
127
-
4.**Same Passkey = Same Account**: The account address is deterministic based on your credential ID. Same passkey always generates the same account address.
140
+
4.**Same Passkey = Same Account**: The account address is deterministic based on your credential ID.
141
+
Same passkey always generates the same account address.
128
142
129
143
## Alternative: Deploy from App (Advanced)
130
144
131
-
If you want to avoid using this script, you can also deploy programmatically by funding the account address BEFORE deployment, then the first transaction will deploy it automatically. However, this is more complex and requires careful gas estimation.
145
+
If you want to avoid using this script, you can also deploy programmatically by funding the account address BEFORE deployment,
146
+
then the first transaction will deploy it automatically.
147
+
However, this is more complex and requires careful gas estimation.
Copy file name to clipboardExpand all lines: passkey-wallet-app/FIXES_APPLIED.md
+30-6Lines changed: 30 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,9 @@
3
3
## Issue: Transaction Signing Errors
4
4
5
5
### Error 1: Challenge Format Issue
6
+
6
7
**Error Message:**
8
+
7
9
```
8
10
startAuthentication() was not called correctly
9
11
TypeError: base64URLString.replace is not a function
@@ -13,6 +15,7 @@ TypeError: base64URLString.replace is not a function
13
15
The `startAuthentication` function from `@simplewebauthn/browser` expects base64url **strings**, but we were passing arrays/bytes.
14
16
15
17
**Fix Applied:**
18
+
16
19
```javascript
17
20
// Before (WRONG):
18
21
constauthOptions= {
@@ -39,16 +42,21 @@ const authOptions = {
39
42
---
40
43
41
44
### Error 2: ABI Encoding Issue
45
+
42
46
**Error Message:**
47
+
43
48
```
44
49
AbiFunctionNotFoundError: Function not found on ABI.
45
50
Make sure you are using the correct ABI and that the function exists on it.
46
51
```
47
52
48
53
**Root Cause:**
49
-
Using `encodeFunctionData` with `parseAbiParameters` is incorrect. `encodeFunctionData` expects a full function ABI with a function name, while `parseAbiParameters` only provides parameter types.
54
+
Using `encodeFunctionData` with `parseAbiParameters` is incorrect.
55
+
`encodeFunctionData` expects a full function ABI with a function name,
56
+
while `parseAbiParameters` only provides parameter types.
50
57
51
58
**Fix Applied:**
59
+
52
60
```javascript
53
61
// Before (WRONG):
54
62
returnencodeFunctionData({
@@ -72,9 +80,11 @@ return encodeAbiParameters(
72
80
### File: `main.js`
73
81
74
82
#### 1. Fixed `signWithPasskey()` function
75
-
**Lines 503-548**
83
+
84
+
Lines 503-548
76
85
77
86
Changes made:
87
+
78
88
1. Convert challenge to base64url string before passing to `startAuthentication`
79
89
2. Use original base64url credential ID string (not bytes)
80
90
3. Replace `encodeFunctionData` with `encodeAbiParameters` for signature encoding
@@ -113,12 +123,14 @@ async function signWithPasskey(hash) {
The `@simplewebauthn/browser` library requires **base64url strings** for:
180
+
166
181
-`challenge`: The authentication challenge
167
182
-`allowCredentials[].id`: The credential ID
168
183
-`user.id`: The user identifier (during registration)
@@ -174,6 +189,7 @@ Do not convert these to arrays or bytes - keep them as base64url strings!
174
189
## Complete Function Call Flow
175
190
176
191
### Transfer Flow
192
+
177
193
```
178
194
1. User clicks "Send ETH"
179
195
↓
@@ -225,11 +241,14 @@ Do not convert these to arrays or bytes - keep them as base64url strings!
225
241
226
242
### Why These Errors Occurred
227
243
228
-
1.**API Expectations Mismatch**: The `@simplewebauthn/browser` library has specific format requirements that weren't immediately obvious from the documentation.
244
+
1.**API Expectations Mismatch**: The `@simplewebauthn/browser` library has specific format requirements
245
+
that weren't immediately obvious from the documentation.
229
246
230
-
2.**Function Naming Confusion**: `encodeFunctionData` and `encodeAbiParameters` sound similar but have different purposes and requirements.
247
+
2.**Function Naming Confusion**: `encodeFunctionData` and `encodeAbiParameters` sound similar
248
+
but have different purposes and requirements.
231
249
232
-
3.**Type Conversion**: JavaScript's flexibility with types (strings, arrays, Uint8Arrays) can lead to passing the wrong type without compile-time errors.
250
+
3.**Type Conversion**: JavaScript's flexibility with types (strings, arrays,
251
+
Uint8Arrays) can lead to passing the wrong type without compile-time errors.
233
252
234
253
### Prevention
235
254
@@ -243,17 +262,21 @@ Do not convert these to arrays or bytes - keep them as base64url strings!
243
262
## Additional Fix: EntryPoint Address
244
263
245
264
### Error: Bundler EntryPoint Mismatch
265
+
246
266
**Error Message:**
267
+
247
268
```
248
269
Bundler error: EntryPoint 0x0000000071727De22E5E9d8BAf0edAc6f37da032 not supported,
The ZKsync SSO bundler uses a custom EntryPoint contract at `0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108` instead of the standard ERC-4337 v0.7 EntryPoint.
274
+
The ZKsync SSO bundler uses a custom EntryPoint contract at `0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108` instead of the
275
+
standard ERC-4337 v0.7 EntryPoint.
254
276
255
277
**Fix Applied:**
256
278
Updated the EntryPoint address to match the bundler's supported address:
279
+
257
280
```javascript
258
281
// Before:
259
282
constENTRYPOINT_ADDRESS="0x0000000071727De22E5E9d8BAf0edAc6f37da032"; // Standard v0.7
0 commit comments