Knowledge Base Home

Ethers.js – HTTP Provider Example

An example script on Kaleido using Ethers.js. This demonstrates how to connect to a Kaleido node using basic auth via HTTP and retrieve the latest block on the chain.

Requirements:

  1. Node & NPM

Steps:

  1. Clone the Kaleido Examples project.
  2. In the javascript/ethers/http subdirectory open index.js and:
    • Replace the RPC_ENDPOINT placeholder with the RPC endpoint for your node.
    • Replace the USER placeholder with the basic auth credentials username.
    • Replace the PASS placeholder with the basic auth credentials password.
  3. Save the file and from the javascript/ethers/http subdirectory run npm install to install the node modules for the project.
  4. From the same directory, run node index.js to drive the program.

Prev Web3.js – HTTP Provider Example Next Web3py Example Application