RPC and Runtime API (Overview for Integrators)¶
This document describes ways to interact with the Taler node through standardized RPC and specific Runtime APIs.
Node and Protocols¶
- Protocols: HTTP/WS JSON-RPC (jsonrpsee)
- Endpoints exposed by node binary (
node/src/rpc.rs) - Example of running with open RPC: see
node-setup.md
Common RPC (substrate)¶
system_*: chain information, version, eventsstate_*: storage reading, subscriptionsauthor_*: signing/sending extrinsicschain_*: blocks, hashes, finalization subscriptions
Example of getting network name:
Payment and Fees¶
transactionPayment_queryInfo— fee estimation for call.
Runtime API (example areas)¶
- Staking Runtime API (
pallets/staking/runtime-api): quota/reward calculations. - Assets/NFT Runtime APIs (if connected): metadata and balance retrieval.
Calling Runtime API via api.rpc.state.call:
// method name and SCALE-encoded input structure depend on specific runtime-api
const resultHex = await api.rpc.state.call('StakingApi_methodName', paramsAsHex);
Types and Metadata¶
- Use
api.registryto register custom types (if there are local types). - Metadata version
v14+contains information about pallets/extrinsics/events.
Security¶
- In production, restrict RPC:
--rpc-methods Safe, CORS/hosts. - Don't expose private nodes with
Unsafemethods publicly.
Debugging¶
- Runtime logs:
-lruntime=debug. - Event subscriptions:
api.query.system.events.
See also: - external-developers.md for dApp examples - partner-pallets.md for integrating custom runtime APIs