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

Quickstart your first contract on Lumia

Who this is for: developers who already know Solidity and Hardhat, and want the shortest correct path from an empty folder to a verified contract on Lumia. If you've never used Hardhat before, this still works: every command is given in full.

What you'll have at the end: a deployed, verified Hardhat contract live on Lumia Beam testnet, plus a script that reads and updates it.

Time: under 10 minutes once your wallet has testnet funds.

Prerequisites

  • Node.js 18+ and npm (or pnpm/yarn) installed.

  • A wallet (MetaMask or similar) with a private key you control.

  • Basic familiarity with the command line.

What you'll do

  1. Add Lumia Beam testnet to your wallet.

  2. Get testnet funds.

  3. Scaffold a Hardhat project.

  4. Configure the network.

  5. Write and deploy a contract.

  6. Verify it on the explorer.

  7. Interact with it.

1

Add Lumia Beam testnet to your wallet

Follow Add Lumia to MetaMask or Add Lumia to FoxWallet. Both pull the network fields from /reference/networks, so you're always adding the current values rather than ones copied out of an old tutorial.

Verify: confirm the chain ID your wallet shows is 2030232745: that's Beam, the live testnet.

2

Get testnet funds

Claim Beam testnet tokens from the faucet listed at /reference/faucet, which carries the current URL, claim amount, and cooldown. Use the same address you added Beam to in step 1.

Verify: your wallet's Beam testnet balance increases once the claim lands. See Block explorers if you want to confirm the incoming transaction on-chain first.

3

Scaffold a Hardhat project

mkdir lumia-quickstart && cd lumia-quickstart
npm init -y
npm install --save-dev hardhat @nomicfoundation/hardhat-toolbox dotenv
npx hardhat init
# choose: "Create a JavaScript project"

This installs Hardhat 2.x with the standard toolbox (ethers v6, chai matchers, gas reporter).

Verify: the command finishes without error and hardhat.config.js exists in your project folder; you'll edit it directly in the next step.

4

Configure the network

Open /reference/networks and copy the Beam testnet RPC (HTTPS) value into a .env file (never commit this file):

.env
LUMIA_BEAM_RPC_URL=<paste the Beam RPC URL from /reference/networks>
PRIVATE_KEY=<YOUR_TESTNET_ONLY_PRIVATE_KEY>

Edit hardhat.config.js:

hardhat.config.js
require("@nomicfoundation/hardhat-toolbox");
require("dotenv").config();

/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
  solidity: "0.8.24",
  networks: {
    lumiaBeam: {
      url: process.env.LUMIA_BEAM_RPC_URL, // from /reference/networks; do not hardcode this value
      chainId: 2030232745,
      accounts: [process.env.PRIVATE_KEY],
    },
  },
};

Deliberately no hardcoded RPC fallback here: if LUMIA_BEAM_RPC_URL is unset, Hardhat should fail loudly rather than silently pointing at a stale or guessed URL.

5

Write and deploy a contract

contracts/Greeter.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

contract Greeter {
    string private greeting;
    address public owner;

    event GreetingChanged(string newGreeting, address changedBy);

    constructor(string memory _greeting) {
        greeting = _greeting;
        owner = msg.sender;
    }

    function greet() external view returns (string memory) {
        return greeting;
    }

    function setGreeting(string calldata _greeting) external {
        greeting = _greeting;
        emit GreetingChanged(_greeting, msg.sender);
    }
}
npx hardhat compile
scripts/deploy.js
const hre = require("hardhat");

async function main() {
  const Greeter = await hre.ethers.getContractFactory("Greeter");
  const greeter = await Greeter.deploy("Hello, Lumia");
  await greeter.waitForDeployment();

  console.log("Greeter deployed to:", await greeter.getAddress());
}

main().catch((error) => {
  console.error(error);
  process.exitCode = 1;
});
npx hardhat run scripts/deploy.js --network lumiaBeam

Copy the printed contract address. You'll need it for the next two steps.

Verify: the terminal prints Greeter deployed to: <address> from the script's final console.log call.

6

Verify it on the explorer

npx hardhat verify --network lumiaBeam <DEPLOYED_CONTRACT_ADDRESS> "Hello, Lumia"

Verify it worked: open the Beam explorer (linked from /reference/explorers) and search for <DEPLOYED_CONTRACT_ADDRESS>. You should see a confirmed contract-creation transaction and, once this step succeeds, a verified "Contract" tab showing your source code.

7

Interact with it

scripts/interact.js
// scripts/interact.js
const hre = require("hardhat");

async function main() {
  const address = "<DEPLOYED_CONTRACT_ADDRESS>";
  const greeter = await hre.ethers.getContractAt("Greeter", address);

  console.log("Current greeting:", await greeter.greet());

  const tx = await greeter.setGreeting("Hello from the quickstart");
  await tx.wait();

  console.log("Updated greeting:", await greeter.greet());
}

main().catch((error) => {
  console.error(error);
  process.exitCode = 1;
});
npx hardhat run scripts/interact.js --network lumiaBeam

Verify: the terminal prints Current greeting: Hello, Lumia, then, after the update transaction confirms, Updated greeting: Hello from the quickstart.

Troubleshooting

insufficient funds for gas

Your address hasn't received testnet tokens yet, or the faucet cooldown hasn't reset. Recheck [`/reference/faucet`](https://app.gitbook.com/s/chmhPiVNAafGw48c4oU2/reference/testnet-faucet).

Deploy hangs or times out

Your wallet or .env is still pointed at the retired 1952959480 network instead of Beam (2030232745). Recheck step 1.

nonce too low / replacement transaction underpriced

You have a stuck pending transaction from a previous attempt; reset the account's nonce in your wallet or wait for the pending transaction to clear.

Hardhat can't find LUMIA_BEAM_RPC_URL

Confirm .env is in the project root and require("dotenv").config() runs before module.exports in hardhat.config.js.

You're done

You've added Beam testnet to a wallet, funded it, and deployed, verified, and called a contract on Lumia. From here:

Last updated

Was this helpful?