SDK Quick Start Guide


Install the mintBlue SDK with npm using the command


Instantiate the SDK

In the example below, replace [YOUR_SDK_TOKEN] with the SDK token generated in quick start


Generating a transaction

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


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


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.

Learn more about encryption


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 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 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 19 Jul 2022
Did this page help you?