Skip to content

StacksMint is an open-source token factory and registry built on Stacks using the Clarity smart contract language. Anyone can mint their own token, track all deployed tokens, and manage their token portfolio β€” no deep smart contract knowledge required.

Notifications You must be signed in to change notification settings

StacksMint/StacksMintContract

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

StacksMint πŸ”¨

Deploy fully compliant SIP-010 fungible tokens on the Stacks blockchain in a single call.

StacksMint is an open-source token factory and registry built on Stacks using the Clarity smart contract language. Anyone can mint their own token, track all deployed tokens, and manage their token portfolio β€” no deep smart contract knowledge required.


Table of Contents


Overview

StacksMint solves a simple problem: deploying a SIP-010 token on Stacks requires writing and deploying a Clarity contract from scratch, which is a barrier for most users. StacksMint provides a battle-tested token template and a public registry so that:

  • Developers can fork the template and deploy in minutes
  • The community can discover and verify all tokens minted through StacksMint
  • Token creators get a compliant, auditable contract out of the box

Features

  • βœ… Full SIP-010 compliance β€” all required trait functions implemented
  • 🏭 Token template β€” a clean, auditable base contract ready to fork and deploy
  • πŸ“‹ On-chain registry β€” every StacksMint token is logged with name, symbol, decimals, supply, and owner
  • πŸ” Owner lookup β€” query all tokens deployed by a specific principal
  • πŸ”’ Mint control β€” initial supply goes to deployer; optional mintable flag
  • 🌐 Token URI support β€” link to off-chain metadata (IPFS, Arweave, HTTPS)
  • πŸͺ™ STX registration fee β€” small fee to register in the public registry (anti-spam)
  • πŸ§ͺ Full test suite β€” unit tests with Clarinet

Architecture

Because Clarity does not support dynamic contract deployment, StacksMint uses a two-contract architecture:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              token-template.clar             β”‚
β”‚  (Deployed once per token by the creator)    β”‚
β”‚  - SIP-010 trait implementation              β”‚
β”‚  - Transfer, mint, burn logic                β”‚
β”‚  - Token metadata (name, symbol, decimals)   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                       β”‚ creator registers token
                       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚          stacksmint-registry.clar            β”‚
β”‚  (Single shared registry contract)           β”‚
β”‚  - Tracks all tokens deployed via StacksMint β”‚
β”‚  - Owner β†’ tokens lookup map                 β”‚
β”‚  - Public token directory                    β”‚
β”‚  - Registration fee collection               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Workflow:

  1. Clone the token template
  2. Customize name, symbol, decimals, initial supply, and token URI
  3. Deploy your token contract to Stacks mainnet or testnet
  4. Call register-token on the StacksMint registry to list your token publicly
  5. Your token is now live and discoverable

SIP-010 Standard

All tokens minted via StacksMint implement the SIP-010 Fungible Token Standard, which requires the following trait functions:

Function Description
transfer Transfer tokens between principals
get-name Returns the token name
get-symbol Returns the token ticker symbol
get-decimals Returns number of decimal places
get-balance Returns balance for a given principal
get-total-supply Returns total token supply
get-token-uri Returns optional URI for token metadata

Contract Reference

token-template.clar

The base token contract. Fork this for each new token you want to deploy.

Constants (customize before deploying)

(define-constant token-name "My Token")
(define-constant token-symbol "MTK")
(define-constant token-decimals u6)
(define-constant initial-supply u1000000000000) ;; 1,000,000 tokens (with 6 decimals)
(define-constant token-uri (some u"https://example.com/token-metadata.json"))

Key Functions

;; Transfer tokens
(define-public (transfer (amount uint) (sender principal) (recipient principal) (memo (optional (buff 34))))

;; Mint new tokens (owner only, if mintable)
(define-public (mint (amount uint) (recipient principal))

;; Burn tokens
(define-public (burn (amount uint) (sender principal))

;; Read-only getters
(define-read-only (get-name))
(define-read-only (get-symbol))
(define-read-only (get-decimals))
(define-read-only (get-balance (account principal)))
(define-read-only (get-total-supply))
(define-read-only (get-token-uri))

stacksmint-registry.clar

The shared public registry. Deploy once; all token creators point to this.

Key Functions

;; Register your deployed token in the public registry
(define-public (register-token
  (token-contract principal)
  (name (string-ascii 32))
  (symbol (string-ascii 10))
  (decimals uint)
  (total-supply uint)
  (token-uri (optional (string-utf8 256))))

;; Look up a token by its contract principal
(define-read-only (get-token-info (token-contract principal)))

;; Get all tokens registered by an owner
(define-read-only (get-tokens-by-owner (owner principal)))

;; Get total number of tokens in the registry
(define-read-only (get-token-count))

Getting Started

Prerequisites

  • Clarinet β€” Clarity development environment
  • Stacks CLI β€” for mainnet/testnet deployments
  • Node.js v18+ (for deployment scripts)
  • A Hiro Wallet with STX for deployment fees

Installation

# Clone the repository
git clone https://github.com/your-username/stacksmint.git
cd stacksmint

# Install dependencies
npm install

# Check Clarinet is working
clarinet check

Deploying a Token

Step 1 β€” Customize the template

Copy the token template and update the constants at the top:

cp contracts/token-template.clar contracts/my-token.clar

Edit contracts/my-token.clar:

(define-constant token-name "Degen Coin")
(define-constant token-symbol "DEGEN")
(define-constant token-decimals u6)
(define-constant initial-supply u500000000000) ;; 500,000 tokens
(define-constant token-uri (some u"ipfs://QmYourMetadataCIDHere"))

Step 2 β€” Test locally

clarinet test
clarinet console

Step 3 β€” Deploy to testnet

clarinet deployments apply --devnet     # local devnet
clarinet deployments apply --testnet    # Stacks testnet

Step 4 β€” Register in the StacksMint registry

After deploying, call the registry to make your token publicly discoverable:

# Using Clarinet console or a deployment script
(contract-call? .stacksmint-registry register-token
  'ST1234...yourtokencontract
  "Degen Coin"
  "DEGEN"
  u6
  u500000000000
  (some u"ipfs://QmYourMetadataCIDHere"))

Step 5 β€” Verify on the explorer

View your token on the Hiro Explorer or Stacks Explorer.


Registry

The StacksMint registry is a permissionless, on-chain directory. Once a token is registered:

  • It appears in the public token list
  • Anyone can query it by contract address or owner
  • The metadata is permanently on-chain and immutable

Querying the registry

;; Get info about a specific token
(contract-call? .stacksmint-registry get-token-info 'SP1234...token-contract)

;; Find all tokens by an owner
(contract-call? .stacksmint-registry get-tokens-by-owner 'SP1234...owner-address)

;; Total tokens in the registry
(contract-call? .stacksmint-registry get-token-count)

Fee Structure

Action Fee
Deploying your token contract Stacks network gas only
Registering in StacksMint registry 1 STX (anti-spam)
Querying the registry Free (read-only)

Registration fees are collected by the registry contract owner and may be used for protocol maintenance and future development.


Project Structure

stacksmint/
β”œβ”€β”€ contracts/
β”‚   β”œβ”€β”€ token-template.clar        # SIP-010 token base contract
β”‚   └── stacksmint-registry.clar   # Public token registry
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ token-template_test.ts     # Token unit tests
β”‚   └── stacksmint-registry_test.ts # Registry unit tests
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ deploy-token.ts            # Deployment helper script
β”‚   └── register-token.ts          # Registry registration script
β”œβ”€β”€ deployments/
β”‚   β”œβ”€β”€ devnet.yaml
β”‚   β”œβ”€β”€ testnet.yaml
β”‚   └── mainnet.yaml
β”œβ”€β”€ settings/
β”‚   └── Devnet.toml
β”œβ”€β”€ Clarinet.toml
β”œβ”€β”€ package.json
└── README.md

Testing

StacksMint uses Clarinet for unit and integration testing.

# Run all tests
clarinet test

# Run a specific test file
clarinet test tests/token-template_test.ts

# Run tests with coverage
clarinet test --coverage

# Open interactive Clarinet console
clarinet console

Test coverage includes

  • SIP-010 trait compliance
  • Transfer with and without memo
  • Mint and burn access control
  • Registry registration and lookup
  • Fee enforcement
  • Edge cases: zero transfers, overflow, unauthorized minting

Roadmap

  • SIP-010 token template
  • On-chain registry contract
  • Web UI for no-code token deployment
  • Token metadata standard (extended JSON schema)
  • Batch registration support
  • SIP-009 NFT factory (StacksMint for NFTs)
  • Token verification badges
  • Integration with Stacks DEXes (ALEX, Arkadiko)
  • Token analytics dashboard
  • Multisig mint control

Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/my-feature)
  3. Write tests for your changes
  4. Ensure all tests pass (clarinet test)
  5. Open a pull request with a clear description

Please read CONTRIBUTING.md for our full contribution guidelines and code of conduct.


License

StacksMint is open source under the MIT License.


Built with ❀️ on Stacks β€” Bitcoin's smart contract layer.

About

StacksMint is an open-source token factory and registry built on Stacks using the Clarity smart contract language. Anyone can mint their own token, track all deployed tokens, and manage their token portfolio β€” no deep smart contract knowledge required.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •