🛠 Developer
Developer Guide
Use the public RPC surface and the official JavaScript SDK to build wallets, dashboards, bots, and browser apps on Tensorium.
Current SDK. The official JavaScript / TypeScript package is
@tensorium/sdk on npm. Python SDK and dApp example are planned next.Current Developer Stack
Package
@tensorium/sdkInstall
npm install @tensorium/sdkRuntimeBrowser-safe and Node.js compatible
TransportHTTP RPC
Address format
txm1... bech32Smallest unit
1 TXM = 100,000,000 atomsRead Balance
TypeScript
import { TxmRPC, TxmWallet } from '@tensorium/sdk';
const rpc = new TxmRPC('https://rpc.tensoriumlabs.com');
const wallet = TxmWallet.fromPrivateKey(process.env.TXM_PRIVATE_KEY!);
const { utxos } = await rpc.getUtxos(wallet.address);
const mature = utxos.filter((u) => u.mature);
const balanceAtoms = mature.reduce((sum, u) => sum + BigInt(u.value_atoms), 0n);
console.log({ address: wallet.address, balanceAtoms });
Use mature UTXOs only when calculating spendable balance. Coinbase outputs remain locked until maturity is reached.
Send Transaction
TypeScript
import { TxmRPC, TxmWallet, send } from '@tensorium/sdk';
const rpc = new TxmRPC('https://rpc.tensoriumlabs.com');
const wallet = TxmWallet.fromPrivateKey(process.env.TXM_PRIVATE_KEY!);
const txid = await send(
rpc,
wallet,
'txm1qdestinationhere...',
100_000_000n
);
console.log('broadcast txid:', txid);
The helper handles UTXO selection, transaction build, signing, and RPC broadcast in one flow.
Low-Level Building Blocks
If you need manual control, the SDK also exposes the lower-level primitives used by the high-level helper.
TypeScript
import {
TxmRPC,
TxmWallet,
selectUtxos,
buildAndSign,
} from '@tensorium/sdk';
const rpc = new TxmRPC('https://rpc.tensoriumlabs.com');
const wallet = TxmWallet.fromPrivateKey(process.env.TXM_PRIVATE_KEY!);
const { utxos } = await rpc.getUtxos(wallet.address);
const chosen = selectUtxos(utxos, 250_000_000n);
const tx = buildAndSign(wallet, chosen, [
{ address: 'txm1qdestinationhere...', value_atoms: 250_000_000n },
]);
const result = await rpc.sendRawTransaction(tx);
console.log(result.txid);
Operational Notes
- Keep private keys client-side. Do not hardcode or commit them.
- For production apps, proxy RPC through your own backend or rate-limited gateway.
- Public RPC should be fronted by nginx or another reverse proxy with method and rate controls.
- When building wallet UX, show both total UTXO balance and mature spendable balance.
Next Planned Pieces
- Python SDK for scripting and automation.
- Simple dApp example using the SDK.
- Additional fee estimation helpers after the first public app integrations.