- Node.js 18+ (recommended: 20+)
- npm or yarn
cd electron-app
npm installnpm run devThis will:
- Start Vite dev server (port 5173)
- Compile Electron TypeScript
- Launch the Electron app with hot reload
- Main Window: BSV Desktop wallet UI
- DevTools: Automatically opened for debugging
- HTTP Server: Running on
http://127.0.0.1:3321
In another terminal:
# Test authentication endpoint
curl http://127.0.0.1:3321/isAuthenticated
# Should return something like:
# {"authenticated":false}On first launch, you'll see the wallet configuration screen:
- Network: Choose mainnet or testnet
- Auth Method:
- Self-custody (local keys) - Recommended for desktop
- WAB (phone verification)
- Storage:
- Local SQLite - Recommended (stored at
~/.bsv-desktop/wallet.db) - Remote Storage Server
- Local SQLite - Recommended (stored at
The default configuration uses local SQLite storage via Knex:
- Database Location:
~/.bsv-desktop/wallet.db - Provider:
StorageKnexfrom@bsv/wallet-toolbox - No remote server required
This is configured in the parent library's WalletContext.tsx when useRemoteStorage: false.
electron-app/
├── electron/
│ ├── main.ts # Electron main process
│ ├── httpServer.ts # HTTP server on port 3321
│ └── preload.ts # IPC bridge
├── src/
│ ├── main.tsx # React entry point
│ ├── onWalletReady.ts # Wallet HTTP handler
│ └── electronFunctions.ts # Native handlers
└── package.json
# Build the app
npm run build
# Package for your platform
npm run package
# Or platform-specific:
npm run package:mac # macOS
npm run package:win # Windows
npm run package:linux # LinuxPackaged apps will be in release/ directory.
lsof -ti:3321 | xargs kill -9rm -rf ~/.bsv-desktop/Open DevTools → Application → Local Storage → Clear All
- Configure wallet on first launch
- Test with external apps by pointing them to
http://127.0.0.1:3321 - Explore the codebase:
- HTTP server:
electron/httpServer.ts - Wallet integration:
src/onWalletReady.ts - Storage config:
../src/WalletContext.tsx
- HTTP server:
Check the terminal where you ran npm run dev
Open DevTools (auto-opens in dev mode)
Use curl to test endpoints:
curl -X POST http://127.0.0.1:3321/isAuthenticated \
-H "Content-Type: application/json" \
-H "Origin: http://example.com"