Tenzro Testnet is live —request testnet TNZO

TypeScript SDK

The Tenzro TypeScript SDK (@tenzro/sdk) provides a complete client library for interacting with the Tenzro Network from Node.js and browser environments. It wraps all 233+ RPC methods across 12 namespaces into typed, ergonomic modules. The SDK uses fetch for HTTP transport with full TypeScript types.

Installation

npm install @tenzro/sdk

Quick Start

import { TenzroClient } from "@tenzro/sdk";

const client = new TenzroClient("https://rpc.tenzro.network");

// Check balance
const balance = await client.blockchain.getBalance("0xAddress...");
console.log("Balance:", balance, "TNZO");

// Send a transaction
const tx = await client.blockchain.sendTransaction({
  to: "0xRecipient...",
  value: "1000000000000000000", // 1 TNZO
});

// Chat with an AI model
const response = await client.models.chat({
  model: "gemma3-270m",
  messages: [{ role: "user", content: "Hello!" }],
});
console.log(response.content);

Client Modules

ModuleDescriptionKey Methods
blockchainBlock and transaction queriesgetBlock, getTransaction, sendTransaction, blockNumber
accountsAccount managementcreateAccount, createWallet, getBalance, getNonce, listAccounts
modelsAI model operationslist, chat, serve, stop, download, endpoints
inferenceAI inference (streaming + batch)request, stream
identityTDIP identity managementregister, resolve, resolveDidDocument, addCredential
walletMPC wallet operationscreate, send, balance, import, export, sessionKeys
paymentsPayment protocolscreateChallenge, payMpp, payX402, listSessions
stakingStaking and providersstake, unstake, registerProvider, providerStats
governanceOn-chain governancelistProposals, vote, getVotingPower
agentsAI agent managementregister, send, spawn, listTemplates, createSwarm
settlementPayment settlementsettle, getSettlement, openChannel, closeChannel
bridgeCross-chain operationsbridgeTokens, getRoutes, listAdapters
tokensToken registrycreate, getInfo, list, crossVmTransfer, wrap
cantonCanton/DAML integrationlistDomains, listContracts, submitCommand
tasksTask marketplacepost, list, get, cancel, quote, assign, complete
networkNode and network infonodeInfo, peerCount, syncing, hardwareProfile
verificationProof and attestation verificationverifyZkProof, verifyTeeAttestation, verifyTransaction
evmEVM-compatible methodseth_blockNumber, eth_getBalance, eth_sendRawTransaction
complianceERC-3643 complianceaddRule, checkTransfer, freeze, unfreeze
paymasterGas sponsorshipdeploy, deposit, getDeposit
sponsoredSponsored transactionssendTransaction, inference
erc7802Cross-chain token standardcrosschainMint, crosschainBurn
skillsSkills registrylist, register, search, use, get
toolsTools registrylist, register, search, use, get
contractsSmart contract deploymentdeploy
faucetTestnet faucetrequest

ProviderClient

The ProviderClient is a specialized client for model providers who serve AI models on the network:

import { ProviderClient } from "@tenzro/sdk";

const provider = new ProviderClient({
  rpcUrl: "https://rpc.tenzro.network",
  walletKey: process.env.PROVIDER_KEY,
});

// Register as a model provider
await provider.register({
  role: "model_provider",
  stake: "10000000000000000000000", // 10,000 TNZO
});

// Start serving a model
await provider.serveModel({
  modelId: "gemma3-270m",
  endpoint: "http://localhost:8080/v1",
  pricing: { perToken: "100000000000000" }, // 0.0001 TNZO
});

// Set availability schedule
await provider.setSchedule({
  timezone: "UTC",
  hours: { start: 0, end: 24 }, // 24/7
});

Marketplace Example

import { TenzroClient } from "@tenzro/sdk";

const client = new TenzroClient("https://rpc.tenzro.network");

// Post a task to the marketplace
const task = await client.tasks.post({
  title: "Translate document to Spanish",
  description: "Translate a 5000-word document from English to Spanish",
  budget: "10000000000000000000", // 10 TNZO
  requiredCapabilities: ["nlp", "translation"],
});

// List available agent templates
const templates = await client.agents.listTemplates({
  category: "nlp",
});

// Spawn an agent from a template
const agent = await client.agents.spawnTemplate(templates[0].id, {
  delegationScope: {
    maxDailySpend: "50000000000000000000",
    allowedOperations: ["inference"],
  },
});

Transaction Signing

Every Tenzro transaction is hybrid post-quantum signed: a classical Ed25519 signature and an ML-DSA-65 (FIPS 204) signature, both verified synchronously by the node against the canonical Transaction::hash() preimage (which commits to the wallet's ML-DSA-65 public key). An invalid or missing signature on either leg returns JSON-RPC error -32003. Two supported flows:

1. Atomic server-side sign + send (recommended). Auth is mandatory — present Authorization: DPoP <jwt> + DPoP: <proof> headers. The node identifies the signing wallet from the bearer JWT, constructs the hash preimage, signs both legs, verifies them, and submits to the mempool — all in one call. Private keys never travel over the wire. client.sendTransaction(...) and client.wallet.signAndSend(...) are thin wrappers over this RPC.

const txHash = await client.wallet.signAndSend({
  from: "0x...",
  to: "0x...",
  value: 1_000_000_000_000_000_000n,
});

2. Offline sign, then submit. Call tenzro_signTransaction to obtain {signature, public_key, pq_signature, pq_public_key, timestamp, tx_hash}, then resubmit later via eth_sendRawTransaction with all six fields intact. Use this for batched or air-gapped submission.

Durable State

The node persists AI infrastructure to RocksDB and restores it on restart — SDK consumers see consistent state across node upgrades and reboots:

  • Model catalogModelRegistry writes ModelInfo records under info:<model_id> in CF_MODELS; models survive restart without re-registration.
  • Agent runtimeAgentRuntime persists RegisteredAgent, AgentLifecycleInfo, and parent→children spawn trees under agent:/lifecycle:/children: prefixes in CF_AGENTS. Terminated agents are retained for audit of state_history, registration_fee, and tenzro_did.
  • SwarmsSwarmManager persists SwarmState under swarm:<swarm_id> in CF_AGENTS with write-through on create, status transitions, and termination.

Related Documentation

Rust SDK — Rust SDK reference
SDK Reference — Combined SDK overview
App Developer Guide — Building apps on Tenzro
API Reference — Full RPC method listing