Skip to main content


The Doc envelope allows storing data on chain with some great aditional features:

  • Double encryption for added security.
  • Add multiple recipients to an encrypted payload.
  • Add multiple signers.
  • Ability to add metadata within a protected header.
  • Payload deterministic encryption keys.

By making use of these features, mintBlue users can:

  • Save and retrieve files on chain.
  • Own their own data by determining who gets access to the documents, using encryption.
  • Authenticate data by adding one or more digital signatures
  • Double encryption allows for selective disclosure of data. The first encryption layer can be disclosed by selected recipients while keeping the document private, stored in a second encryption layer.
  • Encryption secrets are deterministic based on payload (sha256). This means you either have to have the data to decrypt it or the secret needs to be shared, allowing users to authenticate a document with the blockchain by having acces to the original document.

The maximum file size is 50MB per transaction.

Creating a Doc Envelope

Creating a new Doc envelope to be stored on chain, can be achieved by adding a specific output object of type doc and add it to the createTransaction outputs argument.

This output type requires the following properties:

data (required)Uint8ArrayRaw file contents.
signers (required)Array<jose.JWK>Array of JWK signing private keys.
optionsObjectOptional metadata to store with the envelope. See properties below.
options.filename (optional)StringDocument's filename.
options.mimetype (optional)StringDocument's mimetype.
options.meta (optional)ObjectAny additional metadata provided as an object.
receivers (optional)Array<jose.JWK> | Array<String>Array of JWK public keys or hexadecimal public keys. Used to encrypt data for third parties.
iterations(optional)NumberPBKDF2 iterations to perform (defaults to 200 000).


const data = new Uint8Array(Buffer.from('My file contents'));

const outputs = [
type: 'doc',
data: data,
options: {
filename: 'my-file.pdf',
mimetype: 'application/pdf',
signers: [jwkSignKey],
iterations: 200000,
receivers: [jwkReceiverKey],

// Replace [PROJECT_ID] below with yours.
const { txid, rawtx } = await client.createTransaction({project_id: '[PROJECT_ID]', outputs});


The following OP_RETURN arguments are created when a Hash envelope is published on a blockchain transaction.

0Protocol ID"doc"
1EnvelopeSerialized JWE/JWS