About JSONRpcProvider

Overview

The JSONRpcProvider is the primary way to communicate with OP_NET nodes using HTTP-based JSON-RPC protocol. By leveraging the standardized JSON-RPC specification, this provider enables developers to invoke remote methods on OP_NET nodes in a consistent and predictable manner, receiving structured responses in return.

The provider handles connection management, request serialization, response deserialization, and error handling internally, allowing developers to focus on application logic rather than low-level networking concerns. Typical use cases include querying blockchain state, submitting transactions, retrieving account balances, and interacting with smart contracts deployed on the OP_NET network.

The diagram below illustrates the operational flow of a JSONRpcProvider:
JSONRpcProvider Call Sequence Your App JSONRpcProvider OP_NET Node method call Build JSON-RPC payload HTTP POST Process request Provider: JSON response (dashed) --> JSON response Parse response App: Typed result (dashed) --> Typed result Your App JSONRpcProvider OP_NET Node