Skip to content

Commit ab18a58

Browse files
committed
✨ feat(demos): add TACo Account Abstraction signing demo
Add comprehensive demo showing how to integrate TACo's distributed threshold signatures with Account Abstraction wallets using MetaMask Delegation Toolkit. Features: - Single-file implementation - Real TACo testnet integration with 2-of-3 threshold - Balance tracking and fund management - ERC-4337 UserOperation signing with Pimlico bundler - Clean documentation with example output
1 parent 02762f8 commit ab18a58

File tree

6 files changed

+437
-0
lines changed

6 files changed

+437
-0
lines changed

demos/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
- [`taco-demo`](./taco-demo) - A demo of the `@nucypher/taco` library.
44
- [`taco-nft-demo`](./taco-nft-demo) - A demo an NFT-based condition using the
55
`@nucypher/taco` library.
6+
- [`taco-aa-signing`](./taco-aa-signing) - A demo showing TACo distributed signing with Account Abstraction wallets.

demos/taco-aa-signing/.env.example

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Ethereum Sepolia RPC endpoint
2+
RPC_URL=https://ethereum-sepolia-rpc.publicnode.com
3+
4+
# Private key for funding account (needs test ETH on Sepolia)
5+
PRIVATE_KEY=0x1234567890abcdef...
6+
7+
# ERC-4337 bundler endpoint (Pimlico example)
8+
BUNDLER_URL=https://api.pimlico.io/v2/sepolia/rpc?apikey=YOUR_PIMLICO_API_KEY

demos/taco-aa-signing/README.md

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# TACo Account Abstraction Demo
2+
3+
Shows how to create smart accounts with TACo's distributed threshold signatures and execute real transactions using Account Abstraction.
4+
5+
## What This Demo Does
6+
7+
1. **Creates Smart Account**: Uses TACo testnet signers to create a MultiSig smart account
8+
2. **Shows Balance Changes**: Tracks ETH balances throughout the process
9+
3. **Executes Real Transactions**: Transfers funds using TACo's threshold signatures
10+
4. **Returns Funds**: Prevents accumulation by returning funds to the original EOA
11+
12+
## Quick Start
13+
14+
```bash
15+
# Install dependencies
16+
npm install
17+
18+
# Configure environment
19+
cp .env.example .env
20+
# Edit .env with your values
21+
22+
# Run the demo
23+
npm start
24+
```
25+
26+
## Configuration
27+
28+
Create `.env` file:
29+
30+
```env
31+
# Ethereum Sepolia RPC endpoint
32+
RPC_URL=https://ethereum-sepolia-rpc.publicnode.com
33+
34+
# Private key (needs test ETH on Sepolia)
35+
PRIVATE_KEY=0x...
36+
37+
# ERC-4337 bundler endpoint (Pimlico)
38+
BUNDLER_URL=https://api.pimlico.io/v2/sepolia/rpc?apikey=YOUR_KEY
39+
```
40+
41+
## Demo Flow
42+
43+
```
44+
🏗️ Create Smart Account with TACo Signers
45+
📊 Show Initial Balances
46+
💰 Fund Smart Account
47+
🔧 Prepare Transaction
48+
🔐 Sign with TACo Network (2-of-3 threshold)
49+
🚀 Execute via Account Abstraction
50+
📊 Show Final Balances
51+
🎉 Complete & Exit
52+
```
53+
54+
## Key Features
55+
56+
- **Real TACo Testnet**: Uses actual Ursula nodes as signers
57+
- **Threshold Signatures**: 2-of-3 distributed signing
58+
- **Balance Tracking**: Shows ETH movement at each step
59+
- **Fund Management**: Returns funds to prevent accumulation
60+
- **Single File**: Less than 200 lines of clean, working code
61+
62+
## Code Structure
63+
64+
The demo has two main helper functions:
65+
66+
```typescript
67+
// Creates smart account with TACo signers
68+
createTacoSmartAccount()
69+
70+
// Signs UserOperation with TACo network
71+
signUserOpWithTaco()
72+
```
73+
74+
All the core logic is in `src/index.ts` - easy to understand and modify.
75+
76+
## Example Output
77+
78+
```
79+
🎬 Starting TACo Account Abstraction Demo
80+
81+
🏗️ Creating TACo smart account...
82+
✅ Smart account created: 0x1F14beC...
83+
📋 Threshold: 2 signatures required
84+
85+
📊 Initial Balances:
86+
EOA: 0.0421 ETH
87+
Smart Account: 0.002 ETH
88+
89+
🔧 Preparing transaction...
90+
📋 Transfer amount: 0.001 ETH (returning funds to EOA)
91+
92+
🔐 Signing with TACo network...
93+
✅ TACo signature collected (130 bytes)
94+
95+
🚀 Executing transaction...
96+
✅ Transaction executed: 0xabc123...
97+
98+
📊 Final Balances:
99+
EOA: 0.0431 ETH
100+
Smart Account: 0.002 ETH (reserved for gas)
101+
102+
🎉 Demo completed successfully!
103+
```
104+
105+
## Resources
106+
107+
- [TACo Documentation](https://docs.taco.build)
108+
- [Account Abstraction (ERC-4337)](https://eips.ethereum.org/EIPS/eip-4337)
109+
- [MetaMask Delegation Toolkit](https://github.com/MetaMask/delegation-toolkit)

demos/taco-aa-signing/package.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "taco-aa-signing-demo",
3+
"version": "0.0.0",
4+
"description": "A demo showing TACo distributed signing with Account Abstraction wallets",
5+
"private": true,
6+
"author": "NuCypher <[email protected]>",
7+
"scripts": {
8+
"check": "pnpm type-check",
9+
"start": "ts-node src/index.ts",
10+
"dev": "ts-node src/index.ts --debug",
11+
"type-check": "tsc --noEmit"
12+
},
13+
"dependencies": {
14+
"@nucypher/taco": "workspace:*",
15+
"@nucypher/shared": "workspace:*",
16+
"@metamask/delegation-toolkit": "^0.11.0",
17+
"@metamask/delegation-utils": "^0.11.0",
18+
"permissionless": "^0.1.49",
19+
"ethers": "^5.8.0",
20+
"viem": "~2.17.0",
21+
"dotenv": "^16.5.0",
22+
"winston": "^3.17.0"
23+
},
24+
"devDependencies": {
25+
"@types/node": "^20.17.9",
26+
"ts-node": "^10.9.2",
27+
"typescript": "^5.7.2"
28+
}
29+
}

0 commit comments

Comments
 (0)