Track 6 · dApps & frontend · lesson 10

Deploy to Sepolia

16 min


Everything converges here. Your token, on a public network, with an address you can send anyone and a UI that mints from it. This is the Track 6 milestone.

Deploy

A Foundry deploy script is Solidity, like the tests:

// script/Deploy.s.sol
import "forge-std/Script.sol";
import "../src/Proof.sol";

contract Deploy is Script {
    function run() external {
        vm.startBroadcast();     // everything after this is a real transaction
        new Proof();
        vm.stopBroadcast();
    }
}

Run it against Sepolia:

forge script script/Deploy.s.sol \
  --rpc-url $SEPOLIA_RPC \
  --private-key $DEPLOYER_KEY \
  --broadcast --verify

--broadcast is the line between rehearsal and reality. Without it, the script runs as a simulation and sends nothing. With it, real transactions go to the network and your testnet ETH is actually spent.

--verify uploads your source to Etherscan so anyone can read what they are interacting with — the verified-source property from track 3, and something you should do for everything public.

Confirm it exists

The script prints the contract address. Paste it into sepolia.etherscan.io and you will see your contract, your deploy transaction, and — because you verified — your source code. It is real, it is public, and the link works for anyone.

Wire the UI

Point the wagmi app from earlier in this track at Sepolia and your new address. Connect your burner wallet, call mint, wait for the receipt, watch the balance update. Every piece of this track, working together:

Predict

You run the deploy script without `--broadcast`. What happens?

Choose one answer

What you have done

You took a contract from an idea to a public network, and built an interface that anyone can use to interact with it. That is the full loop of shipping a dApp. Everything after this — the capstones — is variations on it, with less scaffolding each time.

Check

Why verify your contract's source on Etherscan?

Choose one answer

Worth remembering

  • A Foundry deploy script is Solidity; `vm.startBroadcast` marks the real transactions.
  • `--broadcast` turns a simulation into real deployment; without it nothing is sent.
  • `--verify` publishes source to Etherscan — do it for everything public.
  • Confirm the deploy on a block explorer via the printed address.
  • Deploy + a wallet-connected UI that mints is the full shipping loop; capstones vary it.