๐Ÿ› ๏ธ ORIGIN BUILDERS

DEVELOPER GUIDE

Build on the Origin Layer โ€” The Honor-Bound Bitcoin L2

Create games, DeFi apps, social platforms, and more.
Every action anchored in Bitcoin. Every TX verified with honor.

QUICK START

Start Building in Minutes

01

Every Action = 1 TX

Each user action creates a Truth Anchor (TX L2) that can be verified forever.

02

Signature Required

Every TX that moves KRAY must be signed by the user. Honor-bound.

03

TX = Source of Truth

Counters and balances are derived from TXs. Never increment directly.

04

Sacred Exits

Users can always withdraw to Bitcoin L1. This is a right, not a feature.

TX L2 STRUCTURE

Truth Anchor Format

Every transaction must follow this structure

JavaScript TX L2 Structure
{
    // ๐Ÿ”‘ IDENTIFICATION (Required)
    id: "unique_txhash_32bytes",
    tx_type: "transfer",
    
    // ๐Ÿ’ฐ MOVEMENT (Required)
    from_account: "bc1p...",
    to_account: "bc1p...",
    amount: "1000",
    
    // ๐Ÿ“Š METADATA (Required)
    gas_fee: "0",
    memo: "Human-readable description",
    status: "completed",
    
    // ๐Ÿ“Ž EXTRAS (Optional)
    metadata: { game_id: "xyz", ... },
    
    // โฐ TIMESTAMP (Required)
    created_at: "2026-01-16T15:30:00.000Z"
}
TX TYPES

Transaction Types

Standard and custom types for your application

๐Ÿ’ฐ Standard

  • transfer KRAY transfer between users
  • deposit Bridge deposit from Bitcoin L1
  • withdrawal Bridge withdrawal to Bitcoin L1

๐Ÿ“ฑ Social

  • social_post Post creation fee
  • social_repost Repost reward claim
  • social_escrow Repost pool deposit

๐Ÿ’ฑ DeFi

  • swap Token swap
  • add_liquidity Add to pool
  • stake Stake tokens

๐ŸŽฎ Custom (Your App)

  • game_reward Game rewards
  • nft_mint NFT minting
  • vote_cast Voting systems
  • doc_certify Document certification
๐Ÿ” SIGNATURE FLOW

Honor-Bound Authentication

Every action must be signed by the user

1

Create Message

const message = `action at ${Date.now()}`;
โ†’
2

User Signs

await krayWallet.signMessage(message);
โ†’
3

Send to API

{ address, signature, message, ...data }
โ†’
4

Server Verifies

verifySignature(address, message, sig)
๐Ÿ“ก API REFERENCE

Endpoints

Base URL: https://api.kray.space

L2 Core

GET /l2/health Health check
GET /l2/account/:address Get balance
GET /l2/transaction/recent Recent TXs
GET /l2/transaction/:id TX details

Bridge

POST /l2/bridge/deposit Initiate deposit
POST /l2/bridge/withdraw Initiate withdrawal

Social

GET /api/social/feed Posts feed
POST /api/social/post/:id/like Like (1 KRAY)
POST /api/social/post/:id/repost Claim reward
๐Ÿ’ป CODE EXAMPLE

Game Reward Implementation

JavaScript Game Reward Function
async function giveGameReward(playerAddress, amount, gameData, signature, message) {
    // 1. Verify player signature (Honor-bound)
    if (!verifySignature(playerAddress, message, signature)) {
        throw new Error('Invalid signature');
    }
    
    // 2. Create unique TX ID (DNA of the action)
    const txHash = `game_reward_${Date.now()}_${crypto.randomBytes(4)}`;
    
    // 3. Transfer from treasury to player
    await updateBalance('GAME_TREASURY', -amount);
    await updateBalance(playerAddress, +amount);
    
    // 4. Create TX L2 (Truth Anchor) โ† THIS IS THE KEY!
    await supabase.from('l2_transactions').insert({
        id: txHash,
        tx_type: 'game_reward',
        from_account: 'GAME_TREASURY',
        to_account: playerAddress,
        amount: amount.toString(),
        memo: `${gameData.game_name} - ${gameData.achievement}`,
        status: 'completed',
        metadata: JSON.stringify(gameData),
        created_at: new Date().toISOString()
    });
    
    return { success: true, txHash };
}
๐Ÿš€ BUILD ANYTHING

What Can You Create?

๐ŸŽฎ

Games

Play-to-earn, tournaments, in-game items, achievements

๐Ÿ’ฑ

DeFi

DEX, lending, staking, yield farming

๐Ÿ“ฑ

Social

Paid content, creator monetization, tipping

๐ŸŽจ

NFT

Marketplace, minting, auctions, royalties

๐Ÿ—ณ๏ธ

Governance

DAOs, voting, proposals, treasuries

๐Ÿ“„

Documents

Certificates, notarization, timestamps

โš”๏ธ

The Builder's Oath

I. I create Truth Anchors for every action.

II. I verify signatures before moving value.

III. I derive counters from TXs, not increments.

IV. I protect user keys โ€” they never leave the device.

V. I let the Code speak โ€” it is my sworn oath.

Ready to Build?

Join the Origin Builders and create the future of Bitcoin scaling.