🤔 Got questions? Schedule an office hours session.
Node RPC
Client Libraries
Ethers

Ethers.js - Node RPC Integration

Ethers.js is a standalone Typescript/Javascript for interacting with the Ethereum blockchain and its ecosystem.

To connect to a network through Node RPC using Ethers 6 or 5, you can use the JSON-RPC provider backed by HTTPS or WebSockets.

ethers-6/json-rpc-provider.ts
// Installation Instructions: https://docs.ethers.io/v6/getting-started
import { ethers } from "ethers";
 
const RPC_URL = `https://mainnet.gateway.tenderly.co/${process.env.TENDERLY_NODE_ACCESS_KEY}`
 
async function executeMethod() {
  // Initialize an ethers provider instance
  const provider = new ethers.JsonRpcProvider(RPC_URL);
 
  const blockNumber = await provider.getBlockNumber();
 
  console.log(blockNumber);
}
 
await executeMethod();

Using WebSocket provider

ethers-6/wss-provider.ts
// Installation Instructions: https://docs.ethers.io/v5/getting-started
import { ethers } from "ethers";
 
const RPC_URL = `https://mainnet.gateway.tenderly.co/${process.env.TENDERLY_NODE_ACCESS_KEY}`
 
async function executeMethod() {
  // Initialize an ethers provider instance
  const provider = new ethers.JsonRpcProvider(RPC_URL);
 
  const blockNumber = await provider.getBlockNumber();
 
  console.log(blockNumber);
}
 
await executeMethod();