ethnotary 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,514 @@
1
+ # Ethnotary CLI
2
+
3
+ CLI for managing MultiSig accounts, transactions, and data queries across EVM networks.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ # Install globally
9
+ npm install -g .
10
+
11
+ # Or use npm link for development
12
+ npm link
13
+ ```
14
+
15
+ ## Quick Start
16
+
17
+ ```bash
18
+ # Generate a new wallet
19
+ ethnotary wallet init
20
+
21
+ # Create a MultiSig account (auto-saved with name as alias)
22
+ ethnotary account create \
23
+ --owners 0x123...,0x456... \
24
+ --required 2 \
25
+ --pin 1234 \
26
+ --name treasury
27
+
28
+ # Switch to the account
29
+ ethnotary checkout treasury
30
+
31
+ # Check account info (uses active contract)
32
+ ethnotary account info
33
+
34
+ # Submit a transaction
35
+ ethnotary tx submit --dest 0x789... --value 0.1
36
+
37
+ # List pending transactions
38
+ ethnotary data pending
39
+ ```
40
+
41
+ ## Global Options
42
+
43
+ All commands support these global flags:
44
+
45
+ | Flag | Description |
46
+ |------|-------------|
47
+ | `--json` | Output in JSON format (machine-readable, no prompts) |
48
+ | `--private-key <key>` | Use this private key directly |
49
+ | `--network <name>` | Network to use (default: `sepolia`) |
50
+ | `--yes` | Skip all confirmation prompts |
51
+ | `--dry-run` | Simulate without executing |
52
+
53
+ ## Commands
54
+
55
+ ### Wallet Management
56
+
57
+ ```bash
58
+ ethnotary wallet init # Generate new wallet, save encrypted keystore
59
+ ethnotary wallet import # Import existing key/mnemonic
60
+ ethnotary wallet show # Display wallet address
61
+ ```
62
+
63
+ ### Account Management
64
+
65
+ Account management commands apply changes across ALL networks the contract is deployed on.
66
+ If a change fails on some networks, the account becomes "decoupled" and a warning is shown.
67
+
68
+ ```bash
69
+ ethnotary account create # Deploy new MultiSig
70
+ --owners <address,address,...> # Comma-separated owner addresses
71
+ --required <number> # Required confirmations
72
+ --pin <number> # PIN for account management
73
+ --name <text> # Account name (used as alias)
74
+ --network <name,name,...> # Network(s) to deploy to
75
+
76
+ ethnotary account info # Show owners, required confirmations, balance
77
+ ethnotary account owners # List owners
78
+ ethnotary account add # Add owner (applies to all networks)
79
+ --owner <address> # New owner address
80
+ --pin <number> # PIN for verification
81
+ --force # Proceed even if pre-flight check fails
82
+
83
+ ethnotary account remove # Remove owner (applies to all networks)
84
+ --owner <address> # Owner to remove
85
+ --pin <number> # PIN for verification
86
+ --force # Proceed even if pre-flight check fails
87
+
88
+ ethnotary account replace # Replace owner (applies to all networks)
89
+ --old <address> # Current owner address
90
+ --new <address> # New owner address
91
+ --pin <number> # PIN for verification
92
+ --force # Proceed even if pre-flight check fails
93
+
94
+ ethnotary account status # Check sync status across all networks
95
+ ethnotary account sync # Re-sync decoupled accounts
96
+ --pin <number> # PIN for authentication
97
+ --dry-run # Preview changes without applying
98
+ ```
99
+
100
+ ### Transaction Management
101
+
102
+ Transaction commands require specifying a network. If not provided, you'll be prompted to select from the contract's configured networks.
103
+
104
+ ```bash
105
+ ethnotary tx submit # Submit transaction
106
+ --dest <address> # Destination address
107
+ --value <ether> # ETH amount (e.g., 0.1)
108
+ --data <hex> # Optional calldata
109
+ --network <name> # Target network (prompts if not specified)
110
+
111
+ ethnotary tx confirm # Confirm transaction
112
+ --txid <number> # Transaction ID
113
+ --network <name> # Target network
114
+
115
+ ethnotary tx execute # Execute confirmed transaction
116
+ --txid <number> # Transaction ID
117
+ --network <name> # Target network
118
+
119
+ ethnotary tx revoke # Revoke confirmation
120
+ --txid <number> # Transaction ID
121
+ --network <name> # Target network
122
+
123
+ ethnotary tx pending # List pending transactions
124
+ --network <name> # Target network
125
+
126
+ ethnotary tx notify # Get notification payload
127
+ --txid <number> # Transaction ID
128
+ --network <name> # Target network
129
+
130
+ ethnotary tx link # Generate approval URL
131
+ --txid <number> # Transaction ID
132
+ --network <name> # Target network
133
+
134
+ ethnotary tx transfer-erc20 # Transfer ERC20 token
135
+ --token <address> # Token contract address
136
+ --to <address> # Recipient address
137
+ --amount <number> # Token amount
138
+ --network <name> # Target network
139
+
140
+ ethnotary tx transfer-nft # Transfer NFT
141
+ --token <address> # NFT contract address
142
+ --to <address> # Recipient address
143
+ --tokenid <number> # Token ID
144
+ --network <name> # Target network
145
+ ```
146
+
147
+ ### Data Queries
148
+
149
+ Data queries pull from ALL networks the contract is deployed on by default. Use `--network` to filter to a specific network.
150
+
151
+ ```bash
152
+ ethnotary data balance # Get balance across all networks
153
+ --network <name> # Filter to specific network (optional)
154
+
155
+ ethnotary data events # Get events across all networks, sorted by time
156
+ --limit <number> # Number of events per network (default: 10)
157
+ --from-block <number> # Start from block number
158
+ --network <name> # Filter to specific network (optional)
159
+
160
+ ethnotary data pending # Get pending transactions across all networks
161
+ --network <name> # Filter to specific network (optional)
162
+
163
+ ethnotary data tokens # Get token holdings across all networks
164
+ --network <name> # Filter to specific network (optional)
165
+ ```
166
+
167
+ ### Contract Management
168
+
169
+ Switch between saved contracts (like git branches):
170
+
171
+ ```bash
172
+ ethnotary create # Deploy new MultiSig (same as account create)
173
+ --owners <addr1,addr2,...> # Comma-separated owner addresses
174
+ --required <number> # Required confirmations
175
+ --pin <number> # PIN for account management
176
+ --name <text> # Account name (used as alias)
177
+ --network <name,name,...> # Network name(s), comma-separated
178
+ --chain-id <id,id,...> # Or chain ID(s), comma-separated
179
+
180
+ ethnotary checkout <alias> # Switch to a contract (sets as active)
181
+ ethnotary status # Show current active contract
182
+ ethnotary list # List all saved contracts
183
+
184
+ ethnotary add # Save existing contract (validates on each network)
185
+ --alias <text> # Alias for the contract
186
+ --address <address> # Contract address
187
+ --network <name,name,...> # Network name(s), comma-separated
188
+ --chain-id <id,id,...> # Or chain ID(s), comma-separated
189
+
190
+ ethnotary remove <alias> # Remove a saved contract
191
+
192
+ # Multi-network examples:
193
+ ethnotary create --owners 0x...,0x... --required 2 --pin 1234 --name treasury \
194
+ --network sepolia,base-sepolia,arbitrum-sepolia
195
+ # Creates: treasury-sepolia, treasury-base-sepolia, treasury-arbitrum-sepolia
196
+
197
+ ethnotary add --alias mywallet --address 0x123... \
198
+ --chain-id 11155111,84532,421614
199
+ # Validates contract exists on each network, saves with network suffix
200
+ ```
201
+
202
+ ### Configuration
203
+
204
+ ```bash
205
+ ethnotary config rpc [network] # Add/update RPC URL
206
+ --url <url> # RPC URL (optional, prompts if missing)
207
+
208
+ ethnotary config network [network] # Add/update network
209
+ --name <text> # Display name
210
+ --chain-id <number> # Chain ID
211
+ --rpc <url> # RPC URL
212
+ --testnet # Mark as testnet
213
+
214
+ ethnotary config show # Show all config (RPC URLs, networks)
215
+ ethnotary config path # Show config file paths
216
+ ```
217
+
218
+ **Examples:**
219
+ ```bash
220
+ # Set RPC URL directly
221
+ ethnotary config rpc sepolia --url https://sepolia.infura.io/v3/YOUR_KEY
222
+
223
+ # Interactive RPC setup (shows provider suggestions)
224
+ ethnotary config rpc base-sepolia
225
+
226
+ # Add a custom network
227
+ ethnotary config network soneium --name "Soneium" --chain-id 1868 --rpc https://rpc.soneium.org
228
+ ```
229
+
230
+ ## Authentication
231
+
232
+ The CLI supports multiple authentication methods (in priority order):
233
+
234
+ 1. **`--private-key <key>`** - Direct key argument (agent-friendly)
235
+ 2. **`PRIVATE_KEY` env var** - Environment variable (agent-friendly)
236
+ 3. **Encrypted keystore** - Password prompt (human-friendly)
237
+
238
+ ## Agent-Friendly Usage
239
+
240
+ For AI agents and automation, use `--json` and `--private-key`:
241
+
242
+ ```bash
243
+ # Create account (no prompts)
244
+ ethnotary account create \
245
+ --owners 0x123...,0x456... \
246
+ --required 2 \
247
+ --pin 1234 \
248
+ --private-key $AGENT_PRIVATE_KEY \
249
+ --name treasury \
250
+ --network sepolia \
251
+ --json --yes
252
+
253
+ # Output: {"address":"0x...","txHash":"0x...","network":"sepolia","alias":"treasury"}
254
+
255
+ # Use alias in subsequent commands
256
+ ethnotary tx pending --address treasury --json
257
+ ethnotary account info --address treasury --json
258
+ ```
259
+
260
+ ## Multi-Signature Approval Workflow (OpenClaw/ClawHub)
261
+
262
+ For MultiSig accounts requiring multiple confirmations, agents can request approvals from human co-owners via messaging platforms.
263
+
264
+ ### Setup Owner Contacts
265
+
266
+ ```bash
267
+ # Register contact info for each owner (one-time setup)
268
+ ethnotary contact add --address 0xHuman... --telegram 123456789 --whatsapp +15551234567
269
+ ethnotary contact list
270
+ ```
271
+
272
+ ### Agent Workflow
273
+
274
+ ```bash
275
+ # 1. Agent submits transaction
276
+ ethnotary tx submit --dest 0xDEX... --value 0.5 --json --private-key $AGENT_KEY
277
+
278
+ # Returns:
279
+ # {
280
+ # "transactionId": 5,
281
+ # "approvalUrl": "https://ethnotary.io/app/demo/views/txn.html?5?sepolia",
282
+ # "notifyOwners": [
283
+ # {
284
+ # "address": "0xHuman...",
285
+ # "whatsapp": "+15551234567",
286
+ # "telegram": "123456789",
287
+ # "message": "🔔 MultiSig Approval Request\n\nTransaction #5..."
288
+ # }
289
+ # ],
290
+ # "confirmations": "1/2",
291
+ # "canExecute": false
292
+ # }
293
+
294
+ # 2. Agent uses OpenClaw's message tool to send WhatsApp/Telegram
295
+ # (OpenClaw handles messaging via its Gateway)
296
+
297
+ # 3. Human receives message → clicks approval link → confirms on ethnotary.io
298
+
299
+ # 4. Agent polls for confirmation
300
+ ethnotary tx pending --json | jq '.transactions[] | select(.canExecute)'
301
+
302
+ # 5. Agent executes when fully confirmed
303
+ ethnotary tx execute --txid 5 --json --private-key $AGENT_KEY
304
+ ```
305
+
306
+ ### Notification Commands
307
+
308
+ ```bash
309
+ ethnotary tx link --txid 5 # Generate approval URL only
310
+ ethnotary tx notify --txid 5 --json # Get full notification payload for existing tx
311
+ ```
312
+
313
+ ### Contact Management
314
+
315
+ ```bash
316
+ ethnotary contact add # Add / update owner contact (--address, --telegram, --whatsapp, --email, --webhook)
317
+ ethnotary contact list # List all contacts
318
+ ethnotary contact show # Show contact for address
319
+ ethnotary contact remove # Remove contact
320
+ ```
321
+
322
+ ## Configuration Files
323
+
324
+ All configuration is stored in `~/.ethnotary/`:
325
+
326
+ | File | Purpose |
327
+ |------|---------|
328
+ | `keystore.json` | Encrypted wallet (password-protected) |
329
+ | `contracts.json` | Saved contract addresses with aliases |
330
+ | `config.json` | General configuration |
331
+
332
+ ## Networks
333
+
334
+ Supported networks (use `--network <name>` or `--chain-id <id>`):
335
+
336
+ **Mainnets:**
337
+ | Network | Name | Chain ID |
338
+ |---------|------|----------|
339
+ | Ethereum Mainnet | `ethereum` | 1 |
340
+ | Optimism | `optimism` | 10 |
341
+ | Base | `base` | 8453 |
342
+ | Arbitrum One | `arbitrum` | 42161 |
343
+ | Arbitrum Nova | `arbitrum-nova` | 42170 |
344
+ | zkSync Era | `zksync-era` | 324 |
345
+ | Scroll | `scroll` | 534352 |
346
+ | Polygon zkEVM | `polygon-zkevm` | 1101 |
347
+ | Linea | `linea` | 59144 |
348
+ | Polygon PoS | `polygon` | 137 |
349
+ | Gnosis Chain | `gnosis` | 100 |
350
+ | Avalanche C-Chain | `avalanche` | 43114 |
351
+ | Celo | `celo` | 42220 |
352
+ | Soneium | `soneium` | 1868 |
353
+
354
+ **Testnets:**
355
+ | Network | Name | Chain ID |
356
+ |---------|------|----------|
357
+ | Sepolia | `sepolia` | 11155111 |
358
+ | Base Sepolia | `base-sepolia` | 84532 |
359
+ | Arbitrum Sepolia | `arbitrum-sepolia` | 421614 |
360
+ | Polygon Mumbai | `polygon-mumbai` | 80001 |
361
+ | Polygon Amoy | `polygon-amoy` | 80002 |
362
+ | Avalanche Fuji | `avalanche-fuji` | 43113 |
363
+
364
+ **Configure RPC URLs:**
365
+ ```bash
366
+ # Interactive setup
367
+ ethnotary config rpc sepolia
368
+
369
+ # Direct setup
370
+ ethnotary config rpc sepolia --url https://sepolia.infura.io/v3/YOUR_KEY
371
+ ```
372
+
373
+ **Add custom network:**
374
+ ```bash
375
+ ethnotary config network mychain --name "My Chain" --chain-id 12345 --rpc https://rpc.mychain.io
376
+ ```
377
+
378
+ **Network not listed?** Request support at https://github.com/ethnotary/cli/issues/new
379
+
380
+ ## Multi-Network Interoperability
381
+
382
+ Ethnotary supports deploying and managing contracts across multiple EVM networks simultaneously.
383
+
384
+ ### Per-Contract Network Configuration
385
+
386
+ Each saved contract stores its own list of networks:
387
+
388
+ ```bash
389
+ # Deploy to multiple networks at once
390
+ ethnotary create --owners 0x...,0x... --required 2 --pin 1234 --name treasury \
391
+ --network sepolia,base-sepolia,arbitrum-sepolia
392
+
393
+ # The create command:
394
+ # 1. Prompts for keystore password ONCE
395
+ # 2. Runs pre-flight check across all networks (balance, gas, factory availability)
396
+ # 3. Shows deployment summary and asks for SINGLE confirmation
397
+ # 4. Deploys sequentially to each ready network
398
+
399
+ # Example output:
400
+ # 📋 Pre-flight Check for 3 network(s)...
401
+ # ✓ Sepolia: Ready
402
+ # Predicted: 0x4620463E34cdb0e2F965637C5650500D7378E7af
403
+ # Balance: 0.5 ETH
404
+ # Est. cost: ~0.012 ETH
405
+ # ✗ Base Sepolia: Factory not available
406
+ # ✓ Arbitrum Sepolia: Ready
407
+ # Predicted: 0x4620463E34cdb0e2F965637C5650500D7378E7af
408
+ # Balance: 0.3 ETH
409
+ # Est. cost: ~0.008 ETH
410
+ #
411
+ # 📝 Deployment Summary:
412
+ # Name: treasury
413
+ # Owners: 0x1c54..., 0xa358...
414
+ # Required: 2
415
+ # Networks ready: sepolia, arbitrum-sepolia
416
+ # Networks skipped: base-sepolia
417
+ # Predicted address: 0x4620463E34cdb0e2F965637C5650500D7378E7af
418
+ #
419
+ # ? Deploy to 2 network(s)? Yes
420
+
421
+ # Add existing contract on multiple networks
422
+ ethnotary add --alias mywallet --address 0x123... \
423
+ --network sepolia,base-sepolia
424
+
425
+ # View contract networks
426
+ ethnotary list
427
+ # Output:
428
+ # treasury
429
+ # Address: 0x123...
430
+ # Networks: sepolia, base-sepolia, arbitrum-sepolia
431
+ ```
432
+
433
+ ### Data Queries (Cross-Network by Default)
434
+
435
+ Data commands automatically query all networks the contract is deployed on:
436
+
437
+ ```bash
438
+ # Get balance across all networks
439
+ ethnotary data balance --address treasury
440
+ # Output: Total balance + per-network breakdown
441
+
442
+ # Get events across all networks, sorted by time
443
+ ethnotary data events --address treasury
444
+
445
+ # Filter to specific network
446
+ ethnotary data events --address treasury --network sepolia
447
+ ```
448
+
449
+ ### Transactions (Network-Specific)
450
+
451
+ Transaction commands require specifying a network. If not provided, you'll be prompted:
452
+
453
+ ```bash
454
+ # Specify network explicitly
455
+ ethnotary tx submit --dest 0x... --value 0.1 --network sepolia
456
+
457
+ # Or be prompted to select
458
+ ethnotary tx submit --dest 0x... --value 0.1
459
+ # ? Select target network: (Use arrow keys)
460
+ # > sepolia
461
+ # base-sepolia
462
+ # arbitrum-sepolia
463
+ ```
464
+
465
+ ### Account Management Pre-flight Checks
466
+
467
+ Before executing account changes, the CLI performs a pre-flight check across all networks:
468
+ - Estimates gas cost for the transaction on each network
469
+ - Checks wallet balance is sufficient for gas fees
470
+ - Validates the transaction will succeed (dry-run simulation)
471
+
472
+ ```bash
473
+ # Pre-flight check runs automatically
474
+ ethnotary account add --owner 0x... --pin 1234 --address treasury
475
+
476
+ # Output:
477
+ # 📋 Pre-flight Check Results:
478
+ # ✓ sepolia: Ready
479
+ # Balance: 0.5 ETH
480
+ # Est. cost: ~0.002 ETH
481
+ # ✗ base-sepolia: Insufficient balance
482
+ # Balance: 0.0001 ETH
483
+ # Required: ~0.002 ETH
484
+ #
485
+ # Error: Pre-flight check failed. Use --force to proceed anyway.
486
+
487
+ # Force execution despite failures
488
+ ethnotary account add --owner 0x... --pin 1234 --address treasury --force
489
+ ```
490
+
491
+ ### Account Sync
492
+
493
+ Account management (add/remove owner, change requirement) applies to ALL networks. If a change fails on some networks, the account becomes "decoupled":
494
+
495
+ ```bash
496
+ # Check sync status
497
+ ethnotary account status --address treasury
498
+ # ✓ Account is in sync across all networks
499
+
500
+ # If out of sync, re-sync:
501
+ ethnotary account sync --address treasury --pin 1234
502
+
503
+ # Preview sync without applying
504
+ ethnotary account sync --address treasury --pin 1234 --dry-run
505
+ ```
506
+
507
+ ## PIN Security
508
+
509
+ - **Account creation**: PIN is hashed with Poseidon, only hash stored on-chain
510
+ - **Account management**: zkSNARK proof verifies PIN without revealing it
511
+
512
+ ## License
513
+
514
+ GPL-3.0