Receive BTC Testnet Coins in SUBTC Wallet

permalink SUBTC
#btc#coins#receive#subtc#testnet

To fund your SUBTC testnet wallet, you first need a receiving address.
This command generates a new address for a specific wallet.

Generate a receive address:
command:

KEY=SUBTC-KEY-c942534db29afa0a50957ef909c8ea4a4fb17bf5392b1682
WID=w_cf21a601a3f461a92699e5b5dac80ad6d9d66de4592d

RESP=$(curl -sS -X POST "https://api.subtc.net/v1/btc?mode=wallet_receive" \
  -H "X-SUBTC-KEY: $KEY" \
  -H "Content-Type: application/json" \
  -d "{\"wallet_id\":\"$WID\"}")

Extract the address:

ADDR=$(echo "$RESP" | sed -n 's/.*"address":"\([^"]*\)".*/\1/p')
echo "ADDR=$ADDR"

Example output:

ADDR=tb1qj3xzdyr6fdhzh37w4avm4l5dnm53cmvf6p27rf

Next, send testnet BTC from a faucet (e.g., [coinfaucet.eu](https://coinfaucet.eu/en/btc-testnet/)) to this address.

Transaction example:

- Amount: 0.00102324 BTC
- Address: tb1qj3xzdyr6fdhzh37w4avm4l5dnm53cmvf6p27rf

- TXID: fc7b555eda7f9e29b5a7ce70fc9e4ad326bc6636ba85a5abd669c33af9016330

Check wallet balance:

curl -sS -X POST "https://api.subtc.net/v1/btc?mode=wallet_balance" \
-H "X-SUBTC-KEY: $KEY" \
-H "Content-Type: application/json" \
-d "{\"wallet_id\":\"$WID\"}"

Example response:

{
"ok": true,
"request_id": "951d925d0503cdc1",
"result": {
"addresses": ["tb1qj3xzdyr6fdhzh37w4avm4l5dnm53cmvf6p27rf"],
"balance_sat": 102324,
"balance_source": "getbalances",
"coin": "btc",
"confirmed_sat": 0,
"immature_sat": 0,
"net": "test",
"unconfirmed_sat": 102324,
"wallet_id": "w_cf21a601a3f461a92699e5b5dac80ad6d9d66de4592d"
}
}

What happened:

The wallet received 0.00102324 BTC (102,324 satoshis) on testnet.
The balance is currently unconfirmed until the transaction is mined.

API Base:
https://subtc.net/api