How do I connect my Ethereum Node using the Web3 interface?
The web3.js library makes it simple to connect and interact with Ethereum nodes.
This knowledgebase article contains sample JS Code that should help explain how to use the web3.js library to connect to your Bloq Ethereum node.
If you haven't done so already, please see the Bloq Node Setup page to spin up your Ethereum node.
Requirements
First, ensure the Web3 libraries are installed by following this guide.
Once the libraries have been installed, you can connect to your Ethereum node with the sample code. Some of the key steps within the sample code includes:
Setting up parameters
Creating a Web3 http provider with credentials
Disregarding self-signed certificates
Creating the Web3 instance
Using the Web3 interface to fetch the current block number
1. Setting up Parameters
2. Creating a Web3 http provider with credentials
Option 1: Basic Authentication
Option 2: Using JWT
3. Creating a Web3 websocket provider with credentials
Option 1: Basic Authentication
Option 2: Using JWT
4. Disregarding Self-Signed Certificates
Additional Resources
Web3 Documentation: https://web3js.readthedocs.io/en/v1.2.0/web3-eth.html
Last updated