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
- ✅ Create an SDK Access Token (see Quick Start) or copy your existing SDK Access Token
- ✅ Create a new project and copy your project ID
- ✅ Install Node v18.19.0 or higher and npm v10.2.3 or higher
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.
- Submit your first transaction: Learn how you can store different data formats on the Bitcoin blockchain
- Output Types: Understand the different output types available in the mintBlue SDK