Bitcoin
Overview
Bitcoin (BTC) is the native asset of the Bitcoin blockchain. It utilizes:
- UTXO model
- ECDSA signature algorithm
Bitcoin is the foundational cryptocurrency created in 2009 by an anonymous person or group known as Satoshi Nakamoto. The Bitcoin blockchain utilizes decentralized network nodes to verify and record transactions, ensuring transparency and security, while also utilizing cryptography to ensure anonymity. You can buy, sell, and exchange bitcoin through various platforms and use it for a wide range of goods and services, making it a popular choice for digital transactions and investments.
Explorerhttps://mempool.space/
Wallets Types
BitGo enables holding bitcoin in the following wallet types:
Multisig Cold | Multisig Hot | MPC Cold | MPC Hot | |
---|---|---|---|---|
Custody | ✅ | N//A | ❌ | N/A |
Self-Custody | ✅ | ✅ | N/A | ❌ |
Ticker Symbols
Mainnet | Testnet |
---|---|
BTC | TBTC4 |
Faucet
You can use a faucet to obtain testnet bitcoin for development and testing purposes.
Faucet: https://testnet4.com/
Units
Bitcoin is divisible by 10-8 and the base unit is a satoshi (sat):
- 1 bitcoin = 100,000,000 satoshis
- 1 satoshi = 0.00000001 bitcoin
You can pass balances in string or integer format. However, BitGo recommends using string format to ensure values don't exceed the programmable number limit.
Tokens
The Bitcoin blockchain doesn't natively support tokens.
Fees
Bitcoin has the following fees:
- Minimum fee = 1000 sats
- Default fee rate = 1000 sats/kvByte or 1 sat/vByte (0.00000001 BTC/vByte)
Learn more about fees at developer.bitcoin.org.
Dust Threshold
A dust threshold is the minimum amount of Bitcoin that you can create in a single output. Bitcoin has a dust threshold of 2730 satoshis.
Create Wallet
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
export BITGO_EXPRESS_HOST="<YOUR_LOCALHOST>" export COIN="tbtc4" export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>" export LABEL="<DESIRED_WALLET_NAME>" export PASSPHRASE="<YOUR_BITGO_LOGIN_PASSPHRASE>" export ENTERPRISE_ID="<YOUR_ENTERPRISE_ID>" curl -X POST \ http://$BITGO_EXPRESS_HOST:3080/api/v2/$COIN/wallet/generate \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -d '{ "label": "'"$LABEL"'", "passphrase": "'"$PASSPHRASE"'", "enterprise": "'"$ENTERPRISE_ID"'", "disableTransactionNotifications": true, "disableKRSEmail": true }'
Create Address
1 2 3 4 5 6 7 8
export COIN="tbtc4" export WALLET_ID="<YOUR_WALLET_ID>" export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>" curl -X POST \ https://app.bitgo-test.com/api/v2/$COIN/wallet/$WALLET_ID/address \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $ACCESS_TOKEN"
Note: BitGo supports a variety of address types for bitcoin. To learn more, see Reference: Address Types.
Consolidate Balance
Bitcoin is a UTXO asset and therefore doesn't require consolidating to the base address in order to use the maximum spendable amount.
Estimate Fee
1 2 3 4 5 6 7
export COIN="tbtc4" export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>" curl -X GET \ https://app.bitgo-test.com/api/v2/$COIN/tx/fee \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $ACCESS_TOKEN"
Transact
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
export BITGO_EXPRESS_HOST="<YOUR_LOCALHOST>" export COIN="tbtc4" export WALLET_ID="<YOUR_WALLET_ID>" export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>" export ADDRESS="<DESTINATION_ADDRESS>" export AMOUNT="<AMOUNT_IN_BASE_UNITS>" export WALLET_PASSPHRASE="<YOUR_WALLET_PASSPHRASE>" curl -X POST \ http://$BITGO_EXPRESS_HOST:3080/api/v2/$COIN/wallet/$WALLET_ID/sendcoins \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -d '{ "address": "'"$ADDRESS"'", "amount": "'"$AMOUNT"'", "walletPassphrase": "'"$WALLET_PASSPHRASE"'", "txFormat": "psbt" }'
Stake
Bitcoin isn't a stakeable asset.
Op Return
An OP_RETURN
output is a type of unspendable script used to add data onto the Bitcoin blockchain. Although Bitcoin consensus rules allow for large OP_RETURN
outputs, relay policies restrict the size of the OP_RETURN
to 80 bytes and only allow a single OP_RETURN output per transaction. Because these scripts are unspendable, we further restrict these outputs to have no value so that you don't accidentally burn your Bitcoin.
The following code samples demonstrate how to create an OP_RETURN
transaction:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
export BITGO_EXPRESS_HOST="<YOUR_LOCALHOST>" export COIN="tbtc4" export WALLET_ID="<YOUR_WALLET_ID>" export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>" export OP_RETURN="<HEX_ENCODED_OP_RETURN_SCRIPT>" export WALLET_PASSPHRASE="<YOUR_WALLET_PASSPHRASE>" curl -X POST \ http://$BITGO_EXPRESS_HOST:3080/api/v2/$COIN/wallet/$WALLET_ID/sendcoins \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -d '{ "address": "'"scriptPubKey:$OP_RETURN"'", "amount": "0", "walletPassphrase": "'"$WALLET_PASSPHRASE"'", "txFormat": "psbt" }'