Skip to content

singhyash05/BitTonica

Repository files navigation

BitTonica

BitTonica is a blockchain protocol that bridges Bitcoin Ordinals to the TON blockchain, enabling seamless Ordinal NFT representation and ownership on TON.

Overview

BitTonica allows users to mint NFTs on the TON blockchain that represent their Bitcoin Ordinals. The system includes smart contract verification, multi-verifier authentication, and optimized gas management to ensure a secure and efficient bridging process.

Project Structure

  • contracts/ - Source code of all the smart contracts and their dependencies
  • wrappers/ - Wrapper classes for the contracts, including serialization primitives and compilation functions
  • tests/ - Tests for the contracts
  • scripts/ - Utility scripts, mainly for deployment
  • backend/ - Backend services for monitoring and verification

Installation & Setup

# Install dependencies
npm install ton@latest

# Build, test, or run scripts
npx blueprint build
npx blueprint test
npx blueprint run [script-name]

# Create a new contract
npx blueprint create AnotherContract

Key Features

Smart Contracts

  • Ordinal Representation: Mint TON NFTs representing Bitcoin Ordinals
  • Duplicate Prevention: Ensures the same Ordinal cannot be minted twice
  • Gas Optimization: Optimized gas usage with excess refund mechanisms
  • Multi-Verifier Support: Enhanced security through multiple verification nodes
  • Secure Transaction Flow: Streamlined and secure minting process

Backend Services

  • Event Listeners: Monitors for minting requests and Bitcoin wallet inscriptions
  • Verification System: Validates Ordinal ownership through transaction IDs and signatures
  • Secure Bridge: Ensures only verified Ordinals can be represented on TON

Workflow

  1. User initiates Ordinal minting request on TON
  2. Backend listener (index.js) captures the event
  3. Bitcoin wallet monitor (ordinal_listener.py) confirms inscription details
  4. Verifier checks transaction ID, inscription ID, and signature
  5. Smart contract mints the corresponding NFT on TON

Implementation Status

  • ✅ TON smart contracts completed
  • ⚠️ Backend services partially implemented
  • 🔄 Verification system in development

Work In Progress

  • Telegram Mini App Marketplace: Developing a marketplace on Telegram Mini App using the TON network where users can sell their NFTs
    • Support for native TON payments
    • Integration with TGBTC payments through TON API
  • TGBTC Integration: Implementing TGBTC payment gateway using the TON API
  • User Interface: Building intuitive UI for minting, buying, and selling Ordinals
  • Transaction History: Adding functionality to track and display transaction history
  • Collection Management: Tools for users to manage their Ordinal collections
  • Search and Discovery: Features to browse and discover Ordinals on the marketplace

Technical Highlights

// Example of gas optimization with refunds
let excess = ctx.value - required_fee;
if (excess > 0) {
    send(SendParameters{
        to: sender(),
        value: excess, 
        bounce: false,
        mode: SendIgnoreErrors
    });
}

Security Considerations

  • Prevention of reentrancy attacks
  • Protection against integer overflows
  • Authorization checks for minting operations
  • Multi-verifier consensus for enhanced security

About

BitTonica is a blockchain protocol that bridges Bitcoin Ordinals to the TON blockchain, enabling seamless Ordinal NFT representation and ownership on TON.

Topics

Resources

Stars

Watchers

Forks

Contributors