Install the SDK
Overview
The BitGo JavaScript SDK is a JavaScript library located in GitHub that you can use to build apps and services for all the Coins and Tokens that BitGo supports. The SDK is an out-of-the-box solution that runs in a browser or Node.js and solves complicated transactional logic required to integrate BitGo REST APIs.
You can use the SDK to:
- Create and manage wallets and addresses.
- Create and execute secure, co-signed transactions.
- Create, store, and interact with tokens and NFTs.
- Implement personal on-premise servers in conjunction with the BitGo Express package for secure interactions with the BitGo Platform.
- Sign keys offsite and send transactional data confidently to BitGo APIs.
You have 2 options for installing the SDK:
- Modular - Integrate only the coins you need.
- All Coins - Integrate all coins that BitGo supports.
Note: BitGo recommends you implement a modular integration for the following benefits:
- Better compatibility in resource-constrained environments (such as running in AWS lambda)
- Reduce dependency exposure
- Smaller install and memory footprint
Prerequisites
Set up your coding environment. We recommend the following:
- Docker
- Git
- Node.js running v14.18.x
- Node Version Manager (NVM)
- Python 2.7 (required for UTXO coins)
Core Packages
The following core packages enable you to integrate only the coins you need:
sdk-api
- Main entry point for API functionality and for registering coins asynchronously.sdk-coin-{name}
- Implementation and dependencies necessary to interact with BitGo APIs and coin blockchains (such as mainnet, testnet, and any related tokens).
Steps
1. Install Core Packages
1 2 3 4 5
# Main entry point for API functionality npm install @bitgo/sdk-api # Individual coin module # For example, btc would be sdk-coin-btc npm install @bitgo/sdk-coin-{name}
2. Use Core Packages
1 2 3 4 5 6
import { BitGoAPI } from '@bitgo/sdk-api'; import { Btc } from '@bitgo/sdk-coin-btc'; const sdk = new BitGoAPI(); sdk.register('btc', Btc.createInstance);
Note: You must import testnet coins separately. For example, you would import
Tbtc
instead ofBtc
.