Skip to main content

nexus wallet new

Create a new wallet with a random keypair.
nexus wallet new <NAME>

Example

nexus wallet new my-wallet

Output

→ Creating new wallet...
Name: my-wallet
Network: regtest
Secret Key: 1234567890abcdef...
Public Key: 02abcdef1234567890...
Address: bcrt1p...
✓ Wallet created!
Saved to ~/.nexus/wallets/my-wallet.json
The secret key is displayed only once. Store it securely!

nexus wallet list

List all saved wallets.
nexus wallet list

Output

→ Wallets:
  my-wallet
  test-wallet
  production-wallet

nexus wallet balance

Get the balance for an address.
nexus wallet balance <ADDRESS>

Example

nexus wallet balance bcrt1p...

Output

→ Balance for bcrt1p...
Balance: 100000 sats

nexus wallet deposit-address

Get the vault deposit address for a wallet.
nexus wallet deposit-address <NAME> --protocol-key <HEX>

Options

OptionRequiredDescription
--protocol-key <HEX>YesProtocol public key (from node info)

Example

# First, get the protocol key
nexus query node-info

# Then derive vault address
nexus wallet deposit-address my-wallet \
  --protocol-key 1234567890abcdef...

Output

→ Deriving Vault Address...
User Vault Address: bcrt1p...
The vault address is a Taproot address with two spending paths:
  1. Protocol Path: L1 balance always matches L2 balance (1:1 backing)
  2. Escape Path: User can spend after timelock (for recovery)

Wallet File Format

Wallets are stored as JSON in ~/.nexus/wallets/:
{
  "name": "my-wallet",
  "secret_key": "1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
  "public_key": "02abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890ab",
  "address": "bcrt1pabcdef1234567890abcdef1234567890abcdef1234567890abcdef12345"
}

Fields

FieldDescription
nameWallet identifier
secret_key32-byte private key (hex)
public_key33-byte compressed public key (hex)
addressBitcoin P2TR address

Address Formats

The CLI supports multiple address formats:
FormatExampleDescription
Wallet namemy-walletLoads from ~/.nexus/wallets/
P2TR addressbcrt1p...Bitcoin Taproot address
Hex pubkey0x1234...Raw public key bytes

Using Addresses

# Using wallet name
nexus contract call --from my-wallet ...

# Using Bitcoin address
nexus contract call --from bcrt1p... ...

# Using hex pubkey
nexus contract call --from 0x1234... ...

Security Best Practices

Never share your secret key! Anyone with access to your secret key can spend your funds.

Recommendations

  1. Backup wallet files - Store copies in secure locations
  2. Use strong permissions - chmod 600 ~/.nexus/wallets/*.json
  3. Separate wallets - Use different wallets for development and production
  4. Hardware wallets - For mainnet, consider hardware wallet integration

File Permissions

# Secure wallet directory
chmod 700 ~/.nexus/wallets
chmod 600 ~/.nexus/wallets/*.json

Network-Specific Addresses

Addresses are network-specific:
NetworkPrefixExample
Mainnetbc1pbc1p...
Testnettb1ptb1p...
Regtestbcrt1pbcrt1p...
Wallets created with --network regtest will have bcrt1p addresses.