Skip to content

iconworldwide/ckTON

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ckTON - TON-ICRC Bridge

A decentralized bridge that enables seamless conversion between TON (The Open Network) and ckTON (ICRC-1 token on Internet Computer). This project provides a user-friendly dashboard and robust backend infrastructure for cross-chain token transfers.

Overview

ckTON is a bridge protocol that allows users to:

  • Mint ckTON: Convert native TON tokens to ckTON (ICRC-1 tokens) on the Internet Computer
  • Burn ckTON: Convert ckTON back to native TON tokens
  • Deploy TON Wallets: Automatically deploy and manage TON wallets for users
  • Cross-chain Operations: Seamlessly move value between TON and Internet Computer ecosystems

Architecture

The project consists of two main components:

1. ckTON Minter Canister (Rust)

  • Location: src/ckton_minter/
  • Purpose: Core bridge logic for TON-ICRC conversions
  • Features:
    • TON wallet deployment and management
    • Minting ckTON tokens when TON is received
    • Burning ckTON tokens to send TON
    • Admin controls for ledger and indexer setup
    • Secure transaction verification

2. ckTON Dashboard (Vue.js)

  • Location: src/ckton_dashboard/
  • Purpose: User interface for bridge operations
  • Features:
    • Internet Identity authentication
    • Balance tracking (TON and ckTON)
    • Mint/withdraw operations
    • TON wallet deployment
    • Real-time transaction status

Key Features

  • πŸ” Secure Authentication: Internet Identity integration
  • πŸ’° Multi-token Support: TON and ckTON balance management
  • πŸš€ One-click Operations: Simple mint/withdraw interface
  • πŸ”§ Auto-wallet Deployment: Automatic TON wallet creation
  • πŸ“Š Real-time Updates: Live balance and transaction tracking
  • 🌐 Cross-chain: Seamless TON ↔ IC conversions

Quick Start

Prerequisites

Local Development

  1. Start the Internet Computer replica:
dfx start --background
  1. Deploy the canisters:
dfx deploy
  1. Start the dashboard development server:
npm start

The dashboard will be available at http://localhost:3001 and will automatically proxy API requests to the replica.

User Workflow

  1. Connect to Internet Identity: Click "Connect to Internet Identity" in the dashboard
  2. Generate Addresses: Click "Generate All Addresses" to create your TON and IC addresses
  3. Fund Your TON Wallet: Send TON tokens to your generated TON address
  4. Deploy Wallet: Click "Deploy Wallet" to initialize your TON wallet on the blockchain
  5. Mint ckTON: Enter an amount and IC address to convert TON to ckTON
  6. Withdraw to TON: Send ckTON to the burn address, then withdraw to a TON address

Technical Details

TON Wallet Deployment

  • Automatic Generation: Each user gets a unique TON wallet derived from their IC principal
  • V4R2 Wallet Standard: Uses the latest TON wallet version for optimal security
  • Deployment Process: Wallets are deployed on-demand when users have sufficient TON balance
  • State Management: Wallet deployment status is tracked and verified

Minting Process (TON β†’ ckTON)

  1. User sends TON to their generated TON wallet address
  2. System detects the incoming transaction via TON API
  3. TON is transferred to the minter's main TON wallet
  4. Equivalent ckTON is minted to the user's IC account
  5. Transaction is verified and recorded

Burning Process (ckTON β†’ TON)

  1. User sends ckTON to the burn address (minter's IC account)
  2. System detects the burn transaction
  3. TON is sent from the minter's wallet to the user's specified TON address
  4. Transaction is verified and recorded

Security Features

  • Transaction Verification: All TON transactions are verified before processing
  • Retry Logic: Failed operations are automatically retried with exponential backoff
  • Fee Management: Configurable fees for both TON and ckTON operations
  • Admin Controls: Secure admin functions for system configuration

Note on frontend environment variables

If you are hosting frontend code somewhere without using DFX, you may need to make one of the following adjustments to ensure your project does not fetch the root key in production:

  • setDFX_NETWORK to ic if you are using Webpack
  • use your own preferred method to replace process.env.DFX_NETWORK in the autogenerated declarations
    • Setting canisters -> {asset_canister_id} -> declarations -> env_override to a string in dfx.json will replace process.env.DFX_NETWORK with the string in the autogenerated declarations
  • Write your own createActor constructor

Production Deployment

Deploy to Internet Computer

  1. Prepare for deployment:
./prep.sh
dfx deploy --ic
  1. Admin Setup (Required for Production):
# Set up the ledger and indexer canisters
dfx canister call ckton_minter admin_setup '(record {
  ckton_transfer_fee=null; 
  indexer_canister=principal "YOUR_INDEXER_CANISTER_ID"; 
  ledger_canister=principal "YOUR_LEDGER_CANISTER_ID"; 
  ton_fee=null
})' --ic
  1. Get the minter's TON address:
dfx canister call ckton_minter minter_ton_address --ic
  1. Fund the minter TON address:

    • Send TON tokens to the address returned in step 3
    • This address will be used for all TON operations
  2. Deploy the minter's TON wallet:

dfx canister call ckton_minter admin_mint_wallet_deploy --ic

Admin Configuration

The admin setup requires:

  • Ledger Canister: ICRC-1 ledger for ckTON token management
  • Indexer Canister: Transaction indexing and history
  • Transfer Fees: Configurable fees for ckTON transfers
  • TON Fees: Configurable fees for TON operations

Production Considerations

  • Security: Ensure proper access controls for admin functions
  • Monitoring: Set up monitoring for transaction processing
  • Backup: Regular backups of canister state
  • Updates: Plan for canister upgrades and migrations

Development Resources

Documentation Links

Project Structure

ckTon/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ ckton_minter/          # Rust minter canister
β”‚   β”‚   β”œβ”€β”€ src/               # Rust source code
β”‚   β”‚   └── Cargo.toml         # Rust dependencies
β”‚   └── ckton_dashboard/       # Vue.js dashboard
β”‚       β”œβ”€β”€ src/               # Vue.js source code
β”‚       └── package.json       # Node.js dependencies
β”œβ”€β”€ dfx.json                   # DFX configuration
└── package.json               # Workspace configuration

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

License

Β© 2025 ICON Worldwide AG, Switzerland. All rights reserved.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors