JSON-RPC - JavaScript Object Notation – Remote Procedure Call

What is JSON-RPC?

JSON-RPC is a remote procedure call (RPC) protocol encoded in JSON (JavaScript Object Notation). It allows data to be exchanged between a client and a server in a simple, lightweight format. It is transport-agnostic and widely used in web and distributed systems.

Why is JSON-RPC useful?

JSON-RPC is useful because it is: - Lightweight and easy to implement - Human-readable due to JSON formatting - Language-independent, enabling communication between systems written in different languages - Suitable for systems where minimal overhead and simplicity are required

How it works?

JSON-RPC uses standard JSON to encode requests and responses: - The client sends a request with a method name, parameters, and an ID. - The server executes the method and responds with the result or an error. - JSON-RPC supports notifications (requests without responses) and batch requests (multiple requests in one message). It does not define a transport layer, so it can work over HTTP, WebSocket, TCP, etc.

Where is JSON-RPC used?

JSON-RPC is commonly used in: - Cryptocurrency APIs (e.g., Bitcoin, Ethereum nodes) - Web applications for AJAX communication - IoT systems and lightweight services - Microservices needing simple RPC mechanisms

Which OSI layer does this protocol belong to?

JSON-RPC operates at the Application Layer (Layer 7) of the OSI model.

Is JSON-RPC Windows specific?

No, JSON-RPC is not Windows specific. It is platform-independent and can be used on any operating system that supports JSON and network communication.

Is JSON-RPC Linux specific?

No, JSON-RPC is not Linux specific. It is equally usable on Linux, macOS, Windows, and embedded systems.

Which Transport Protocol is used by JSON-RPC?

JSON-RPC is transport-agnostic. Common transport protocols include: - HTTP/HTTPS - WebSocket - TCP - Unix Domain Sockets

Which Port is used by JSON-RPC?

JSON-RPC does not define a specific port. The port depends on the transport used (e.g., HTTP on port 80 or 443, WebSocket on configurable ports). For example, Bitcoin’s JSON-RPC typically runs on port 8332.

Is JSON-RPC using Client server model?

Yes, JSON-RPC follows a client-server model: - The client initiates requests to call remote methods. - The server executes those methods and returns results or errors.

  • In this section, you are going to learn

  • Terminology

  • Version Info

  • rfc details

  • setup

  • setup

  • packet details

  • usecases

  • features

  • Reference links