Skip to content
ValuedMammalPublic

About

A minimal watch-only Bitcoin wallet using BDK

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

30 Commits

Folders and files

Repository files navigation

Satchl

A place for your sats

Features

  • Watch-Only Wallet: Initialize with public key descriptors for enhanced security
  • Network Support: Mainnet and test networks
  • Simple Configuration: Setup configuration via toml file
  • Address Generation: Generate receive addresses
  • Balance Management: View confirmed and unconfirmed balances
  • UTXO Management: List unspent transaction outputs
  • Blockchain Sync: Synchronize with Bitcoin network via Electrum
  • PSBT Creation: Create unsigned PSBTs

Installation

Requires:

git clone https://github.com/ValuedMammal/satchl && cd satchl
cargo update
cargo install --locked --path .

The binary will be at ~/.cargo/bin/satchl.

Configuration

Satchl uses a configuration file located at ~/.satchl/config.toml (or $SATCHL_DATADIR/config.toml).

Environment Variables

  • SATCHL_DATADIR (optional): Data directory (default: ~/.satchl)
  • SATCHL_XKEY (optional): Extended private key for signing transactions

Configuration File

See sample-config.toml for a sample of the configuration file.

Electrum Servers

  • ssl://electrum.blockstream.info:50002 (Blockstream - mainnet)
  • ssl://bitcoin.lu.ke:50002 (lu.ke - mainnet)
  • Your own romanz/electrs instance

Quick Start

1. Create Configuration File

Create ~/.satchl/config.toml with your wallet configuration:

network = "bitcoin"
electrum_url = "ssl://electrum.blockstream.info:50002"
descriptors = [
    "wpkh([d34dbeef/84h/0h/0h]xpub.../0/*)",
    "wpkh([d34dbeef/84h/0h/0h]xpub.../1/*)",
]

2. Initialize Watch-Only Wallet

satchl new

This creates a wallet database at ~/.satchl/wallet.db (or wallet-signet.db for Signet, etc.).

3. Sync with Blockchain

satchl sync

Usage

Usage: satchl <COMMAND>

Commands:
  new      Initialize a new wallet
  address  Generate a new receive address
  balance  Display wallet balance
  utxos    List unspent transaction outputs
  sync     Synchronize wallet with blockchain
  send     Send to address
  help     Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version

Send Transaction

Create an unsigned PSBT:

Usage: satchl send [OPTIONS] --amount <AMOUNT> <ADDRESS>

Arguments:
  <ADDRESS>  Recipient address

Options:
  -a, --amount <AMOUNT>      Amount in satoshis
  -f, --fee-rate <FEE_RATE>  Fee rate in sat/vB [default: 1.0]
  -s, --sign                 Sign the transaction
  -b, --broadcast            Broadcast signed transaction (implies --sign)
  -h, --help                 Print help

Example:

satchl send bc1qg35sdfjkpk9dwcxmx9t8qmnju9cl8g42cnry50 \
  --amount 21000 \
  --fee-rate 2

Sign Transaction

To sign, set your extended private key as an environment variable:

export SATCHL_XKEY="xprv..."

Then use the --sign flag:

satchl send bc1q... --amount 10000 --fee-rate 2 --sign

Sign and Broadcast

To sign and broadcast in one step:

satchl send bc1q... --amount 10000 --fee-rate 2 --broadcast

The output includes:

  • Final transaction in hex format
  • Transaction ID

Architecture

  • CLI: clap for command-line interface
  • Wallet: bdk_wallet with SQLite persistence
  • Blockchain: bdk_electrum for Electrum protocol

Database Location

Wallet databases are stored in the satchl data directory:

  • Default: ~/.satchl/
  • Custom: Set SATCHL_DATADIR environment variable

Database files:

  • wallet.db - Bitcoin (mainnet)
  • wallet-signet.db - Signet
  • wallet-testnet.db - Testnet
  • wallet-testnet4.db - Testnet4
  • wallet-regtest.db - Regtest

Development

# Check code
cargo check

# Run tests
cargo test

# Build debug
cargo build

# Build release
cargo build --release

License

See Cargo.toml for project metadata.

About

A minimal watch-only Bitcoin wallet using BDK

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages