@mingderwang/wallet
v0.1.6
Published
Ethereum wallet + encrypted keystore helpers (scrypt + AES-256-GCM) built on ethers v6. Ships a `wallet` CLI.
Maintainers
Readme
@mingderwang/wallet
Ethereum wallet + encrypted keystore helpers for Node.js, built on ethers v6. Ships both a library and a wallet CLI.
- Create / import / load wallets (private key + mnemonic)
- Encrypted keystore: scrypt (N=2^15, r=8, p=1) + AES-256-GCM, stored at a path of your choice
- Balances for ETH + USDC on
ethereum-sepolia,ethereum-mainnet,base-sepolia,base - Default per-network public RPCs; override any with
X402_RPC_URL
Used by @mingderwang/xsift and @mingderwang/x402.
Install
npm install @mingderwang/wallet # library
npm install -g @mingderwang/wallet # also gives the `wallet` CLICLI
wallet create [--path <file>] [--json]
wallet import <mnemonic | private key> [--path <file>] [--json]
wallet address [--path <file>]
wallet balance [--path <file>] [--network <ethereum-sepolia|ethereum-mainnet|base-sepolia|base>]
wallet export [--path <file>]
wallet delete [--path <file>]Keystore defaults to ~/.wallet/wallet.json. Prompts for the password, or set WALLET_PASSWORD in the environment to script it.
WALLET_PASSWORD=hunter2 wallet create
wallet addressLibrary
import { createWallet, encryptPrivateKey, saveKeystore, loadWallet, readKeystore, getBalances } from '@mingderwang/wallet';
const { wallet, privateKey, address } = createWallet();
const keystore = encryptPrivateKey(privateKey, 's3cret', address);
saveKeystore(keystore, '~/.xsift/wallet.json');
const loaded = loadWallet(readKeystore('~/.xsift/wallet.json'), 's3cret');
const { eth, usdc } = await getBalances(loaded, 'ethereum-sepolia');License
MIT
