Skip to main content

Getting Started

Overview

This tutorial will guide you to install the mintBlue SDK and create a mintBlue client object using your SDK access token.

If you are using a non-JavaScript environment, follow the JSON-RPC tutorial. This JSON-RPC server allows you to use the SDK's functionalities without integrating the SDK package into your solution.

Prerequisites

Step 1: Create your project directory

Open your terminal and create a directory called mintblue. After you create the project directory, navigate to the directory by running the following command:

mkdir mintblue && cd mintblue

Initialize a Node.js project in this new directory by running the following command:

npm init -y

Install the mintBlue SDK with NPM.

npm install @mintblue/sdk

Next, create a new file main.js.

touch main.js

And finally, let's add some skeleton code to our main.js file. Make sure to replace the placeholder <YOUR-SDK-TOKEN> with your SDK Access Token and <YOUR-PROJECT-ID> with your project ID.

const { Mintblue } = require("@mintblue/sdk");

async function main() {
  const sdkToken = '<YOUR-SDK-TOKEN>';
  const project_id = '<YOUR-PROJECT-ID>';
  
  // Here comes the rest of your code
}

main();

Step 2: Instantiate the SDK

We must instantiate the SDK with our access token to obtain a mintBlue client object. We can then use this mintBlue client object to send transactions to mintBlue, which will take care of the final blockchain storage on the Bitcoin blockchain.

const { Mintblue } = require("@mintblue/sdk");

async function main() {
  const sdkToken = '<YOUR-SDK-TOKEN>';
  const project_id = '<YOUR-PROJECT-ID>';
  
  const client = await Mintblue.create({ token: sdkToken });
  
  // Rest of your code comes here
}

main();

What should I learn next?

Make sure to understand how to send your first transaction using the mintBlue SDK.