/ API Reference Back to home
Developer Reference

MooChedda API

Standard REST endpoints with JSON request/response. Integrate digital asset payments into any stack — Node, Python, PHP, Ruby, Go — without proprietary SDKs or libraries.

Instant settlement
0% transaction fees
No API keys required
secp256k1 ECDSA signing

No SDK, just HTTP

Every operation is a plain JSON REST call. Any HTTP client works — fetch, axios, curl, requests, Guzzle.

Client-side signing

Transactions are signed locally before sending. Your private key never leaves your device or server.

Self-custody wallets

secp256k1 keypairs. You own the private key — MooChedda cannot freeze or access your funds.

Overview

Base URL

All API requests go to the following base URL. All request and response bodies are application/json.

Base URL https://v1.moochedda.com:3002
// Example: full request URL
const BASE = 'https://v1.moochedda.com:3002';
const res = await fetch(`${BASE}/balance/${address}`);

Authentication

MooChedda uses cryptographic signatures rather than API keys. For write operations (transfers, marketplace actions), you sign the payload client-side with your secp256k1 private key and send the signature with the request. The server verifies the signature against your public wallet address — your private key never leaves your device.

Self-custody by design Read-only endpoints (balances, prices, tokens) require no authentication at all. Write endpoints require a valid ECDSA signature tied to the sender's wallet address.
1
Build the payload
Construct the transaction fields: fromAddress, toAddress, amount, tokenSymbol, timestamp.
2
Hash the payload locally
SHA-256 over the concatenated string of the fields. Use the Web Crypto API or any standard SHA-256 library.
3
Sign with your private key
ECDSA sign the hash using the secp256k1 curve. DER-encode the result as a hex string.
4
Send only the signature
Include timestamp and signature in the JSON body. The private key stays local — always.

Errors

All errors return a JSON body with an error string and an HTTP status code.

StatusMeaning
400Bad request — missing or invalid fields
401Unauthorized — invalid ECDSA signature
404Resource not found
500Server error
// Error response shape
{
  "error": "Invalid signature"
}

Getting Started

Wallets & Balances

Every user or merchant needs a wallet. Wallets are secp256k1 keypairs — the address is the uncompressed 130-char hex public key. Keep the private key and mnemonic offline; they cannot be recovered from the server.

Create Wallet

POST /wallet/create

Generate a new secp256k1 keypair. Returns the wallet address (public key), private key, and a BIP39 12-word mnemonic. Store both the private key and mnemonic securely — neither can be recovered from the server.

Never expose the private key. Store it encrypted at rest. Use it only client-side to sign transactions — never send it to any server.
FieldTypeRequiredDescription
labelstringOptionalHuman-readable label stored with the wallet
// Request
const res = await fetch('https://v1.moochedda.com:3002/wallet/create', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ label: 'my-wallet' })
});
const { address, privateKey, mnemonic } = await res.json();

// Response
{
  "address":    "04a3f9c2...",  // 130-char uncompressed secp256k1 public key
  "privateKey": "7e2c1b3d...",  // 64-char hex — never transmit this
  "mnemonic":   "word1 word2 ... word12"
}

Import Wallet from Mnemonic

POST /wallet/recover

Restore a wallet from a BIP39 mnemonic phrase. Returns the wallet address so you can verify before proceeding. The server does not store the mnemonic.

FieldTypeRequiredDescription
mnemonicstringRequiredSpace-separated 12-word BIP39 mnemonic
const res = await fetch('https://v1.moochedda.com:3002/wallet/recover', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ mnemonic: 'word1 word2 ... word12' })
});
const { address, privateKey } = await res.json();

// Response
{
  "address":    "04a3f9c2...",
  "privateKey": "7e2c1b3d..."
}

Get Balance

GET /balance/:address

Returns all token balances for a wallet address as a key-value map. No authentication required — balances are public.

const res = await fetch(
  `https://v1.moochedda.com:3002/balance/${address}`
);
const { balances } = await res.json();

// Response
{
  "balances": {
    "USDC":   500.00,
    "CHEDDA": 1000
  }
}

Payments

Signing Transactions

All write payment operations require a client-side ECDSA signature. Use the helper below in any browser or Node.js environment. The elliptic library is available via CDN or npm.

Install elliptic (Node.js) npm install elliptic — or load from CDN for browser use.
// Signing helper — works in browser (Web Crypto) and Node.js
//   privateKeyHex: 64-char hex private key
//   fields: the exact fields and values sent in the request body
async function signPayload(privateKeyHex, ...parts) {
  // 1. Hash the concatenated field values with SHA-256
  const raw = parts.map(p => String(p)).join('');
  const buf = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(raw));
  const hashHex = Array.from(new Uint8Array(buf))
    .map(b => b.toString(16).padStart(2, '0')).join('');

  // 2. ECDSA sign with secp256k1
  const ec = new elliptic.ec('secp256k1');
  const key = ec.keyFromPrivate(privateKeyHex, 'hex');
  const sig = key.sign(hashHex);
  return sig.toDER('hex');  // DER-encoded hex string
}

// Usage for a token transfer
const timestamp = Date.now();
const signature = await signPayload(
  myPrivateKey,
  fromAddress, toAddress, amount, tokenSymbol, timestamp
);

Token Transfer

POST /token/transfer

Transfer tokens from one wallet to another. Sign the transaction client-side — only the signature travels to the server, never the private key. The server verifies the ECDSA signature against the sender's public address before executing. 0% fee, instant settlement.

FieldTypeRequiredDescription
fromAddressstringRequiredSender's wallet address (public key)
toAddressstringRequiredRecipient's wallet address
amountnumberRequiredToken amount to send
tokenSymbolstringRequiredToken symbol e.g. USDC, CHEDDA
timestampnumberRequiredUnix ms timestamp used when signing — must match signed payload exactly
signaturestringRequiredDER hex ECDSA signature over fromAddress + toAddress + amount + tokenSymbol + timestamp
// Step 1 — sign locally (private key never leaves the device)
const timestamp = Date.now();
const signature = await signPayload(
  myPrivateKey,
  fromAddress, toAddress, amount, tokenSymbol, timestamp
);

// Step 2 — send only the signed payload
const res = await fetch('https://v1.moochedda.com:3002/token/transfer', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    fromAddress:  '04a3f9...',
    toAddress:    '04b7c2...',
    amount:       100,
    tokenSymbol:  'USDC',
    timestamp,
    signature
  })
});

// Response — 0% fee, instant
{
  "success": true,
  "message": "Token transfer confirmed!",
  "transaction": {
    "from":      "04a3f9...",
    "to":        "04b7c2...",
    "amount":    100,
    "token":     "USDC",
    "timestamp": 1710000000000
  }
}

Create Invoice

POST /invoice/create

Generate a payment invoice with line items, optional tax, and accepted tokens. Returns an invoiceId and a hosted payment URL to redirect the customer to. No authentication required — invoices are public payment requests.

FieldTypeRequiredDescription
merchantAddressstringRequiredMerchant's wallet address — funds go directly here
merchantNamestringOptionalDisplay name shown on the payment page
itemsarrayRequiredArray of { name, price, quantity } line items
taxRatenumberOptionalTax rate as a decimal e.g. 0.08 for 8%
acceptedTokensstring[]OptionalAccepted token symbols. Defaults to ["USDC"]
preferredTokenstringOptionalPre-selected token on the payment page
expiresInnumberOptionalExpiry in seconds (default: 3600)
const res = await fetch('https://v1.moochedda.com:3002/invoice/create', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    merchantAddress: '04a3f9...',
    merchantName:    'Acme Store',
    items: [
      { name: 'Widget Pro', price: 49.99, quantity: 2 },
      { name: 'Shipping',   price: 5.00,  quantity: 1 }
    ],
    taxRate:        0.08,
    acceptedTokens: ['USDC', 'CHEDDA'],
    preferredToken: 'USDC',
    expiresIn:      3600
  })
});
const { invoiceId, paymentUrl, total } = await res.json();

// Redirect the customer to pay:
window.location.href = paymentUrl;

// Response
{
  "invoiceId":  "inv_9x2kq...",
  "paymentUrl": "https://v1.moochedda.com/pay/inv_9x2kq...",
  "total":      112.47,
  "status":     "pending",
  "expiresAt":  1710003600000
}

Pay Invoice

POST /invoice/:id/pay

Pay an existing invoice directly via the API. The payer signs the transaction client-side. This is an alternative to redirecting the customer to the hosted payment page.

FieldTypeRequiredDescription
fromAddressstringRequiredPayer's wallet address
tokenSymbolstringOptionalToken to pay with — must be in invoice's acceptedTokens. Defaults to first accepted token.
timestampnumberRequiredUnix ms timestamp used when signing
signaturestringRequiredDER hex ECDSA signature over fromAddress + merchantAddress + amount + tokenSymbol + timestamp
const invoiceId = 'inv_9x2kq...';

// Fetch invoice to get amount and merchantAddress
const invoice = await (await fetch(`https://v1.moochedda.com:3002/invoice/${invoiceId}`)).json();

const timestamp = Date.now();
const signature = await signPayload(
  myPrivateKey,
  fromAddress, invoice.merchantAddress, invoice.total, tokenSymbol, timestamp
);

const res = await fetch(`https://v1.moochedda.com:3002/invoice/${invoiceId}/pay`, {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ fromAddress, tokenSymbol: 'USDC', timestamp, signature })
});

// Response
{
  "success": true,
  "invoiceId": "inv_9x2kq...",
  "paidAt":    1710000000000,
  "paidBy":    "04a3f9...",
  "amount":    112.47,
  "token":     "USDC"
}

Invoice Status

GET /invoice/:id/status

Poll this endpoint after the customer returns from the hosted payment page to confirm on-chain finality before fulfilling an order. No authentication required.

const res = await fetch(
  `https://v1.moochedda.com:3002/invoice/${invoiceId}/status`
);
const data = await res.json();

// Possible status values:
//  "pending"  — waiting for payment
//  "paid"     — confirmed on-chain
//  "expired"  — invoice timed out

if (data.status === 'paid') {
  fulfillOrder(data.paidBy, data.paidAt);
}

// Response
{
  "invoiceId": "inv_9x2kq...",
  "status":    "paid",
  "paidBy":    "04a3f9...",
  "paidAt":    1710000000000,
  "amount":    112.47,
  "token":     "USDC"
}

Deposits

Funding Wallets

Users fund their wallets by depositing USD via ACH or wire transfer. The deposit is credited as USDC at 1:1 — no conversion fee. The wallet address must be included as the memo/reference on the bank transfer.

Bank Deposit Instructions

GET /usdc/deposit/instructions

Returns ACH and wire bank details to display to users who want to fund their wallet with USDC. Deposits arrive at 0% fee, credited 1:1 USD. The user must include their wallet address as the memo/reference.

const { wire, ach } = await (
  await fetch('https://v1.moochedda.com:3002/usdc/deposit/instructions')
).json();

// Response — same shape for wire and ach
{
  "wire": {
    "bankName":       "Wells Fargo Bank, N.A.",
    "beneficiary":    "MooChedda Inc.",
    "routingABA":     "125009548",
    "accountNumber":  "••••3456",
    "swiftCode":      "WFBIUS6S",
    "processingTime": "Same day or next business day",
    "fee":            "0%",
    "memo":           "Your wallet address (required)"
  },
  "ach": {
    "bankName":       "Wells Fargo Bank, N.A.",
    "routingABA":     "125009548",
    "accountNumber":  "••••3456",
    "processingTime": "1–2 business days",
    "fee":            "0%",
    "memo":           "Your wallet address (required)"
  }
}

Market Data

Tokens & Prices

Read-only endpoints for token metadata and real-time prices. No authentication required.

List All Tokens

GET /tokens

Returns all tokens registered on the platform, including symbol, name, total supply, creator address, and decimals.

const { tokens } = await (
  await fetch('https://v1.moochedda.com:3002/tokens')
).json();

// Each token object:
{
  "tokenId":     "a3b9f1...",
  "symbol":      "USDC",
  "name":        "USD Coin",
  "totalSupply": 1000000,
  "decimals":    6,
  "creator":     "04a3f9...",
  "type":        "CURRENCY",
  "createdAt":   1710000000000
}

Token Prices

GET /prices

Returns current prices for all tokens denominated in USDT. Prices update in real time based on on-chain swap activity via the built-in price oracle.

const { prices } = await (
  await fetch('https://v1.moochedda.com:3002/prices')
).json();

// Response
{
  "prices": {
    "USDC":   1.00,
    "CHEDDA": 0.042
  },
  "updatedAt": 1710000000000
}