Automated Starknet L2 wallet creation system that generates, funds, and deploys Argent wallets for seamless L1โL2 bridge operations.
โ STORING PRIVATE KEYS IN DATABASE IS EXTREMELY DANGEROUS
- This MVP stores wallet private keys in a local JSON file
- THIS IS ONLY FOR DEVELOPMENT AND TESTING PURPOSES
- NEVER deploy this to production servers
- NEVER use with real funds on mainnet
- โ DO NOT store private keys anywhere
- โ Use non-custodial wallet generation only
- โ Return only public addresses to users
- โ Let users control their own private keys
- โ Implement proper key management (HSM, hardware wallets)
- โ Use account abstraction for gasless transactions
- โ Development and testing
- โ Understanding Starknet wallet creation flows
- โ Prototyping bridge mechanics
- โ Learning account abstraction concepts
- Use proper key management systems
- Implement non-custodial architecture
- Follow security best practices
- Conduct security audits
- Use hardware security modules (HSM)
โก YOU HAVE BEEN WARNED - USE AT YOUR OWN RISK โก
This MVP creates complete Argent wallets on Starknet L2:
- โ Generates cryptographic keypairs
- โ Calculates correct Argent wallet addresses
- โ Funds wallets with 0.1 STRK for gas
- โ Deploys wallets to Starknet
- โ Saves all data to local database
- โ Returns Sepolia Starkscan links
- Node.js 18+
sncast(Starknet Foundry)starkli(Starknet CLI)
npm install
cp .env.example .env # Configure your environment# Create a new wallet
node index.js create <userId>
# List all wallets
node index.js listAll sensitive data is loaded from .env:
# Starknet Configuration
STARKNET_RPC_URL=https://starknet-sepolia.public.blastapi.io
MASTER_ACCOUNT_ADDRESS=0x...
STRK_TOKEN_ADDRESS=0x...
ARGENT_ACCOUNT_CLASS_HASH=0x...
# Wallet Settings
FUNDING_AMOUNT=100000000000000000 # 0.1 STRK in wei
WALLETS_DB_FILE=./data/wallets-db.json
NETWORK=sepoliainvisible-wallet/
โโโ src/
โ โโโ complete-wallet-creator.js # Main wallet creation logic
โโโ data/
โ โโโ wallets-db.json # Wallet database
โโโ scripts/
โ โโโ mixing-executor.js # Reference implementation
โโโ temp/ # Temporary files
โโโ .env # Environment configuration
โโโ index.js # Entry point
โโโ README.md # This file
- โ
No hardcoded secrets - All sensitive data in
.env - โ Private keys secured - Never logged or exposed
- โ Environment validation - Checks required variables
- โ Temporary file cleanup - No sensitive data left behind
- Automatic Argent wallet generation
- STRK funding (0.1 STRK per wallet)
- Complete wallet deployment
- Database persistence
- Environment-based configuration
- Sepolia testnet integration
- Mainnet support
- Frontend integration
- LayerSwap API integration
- L1โL2 bridge automation
- Paymaster integration
starknet: Starknet.js librarydotenv: Environment variable loadingsncast: Starknet Foundry CLI (external)starkli: Starknet CLI (external)
- Generate random keypair using Starknet.js
- Use
starklito calculate correct Argent address - Fund address with STRK using
sncast - Deploy wallet using
starkli account deploy - Save complete wallet data to JSON database
$ node index.js create alice
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ Creating complete wallet for: alice
๐ Generating keypair...
๐ Generating Argent account config with starkli...
โ
Starknet L2 Wallet Address: 0x063597c2ff6f08d298a627911f05510e3bcb2ede2693c9b92c09946c7eb46797
๐ธ Funding wallet with 0.1 STRK...
โ
STRK transfer TX: 0x0258dbe557fb46f9fbb9a8e54af8f7c8ca079106c961ed98d30e818a7cae0b2e
๐ฐ Account balance: 0.1000 STRK
๐ Deploying account using starkli account deploy...
โ
Account deployed via starkli! TX: 0x006cb97731018303616548b2f39f18dedc61fcec35c89f2b969d43fe38ab6255
๐ WALLET CREATION COMPLETE!
Status: DEPLOYED โ
๐ DEPLOYED WALLET: https://sepolia.starkscan.co/contract/0x063597c2ff6f08d298a627911f05510e3bcb2ede2693c9b92c09946c7eb46797
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ# Test wallet creation
node index.js create test_user_$(date +%s)
# Check database
node index.js listSet DEBUG=1 in .env for verbose logging.
This is an MVP for research and development. Focus on:
- Security improvements
- Error handling
- Performance optimization
- Frontend integration preparation
MILESTONES/IDEAS for contribute:
- Use account abstraction for gasless UX
- Generate wallets client-side only
- Implement proper session management
- Use hardware security modules (HSM)
- Follow zero-knowledge principles
๐ฏ Remember: This is a learning tool and proof of concept - not production-ready code.
DISCLAIMER: I know that this may be doable just by using starknet-js w/o sncast/starkli, but I can't simply make v3 transaction's resource bounds work as expected.*