RPC
monerod
's daemon RPC has three kinds of RPC calls:
- JSON-RPC 2.0 methods, called at the
/json_rpc
endpoint - JSON (but not JSON-RPC 2.0) methods called at their own endpoints, e.g.
/get_height
- Binary (epee) RPC methods called at their own endpoints ending in
.bin
, e.g./get_blocks.bin
Cuprate's RPC aims to mirror monerod
's as much as it practically can.
This includes, but is not limited to:
- Using the same endpoints
- Receiving the same request data
- Sending the same response data
- Responding with the same HTTP status codes
- Following internal behavior (e.g.
/pop_blocks
)
Not all monerod
behavior can always be followed, however.
Some are not followed on purpose, some cannot be followed due to technical limitations, and some cannot be due to the behavior being monerod
specific such as the /set_log_categories
endpoint which uses monerod
's logging categories.
Both subtle and large differences between Cuprate's RPC and monerod
's RPC are documented in the Differences with monerod
section.
Main RPC components
The main components that make up Cuprate's RPC are noted below, alongside the equivalent monerod
code and other notes.
Cuprate crate | monerod (rough) equivalent | Purpose | Notes |
---|---|---|---|
cuprate-json-rpc | jsonrpc_structs.h , http_server_handlers_map2.h | JSON-RPC 2.0 implementation | monerod 's JSON-RPC 2.0 handling is spread across a few files. The first defines some data structures, the second contains macros that (essentially) implement JSON-RPC 2.0. |
cuprate-rpc-types | core_rpc_server_commands_defs.h | RPC request/response type definitions and (de)serialization | |
cuprate-rpc-interface | core_rpc_server.h | RPC interface, routing, endpoints | |
cuprate-rpc-handler | core_rpc_server.cpp | RPC request/response handling | These are the "inner handler" functions that turn requests into responses |