For the complete documentation index, see llms.txt. This page is also available as Markdown.

Interact with a deployed contract

You already have a contract address on Lumia and want to call it, either from code or from the explorer UI.

Who this is for: developers with a contract already deployed on Lumia mainnet or Beam testnet (see /build/quickstart or /build/smart-contracts/deploy-with-hardhat if you don't have one yet). Prerequisites: a deployed contract address and its ABI; network values from /reference/networks. Time: 10-15 minutes.

Steps

  1. Open the contract address on the relevant explorer: mainnet explorer.lumia.org or Beam beam-explorer.lumia.org (see /reference/networks for both).

  2. If the contract is verified, the explorer's Contract tab exposes Read Contract and Write Contract sub-tabs generated from the ABI. Unverified contracts only expose raw calldata entry. Verify first with /build/smart-contracts/verify-with-hardhat or /build/smart-contracts/verify-with-truffle if you need the decoded UI.

  3. Read Contract: expand a view/pure function, fill in arguments, click query. No wallet or gas needed.

  4. Write Contract: connect a wallet (must be on the same network as the contract), expand the function, fill in arguments, submit. This costs gas in the native token.

npm install ethers
read.js
const { ethers } = require("ethers");

// Use the RPC value for the network your contract is on; see /reference/networks.
// Do not retype it from memory; the retired "Lumia Testnet" RPC (chain ID 1952959480) is dead.
const provider = new ethers.JsonRpcProvider("https://beam-rpc.lumia.org");

const abi = [ /* your contract's ABI */ ];
const address = "0xYourContractAddress";

async function main() {
  const contract = new ethers.Contract(address, abi, provider);
  const value = await contract.someViewFunction();
  console.log("Result:", value);
}

main();

To send a state-changing transaction, attach a signer instead of a bare provider:

write.js
const { ethers } = require("ethers");

const provider = new ethers.JsonRpcProvider("https://beam-rpc.lumia.org");
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY, provider); // testnet key only
const abi = [ /* your contract's ABI */ ];
const contract = new ethers.Contract("0xYourContractAddress", abi, wallet);

async function main() {
  const tx = await contract.someStateChangingFunction(/* args */);
  const receipt = await tx.wait();
  console.log("Confirmed in block:", receipt.blockNumber);
}

main();

The web3.js equivalent (new Web3(rpcUrl), new web3.eth.Contract(abi, address)) follows the same shape: provider/RPC URL, ABI, address, then .methods.fn().call() for reads or .send({ from }) for writes.

Verify it worked

  • A read call returns a decoded value with no error.

  • A write call's tx.wait() (or the explorer's pending-tx banner) resolves to a receipt; open the transaction hash on the explorer and confirm status is Success.

Troubleshooting

call revert exception on a read

Check you're calling the right function signature/ABI and that any required state (e.g. an allowlist) is satisfied; an unverified contract with a hand-written ABI is the most common cause of a mismatch.

Wallet shows the wrong chain / transaction never confirms

Your wallet is pointed at a different network. Re-check against /reference/networks; this is exactly the trap the retired chain ID 1952959480 sets for anyone following an old tutorial.

insufficient funds for gas

Fund the account from /reference/faucet (Beam) or your own mainnet balance.

Was this helpful?