Smart contracts scared me. "Decentralized blockchain Ethereum gas fees"... it sounded like buzzwords.
Then I actually built one. It took 45 minutes. Here's how.
What Is a Smart Contract?
A smart contract is code that runs on a blockchain. Once deployed, it runs exactly as written — no middlemen, no servers to maintain, no downtime.
Think of it as a vending machine: put in the right input, get the right output. Guaranteed.
Setup: Remix IDE (Zero Installation)
Go to remix.ethereum.org. It's a browser-based IDE for Solidity. No installation needed.
Your First Smart Contract
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
contract SimpleStorage {
uint256 private storedNumber;
function store(uint256 number) public {
storedNumber = number;
}
function retrieve() public view returns (uint256) {
return storedNumber;
}
}
This contract:
- Stores a number on the blockchain
- Anyone can read it
- Only function calls can change it
Key Solidity Concepts
Data Types
uint256 count = 42; // unsigned integer (no negatives)
int256 balance = -100; // signed integer
bool isActive = true; // boolean
address owner = msg.sender; // Ethereum address
string name = "OTTO"; // string
bytes32 data; // fixed-size bytes
Visibility
uint256 public total; // anyone can read
uint256 private secret; // only this contract
uint256 internal base; // this contract + children
function myFunc() public {} // anyone can call
function myFunc() private {} // only this contract
function myFunc() external {} // only from outside
function myFunc() internal {} // this + children
Mappings (The Blockchain HashMap)
mapping(address => uint256) public balances;
function getBalance(address user) public view returns (uint256) {
return balances[user];
}
Events (Blockchain Logs)
event Transfer(address indexed from, address indexed to, uint256 amount);
function transfer(address to, uint256 amount) public {
// ... logic ...
emit Transfer(msg.sender, to, amount);
}
A Real Example: Simple Bank
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
contract SimpleBank {
mapping(address => uint256) private balances;
event Deposited(address indexed user, uint256 amount);
event Withdrawn(address indexed user, uint256 amount);
// Accept ETH deposits
function deposit() public payable {
require(msg.value > 0, "Send some ETH");
balances[msg.sender] += msg.value;
emit Deposited(msg.sender, msg.value);
}
// Withdraw your ETH
function withdraw(uint256 amount) public {
require(balances[msg.sender] >= amount, "Insufficient balance");
balances[msg.sender] -= amount;
(bool success, ) = msg.sender.call{value: amount}("");
require(success, "Transfer failed");
emit Withdrawn(msg.sender, amount);
}
function getBalance() public view returns (uint256) {
return balances[msg.sender];
}
}
Deploying on a Testnet (Free)
- Install MetaMask browser extension
- Switch to Sepolia Testnet
- Get free test ETH from a Sepolia faucet
- In Remix: select "Injected Provider - MetaMask"
- Hit Deploy
You just deployed a smart contract. No real money needed.
Security: The Big Rules
Smart contracts are immutable once deployed. Bugs = real money lost. Always:
1. Checks-Effects-Interactions Pattern
function withdraw(uint256 amount) public {
// CHECK
require(balances[msg.sender] >= amount);
// EFFECT (update state first)
balances[msg.sender] -= amount;
// INTERACT (then transfer)
payable(msg.sender).transfer(amount);
}
2. Use OpenZeppelin (Audited Libraries)
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
3. Never Trust User Input
require(amount > 0, "Amount must be positive");
require(amount <= MAX_LIMIT, "Amount too large");
What Can You Build?
- Token (ERC-20): launch your own cryptocurrency
- NFT collection (ERC-721): digital ownership
- DAO: decentralized voting/governance
- DeFi protocol: lending, swapping, yield
- On-chain game: provably fair, unstoppable
The Web3 Developer Market in 2026
Solidity devs remain in high demand. The average Solidity developer salary is $130K-$200K+ in 2026. Supply hasn't caught up with demand.
Learning path: Solidity basics → Hardhat/Foundry → OpenZeppelin → auditing → DeFi protocols.
Next Steps
- Complete the CryptoZombies tutorial (free, gamified)
- Read the Solidity docs
- Deploy your SimpleBank on Sepolia
- Join Developer DAO for community
The Web3 rabbit hole is deep. But it starts with one simple contract.
Tracking your crypto portfolio while you learn? Check out the tools at guittet.gumroad.com — including a DCA Crypto Bot in Python (€14.99) that tracks your investments automatically. 📊
Top comments (0)