Skip to Content

👨🏻‍🎓 Register for live classes

Web3

In this lesson I'll show you what Web3.js is and how to use it to talk to the RSK blockchain.

Web3.js is a collection of libraries. It is the main JavaScript library for interacting with the Ethereum Blockchain and also works on RSK Blockchain. It allow you to interact with a local or remote RSK / ethereum node using HTTP, IPC or WebSocket.

We are talking about developing websites or clients that interact with the blockchain, it means writing code that reads and writes data from the blockchain with smart contracts.

External programs can interact with the EVM client using the web3 interface. Web3 libraries expose various JSON RPC based methods which one can use to interact with the Ethereum and RSK clients.

Web3.js allow you to:

  • send Ether from one account to another
  • read and write data from smart contracts
  • create smart contracts
  • and so much more!

Here is a diagram of how a client talks to Ethereum, and it is the same for RSK:

diagram web3 client

Image: iotbl

Web3.js talks to Blockchain using JSON RPC (Remote Procedure Call) protocol. It allows us to make requests to an individual RSK / Ethereum node with JSON RPC in order to read and write data to the network.

Web3.js has a community of users and maintainers associated with the Ethereum Foundation. It has a good API reference. It has been around since 2015 and has seen extensive use by many projects.

Web3 References

RSK3.js

The rsk3.js library is the RSK veesion of web3.js. It allows you to interact with a RSK blockchain itself and the deployed smart contracts.

RSK3 References

Final considerations

The purpose of this lesson was to present the web3 concepts and libraries.

In the next lesson you will create your first frontend!