pulsechain.box
Getting Started

Ethers.js

Connect to PulseChain using ethers.js v6.

Connect to PulseChain using ethers.js v6.

Setup

npm install ethers

Basic usage

import { JsonRpcProvider, formatEther } from "ethers";

const provider = new JsonRpcProvider("https://rpc.pulsechain.box");

// Get latest block number
const blockNumber = await provider.getBlockNumber();
console.log("Block:", blockNumber);

// Get native PLS balance
const balance = await provider.getBalance("0x3693693693693693693693693693693693693693");
console.log("Balance:", formatEther(balance), "PLS");

// Get block details
const block = await provider.getBlock("latest");
console.log("Timestamp:", block.timestamp);

Read a contract

import { Contract } from "ethers";

const ERC20_ABI = [
  "function name() view returns (string)",
  "function symbol() view returns (string)",
  "function decimals() view returns (uint8)",
  "function balanceOf(address) view returns (uint256)",
  "function totalSupply() view returns (uint256)"
];

// WPLS contract
const wpls = new Contract(
  "0xA1077a294dDE1B09bB078844df40758a5D0f9a27",
  ERC20_ABI,
  provider
);

const name = await wpls.name();
const symbol = await wpls.symbol();
const decimals = await wpls.decimals();
const balance = await wpls.balanceOf("0x3693693693693693693693693693693693693693");

console.log(`${name} (${symbol}): ${formatEther(balance)}`);

Send a transaction

import { Wallet, parseEther } from "ethers";

const wallet = new Wallet("YOUR_PRIVATE_KEY", provider);

const tx = await wallet.sendTransaction({
  to: "0xRECIPIENT_ADDRESS",
  value: parseEther("1.0")
});

console.log("TX hash:", tx.hash);
const receipt = await tx.wait();
console.log("Confirmed in block:", receipt.blockNumber);

Listen for events

const filter = wpls.filters.Transfer();
wpls.on(filter, (from, to, value, event) => {
  console.log(`Transfer: ${from} -> ${to}: ${formatEther(value)} WPLS`);
});

Network configuration

If you need to explicitly define the network:

import { Network } from "ethers";

const pulsechain = new Network("pulsechain", 369);
const provider = new JsonRpcProvider("https://rpc.pulsechain.box", pulsechain, {
  staticNetwork: pulsechain
});
Copyright © 2026 AvecdrA. Made with love.