komet-node is a local Stellar testnet backed by the K semantics of Soroban. The compiled semantics are a one-shot interpreter (one process per request, no networking, no state between runs), so Python wraps them into a long-running server: it holds the HTTP socket, keeps state on disk between runs, and decodes Stellar XDR, which K cannot. The RPC layer itself — method dispatch, receipt bookkeeping, ledger accounting, status, and response formatting — runs inside the K semantics (node.md).
| Module | Role |
|---|---|
server.py — StellarRpcServer |
Long-running HTTP/JSON-RPC server wrapping the one-shot K interpreter; handle_rpc dispatch; owns the io-dir files. Holds no ledger or receipt state. |
transaction.py — TransactionEncoder |
XDR → request envelope + (for wasm uploads) kasmer steps; address/contract-id helpers. |
interpreter.py — NodeInterpreter |
Runs request envelopes through llvm_interpret; persists state.kore. No kast↔kore whole-config conversions. |
scval.py |
XDR SCVal ↔ Komet SCValue (scvalue_from_xdr) and XDR SCVal → request JSON (scval_to_json). |
kdist/node.md |
The K RPC layer: reads request.json, dispatches, updates metadata.json and the per-transaction receipts/ files, writes response.json. |
State lives in the io dir as state.kore (KORE world state) and metadata.json (ledger counter), with per-transaction receipts and traces under receipts/ and traces/. See architecture.md.
test_server.pydrives the running HTTP server end-to-end. It exercises the read-only methods,sendTransaction+getTransaction, ledger increments, the full lifecycle (create → upload wasm → deploy → invoke), and thetraceTransactionflows.test_call_tx_with_argsdeploysargs.watand calls functions withbool,u32,i32,u64,i64,u128,i128, andsymbolarguments, exercising thescval_to_json/#decodeArgpipeline.test_integration.pyandtest_unit.pyhold small sanity checks.
Run with make test (requires make kdist-build first).
The tests do not yet cover bytes / address SCVal arguments or SCVec / SCMap (and scval_to_json does not yet encode the latter).
resultXdr/resultMetaXdrare empty stubs (contract return values not surfaced).sendTransaction'serrorResultXdris always a generictxMALFORMEDresult (no per-cause codes such astxBAD_SEQ— sequence numbers, fees, and signatures are not modelled), anddiagnosticEventsXdris never populated (both fields are optional in the spec).TRY_AGAIN_LATERis never returned by design: it signals mempool backpressure, which cannot arise in a synchronous node without a mempool.SCVec/SCMapcontract arguments are not yet encoded.simulateTransaction,getEvents,getLedgerEntries,getFeeStats, and TTL/footprint operations are not implemented.- Receipts are not a stable format: older io-dirs store
ledger/createdAtwith pre-spec types and lackapplicationOrder/feeBump. Resume only io-dirs written by the same version, or start fresh.