App Developer Guide
This guide covers everything you need to build applications on Tenzro. The recommended pattern uses the AppClient SDK class which handles identity provisioning, wallet management, gas sponsorship, and AI inference in a single abstraction. Your users never need to hold TNZO or understand blockchain mechanics.
Quick Start
npm install @tenzro/sdkimport { AppClient } from "@tenzro/sdk";
const app = new AppClient({
rpcUrl: "https://rpc.tenzro.network",
masterWallet: process.env.TENZRO_MASTER_KEY,
appName: "MyApp",
});
// 1. Register a user (provisions identity + wallet + smart account)
const user = await app.registerUser({ externalId: "user-42" });
// 2. Run AI inference on behalf of the user (gas sponsored)
const response = await app.inference(user.address, {
model: "gemma3-270m",
messages: [{ role: "user", content: "Hello, Tenzro!" }],
});
console.log(response.content);AppClient Architecture
Step 1: Set Up Master Wallet
The master wallet is your application's funding source. It pays gas fees for all your users via the paymaster. On testnet, fund it from the faucet:
# Generate a master wallet
tenzro-cli wallet create
# Output: Address: 0xYourMasterWallet...
# Fund from testnet faucet (100 TNZO per request)
curl -X POST https://api.tenzro.network/api/faucet \
-H "Content-Type: application/json" \
-d '{"address": "0xYourMasterWallet..."}'Step 2: Register Users
When a user signs up for your application, call registerUser to provision their on-chain identity. This creates a TDIP DID, MPC wallet, and ERC-4337 smart account in a single call:
const user = await app.registerUser({
externalId: "user-42", // Your app's user ID
displayName: "Alice", // Optional display name
identityType: "human", // "human" or "machine"
});
// What was provisioned:
console.log(user.address); // 0x... (smart account address)
console.log(user.did); // did:tenzro:human:a1b2c3...
console.log(user.walletId); // MPC wallet ID (2-of-3 threshold)
// Map your app's user ID to the Tenzro address
await db.saveMapping(user.externalId, user.address);Step 3: Execute Operations
All operations are executed through the AppClient with automatic gas sponsorship:
// AI inference
const chat = await app.inference(user.address, {
model: "qwen3.5-0.8b",
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: "Explain quantum computing." },
],
maxTokens: 500,
});
// Token transfer (user-to-user, gas sponsored)
await app.transfer(user.address, {
to: otherUser.address,
amount: "5000000000000000000", // 5 TNZO
});
// Register an AI agent for the user
const agent = await app.registerAgent(user.address, {
name: "ResearchBot",
capabilities: ["nlp", "web-search"],
delegationScope: {
maxDailySpend: "10000000000000000000", // 10 TNZO
allowedOperations: ["inference", "transfer"],
},
});Step 4: Handle Payments
Tenzro supports multiple payment protocols. Use MPP for streaming AI access or x402 for one-shot API calls:
// MPP payment for streaming inference
const session = await app.payments.createMppSession(user.address, {
provider: "0xModelProvider...",
maxBudget: "5000000000000000000", // 5 TNZO
});
// x402 one-shot payment
const receipt = await app.payments.payX402(user.address, {
resource: "https://api.provider.com/inference",
amount: "100000000000000000", // 0.1 TNZO
});RPC Methods Reference
| Method | Description |
|---|---|
tenzro_participate | One-call onboarding: provisions identity, wallet, and hardware profile |
tenzro_registerIdentity | Register a human or machine DID |
tenzro_chat | Chat completion with a served model |
tenzro_createPaymentChallenge | Create MPP, x402, or native payment challenge |
eth_sendRawTransaction | Submit a signed transaction (EVM-compatible) |
eth_getBalance | Query TNZO balance for any address |