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 doesn't natively support staking, since it's a proof of work (PoW) blockchain. However, you can earn other rewards by staking your bitcoin on other blockchains. BitGo currently supports bitcoin staking on the Core blockchain to earn CoreDAO rewards. Staking bitcoin on Core utilizes a hybrid consensus mechanism known as Satoshi Plus. This process leverages the bitcoin mining hash rate, delegated proof-of-stake (DPoS), and Ethereum-compatible smart contracts.
Note: Bitcoin staking on Core is locked staking. Once staked, you must unstake your bitcoin before you can withdraw it again.
The following example shows how to build a bitcoin staking request.
Endpoint: Create staking request
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
export WALLET_ID="<YOUR_WALLET_ID>" export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>" export AMOUNT="<AMOUNT_IN_BASE_UNITS>" export VALIDATOR="<VALIDATOR>" export EXPRIE_AT="<EXPIRE_AT>" export REWARD_ADDRESS="<REWARD_ADDRESS>" curl -X POST \ https://app.bitgo-test.com/api/staking/v1/tbtc4/wallets/$WALLET_ID/requests \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -d '{ "coreDao": { "amount": "'"$AMOUNT"'", "validator": "'"$VALIDATOR"'", "expireAt": "'"$EXPRIE_AT"'", "rewardAddress": "'"$REWARD_ADDRESS"'", "type": "STAKE" } }'
View the whole staking flow and learn more about staking other assets with BitGo at Staking Overview. To learn more about staking on Core, see Core DAO Documentation.
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" }'