Glittr
  • Introduction
  • Protocol Overview
  • Contract Primitives
    • MOAs - Mint Only Assets
    • MBAs - Mint and Burn Assets
      • Vaults
    • Spec Contracts
    • Oracle Commitments
  • Building on Glittr
    • Setup
    • Faucet
    • Glittr SDK
    • Glittr Transactions
    • Glittr Contracts
    • Installing Glittr Wallet
    • Local Development Guide
  • GLIP
  • Node
    • Run a Bitcoin Node
    • Run a Glittr Node
  • Examples & Guide
    • Creating Tokens
    • Contract Custody
    • Complex Tokens
    • Vesting and Freemint Contract
    • Wrapped BTC Contract
    • USD Contract
    • Oracle Implementation Guide
    • Glittr Output Structure
    • AMM Contract
  • API Reference
    • Getting Assets API
  • APP EXAMPLES
    • Freemint App (NextJS)
    • Freemint App (React + Vite)
    • NFT App (React + Vite)
Powered by GitBook
On this page
  1. Building on Glittr

Glittr Contracts

All Glittr transactions are Bitcoin transactions, developers can easily interact with Glittr via SDK.

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: {
        moa: {
          supply_cap: 2000n.toString(),
          divisibility: 18,
          live_time: 0,
          mint_mechanism: {
            free_mint: {
              supply_cap: 2000n.toString(),
              amount_per_mint: 10n.toString(),
            },
          },
        },
      },
    },
  };

console.log(txBuilder.compile(t))

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.

PreviousGlittr TransactionsNextInstalling Glittr Wallet

Last updated 3 months ago