Bitcoin
Bitcoin
Bitcoin can be accessed with the following coin types:
Environment | Coin Type | Faucet |
---|---|---|
Bitcoin Production | btc | |
Bitcoin Testnet | tbtc | https://coinfaucet.eu/en/btc-testnet/ |
Note: The Bitcoin wallets in Platform V2 should not be confused with the wallets created via V1 routes.
Generating wallets
1 2 3 4 5 6 7 8 9 10 11
bitgo .coin('tbtc') .wallets() .generateWallet({ label: 'My Test Wallet', passphrase: 'secretpassphrase1a5df8380e0e30', }) .then(function (wallet) { // print the new wallet console.dir(wallet); });
1 2 3 4 5 6 7 8
LABEL="My Test Wallet" PASSPHRASE="secretpassphrase1a5df8380e0e30" curl -X POST \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -d "{ \"label\": \"$LABEL\", \"passphrase\": \"$PASSPHRASE\" }" \ http://$BITGO_EXPRESS_HOST:3080/api/v2/tbtc/wallet/generate
For Bitcoin, BitGo uses a 2-of-3 multisig P2SH scheme, with the keys in the order of User, Backup, and BitGo respectively.
You can create wallets with a single line of code using the BitGo SDK.
Creating addresses
1 2 3 4 5 6 7 8 9 10 11
bitgo .coin('tbtc') .wallets() .getWallet({ id: '585c51a5df8380e0e3082e46' }) .then(function (wallet) { return wallet.createAddress(); }) .then(function (newAddress) { // print new address details console.dir(newAddress); });
1 2 3 4 5
WALLET=585c51a5df8380e0e3082e46 curl -X POST \ -H "Authorization: Bearer $ACCESS_TOKEN" \ https://app.bitgo-test.com/api/v2/tbtc/wallet/$WALLET/address
Note: You can view address types and their Chain Codes. Bitcoin defaults to chain code 10.
Balances
Bitcoin (BTC) is the native asset of the Bitcoin blockchain. The base unit of Bitcoin is satoshi (or "sat"):
- 1 satoshi is (
10-8
) or 0.00000001 Bitcoin. - 1 Bitcoin is (
108
) or 100000000 satoshis (100 million).
Balances are supported in string and number format but string is recommended to ensure values do not exceed the
programmable number limit: balanceString
, confirmedBalanceString
, and spendableBalanceString
.
Fee rate
Bitcoin's
minimum transaction fee
is 1000 satoshis. When sending a transaction, the default feeRate
is 1000 satoshis/kvByte or 1 sat/vByte (which is 0.00000001
BTC/vByte). Use Get Fee Estimate to calculate a fee rate (feePerKb
) that increases the
probability that your transaction is confirmed.