JSON-RPC
1 min read
Pronunciation
[jay-sawn ar‑pee‑see]
Analogy
JSON‑RPC is like a waiter taking your order in plain English (JSON) and delivering it to the kitchen (node), then returning the response in the same format.
Definition
A stateless, lightweight remote procedure call protocol encoded in JSON, commonly used to interact with blockchain nodes.
Key Points Intro
JSON‑RPC’s simplicity makes it ubiquitous in blockchain APIs:
Key Points
Method calls: Encodes function name and parameters in JSON.
Stateless: Each request contains all context needed.
Batching: Multiple calls in one HTTP request.
Error handling: Standardized error object with code and message.
Example
Technical Deep Dive
A JSON‑RPC request is a JSON object with "jsonrpc":"2.0", "method", "params", and "id". The server responds with a matching "id" and either a "result" or an "error" object. Over HTTP or WebSocket transports, clients send POST requests or messages. Nodes implement method namespaces (eth_, net_, web3_).
Security Warning
Expose JSON‑RPC endpoints only over authenticated channels; unrestricted access can allow account manipulation or DoS attacks.
Caveat
Lacks built‑in authentication or encryption; must rely on transport layer security.
JSON-RPC - Related Articles
No related articles for this term.