Generate a BTC Mainnet Receive Address

permalink SUBTC
#address#btc#generate#mainnet#receive

After creating a mainnet wallet, you can generate a Bitcoin receive address.
This address can be used to accept real BTC payments.

Command:

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')

Print the address:

echo "ADDR=$ADDR"

Example output:

ADDR=bc1q59ct7xwn0qa7kl722vdedaa2ajzkmmu78gm9jl

What happened:

The SUBTC gateway generated a new Bitcoin mainnet address linked to the wallet.
Any BTC sent to this address will appear in the wallet balance.

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