Skip to content

tokamak-network/toki

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

332 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Toki — stake TON, get unlimited AI

TOKI

Stake TON → get unlimited AI.

A mascot mini-wallet & hub for the Tokamak Network ecosystem — Ethereum L1, non-custodial, gasless.

Unlimited AI MCP Features Quick Start

Next.js TypeScript Tailwind Ethereum EIP-7702


Launch trailer

toki-launch-trailer.mp4

▶ Watch on YouTube if the inline player doesn't load.


What is Toki?

Toki turns staking into access. Stake TON on Tokamak Network (non-custodial, Ethereum L1, gasless) and unlock the ecosystem — led by the headline perk: an unlimited AI key.

  • 🤖 Stake 100 TON → unlimited AI. Get an OpenAI-compatible LLM key (Qwen / DeepSeek / Gemma) with a generous daily budget (~1M tokens/day) you can drop into Claude Code, Cursor, or any agent — plus the Toki MCP server. You keep your TON (it earns yield); inference runs on a self-hosted Tokamak AI server, not your wallet.
  • 💸 Easiest staking UX. Sign in with Google or connect MetaMask, send TON, click once. Gas is paid in TON via EIP-7702 + Paymaster — no ETH, no WTON wrapping, no operator research.
  • 🪙 Real, non-custodial yield. Tokamak distributes 3.92 WTON/block of seigniorage to stakers; APR is computed live from on-chain SeigManager data. Your TON stays yours, withdrawable after the protocol's unstaking period.
  • 🎮 Mascot hub. Wallet, private transfer (zk), AI access, achievement cards, ecosystem explore — one cozy anime-mascot surface (the /dashboard lobby).

Unlimited AI by staking

Toki AI familiar

The wedge: stake 100 TON, get an unlimited* AI key. No subscription, no per-token bill — your staked TON (which you keep, and which earns seigniorage) is the credential.

  • OpenAI-compatible — point any client at base_url + your sk-… key. Models: Qwen, DeepSeek, Gemma.
  • Works in your tools — Claude Code, Cursor, Codex, or the Toki MCP server (live Tokamak staking tools inside your agent).
  • Why it's free — inference runs on a self-hosted Tokamak AI server (zero marginal cost), funded as a growth wedge + seigniorage. Unstake any time → access ends.

*Unlimited within a generous daily budget (~1M tokens/day).

Connect your agent (MCP)

# Hosted — no install. Live Tokamak staking tools in Claude Code:
claude mcp add --transport http toki https://toki.tokamak.network/api/mcp

Tools: toki_get_apr, toki_list_operators, toki_staking_status. Prefer a local stdio server? See mcp-server/ (@toki/mcp).


One mascot, the whole ecosystem

The /dashboard lobby is a gacha-style hub — every Tokamak service is a tile, fronted by Toki and your live on-chain balances:

Toki dashboard — gacha-lobby hub with staking, AI access, wallet, private transfer and more

Features

Gasless Staking (EIP-7702)

  • TON Paymaster — Gas fees paid in TON, no ETH needed
  • Session Key Delegation — Sign once, stake gaslessly for 7 days
  • Auto WTON Wrapping — TON → WTON conversion handled automatically
  • Auto Operator Selection — Best operator chosen by commission rate and activity

Visual Novel Onboarding

A guided tutorial with Toki as your companion through 5 quests:


Quest 1
Create Account

Quest 2
Bridge to MetaMask

Quest 3
Exchange Verification

Quest 4
Receive TON

Quest 5
First Gasless Stake

Each quest features dialogue sequences, mood-based character expressions, and XP rewards.

Bilingual (i18n)

Full Korean/English support via custom LanguageProvider with locale files in src/locales/.


Achievement Cards

Collect 19 unique cards across 5 categories as you progress through your staking journey.


Bronze
Common

Silver
Uncommon

Gold
Rare

Platinum
Epic

Black
Legendary
View all 19 cards

Onboarding (5 cards)

Card Trigger
First Account Create your first wallet
Bridge Master Complete MetaMask bridge
Exchange Verified Verify exchange address
TON Received Receive first TON
Onboarding Complete Finish all 5 quests

Staking (6 cards)

Card Trigger
First Stake Stake any amount of TON
Staker 10 Cumulative 10+ TON staked
Whale Staker Cumulative 100+ TON staked
Gasless Pioneer Use gasless staking
Delegation User Use session key delegation
First Unstake Complete first unstake

Explore (3 cards)

Card Trigger
Explorer Visit the ecosystem page
Service Surfer Click 3+ different services
Category Master View all 4 categories

Social (3 cards)

Card Trigger
Chat Starter Start first chat with Toki
Dialogue Veteran Visit 10+ dialogue nodes
Free Spirit Use free text input 3+ times

Special (1 card)

Card Trigger
Power User Unlock 15+ achievements

Architecture

User (Social Login)
  → Privy SDK (EOA creation)
  → EIP-7702 (EOA → Smart Account delegation)
  → TON Paymaster (gas fees in TON, not ETH)
  → Tokamak Contracts (TON → WTON → DepositManager → SeigManager)
Key Design Decisions
  • L1-only — Staking contracts live on Ethereum L1. No L2 bridge needed.
  • EIP-7702 — EOA stays exchange-compatible (Travel Rule) while gaining Smart Account capabilities.
  • TON Paymaster — Users never need ETH. Gas fees are deducted from their TON balance.
  • Auto operator selection — Best operator chosen automatically based on commission rate and activity.
  • Compound seigniorage — No restaking needed. Rewards compound automatically via coinage tokens.
Tech Stack
Layer Technology
Frontend Next.js 14, TypeScript, Tailwind CSS
Auth Privy SDK (Google OAuth)
Web3 viem (EIP-7702 + UserOperation signing)
Bundler Pimlico (EntryPoint v0.8)
Paymaster Custom TonPaymaster (TON → ETH swap)
Contracts Tokamak Network (TON, WTON, SeigManager, DepositManager)
Contracts
Contract Address
EntryPoint v0.8 0x4337084d9e255ff0702461cf8895ce9e3b5ff108
TON 0x2be5e8c109e2197D077D13A82dAead6a9b3433C5
WTON 0xc4A11aaf6ea915Ed7Ac194161d2fC9384F15bff2
SeigManager 0x0b55a0f463b6defb81c6063973763951712d0e5f
DepositManager 0x0b58ca72b12f01fc05f8f252e226f3e2089bd00e
TonPaymaster Custom (accepts TON as gas payment)

Getting Started

Step 1: Clone & Install

git clone https://github.com/tokamak-network/toki.git
cd toki
npm install

Step 2: Configure

Copy the example env and fill in your keys:

cp .env.local.example .env.local

Core: NEXT_PUBLIC_PRIVY_APP_ID (Privy), NEXT_PUBLIC_RPC_URL (Alchemy/Infura), NEXT_PUBLIC_PIMLICO_API_KEY (bundler), NEXT_PUBLIC_NETWORK (mainnet | sepolia). For AI Access + analytics (server-side): PRIVY_APP_SECRET, AI_KEY_ENC_SECRET, and the Supabase keys.

Every var is documented inline in .env.local.example. Privy keys: dashboard.privy.io.

Step 3: Launch

npm run dev

Open http://localhost:3000.


Project Structure

src/
  app/
    api/            # Routes: /api/agent (AI proxy) · /api/aikey (key vault) · /api/mcp (MCP) · ...
    ...             # App Router pages: dashboard · staking · agent · profile · lottery
  components/
    agent/          # AI Access workspace — issued key → chat + "Connect" modal (MCP/LiteLLM)
    hub/            # /dashboard gacha-lobby hub (HubLobby + MENU collage)
    landing/        # Landing (hero, profit simulator, FAQ)
    staking/        # Gasless staking screen
    onboarding/     # Visual-novel quest system
    achievements/   # Achievement toasts + card reveals
    providers/      # Privy · Language · Achievement · Web3
  constants/        # Contract addresses, ABIs
  hooks/            # useEip7702, useStakedTon
  lib/              # aiAccess · staking · leaderboard · achievements · crypto (key vault)
  locales/          # en.ts, ko.ts (i18n)
mcp-server/         # @toki/mcp — standalone MCP server exposing Tokamak staking as agent tools
supabase/migrations # ai_access_keys (key vault) · profile_scores (leaderboard) · analytics_events

Contributing

Contributions are welcome! Please open an issue first to discuss changes.

Never commit .env files or private keys to version control.

License

MIT



Built with Tokamak Network

About

Stake TON in 3 steps — no ETH gas. Visual novel onboarding + EIP-7702 gasless staking on Tokamak Network.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors