Concept
Integration overview
The interfaces Tenrai offers to developers, what each one is for, and the handful of rules every integration has to follow.
Pick an interface
| You want to | Use |
|---|---|
| Read blocks, cuts, transactions, balances | REST API |
| React to new cuts, payments or a transaction's progress | WebSocket events |
| Do both from JavaScript or TypeScript, and sign transactions | SDK |
| Take deposits and pay withdrawals on a server | Wallet daemon |
| Derive addresses or sign in a browser without the SDK | WASM module |
| Connect mining software or build a pool | Stratum |
Node or Tenrai API
Both serve the same routes, the same JSON documents and the same sockets. A client switches between them by changing one URL.
| Your node | Tenrai API | |
|---|---|---|
| Address | http://127.0.0.1:28701 | https://api.tenrai-technologies.org |
| Run by | You | Tenrai Technologies |
| Limits | None per client unless you set them | Rate limits per client address |
| History | What the node's storage mode keeps | Also what its archive holds |
| Extra routes | Mining control on port 28702 | Network history and price under /v1/gateway/ |
| Signed answers | With the node's identity key | With the service's own key |
Start with the Tenrai API. Move to your own node when you need more throughput, privacy for the addresses you query, or independence from a third party.
What is open source
| Component | Source |
|---|---|
| Node, command-line wallet, miner, stratum bridge | Open |
| Reference pool | Open |
| SDK | Open |
| Reference explorer, reference wallet | Open; built on the SDK as examples to start from |
| Tenrai API, Tenrai Explorer, Tenrai Wallet | Hosted services, free to use |
Rules every integration follows
- Finality. Credit a payment when its status is
finalized. One finalized cut is final; there are no reorganizations. - Amounts. Atoms as decimal strings, 8 decimals. Never parse them as floating point.
- Identifiers. Transaction, block and cut IDs are 96 lower-case hexadecimal characters, SHA-384.
- Addresses. Bech32m with a network prefix:
trai,ttraiordtrai. Validate the checksum and the network before use. - Spending. A transaction spends at most 8 outputs and only finalized ones. Wallets with many small outputs compound first.
- Expiry. A transaction names the last cut at which it may execute, at most 1,800 cuts ahead. After that it can never execute, so a retry cannot pay twice.
- Payloads are public and untrusted. Up to 1,024 bytes travel with a transaction. Escape them before display and pass them to SQL only as parameters.
