TypeScript SDK

MRTZ SDK & API

Build social stakes into your own applications. The MRTZ API provides a complete ledger system for tracking non-monetary challenges and commitments.

Immutable Ledger

Every transaction is permanently recorded. Audit trails for complete transparency.

Cross-App Sync

One balance across all ecosystem apps. Earn anywhere, spend anywhere.

Validation System

Built-in support for challenge verification and community validation.

TypeScript First

Full type safety. Excellent IDE support. Catch errors at compile time.

QUICKSTART

Get up and running in minutes

1

Install the SDK

Terminal
npm install @mrtz/sdk @mrtz/types
2

Initialize the Client

src/mrtz.ts
import { MRTZClient } from '@mrtz/sdk';

// Initialize with your API key
const mrtz = new MRTZClient({
  apiKey: process.env.MRTZ_API_KEY,
  environment: 'production', // or 'sandbox'
});
3

Create a Challenge

src/challenges.ts
// Create a new challenge (BARK)
const challenge = await mrtz.challenges.create({
  challenger: 'user_abc123',
  description: 'Chiefs beat the Ravens by 7+',
  stakes: 50, // MRTZ amount
  type: 'sports',
  expiresAt: new Date('2026-01-26T23:59:59Z'),
});

console.log(`Challenge created: ${challenge.id}`);
4

Accept & Settle

src/settlement.ts
// Accept the challenge (BITE)
await mrtz.challenges.accept(challenge.id, {
  acceptor: 'user_xyz789',
});

// After the event... settle the challenge (FETCH)
await mrtz.challenges.settle(challenge.id, {
  winner: 'user_abc123',
  evidence: {
    type: 'sports_api',
    source: 'espn',
    score: 'Chiefs 31 - Ravens 17',
  },
});

// MRTZ automatically transfers to the winner!

CORE CONCEPTS

Balances

Every user has an MRTZ balance. The API provides methods to check balances, view transaction history, and understand earning/spending patterns.

const balance = await mrtz.balances.get('user_id');

Transactions

All MRTZ movements are recorded as transactions. Types include challenge settlements, transfers, good deeds (contributions), and penalties.

const txns = await mrtz.transactions.list({ userId: '...' });

Challenges

The core primitive. Challenges go through states: PENDING → ACTIVE → SETTLING → COMPLETE (or DISPUTED, CANCELLED).

const status = challenge.status; // 'active'

Validation

For contributions (like course data), the validation system manages community approval workflows with stake-weighted voting.

await mrtz.validations.submit(contributionId, { approve: true });

API REFERENCE

Explore the full API

GET /balances/:userId

Get current MRTZ balance for a user

POST /challenges

Create a new challenge (BARK)

POST /challenges/:id/accept

Accept a challenge (BITE)

POST /challenges/:id/settle

Settle a completed challenge (FETCH)

GET /transactions

List transaction history with filters

POST /transfers

Transfer MRTZ between users

RATE LIMITS & PRICING

The MRTZ API is free for ecosystem apps. Third-party integrations receive generous rate limits.

Tier Rate Limit Price
Ecosystem Unlimited Free
Developer 1,000 req/min Free
Growth 10,000 req/min Contact us
SANDBOX

Test with fake MRTZ in our sandbox environment. No real balances affected.

environment: 'sandbox'

READY TO BUILD?

Get your API key and start integrating social stakes into your app.