Browse DIDLab Docs
Build · ethers.js
Connect a JavaScript application to DIDLab
Use a browser provider when the user signs transactions and a JSON-RPC provider for read-only server or script access.
Browser wallet connection
A browser wallet exposes an EIP-1193 provider. ethers wraps it with BrowserProvider and exposes a signer only after the user authorizes the account.
import { BrowserProvider } from "ethers";
const provider = new BrowserProvider(window.ethereum);
await provider.send("eth_requestAccounts", []);
const network = await provider.getNetwork();
console.log("chainId", network.chainId.toString());
const signer = await provider.getSigner();
console.log("wallet", await signer.getAddress());Expected result
network.chainId should be 252501.Read directly from the DIDLab RPC
Read-only scripts do not need a private key. Query the chain through the public HTTPS RPC endpoint.
import { JsonRpcProvider, formatEther } from "ethers";
const provider = new JsonRpcProvider("https://eth.didlab.org");
const blockNumber = await provider.getBlockNumber();
const network = await provider.getNetwork();
const balance = await provider.getBalance("0xYOUR_ADDRESS");
console.log({
chainId: network.chainId.toString(),
blockNumber,
balance: formatEther(balance)
});Private-key boundary
Validation profile
Network
DIDLab Blockchain
Chain ID
252501
Client
Hyperledger Besu
Consensus
QBFT
Native asset
TRUST
Platform token
TT (ERC-20)
Solidity examples
0.8.24
Last validated
August 2026
Go deeper in DIDLab Labs
Public documentation explains the workflow and expected result. Authenticated DIDLab Labs adds managed workspaces, deeper exercises, checkpoints, evidence capture, and instructor assessment.
Open DIDLab Labs