Packages: core (BIP39/32/44/49/84/86 derivation, WIF), keystore (PBKDF2 + AES-GCM), psbt, p2p (BIP157/158 SPV daemon, Dandelion++ broadcast with relay-echo verification), blockbook, rpc, electrum, net, bns, web-ui (React/Vite), mobile (Expo). ops/ holds the nginx vhost, systemd unit and push.sh deploy script for digibyte.x/web.
2.1 KiB
2.1 KiB
@dgb-wallet/rpc
JSON-RPC client for DigiByte Core, calling only the read-only + broadcast methods a wallet needs. Companion to ops/setup.sh, which provisions the matching pruned VPS backend.
API
new RpcClient({ url, username, password, timeoutMs })getBlockchainInfo(client)— chain tip, sync progress, prune statusscanTxOutSet(client, descriptors)— walk UTXO set for descriptors/xpubs; returns matching UTXOssendRawTransaction(client, hex)— broadcast; returns txid or throwsestimateSmartFee(client, confTarget)— DGB/kB fee estimatedescriptorForAccount(purpose, xpub, change, rangeEnd)— build BIP44/49/84/86 descriptors with checksumsdescriptorChecksum(desc),withChecksum(desc)— BIP380 checksum helpers
Demo — real recovery scan via your VPS
Provision the backend once with ../../ops/setup.sh (turnkey for a fresh Ubuntu/Debian VPS). Then:
cd "D:\Dev\SilentCode\Digibyte"
npm install # first time only
npm run build -w @dgb-wallet/core
export DGB_RPC_URL=https://your-domain.example.com/
export DGB_RPC_USER=dgb_...
export DGB_RPC_PASSWORD=...
npm run demo -w @dgb-wallet/rpc
# or with a specific seed:
npm run demo -w @dgb-wallet/rpc -- "word1 word2 ... word12"
Scans 3 accounts × 4 descriptor paths × 2 change/receive × 101 addresses each = 2,424 addresses in one RPC call, typically 5–15 seconds on a synced pruned node. Prints every UTXO found with its descriptor path, ready to feed into @dgb-wallet/psbt for spending.
Descriptor checksums
DGB Core requires descriptors passed to scantxoutset to carry a BIP380 checksum. withChecksum(desc) and descriptorForAccount(...) compute it locally so we don't need a round-trip to getdescriptorinfo.
Notes
- Uses
fetch— Node 18+, React Native, and browser extensions all work. - Future: swap
fetchfor@dgb-wallet/net'sNetProviderso requests can go through Tor by default (per RESEARCH.md §10.7b). - Wallet-side is stateless; the VPS holds the chain state. Client keys never leave the wallet.