November 13, 2026
TL;DR
HelloWorld with a state variable, and a working ERC-20 token using OpenZeppelin.Solidity programming sounds intimidating because the stakes are high. A bug in a normal app gets patched. A bug in a deployed contract can drain funds permanently, because deployed code cannot be quietly changed.
That is the whole reason to start small. A “Hello World” contract teaches the full loop: write, compile, deploy, and call. The mechanics are the same for a token, an NFT, or a lending market. Only the logic in the middle grows.
You need three things to begin.
Do not use a wallet that holds real funds for development. Create a fresh MetaMask account and keep it separate.
Solidity is a statically typed, contract-oriented language that compiles to EVM bytecode. Its syntax borrows from JavaScript, C++, and Python. Variables have explicit types like uint256, bool, address, and string. Code is organized into contract blocks that resemble classes.
The latest stable release is 0.8.37, published in September 2026. Solidity 0.8 and later includes automatic overflow checks, so you do not need a separate SafeMath library for basic arithmetic.
Remix is the fastest path from zero to a deployed contract. It compiles and deploys in the browser, and it resolves imports like OpenZeppelin automatically.
HelloWorld.sol. Remix appends .sol if you omit it.solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract HelloWorld {
string public greet = "Hello, World!";
}// SPDX-License-Identifier: MIT declares the license. The compiler warns if it is missing.pragma solidity ^0.8.0; locks the compiler to 0.8.x. The caret allows any compatible 0.8 release but rejects a breaking 0.9.0.contract HelloWorld { ... } declares the contract, similar to a class.string public greet = "Hello, World!"; stores a string on-chain. The public keyword generates a free getter, so anyone can read greet without you writing a function.
Hello, World!.That is the full loop. You compiled Solidity to bytecode, deployed it to a simulated chain, and read state from it.
A fixed string is a start, but contracts become useful when state can change. Add one function.
solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract HelloWorld {
string public greet = "Hello, World!";
function setGreeting(string memory _newGreeting) public {
greet = _newGreeting;
}
}Recompile and redeploy. Under Deployed Contracts, you now see two buttons: greet (blue, read-only) and setGreeting (orange, writes state).
Reading greet is free. Calling setGreeting changes on-chain state, so it costs gas and requires a transaction. That distinction between reading and writing is the single most important concept in Ethereum development.
The Hello World contract proves the workflow. An ERC-20 token proves you can use Solidity programming for something people actually build. ERC-20 is the standard interface for fungible tokens, and OpenZeppelin provides audited, reusable implementations so you do not rewrite the basics.
MyToken.sol.solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.35;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract MyToken is ERC20 {
constructor(uint256 initialSupply)
ERC20("MyToken", "MTK")
{
_mint(msg.sender, initialSupply * 10 ** decimals());
}
}This imports the full ERC-20 implementation from OpenZeppelin and mints an initial supply to the deployer. The name is “MyToken” and the symbol is “MTK”. Change both to whatever you want.
MyToken.sol in the Solidity Compiler tab.1000000 for one million tokens.MyToken and call name, symbol, totalSupply, and balanceOf with your address. The values should match what you configured.
Remix VM resets when you refresh the browser. For a more realistic test, deploy to Sepolia.
If the deploy button does nothing, check that MetaMask is unlocked and connected to the correct network.
Solidity programming rewards precision. Most beginner losses do not come from exotic exploits. They come from a handful of repeated errors that are well documented and preventable.
A reentrancy attack happens when a malicious contract calls back into your function before your balance update completes. If you send ETH before setting the balance to zero, the attacker can withdraw repeatedly.
Vulnerable pattern:
solidity
payable(msg.sender).call{value: bal}("");
deposit[msg.sender] = 0; // too lateSafe pattern: apply Checks-Effects-Interactions.
solidity
deposit[msg.sender] = 0; // effect first
(bool success, ) = payable(msg.sender).call{value: bal}("");
require(success, "transfer failed");Use OpenZeppelin’s ReentrancyGuard with the nonReentrant modifier as a second layer of defense. Check first, update state second, interact with external addresses last.
If a mint function is public with no restriction, anyone can create tokens for themselves. That is not a bug in the compiler. It is a missing permission check.
Use an onlyOwner modifier or OpenZeppelin AccessControl:
solidity
modifier onlyOwner() {
require(msg.sender == owner, "not admin");
_;
}Set owner = msg.sender in the constructor and protect every privileged function.
Local variables of struct or array type default to memory, which is a copy. Changing the copy does not change the on-chain data. Beginners often “update” a struct and wonder why nothing persists.
Use storage when you need to modify persistent state:
solidity
User storage temp = user; temp.name = newName; // writes to storage
Use calldata for external function parameters that do not need modification. It is cheaper than memory because it references the input directly.
transfer() for ETH payoutstransfer() forwards a fixed 2300 gas stipend. If the recipient is a contract with logic in its receive function, the transfer reverts and your ETH can be stuck. Prefer call{value: ...}("") with a success check.
Safety note: This article is educational only and is not financial advice. Smart contracts carry permanent risk. Never deploy code holding real funds without testing, and consider a professional audit before launch.
Do I need to install anything to start Solidity programming?
No. Remix IDE runs entirely in your browser and includes a compiler and a simulated blockchain. You only need MetaMask when you deploy to a public test network.
What is the difference between Remix, Hardhat, and Foundry?
Remix is best for first contracts and quick experiments. Hardhat is a local development environment for scripted deployments and automated tests. Foundry is a Rust-based toolchain for fast test suites and larger codebases.
How much does it cost to deploy a smart contract?
On a testnet, it costs nothing real. On Ethereum mainnet, deployment costs gas paid in ETH. The exact amount depends on bytecode size and network conditions. Always test on Sepolia first.
Is Solidity the same as JavaScript?
No. Solidity borrows syntax from JavaScript, but it is statically typed, compiled to bytecode, and runs on the EVM. Concepts like gas, storage, and msg.sender have no direct JavaScript equivalent.
What version of Solidity should I use?
Use the latest stable 0.8.x release. Version 0.8 includes built-in overflow checks, which removes the need for SafeMath in most cases. Pin the pragma to a compatible range such as ^0.8.30.
Once your solidity programming setup is working, the next step is to move beyond Remix. Hardhat or Foundry gives you automated tests, and OpenZeppelin gives you audited building blocks. Keep your test wallet separate, test on Sepolia, and read every line before you deploy. For more developer guides, explore packprotv.com.
© 2026 PackProTV. All Rights Reserved.