Post-quantum self-custody command-line wallet for the NEX blockchain.
A single-file Swift tool that generates keys, signs transactions locally, and talks to a nexd node over JSON-RPC — no dependencies beyond macOS system frameworks (Foundation, CommonCrypto, Security).
- Generates a 24-word BIP-39 seed phrase
- Derives a post-quantum address from the seed (witness version 2,
nex1zprefix) - Signs transactions locally using Path B seed-spend (64-byte seed witness)
- Queries balances by scanning the node's UTXO set
- Imports seed phrases from the NEX PWA wallet (flexible input format)
- Displays receive addresses with terminal QR codes
- Stores keys securely in the macOS Keychain
Requires macOS 14+ and Swift 5.9+.
swiftc -O -o nex-wallet nex-wallet.swiftThat produces a single nex-wallet binary. Drop it on your $PATH or run it in place.
The wallet needs a BIP-39 English word list at ~/.nex-wallet/bip39_english.txt (one word per line, 2048 words). Copy it from the PWA wallet or any standard BIP-39 source.
| Command | Purpose |
|---|---|
create |
Generate a new wallet (prints the 24-word seed) |
restore |
Restore a wallet from an existing seed phrase |
import |
Import seed phrase from NEX PWA wallet (flexible input) |
address |
Show the receive address |
balance |
Query balance from a nexd node |
send |
Build, sign locally, and broadcast a transaction |
receive |
Show the receive address with a terminal QR code |
claim |
Import and broadcast a BTC snapshot claim (coming soon) |
export |
Export the public key or seed phrase (requires confirmation) |
backup |
Display the seed phrase (requires confirmation) |
wipe |
Destroy all stored keys (requires typing RESET) |
selftest |
Run cryptographic self-tests (27 tests) |
info |
Show wallet and node status |
config |
Save node connection settings |
# One-time setup
nex-wallet create
nex-wallet config --node http://98.80.98.17:19332 --user nex --pass YOUR-PASS
# Import from PWA wallet
nex-wallet import # paste 24 words in any format
# Day-to-day
nex-wallet balance
nex-wallet receive # show address + QR code
nex-wallet send --to nex1z... --amount 10.5
# Export & backup
nex-wallet export # interactive: pubkey hash or seed phrase
nex-wallet backup # reveal seed with confirmation
# Maintenance
nex-wallet selftest # verify crypto primitives
nex-wallet wipe # destroy keys with confirmation| Data | Location | Protection |
|---|---|---|
| BIP-39 seed (64 bytes) | macOS Keychain | Encrypted at rest |
| Mnemonic (24 words) | macOS Keychain | Encrypted at rest |
| Public key hash | ~/.nex-wallet/pubkey_hash.bin |
File permissions |
| Node config | ~/.nex-wallet/config.json |
Plain text |
- Seed generation: 256-bit entropy + SHA-256 checksum = 24-word BIP-39 mnemonic
- Seed derivation: PBKDF2-HMAC-SHA512 (2048 iterations, salt "mnemonic")
- Address derivation: SHA-256(seed + "NEX-CLI-KEY-0") → bech32m (witness v2, HRP
nex) - Transaction signing: Path B seed-spend — raw 64-byte seed in witness stack
- Address encoding: Bech32m (BIP-350), witness version 2,
nex1zprefix
The CLI wallet uses the same key derivation as the NEX PWA wallet:
- Same BIP-39 mnemonic format (24 words)
- Same PBKDF2-SHA512 seed derivation
- Same
SHA256(seed + "NEX-CLI-KEY-{index}")address derivation - Same Path B witness spending
A seed phrase created in the PWA wallet will produce the same address in the CLI, and vice versa.
Unlicensed — personal use only until stated otherwise.