Learnr

Learn Solidity

Write and test smart contracts for the Ethereum Virtual Machine.

Free to start. No credit card. Or browse all courses.

What's inside your Solidity course

A sample path Learnr builds for Solidity. Your real course adapts to your goal and level.

  1. How the EVM, accounts and transactions work
  2. Contract structure, types and functions
  3. Mappings, structs, events and errors
  4. Gas, storage and memory
  5. Testing and deploying on a testnet
  6. Security patterns and reading audited code

Solidity is a statically typed, curly-brace language for writing smart contracts that run on the Ethereum Virtual Machine and compatible blockchains. A contract looks like a class: it has state variables stored on chain, functions with visibility like public and external, modifiers that guard access, and events that applications can listen for. Every operation costs gas, and once deployed, contract code generally cannot be changed, so a bug can lose real funds. That is why learning Solidity is as much about testing and security as syntax. Learnr builds a personalized Solidity course in short, interactive lessons focused on how contracts work.

How to learn Solidity, step by step

  1. Understand the EVM before the syntax. Learn what accounts, transactions, gas and contract storage are, and why code is public and permanent once deployed. Those constraints explain almost every Solidity design choice you will meet later.
  2. Write first contracts in Remix. Use the browser-based Remix IDE to write a simple storage contract and a counter, deploy them to its built-in test environment, and call functions. Watch how a write costs gas while a view function does not when called off chain.
  3. Learn types, mappings and visibility. Practice uint256, address, bool, structs, arrays and mappings, and the difference between storage, memory and calldata. Get clear on public, private, internal and external, remembering that private data is still readable on chain.
  4. Test everything with Foundry or Hardhat. Move to a local toolchain and write tests for every function, including failure cases with expected reverts. Foundry lets you write tests in Solidity and fuzz inputs, which catches edge cases you would not think of.
  5. Study security patterns and real exploits. Learn reentrancy, the checks-effects-interactions pattern, access control mistakes and unsafe external calls. Read well-reviewed libraries such as OpenZeppelin Contracts and work through intentionally vulnerable practice contracts to see attacks safely.
  6. Deploy only to testnets while learning. Deploy to a public testnet such as Sepolia using free test ether, never with real funds. Keep a daily Learnr lesson going on concepts like gas and storage while you build bigger contracts.

What you'll learn

  • Write contracts with state variables, mappings, structs and functions
  • Control access with modifiers, require and custom errors
  • Emit events and explain how gas costs shape contract design
  • Test contracts locally with Foundry or Hardhat and deploy to a testnet
  • Recognize common vulnerabilities such as reentrancy and access control flaws

How long does it take to learn Solidity?

A programmer can write and test simple contracts in 3 to 6 weeks at 5 to 7 hours a week. Writing contracts you would trust with real value takes much longer, often many months of studying security and reading audited code, plus independent review.

What you need before you start

Experience with at least one programming language, ideally JavaScript or another typed language, and a basic idea of how blockchains, transactions and public-key cryptography work.

Common mistakes to avoid

  • Deploying untested code with real funds. Smart-contract bugs can permanently lose money, so test thoroughly, use testnets, and get reviews before anything handles value.
  • Making external calls before updating state, which opens the door to reentrancy. Follow checks-effects-interactions and consider a reentrancy guard.
  • Assuming private variables are secret. Everything stored on a public blockchain can be read, so never keep passwords or keys in contract state.

How Learnr builds your course

Type your topic

Tell Learnr you want to learn Solidity, or get as specific as you like.

Get a personalized course

Learnr instantly builds a full Solidity course tailored to your goal and skill level.

Learn and level up

Move through bite-sized lessons and interactive practice, earning XP and keeping your streak.

Solidity questions, answered

Do I need to buy cryptocurrency to learn Solidity?

No. Remix's built-in environment, local test chains from Foundry or Hardhat, and public testnets with free test ether let you learn and deploy without spending real money.

Is Solidity like JavaScript?

The curly-brace syntax looks familiar, but Solidity is statically typed, compiled, and runs in a very different environment where every operation costs gas and code is hard to change after deployment.

What is gas in Solidity?

Gas measures the computation and storage a transaction uses. Writing to storage is especially costly, so contract authors design data layouts and loops carefully to keep transactions affordable.

Explore more courses

More programming and tech courses

See all programming and tech courses

Ready to learn Solidity?

Start your free, personalized Solidity course in seconds. It will be typed in and ready when you get there.

Start learning Solidity

Free to start. No credit card.