Skip to content

caxtonacollins/zerlin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zerlin - STX Gas Calculator

Real-time fee estimation for Stacks blockchain

Why Zerlin?

Stacks users need to hold STX for transaction fees, but understanding how much STX to keep is non-obvious. Zerlin removes

Quick Start

Backend (with Swagger)

cd backend
pnpm install
pnpm start:dev

Swagger UI: http://localhost:3000/api

Contracts

cd contract
pnpm test  # Run tests
clarinet deployments generate --devnet  # Generate deployment plan

API Endpoints

POST /api/estimate

Estimate transaction fee

Request:

{
  "type": "transfer",
  "payload": {
    "amount": 1000000,
    "recipient": "SP2X0TZ59D5SZ8ACQ..."
  }
}

Response:

{
  "transactionType": "transfer",
  "estimatedFee": {
    "stx": "0.000180",
    "microStx": 180,
    "usd": "0.00",
    "btc": 0
  },
  "breakdown": {
    "baseFee": 180,
    "executionCost": 0,
    "dataSize": 180
  },
  "networkStatus": {
    "congestion": "low",
    "averageFee": 1,
    "recommendedBuffer": 360
  }
}

GET /api/network

Get current network status

GET /api/history

Get recent fee estimates (last 50)


Testing

Contract Tests

cd contract
pnpm test

Results: 88 passing tests ✅

Backend Tests

cd backend
pnpm test

Deployment

Devnet

cd contract
clarinet deployments generate --devnet
clarinet deployments apply -p deployments/default.devnet-plan.yaml

Testnet

clarinet deployments generate --testnet
clarinet deployments apply -p deployments/default.testnet-plan.yaml


Next Steps

Post-MVP Features

  • Add back batch operations
  • Implement WebSocket for real-time updates
  • Build Next.js frontend
  • Integrate wallet connections
  • Add price feed for USD/BTC conversion

Documentation

  • API integration guide
  • Contract deployment guide
  • Frontend integration examples

Support

Acknowledgments

Built with support from the Stacks Foundation and the Stacks community.

About

Real-time fee estimation for Stacks blockchain

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •