mintBlue

Output Types

Every output shape createTransaction accepts, what each one publishes, and how to combine them in a single transaction.

Current SDK generation. This page documents the output shapes the mintBlue SDK accepts today. The envelope model is specified by the open SDX Protocol. Read the specification

Generations sets out which document applies to the code you installed.

An output is one thing a transaction publishes. createTransaction takes an array of them, so a transaction can carry several, of different types, at once. What the protocol calls a field is what the SDK calls an output; the SDK name is the one in your code.

The output types

typeWhat it publishes
dataA value as a data packet, optionally signed and encrypted.
paymentA transfer to an address, in satoshis.
fileA file's bytes, with its content type and file name.
hashA digest of a file, without the file.
docA document in the Doc envelope: double encryption, several signers, several recipients.
peppolAn AS4 payload in the Peppol v1 envelope, encrypted to one receiver.
pigiA file in the PIGI envelope.
scriptA script you supply yourself, hex, asm or base64.
treeTrees planted, billed as a payment.

Two further members of the union, env and undefined, are marked as internal in the package's own source and are left out of its published reference. They are left out here for the same reason.

Data output

A data output publishes a value as a data packet. sign: true attaches a digital signature made with your own key, so a reader can check who wrote the record without asking mintBlue. encrypt: true encrypts the value before it leaves your machine; leave it out and the value is published in the clear.

const outputs = [
  {
    type: 'data',
    value: 'invoice INV-0001 approved',
    sign: true,
    encrypt: true,
  },
];

Data outputs are published in OP_RETURN scripts, and the value travels inside an envelope. What the shipped SDK writes is documented one page per format under Envelope formats. For the envelope as the protocol defines it, the normative document is the SDX Protocol's envelope reference; this site does not restate it.

A common use is to publish a hash standing for a document, so a reader can later check that the document has not been altered. The hash output type does that job with the digest computed for you.

Payment output

A payment output moves value to an address. It takes to, either a paymail address or an address string, and satoshis, an integer amount.

const outputs = [
  {
    type: 'payment',
    to: '12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX',
    satoshis: 1000,
  },
];

Payment outputs are billed separately from the rest of a transaction, priced at the moment the transaction is created and carrying a margin that depends on your plan.

The full shape, a worked example and how the output reads back are on Payment output.

File output

A file output publishes a file's contents, so the record carries the document itself rather than a pointer to it. The value is an object, not a bare buffer:

const outputs = [
  {
    type: 'file',
    value: {
      fileName: 'invoice.pdf',
      contentType: 'application/pdf',
      content: fileBuffer,
    },
    sign: true,
    encrypt: true,
  },
];

sign and encrypt behave as they do for a data output.

The maximum file size is 50MB per transaction.

Envelope outputs

Four output types write a named envelope format rather than a general packet. Each has its own page, because each has its own properties and its own published arguments.

Combining outputs

outputs is an array and it may hold different types at once, which is how one transaction both moves value and records what the payment was for.

const outputs = [
  { type: 'data', value: 'invoice INV-0001 approved', sign: true, encrypt: true },
  { type: 'payment', to: '12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX', satoshis: 1000 },
];

const { txid } = await client.createTransaction({ project_id, outputs });

One call, one transaction, one transaction ID covering both outputs.

On this page