Mint CHRN with Agents

Programmatically acquire Chronos tokens by hitting the MPP-gated API directly. No browser, no wallet popup — just a single HTTP call.

How It Works

The /api/mint endpoint is gated by MPP (Micropayments Protocol). When an unauthenticated request hits the endpoint, the server responds with HTTP 402 Payment Required and a payment challenge.

The mppx client (CLI or SDK) handles this automatically:

  1. Agent sends POST /api/mint
  2. Server returns 402 + payment challenge (0.50 USDC.e)
  3. mppx signs & submits payment on Tempo
  4. mppx retries the request with proof of payment
  5. Server verifies payment, mints 20,000 CHRN to the agent's address
Agent                    mppx                    Server
  |                        |                        |
  |-- POST /api/mint ----->|-- POST /api/mint ----->|
  |                        |<-- 402 + challenge ----|
  |                        |                        |
  |                        |-- pay 0.50 USDC.e ---> Tempo
  |                        |<-- tx confirmed -------|
  |                        |                        |
  |                        |-- POST + proof ------->|
  |                        |         mint 20k CHRN  |
  |<-- { success, txHash } |<-- 200 + receipt ------|

Prerequisites

  • Node.js 18+
  • mppx CLI installed (npm i -g mppx or use npx)
  • A Tempo account with USDC.e balance (min 0.50 per mint)

Method 1 — mppx CLI

The fastest way. One command, one mint.

1. Create an account

npx mppx account create

This generates a Tempo keypair stored in your OS keychain. Or set MPPX_PRIVATE_KEY env var to use an existing key.

2. Fund your account

Send USDC.e to your account address on Tempo (chain ID 4217). Check your address with:

npx mppx account view

3. Create config file

In your working directory, create mppx.config.ts:

import { defineConfig, resolveAccount } from 'mppx/cli'
import { tempo } from 'mppx/client'

export default defineConfig({
  methods: [
    tempo({
      account: await resolveAccount(),
      rpcUrl: 'https://rpc.tempo.xyz',
    }),
  ],
})

Or run npx mppx init to generate this automatically.

4. Mint

# Replace <YOUR_ADDRESS> with the wallet to receive CHRN
# Replace https://api.thechronos.xyz with the deployment URL

npx mppx -r https://rpc.tempo.xyz \
  -X POST \
  -J '{"address":"<YOUR_ADDRESS>"}' \
  https://api.thechronos.xyz/api/mint

Response

{
  "success": true,
  "txHash": "0xabc...def",
  "amount": "20,000 CHRN",
  "mintNumber": 2,
  "maxMints": 800000000,
  "explorerUrl": "https://explore.tempo.xyz/tx/0xabc...def"
}

With private key (no keychain)

MPPX_PRIVATE_KEY=0x... npx mppx \
  -r https://rpc.tempo.xyz \
  -X POST \
  -J '{"address":"0xYOUR_WALLET"}' \
  https://api.thechronos.xyz/api/mint

Method 2 — TypeScript SDK

For agents that mint programmatically — bots, cron jobs, multi-agent systems.

Install

npm install mppx viem

Agent script

import { Mppx, tempo } from 'mppx/client'
import { privateKeyToAccount } from 'viem/accounts'

// 1. Set up the mppx client with your agent's key
const account = privateKeyToAccount(process.env.AGENT_KEY as `0x${string}`)

const mppx = Mppx.create({
  methods: [
    tempo({
      account,
      rpcUrl: 'https://rpc.tempo.xyz',
    }),
  ],
})

// 2. Mint — mppx handles the 402 + payment automatically
async function mint() {
  const res = await mppx.fetch('https://api.thechronos.xyz/api/mint', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ address: account.address }),
  })

  const data = await res.json()
  console.log(data)
  // { success: true, txHash: "0x...", amount: "20,000 CHRN", ... }
}

mint()

Loop mint (multi-mint agent)

async function mintLoop(times: number) {
  for (let i = 0; i < times; i++) {
    try {
      const res = await mppx.fetch('https://api.thechronos.xyz/api/mint', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({ address: account.address }),
      })
      const data = await res.json()

      if (data.success) {
        console.log(`Mint #${data.mintNumber}: ${data.txHash}`)
      } else {
        console.error(`Failed: ${data.error}`)
        break
      }
    } catch (err: any) {
      console.error('Error:', err.message)
      break
    }
  }
}

// Mint 5 times (100,000 CHRN for 2.50 USDC.e)
mintLoop(5)

API Reference

POST /api/mint

Mint 20,000 CHRN. Requires MPP payment of 0.50 USDC.e.

Request body

{
  "address": "0x..."  // Tempo wallet to receive CHRN
}

Success response (200)

{
  "success": true,
  "txHash": "0x...",
  "amount": "20,000 CHRN",
  "mintNumber": 1,
  "maxMints": 800000000,
  "explorerUrl": "https://explore.tempo.xyz/tx/0x..."
}

Error responses

402  Payment Required (handled by mppx automatically)
400  { "error": "Invalid wallet address" }
400  { "error": "All public mints have been claimed!" }
500  { "error": "Mint failed" }

GET /api/supply

Check current mint progress. No payment required.

Response

{
  "totalSupply": "200020000000000",
  "totalMints": 1,
  "maxMints": 40000
}

Usage

# No mppx needed — this endpoint is free
curl https://api.thechronos.xyz/api/supply

Key Details

TokenChronos (CHRN)
StandardTIP-20
NetworkTempo Mainnet (chain 4217)
Price0.50 USDC.e per mint
Per mint20,000 CHRN
Public allocation800,000,000 CHRN
Payment currencyUSDC.e (0x20c0...b50)
RPChttps://rpc.tempo.xyz