SUBTC-CLI V2 — Unified Bitcoin Interface (Testnet & Mainnet)

permalink SUBTC
#bitcoin#cli#developer-tools#idempotent#mainnet#opensource#payment-api#polling#testnet#webhook

SUBTC-CLI V2 is a unified command-line tool for Bitcoin payments on both testnet and mainnet.

It is:

· Single binary (Go, zero external dependencies)<br>· Idempotent — safe to retry, never double-spend<br>· Multi-network — switch between testnet/mainnet seamlessly<br>· Event-driven — long-poll, webhooks, and polling loops<br>· Curl-first — works with any stack, any language

What's New in V2

Mainnet Support: V1 No, V2 Yes<br>Testnet Support: V1 Yes, V2 Yes<br>Network Switching: V1 No, V2 Yes (config, flag, env)<br>Idempotent Sends: V1 Yes, V2 Yes (enhanced)<br>Webhook Callbacks: V1 No, V2 Yes<br>Configurable Polling: V1 No, V2 Yes (--interval)<br>Mainnet Confirmation: V1 No, V2 Yes (YES prompt)<br>Persistent Config: V1 Limited, V2 Yes (~/.subtc.json)

Quick Start

Build from source:<br>go build -o subtc subtc-cli.go

Create API key:<br>./subtc key create

Set network (testnet for testing):<br>./subtc config set-net test

Create wallet:<br>./subtc wallet create

Generate receive address:<br>./subtc wallet receive <wallet_id>

Check balance:<br>./subtc wallet balance <wallet_id>

Send Bitcoin:<br>./subtc send <wallet_id> 50000

Wait for payment:<br>./subtc wait <wallet_id> 30000

Poll until confirmed:<br>./subtc poll <wallet_id> 30000 --loop

Network Control

Set default network:<br>./subtc config set-net test<br>./subtc config set-net main

Per-command override:<br>./subtc --net=main wallet create<br>SUBTC_NET=main ./subtc wallet create

Precedence: flag > env > config

Key Management

./subtc key create # Generate & save new API key<br>./subtc key status # Verify current key

Example:<br>$ ./subtc key create<br>Key Created<br>✓ Key saved → ~/.subtc.json

$ ./subtc key status<br>{<br>"ok": true,<br>"result": {<br>"key": "SUBTC-KEY-79821c194c...",<br>"wallet_count": 0<br>}<br>}

Wallet Operations

./subtc wallet create # New wallet (active network)<br>./subtc wallet list # List all wallets<br>./subtc wallet receive <wid> # Generate receive address<br>./subtc wallet balance <wid> # Check balance

Example:<br>$ ./subtc wallet create<br>Wallet Created · testnet<br>wallet_id: w_acfd7aa7e54f31d533c4f6eed2cf18c9c192957c2f2e

$ ./subtc wallet receive w_acfd7aa7e54f...<br>Receive Address · testnet<br>address: tb1qhcy9w09yk22ppf3fdg6twnjh2zvgarf4zlsw4s

$ ./subtc wallet balance w_acfd7aa7e54f...<br>balance: 191849 sat

Send Bitcoin

Auto idempotency key:<br>./subtc send <wid> 50000

Custom idempotency key (safe to retry):<br>./subtc send <wid> 50000 my-unique-id

Rules:<br>Minimum: 50,000 sat<br>Fee: 3% (service + network)<br>Mainnet requires YES confirmation prompt

Example:<br>$ ./subtc send w_acfd7aa7e... tb1qjcr7lc... 50000<br>Send BTC · testnet<br>✓ Transaction broadcast<br>txid: 26c264561605408253edec687c2f159f8c6dd0091f03b12b68969892e0086b1d<br>sent_sat: 48500 sat<br>fee_sat: 1500 sat

Inbox (Payment Intent)

Create a pre-configured receive target — perfect for apps, bots, and automation.

./subtc inbox <wallet_id> <expected_sat>

Example:<br>$ ./subtc inbox w_acfd7aa7e... 20000<br>Inbox · testnet<br>✓ Inbox ready<br>address: tb1qhcy9w09yk22ppf3fdg6twnjh2zvgarf4zlsw4s<br>expected: 20000 sat

Wait (Long-Poll / Webhook)

Blocking mode:<br>./subtc wait <wid> 30000 # 300s timeout<br>./subtc wait <wid> 30000 600 # Custom timeout

Webhook mode:<br>./subtc wait <wid> 30000 300 https://yourserver.com/webhook

Example:<br>$ ./subtc wait w_acfd7aa7e... tb1qhcy9w09... 30000<br>Waiting for Funds · testnet<br>✓ Payment confirmed!<br>received: 191849 sat

Poll (Check & Loop)

Single check:<br>./subtc poll <wid> 30000

Loop until confirmed:<br>./subtc poll <wid> 30000 --loop<br>./subtc poll <wid> 30000 --loop --interval=5

Example:<br>$ ./subtc poll w_acfd7aa7e... tb1qhcy9w09... 30000 --loop<br>Poll · testnet<br>⏳ received: 191849 sat reached: false<br>⏳ received: 191849 sat reached: false<br>✅ received: 191849 sat reached: true<br>✓ Payment confirmed — stopping loop

Configuration

Commands:<br>./subtc config show # View current config<br>./subtc config set-key <key> # Set API key<br>./subtc config set-net <test|main> # Set default network<br>./subtc health # Node health status

Config file (~/.subtc.json):<br>{<br>"key": "SUBTC-KEY-79821c194c...",<br>"network": "test"<br>}

Environment override:<br>SUBTC_KEY=xxx ./subtc wallet list<br>SUBTC_NET=main ./subtc wallet create

Example:<br>$ ./subtc config show<br>key: SUBTC-KEY-79••••••••<br>network: test testnet<br>file: ~/.subtc.json<br>env-override: SUBTC_KEY · SUBTC_NET

$ ./subtc health<br>{<br>"ok": true,<br>"configured": true,<br>"fee_bps": 300,<br>"min_send_sat": 20000<br>}

Complete Workflow Example

  1. Create key:

./subtc key create

  1. Set network to testnet:

./subtc config set-net test

  1. Create wallet:

./subtc wallet create<br>wallet_id: w_acfd7aa7e54f31d533c4f6eed2cf18c9c192957c2f2e

  1. Generate address:

./subtc wallet receive w_acfd7aa7e...<br>address: tb1qhcy9w09yk22ppf3fdg6twnjh2zvgarf4zlsw4s

  1. Check balance:

./subtc wallet balance w_acfd7aa7e...<br>balance: 191849 sat

  1. Wait for incoming payment:

./subtc wait w_acfd7aa7e... tb1qhcy9w09... 30000<br>received: 191849 sat

  1. Send BTC:

./subtc send w_acfd7aa7e... tb1qjcr7lc... 50000<br>✓ Transaction broadcast<br>txid: 26c2645616...

  1. Check final balance:

./subtc wallet balance w_acfd7aa7e...<br>balance: 91849 sat

  1. Health check:

./subtc health

  1. Show config:

./subtc config show

Why SUBTC-CLI V2 Matters

· Simple for beginners — clear commands, helpful output<br>· Powerful for developers — idempotent, webhooks, polling<br>· Ready for automation — works with scripts, bots, APIs<br>· Zero dependencies — single Go binary<br>· curl-first design — integrate with any stack<br>· Mainnet-safe — confirmation prompts prevent mistakes

Use Cases

· Payment bots (Telegram, Discord, Slack)<br>· Donation systems<br>· Testnet apps & prototyping<br>· Automation scripts<br>· AI agents (coming with V3 Docker support)<br>· Point-of-sale integrations<br>· Recurring payments<br>· Webhook receivers

What's Next (V3 & V4)

V3: Docker containers — ready for AI agents<br>V4: Tor support + .onion endpoints<br>V5: AI agent integration (Open Claw, etc.)

Download & Docs

Download V2: https://subtc.net/post/subtc-cli-v2-unified-bitcoin-cli<br>Full API Reference: https://subtc.net/api<br>LLM-friendly version: https://subtc.net/llms-full.txt<br>GitHub: https://github.com/subtc/SUBTC-CLI-V2-Unified-Bitcoin-CLI-

License

Apache 2.0 — free for commercial and personal use.

Built for Freedom

SUBTC-CLI works everywhere — regardless of geographic restrictions.

Combined with our distributed proxy infrastructure and upcoming Tor support, we're building tools that respect your right to access financial technology.

No borders. No blocks. Just Bitcoin.

One CLI. Both networks. Zero limits.