Backend Server Configuration
Overview
The mobile and web SDKs send and receive data related to multi-party computation (MPC) key generation and signing through a proxy owned by the customer’s backend. This provides an additional layer of security and allows you to customize the solution to fit the needs of your business.
The Fireblocks NCW REST API lets you interact programmatically with the Fireblocks platform for a variety of use cases:
- Creating new non-custodial wallets (NCWs)
- Creating accounts within NCWs
- Creating assets within the accounts
- Disable NCWs
- Create transactions from NCWs
- Invoke the Fireblocks RPC for MPC-related operations
Prerequisites
- Create API users in your workspace.
Kindly note that NCW requires 2 dedicated API Users: NCW Admin & NCW Signer.
Visit this guide for detailed explanation about these API users.
- Configure a webhook endpoint as described in the following guide.
- Instantiate an API client that communicates with the Fireblocks API. You can do this by creating your own client or by using one of the API Software Development Kits (SDKs) provided by Fireblocks.
Using Fireblocks API SDKs
JavaScript
Install Node v6.3.1 or newer
The Fireblocks JavaScript SDK requires Node v6.3.1 or newer. You can check which version of Node you already have installed by running the following command.
node -v
Learn how to install or update Node to a newer version.
Install fireblocks-sdk
The Fireblocks JavaScript SDK is open-source and hosted on both GitHub and NPM, the official package repository.
- Source code: https://github.com/fireblocks/fireblocks-sdk-js
- JavaScript Package: https://www.npmjs.com/package/fireblocks-sdk
Installing the latest SDK is easy with npm
:
npm install fireblocks-sdk
Python
Install Python 3.6 or newer
The Fireblocks Python SDK requires Python 3.6 or newer. You can check which version of Python you already have installed with the following command.
python --version
or python3 --version
Learn how to install or update Python to a newer version.
Install fireblocks-sdk
The Fireblocks Python SDK is open-source and hosted on both GitHub and PIP, the official package repository.
- Source code: https://github.com/fireblocks/fireblocks-sdk-py
- Python Package: https://pypi.org/project/fireblocks-sdk/
Installing the latest SDK is easy with pip
:
pip3 install fireblocks-sdk
Creating your first API call
Use the correct API Base URL
Depending on the script, make sure you're using the correct value for api_base_url or base_url for your environment:
- Sandbox workspaces:
https://sandbox-api.fireblocks.io
- Mainnet or Testnet workspaces:
https://api.fireblocks.io
const fs = require('fs');
const path = require('path');
const { FireblocksSDK } = require('fireblocks-sdk');
const { exit } = require('process');
const { inspect } = require('util');
const apiSecret = fs.readFileSync(path.resolve("</path/to/fireblocks_secret.key>"), "utf8");
// Your NCW Admin API key
const apiKey = "<your-api-key-here>"
// Choose the right api url for your workspace type
const baseUrl = "https://sandbox-api.fireblocks.io";
const fireblocks = new FireblocksSDK(apiSecret, apiKey, baseUrl);
(async () => {
//Create a new Non Custodial Wallet
const walletId = await fireblocks.NCW.createWallet();
console.log(inspect(walletId, false, null, true));
})().catch((e)=>{
console.error(`Failed: ${e}`);
exit(-1);
})
Updated 11 months ago