Glittr Contracts

All Glittr transactions are Bitcoin transactions, developers can easily interact with Glittr via SDK or generate Glittr transactions as raw outputs and manually build the transactions using any Bitcoin library.

Interacting with Glittr via raw Bitcoin transactions

This section is useful if you're planning to create your own GLIP, which means you need to create a new standard based on the Glittr specification to perform custom tasks.

You can manually build the Glittr transaction based on the specification or create your own custom Glittr contract and standard. Glittr transactions contain specific inputs and outputs within Bitcoin transactions that will later be processed by a Glittr node.

Using transaction builder

import { OpReturnMessage, txBuilder } from "@glittr-sdk/sdk";

const t: OpReturnMessage = {
    contract_creation: {
      contract_type: {
        asset: {
          asset: {
            supply_cap: 2000n.toString(),
            divisibility: 18,
            live_time: 0,
          },
          distribution_schemes: {
            free_mint: {
              supply_cap: 2000n.toString(),
              amount_per_mint: 10n.toString(),
            },
          },
        },
      },
    },
  };
const tBuild = txBuilder.buildMessage(t);
console.log(JSON.stringify(tBuild));

Glittr specification is written into the Bitcoin transactions via OP_RETURN. You can customize the OP_RETURN message and after the transaction is confirmed, it will be processed by the Glittr node if the OP_RETURN message structure is confirmed to be one of Glittr transaction.

Last updated