Builders • Documentation

Developer Docs

APIs, RPC, SDK examples, and contract scaffolds for building on Maharlikas.

Quick Start

  1. Install a wallet and request test $MAHA from the faucet (coming soon).
  2. Install CLI: npm i -g @maharlikas/cli
  3. Scaffold a contract: maha init hello-world maha build maha deploy --network testnet
  4. Verify in Explorer: /explorer

Network & RPC

Mainnet (planned)
  • Chain: maha-mainnet
  • RPC (HTTPS): https://rpc.maharlikas.ph
  • WS: wss://rpc.maharlikas.ph/ws
Testnet (public)
  • Chain: maha-testnet
  • RPC (HTTPS): https://test-rpc.maharlikas.ph
  • WS: wss://test-rpc.maharlikas.ph/ws
Faucet
  • https://faucet.maharlikas.ph (soon)
  • CLI: maha faucet <address>

Tip: all examples below assume testnet.

SDK Examples

// JavaScript/TypeScript
import { Maha, Keypair } from "@maharlikas/sdk";

const client = new Maha({ rpcUrl: "https://test-rpc.maharlikas.ph" });

async function demo() {
  // Read: recent txns
  const txns = await client.tx.list({ limit: 10 });
  console.log(txns);

  // Write: simple transfer
  const from = Keypair.fromSecret(process.env.PRIVKEY!);
  const sig = await client.tx.transfer({
    from,
    to: "Hk2f...9P8a",
    amount: 100_000, // minor units (e.g., micromaha)
  });
  console.log("submitted:", sig);
}
demo();

HTTP Endpoints

/api/budgetsGET
Sample budgets feed (demo)
/api/txnsGET
Sample transactions feed (demo)
/rpcPOST
JSON-RPC (submit Tx, get block, etc.)
cURL — list transactions
curl -s https://maharlikas.ph/api/txns | jq .[0]
JSON-RPC — submit transaction
curl -s https://test-rpc.maharlikas.ph/rpc \
  -H 'content-type: application/json' \
  -d '{
    "jsonrpc":"2.0",
    "id":"1",
    "method":"tx_submit",
    "params":{ "signedTx":"BASE64_OR_HEX" }
  }'

Pagination & Filtering

  • limit — 1..200 (default 50)
  • before — cursor or timestamp for backward paging
  • since — ISO8601/epoch filter by time
  • statussuccess|failed|pending
GET /api/txns?limit=50&status=success&since=2025-08-01T00:00:00Z

Errors

// HTTP JSON error shape
{
  "error": {
    "code": "INVALID_PARAM",   // or UNAUTHORIZED, INTERNAL
    "message": "Invalid input."
  }
}

JSON-RPC follows the spec: { jsonrpc, id, error: { code, message, data? } }

Webhooks (optional)

Subscribe to events like tx_confirmed or budget_updated.

POST /api/webhooks
{
  "url": "https://your.app/hook",
  "events": ["tx_confirmed", "tx_failed"]
}

We sign webhook POSTs with X-Maha-Signature (HMAC-SHA256).

Contract Scaffold (Rust)

// examples/hello/src/lib.rs
use maha_sdk::{context::Context, prelude::*};

#[contract]
pub struct Hello;

#[derive(Serialize, Deserialize)]
pub struct HelloArgs {
  pub name: String,
}

#[entrypoint]
impl Hello {
  pub fn say(ctx: Context, args: HelloArgs) -> Result<()> {
    let who = args.name;
    log!("Hello, {}! tx={}", who, ctx.tx_sig());
    Ok(())
  }
}
// build:   maha build
// deploy:  maha deploy --program target/hello.so --network testnet

Docs Security Notes

These docs are informational for developers. Examples may reference keys, tokens, or endpoints—never paste real secrets into the browser console, and store credentials securely in your own environment. The docs site itself does not collect personal data or keys.