← writing

Sand Chain: A Batteries-Included Sandbox EVM Stack

Sand Chain — a sandbox EVM stack: dunes flowing into linked blocks, liquidity curves, branching markets, a launch rocket, and an oracle pulse

Local EVM dev tools are great at giving you a chain. They are not great at giving you a place — somewhere a newcomer can connect a wallet, swap a token, post a limit order, bet on a market, mint a meme coin, and then watch the whole thing settle in a block explorer, all without writing a line of Solidity. After reaching for that "place" one too many times and not finding it, I built one.

Sand Chain is a batteries-included local/private EVM stack for teaching, demos, and protocol experiments. One command brings up a real proof-of-authority chain, a block explorer, a real-time indexer, and a suite of working dapps: a faucet, a Uniswap-V2 AMM, an on-chain central limit order book (CLOB), prediction markets, a meme-coin bonding-curve launcher, and an on-chain price oracle. Bots and an oracle updater keep the markets moving, so the world feels alive the moment it boots.

It's open source here: github.com/jqhils/sandbox-evm-stack.

Try it live. I run a public instance at chain.finscrypto.xyz — connect MetaMask, claim from the faucet, and trade. Every screenshot below links to the corresponding live page. The default network name in the project is Sand Chain, but the display name, ticker, and chain ID are all environment-driven, so the whole stack can be rebranded without touching code; the live instance shown here is branded FINSCRYPTO Chain.

How this started

It started small. I kept wanting a sandbox where people could do DeFi rather than just read about it, and nothing off the shelf fit. Public testnets are flaky, full of distractions, and their faucets are perpetually dry. A fresh anvil or Hardhat node is the opposite problem: a pristine blank canvas with no liquidity, no UI, and no sense that anything is happening.

What I actually wanted sat in between: a self-contained world that boots with deep liquidity and live charts, that I could seed deterministically, reset between groups of learners, and host on a small server. So I seeded a couple of Uniswap pools, then added a faucet so wallets could start from zero, then an explorer so people could see their transactions, then an order book, prediction markets, a meme launchpad, an oracle, and bots to keep prices honest. Somewhere along the way the pile of scripts became a stack.

The motivation throughout has been teaching. The stack plays a supporting role: it's the environment that hosts hands-on exercises, where every action a learner takes is a genuine on-chain transaction. More on that below.

What's in the stack

Under one docker compose project, behind a single nginx edge, Sand Chain runs:

  • ExecutionHyperledger Besu with QBFT proof-of-authority consensus and ~2-second blocks. It feels more like a "real" network than an instant-mine dev node, while staying completely private and disposable.
  • Explorer — a full Blockscout deployment (backend, frontend, and a smart-contract verifier) so every block, transaction, token, and contract is browsable.
  • Indexerrindexer + Postgres ingest contract events into SQL views, which power the app's charts, trade history, and leaderboards (and a GraphQL endpoint).
  • App — a single Next.js front end (wagmi + viem) that hosts all the dapps as routes: the dashboard, DEX, prediction board, meme launchpad, faucet, and an admin panel.
  • Contracts — a Foundry project (Solidity, OpenZeppelin v5): WETH and teaching ERC-20s, a faucet, Uniswap V2, a Clober-style order book, conditional-token prediction markets, a meme-token factory, and a Chainlink-compatible price feed.
  • Live markets — an oracle updater pushes prices on-chain, while a market-making bot and an AMM-arbitrage bot keep the order book and pools tracking those prices.
  • A hardened edge — nginx routes the app, explorer, and a JSON-RPC endpoint that sits behind an rpc-filter with a closed method allowlist, so a student-facing RPC can be exposed safely.
Sand Chain runtime architecture: a browser and wallet reach nginx, which routes to the Next.js app, Blockscout, and a filtered JSON-RPC; the indexer, bots, and oracle updater read from and write to the Besu node
Runtime architecture — public HTTP surfaces on the left, the private Docker network on the right. (Click to enlarge.)

The thing I'm most happy with is how little it takes to get all of that running:

git clone https://github.com/jqhils/sandbox-evm-stack
cd sandbox-evm-stack
make bootstrap

make bootstrap generates a local env file and signer keys, checks your host tooling, starts every service, deploys the contracts, seeds liquidity, wires the indexer to the freshly deployed addresses, funds the bots, and runs a health check. When it finishes, make urls prints the app, explorer, and wallet RPC endpoints, and you're ready to add the network to MetaMask.

A tour of what's inside

Everything below is from the live instance — each image links to the page it came from.

The dashboard

The home screen is a snapshot of the whole economy: live oracle prices, your token balances, a feed of recent on-chain activity, and a power-user leaderboard scored from indexed activity across every protocol.

Sand Chain dashboard showing oracle prices, asset balances, a power-user leaderboard, and a live activity feed

An AMM, with charts that move

The DEX ships with a complete Uniswap V2 deployment and pre-seeded pools. Because the arbitrage bot keeps pools tracking the oracle, the candlestick chart actually moves, and the trade-history and pool-reserve tables fill up on their own — so concepts like price impact, slippage, and impermanent loss have real data behind them.

Sand Chain AMM page with a candlestick price chart, swap panel, trade history, and active liquidity pools

A real on-chain order book

Alongside the AMM is a central limit order book built on the Clober order-book engine — limit and market orders, live depth, and a market list. Having both an AMM and a CLOB on the same tokens is unusual for a teaching environment, and it makes the comparison between the two trading models tangible.

Sand Chain CLOB page with an order-book ladder, depth chart, order entry form, and market list

Prediction markets

The prediction board supports binary, categorical, and scalar markets built on conditional tokens. Each market has a probability chart, an order panel, live positions, and an activity feed — a clean way to explore how outcome prices encode probabilities.

Sand Chain prediction market page with a probability chart, outcome shares, an order panel, and recent activity

A meme-coin launchpad

The launchpad lets anyone mint a token on a bonding curve and trade it the moment it lists. Once a token's curve fills, it "graduates" — the launchpad seeds a Uniswap V2 pool and burns the LP. It's a surprisingly effective (and fun) way to teach bonding curves, supply, and market cap.

Sand Chain meme launchpad showing a grid of user-created tokens with market caps, holder counts, and bonding-curve progress

A real block explorer

Every action lands in Blockscout. Learners can follow their own transactions, inspect contracts, read verified source, and watch blocks tick by at two-second intervals — the same explorer experience they'd get on a public network, just for a chain that's entirely yours.

Blockscout explorer for the chain showing total blocks, average block time, daily transactions, and the latest blocks and transactions

An admin panel for the operator

Running a chain for other people means doing operator things constantly, so the app has a sign-in-with-Ethereum admin panel: mint teaching tokens, enable and tune the faucet, manage prediction-market managers, route CLOB fees, and nudge oracle feeds. Privileged actions are signed in your own wallet and enforced on-chain — admins are just an env-configured address list, so no rebuild is needed to change who's in charge.

Sand Chain admin panel with sections for services, token minting, the faucet, prediction managers, CLOB fee routing, and oracle feeds

What makes it different

There are excellent local-chain tools — Anvil, Hardhat Network, Ganache — and Sand Chain isn't trying to replace them. They give you a node and a developer's toolbox. Sand Chain gives you a world:

  • A whole DeFi surface, pre-wired. An AMM, an order book, prediction markets, a meme launchpad, a faucet, and an oracle, all deployed and talking to each other out of the box.
  • Markets that are actually live. The oracle updater and bots mean charts move and books fill without anyone trading — demos don't sit on flat, empty data.
  • An explorer and an indexer, not just RPC. Blockscout for humans, plus a SQL/GraphQL analytics layer for the app's charts, history, and leaderboards.
  • Operations built in. make reset-term rebuilds a clean chain for a new group; make snapshot / make restore capture a moment in time; make seed and make fund set up liquidity and wallets. A gas-friction-free push faucet even lets a server relayer fund a brand-new, zero-ETH wallet so a first-timer's very first action isn't blocked on gas.
  • Curriculum as config. Tokens, pools, order books, oracle feeds, and sample markets are declared in JSON manifests — you version-control your sandbox's economy instead of hand-writing Solidity for every demo token.
  • Yours to extend. The app is a single Next.js project where every dapp is just a route, so dropping in your own page or dapp is straightforward, and new contracts slot into the Foundry project and deploy pipeline. Between that and the manifests above, the stack is a foundation to build on, not a closed demo.
  • Safe to expose. The rpc-filter denies admin/debug/stateful methods and bounds heavy queries, separate keys are used for the validator and deployer, and there's env validation and a secret scan to run before publishing a fork.

Built for teaching

Sand Chain's day job is supporting hands-on learning. The pattern is simple: connect a wallet, claim some funds, and complete a task that is a real transaction — swap on the AMM, add liquidity, post a limit order, take the other side of one, bet on a prediction market, or launch a token.

Because each of those tasks leaves an on-chain trace, a learner's progress is easy to verify. It can be checked by reading chain state directly — verifying a transaction against a contract address and method, reading a balance or a position, or querying the indexer and explorer for a learner's activity. The chain becomes the source of truth: an observable, verifiable backend that a course platform can read from to track completion. No screenshots to trust, no self-reporting — just what actually happened on-chain.

That's also why the operational tooling matters as much as the dapps. Resetting between cohorts, snapshotting a known-good state, seeding consistent liquidity, and funding wallets in bulk are what make it practical to run the same environment for a room full of people, again and again.

Try it yourself

The fastest way to get a feel for it is to open the live instance and click around. When you want your own:

git clone https://github.com/jqhils/sandbox-evm-stack
cd sandbox-evm-stack
make bootstrap
make urls

Then add the printed RPC to MetaMask and start trading. There's a production path too — the same compose stack runs on a VPS or homeserver behind a TLS reverse proxy, with env validation and per-environment config — but a word of caution: this is a sandbox, not a mainnet-ready financial system. Keep public RPC methods restricted, rotate the generated keys before any shared deployment, and run the included checks before publishing a fork.

If you build something with it, or use it to teach, I'd love to hear about it. The code is on GitHub, and a live world is waiting at chain.finscrypto.xyz.