website logo
WebsiteTry DashboardContact Sales
⌘K
πŸ‘‹Welcome to mintBlue!
❓Why Use mintBlue?
🧧mintBlue Products
⛓️Enterprise Bitcoin
πŸš€Introduction
πŸ‘‰mintBlue Quick Start Guide
πŸ”—Setting up Zapier & mintBlue
πŸŽ‡mintBlue SDK
πŸ‘‰SDK Quick Start Guide
πŸ—οΈSDK Encryption
πŸ“©Envelopes
πŸ–₯️SDK Server
πŸ“SDK Scripts
πŸ“–mintBlue API
⏹️Blockchain API
πŸ“‘Token API
πŸ–₯️mintBlue Console
πŸ‘‚Event Listeners
πŸ†Examples of Building with mintBlue
πŸ”‘password manager
πŸ“ƒNotary Express App
Docs powered byΒ archbeeΒ 
7min

SDK Quick Start Guide

Installation

Install the mintBlue SDK with npm using the command

JS
|
ο»Ώ

Instantiate the SDK

In the example below, replace [YOUR_SDK_TOKEN] with the SDK token generated in ο»ΏmintBlue Quick Start Guide

JS
|
ο»Ώ

Generating a Transaction

The code snippet below shows how to generate a signed and encrypted data transaction.

JS
|
ο»Ώ

The outputs array contains objects according to the output definition. Valid output types are explained below.

Data

Data outputs are published in so called OP_RETURN scripts and use an envelope according to the ο»ΏUnivrse spec. Data outputs are defined by setting the type property to 'data'. Valid data outputs require a value property, which can contain any object, including a simple string. Optional properties are sign and encrypt, both booleans, that result in the respective action when set to true. By default these properties are set to false.

Learn more about ο»ΏSDK Encryption

Micropayment

Payment outputs result in default P2PKH outputs. Payment outputs are defined by setting the type property to 'payment'. Valid payment outputs require a to property containing either a paymail address or a Bitcoin SV address string. Payment outputs also require a satoshis property containing an integer defining the amount of satoshis that will be sent to the respective recipient. An example can be found here: ο»ΏCreate a micropayment

File

File outputs are defined by setting the type property to 'file'. A valid file output requires a property value containing an object with properties contentType (a string containing the content type), and content (a buffer containing the file's content). An example can be found here: ο»ΏPublish a file Optionally, booleans sign and encrypt can be provided in the same way as a data transaction.

Script

Script outputs can be used to create more complex smart contracts using the Bitcoin script language. Script output definitions need to contain a property encoding (which can be either 'base64', or 'hex') and a property value which needs to contain the script in a string encoded with the respective encoding.

ο»Ώ

Updated 08 Feb 2023
Did this page help you?
Yes
No
UP NEXT
SDK Encryption
Docs powered byΒ archbeeΒ 
TABLE OF CONTENTS
Installation
Instantiate the SDK
Generating a Transaction
Data
Micropayment
File
Script