SUBTC CLI V2 — Full Payment Flow Example

permalink SUBTC
#cli#flow#full#payment#subtc

This guide shows a complete payment flow
using SUBTC CLI V2.

We combine Inbox, Wait, Send, and Poll
for real-world usage.

# Scenario

Alice wants to receive 20,000 satoshis
to her testnet wallet from Bob.

# Step 1: Create Wallet

./subtc wallet create

Example Output:
────────────────────────────────────────────
wallet_id: w_ce9e16e59a72cd59840ce2256662a2400bc114ea3758

# Step 2: Create Inbox

./subtc inbox w_ce9e16e59a72cd59840ce2256662a2400bc114ea3758 20000

Inbox ensures expected payment is tracked.

# Step 3: Generate Receive Address

./subtc wallet receive w_ce9e16e59a72cd59840ce2256662a2400bc114ea3758

Receive Address:
tb1qwphc20fty0l42cn3tnwv32uz85zm9jm2thdl4y

# Step 4: Wait for Payment (Optional Blocking)

./subtc wait w_ce9e16e59a72cd59840ce2256662a2400bc114y 20000 300

- Blocks until 20,000 sat are received
- Timeout 300 seconds
- Can trigger webhook when payment arrives

# Step 5: Send Payment

Bob sends 50,000 sat (auto idempotency):

./subtc send w_ce9e16e59a72cd59840ce2256662a2400bc114ea3758 tb1qjcr7lcucmwudwqscew4r078gxkw549ruq5r97w 50000

Output:
────────────────────────────────────────────
txid: 3d72d72aa9f43be50e4dfb35971107252143fdf3da859d74427336b5ef8fd

# Step 6: Check Balance

./subtc wallet balance w_ce9e16e59a72cd59840ce2256662a2400bc114ea3758

Balance:
97,000 sat (0.00097000 BTC)

# Step 7: Poll for Payment (Optional Non-blocking)

./subtc poll w_ce9e16e59a72cd59840ce2256662a2400bc114ea3758 tb1qwphc20fty0l42cn3tnwv32uz85zm9jm2thdl4y 20000 --loop

Loop every 3 seconds until confirmed.

# Summary

1. Create wallet
2. Generate receive address
3. Create Inbox for expected payment
4. Wait or Poll for incoming funds
5. Send payment
6. Check balances

# Why This Flow

- Combines all V2 tools
- Works for testnet and mainnet
- Ideal for automation, bots, and AI agents
- Supports real-world payment scenarios

# Notes

- Minimum send: 50,000 sat
- Fee: 3%
- Mainnet requires YES confirmation
- Use SUBTC_KEY and SUBTC_NET env variables to override defaults

# Use Cases

- Donation systems
- Marketplace payments
- Testnet app automation
- AI payment agents

## tools subtc cli v2 : https://subtc.net/post/subtc-cli-v2-unified-bitcoin-cli