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
  • Disabling and enabling NCWs
  • Creating transactions from NCWs
  • Invoking the Fireblocks RPC for MPC-related operations

Prerequisites

  • Create API users in your workspace. NCW requires two dedicated API Users: NCW Admin and NCW Signer.
  • Configure a webhook endpoint.
  • Instantiate an API client that communicates with the Fireblocks API. You can do this by creating a client or using one of the API Software Development Kits (SDKs) provided by Fireblocks.

RPC Endpoint body request size

During the MPC key generation and transaction signing processes, requests are sent to an endpoint on your backend (BE). Your BE then delegates these requests to Fireblocks using the API users you created in the previous section. The request body sent to this endpoint may vary, so we recommend increasing your backend's maximum request body size to at least 2 MB.

In the open-source backend that we provide, you can find the following snippet: app.use(bodyParser.json({ limit: "50mb" }));

Using Fireblocks API SDKs

JavaScript

Install Node v6.3.1 or later

The Fireblocks JavaScript SDK requires Node v6.3.1 or later. You can check which version you 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.

Installing the latest SDK is easy with npm:

npm install fireblocks-sdk

Python

Install Python 3.6 or later

The Fireblocks Python SDK requires Python 3.6 or later. You can check which version you 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.

Installing the latest SDK is easy with pip:

pip3 install fireblocks-sdk

Directly using the API

You can still interact with the Fireblocks platform using the REST API if your backend is not written in JavaScript or Python. When working directly with the Fireblocks API, refer to the NCW API reference documentation and the Fireblocks API reference documentation for additional information.

The Fireblocks REST API is designed to be simple and easy to adopt. However, specific authentication methods are required to ensure the security of your workspace. We recommend reviewing the authentication guidelines, which include coding examples in various languages.

Creating your first API call

Depending on the script, make sure you use the correct value for api_base_url or base_url for your environment:

Learn more about workspace differences.

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);
})