4

As I am getting into blockchain-development (Ethereum), I'm often left confused with what the exact difference between web3.js [link here] and specification of JSON-RPC for ethereum on this page. And what is this documentation about?

Are they same? If not, then how are they related?

Is the geth conosole same as JSON-RPC?

I tried looking up for different answers, and it seems a lot of answers tend to mix up between JSON-RPC and web3.js.

3 Answers 3

0

The Javascript API wiki is the document for the 0.2x.x version of Web3js. Most of the tutorials online use this version since the 1.0.0 just released recently. The Web3js on web3js.readthedocs.io is another Web3js document for the 1.0.0 version which greatly different from the 0.2x.x thus explains why there are two different documents for this library.

The JSON-RPC is the remote procedure call protocol version. If you Google "RPC", you will know that it can be easily used/implemented in many different languages, not just only Javascript.

In term of functionality, they are basically the same, but there are many versions and there are many tutorials using different version so it's a bit confusing.

6

JSON-RPC is a stateless, light-weight remote procedure call (RPC) protocol. Primarily this specification defines several data structures and the rules around their processing. It is transport agnostic in that the concepts can be used within the same process, over sockets, over HTTP, or in many various message passing environments. It uses JSON (RFC 4627) as data format.


The web3.js library is a collection of modules which allow you to interact with a local or remote ethereum node, using a HTTP or IPC connection.

2

JSON-RPC is the primary protocol to interact with an Ethereum client. Web3.js is a javascript wrapper around JSON-RPC. Web3.js gives you more convenience but less flexibility (e.g. with requests) than JSON-RPC.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.