Solidity Playground
Write, run, and share code snippets — no setup required.
Click Run to see the output here.
Try Solidity in the browser
Solidity is the language of Ethereum smart contracts. It runs on the EVM — the same virtual machine that secures hundreds of billions of dollars on mainnet and powers most L2s. This playground gives you a Monaco editor wired to a sandboxed solc + geth EVM, so you can write a contract, press Run, and see exactly what would happen on-chain: console.log output, emitted events, and the final state of your storage variables — without deploying anything, paying gas, or touching a wallet.
Solidity is unusual in a few ways worth noticing as you start. Storage is permanent by default — anything assigned to a state variable persists; anything inside a function is gone when the call returns. Events are how contracts talk to the outside world (your frontend, your indexer, The Graph) — they cost gas, get written into transaction logs, and are filterable by indexed parameters. And every external function takes its inputs through ABI encoding, not stdin — so the playground exposes a typed Args panel that wires straight into your main(...) parameters.
What this Solidity playground does well
- Real solc + EVM execution, not a transpiler simulation. console.log uses forge-std and the emit / storage paths go through actual EVM semantics — opcodes, gas, all of it.
- Events tab shows every
emitfrom your run withindexedparameters flagged distinctly, so you can see exactly what a frontend or subgraph would receive. - Storage tab shows the final value of every state variable the contract touched — including mapping entries (e.g.
balances[0xabc...]). Variables you didn't write don't appear. - Typed Args panel feeds values to a parametric
main(uint256 n, string memory name, ...). The runner ABI-encodes them based on your function's signature, so42becomes auint256and"hello"becomes astring.
What you can build in the Solidity playground
- Counter / increment-decrement contracts to learn how state variables persist across calls — write to
count, run, then watch it appear in the Storage tab. - Token-flow patterns — emit
Transfer(from indexed, to indexed, value)and see indexed vs non-indexed fields rendered differently in the Events tab, the same way they appear in real EVM log topics. require/revertfailure cases — write a guard that fails on bad input and see the revert message surface in stdout, instead of burning gas on a failed transaction on mainnet.
Frequently asked questions about Solidity
What is Solidity?
Do I need a wallet or testnet ETH to use this?
main(...) function with whatever args you supplied, and shows you stdout, events, and storage from that one call. Everything is thrown away after the Run.How do I pass inputs to my contract?
main(...) with whatever typed parameters you want — function main(uint256 n) external or function main(string memory name, uint256 age, bool active) external view. Then add the values in the Args panel below the editor. The runner inspects the function's signature and ABI-encodes your strings into the right types, the same way cast call does on the command line. For an address argument, type 0x...; for a bool, type true or false; for a uint, type the decimal value.What's the difference between the Output, Events, and Storage tabs?
console.log(...) from forge-std/console.sol, plus any revert / require error message. Events shows every event your contract emitted during the run, in order, with each parameter's value (and a small "indexed" pill for indexed params — those are the ones that go into EVM log topics and are filterable by tools like The Graph). Storage shows the post-run value of every state variable that got written, including individual mapping entries — variables you didn't touch stay out of the list.Why is there no main() in some Solidity tutorials I've read?
main() as a convention so there's an obvious thing to run and a place to put arguments. Outside the playground, your contract will typically expose multiple functions (mint, transfer, withdraw, ...) and your frontend or a tool like cast / ethers / viem picks which one to call.