SDK Quick Start Guide
Installation
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 ο»ΏmintBlue Quick Start Guide
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
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.
ο»Ώ