Browse DIDLab Docs
Build · Contracts
Interact with a deployed contract
Use a provider for read-only calls and a signer for state-changing transactions. The ABI describes the functions and events your application can use.
Read without a wallet signature
A view function can be called through the public RPC. Replace the example address with the SimpleStorage address you deployed.
import { Contract, JsonRpcProvider } from "ethers";
const abi = ["function get() view returns (uint256)"];
const provider = new JsonRpcProvider("https://eth.didlab.org");
const contract = new Contract("0xYOUR_CONTRACT_ADDRESS", abi, provider);
const value = await contract.get();
console.log(value.toString());Write with the connected wallet
Calling set(42) changes state, so the wallet must sign the transaction and the network must include it in a block.
import { BrowserProvider, Contract } from "ethers";
const abi = [
"function set(uint256 newValue)",
"event ValueChanged(uint256 value, address indexed changedBy)"
];
const provider = new BrowserProvider(window.ethereum);
await provider.send("eth_requestAccounts", []);
const signer = await provider.getSigner();
const contract = new Contract("0xYOUR_CONTRACT_ADDRESS", abi, signer);
const tx = await contract.set(42);
console.log("submitted", tx.hash);
const receipt = await tx.wait();
console.log("confirmed in block", receipt?.blockNumber);Expected evidence
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