When someone interacts with it, it checks if the rules are met, and if they are, it automatically does what the code says.
This could be sending tokens, giving access to something, or anything else the code is programmed to do.
Once a smart contract is deployed to the blockchain, it cannot be edited, paused, or tampered with. It will always run the same way for everyone.
Every step it takes is recorded publicly, and anyone can verify what it does.
Using the same analogy we used a couple of sections ago:
A smart contract is like a vending machine. You put in your money, press a button, and the machine checks everything before giving you your snack and your change.
Now imagine that same vending machine can handle more useful actions. You could use it to rent a scooter for an hour. You pay the fee, and it unlocks the scooter.
No person is needed to approve anything. If the conditions are met, it just works.
And because this vending machine runs on the blockchain, the rules are public and cannot be changed secretly. Everyone can trust it to do exactly what it says, every time.
By introducing smart contracts, Ethereum expanded what blockchains are capable of.
It gave developers a way to build rules, logic, and systems on top of money itself.
This is what people mean when they call Ethereum programmable money. It does not just move funds, it can also enforce agreements and run logic that is built into the network itself.
b) How They Work
Smart contracts are written in programming languages designed for blockchains. The most common is Solidity, used for Ethereum.
Once the code is ready, it is deployed to the blockchain, where it becomes permanent.
After deployment, the contract has its own address. Anyone can interact with it, unless it includes code that blocks certain users or restricts access.
It listens for inputs, checks whether the rules are met, and then performs the action it was programmed to do.
A smart contract can be as simple as "if someone sends 1 ETH, they get access to a product," or as complex as managing a DeFi platform or an entire game.
You can inspect and interact with smart contracts using tools like Etherscan, where you can see their code, transactions, and activity.
We will explore utilising blockchain scanners like Etherscan to interact with smart contracts directly in Module 2.2.1.
c) What Smart Contracts Are Used For
Smart contracts are what take blockchains from just handling payments to supporting entire apps, platforms, and systems.
They allow developers to build tools that operate without a central authority, all through code that runs automatically on-chain.
Here are some of the most important ways smart contracts are used today:
Decentralized Finance (DeFi)
Smart contracts are the foundation of DeFi.
They let people lend, borrow, trade, and earn interest on their crypto without needing a bank or middleman. Everything is run by code on the blockchain.
For example, platforms like Aave and Compound use smart contracts to manage lending pools.
Users deposit crypto into these pools to earn interest, while borrowers take out loans by putting up their own crypto as collateral.
The smart contract handles all of it: calculating interest, tracking repayments, and even liquidating loans if collateral drops in value.
On Uniswap and other decentralized exchanges(DEX's), smart contracts handle all the trading.
Instead of matching buyers and sellers, users trade against shared pools of tokens, which are like a basket containing both the tokens you intend to trade between.
These shared baskets are called liquidity pools(LP'S)
Essentially, when you buy token A using token B, let's say buying $ETH with $USDC, you are sending token B into a smart contract, and the smart contract sends you token A in return.
The smart contract holds a balance of both tokens at it's own address.
The pool always has enough to make the trade happen, and the prices are adjusted automatically based on supply and demand.
Analogy:
...
Now imagine this vending machine does not restock itself.
Instead, people from the community fill it up with snacks and drinks. In return, every time someone buys something, the machine gives those contributors a small share of the payment as a reward.
That is what a liquidity pool is. You are not trading with another person directly, you are trading with the vending machine, which uses whatever is inside of it to complete the transaction.
The smart contract running the machine keeps track of what is added, what is removed, and how much each contributor is owed. It also adjusts the prices based on how much of each item is left.
Just like the machine needs to stay stocked to keep working smoothly, liquidity pools need enough tokens inside them to allow trades to happen quickly and fairly.
Smart contracts in DeFi are also used for more complex tools like yield farming, decentralized insurance, etc.
Token Creation and Management
Smart contracts are used to create and manage tokens across many blockchains, not just Ethereum.
Networks like BNB Chain, Avalanche, Polygon, Base, Arbitrum, and Solana all support token creation through their own smart contract standards.
These standards are rules that specify how tokens should be created, transferred, and interacted with, so they work smoothly with wallets, exchanges, and other apps on the network.
Most tokens follow widely accepted formats, such as ERC-20 for Ethereum-compatible chains or SPL on Solana.
The contract acts as the rulebook. Once it is deployed, everything from buying and selling to tracking balances happens automatically according to the logic written into the contract.
Token Launches and Fundraising
Smart contracts are used to launch new crypto tokens and manage fundraising events like initial Coin Offerings (ICOs) or Token Generation Events (TGEs).
The contract sets the rules, such as how many tokens are created, who can receive them, and under what conditions they can be transferred.
Pinksale Example - Rules set on an IDO sale, managed by a Smart Contract
In a token sale, the smart contract might say, "For every 1 ETH sent to this address, send back 1,000 tokens."
It automates distribution, enforces limits, and keeps a transparent record of who contributed.
Non-Fungible Tokens(NFTs)
Every NFT is powered by a smart contract.
When an NFT is created, or "minted", a contract records its details on the blockchain. This includes who owns it, what digital item it points to, and how it can be transferred.
Smart contracts can also handle royalties, so every time the NFT is sold on a secondary market, a percentage automatically goes back to the original creator.
In virtual worlds like Decentraland, smart contracts control land ownership, wearables, and interactions inside the world.
Access Control and Subscription Models
Smart contracts can be used to control access to digital services, memberships, or content.
For example, a contract might check if your wallet holds a specific NFT or token. If it does, it unlocks access to a site, group chat, a piece of content, etc.
This is already being used for token-gated communities, exclusive Discord channels, or blockchain-powered streaming platforms.
Token Gated Discord
Some projects even use smart contracts for recurring subscription models, where a small payment grants temporary access and renews automatically as long as payments continue, like any other Web2 subscription service.
Real World Applications
Developers are also experimenting with smart contracts in areas like supply chain tracking, digital identity, voting, thehealthcare system, etc.
We will cover these in Module 1.2.4 .
d) Smart Contract Standards
Smart contracts are not all written from scratch. Most blockchains that support tokens use shared standards to keep things consistent.
These standards define how tokens behave, how they move between users, and how apps and wallets interact with them.
Following a common format makes everything more compatible. It means a wallet or exchange can support thousands of tokens without needing custom rules for each one.
Below are some of the most widely used standards across Ethereum and other smart contract platforms:
ERC-20(Ethereum Request for Comment)
ERC 20 is the standard used to create fungible tokens on Ethereum, where each token is equal in value and interchangeable with any other.
The contract handles things like balances, transfers, and who is allowed to move tokens on someone’s behalf.
It is the format behind most of the tokens you see in DeFi, governance systems, meme coins and payment tokens.
ERC stands for Ethereum Request for Comment, and any token following an ERC standard is built to run on the Ethereum Virtual Machine, which is the part of Ethereum that runs smart contracts.
That means ERC 20 tokens are not just used on Ethereum, but also on EVM-compatible blockchains like Polygon, BNBChain, Avalanche, Arbitrum, and others.
ERC-721(NFT's)
This was the first major standard for non fungible tokens, or NFTs.
Each token is unique, with its own metadata and ownership record.
It is used for digital art, collectibles, and other assets where uniqueness matters.
In the above picture, you can see that ERC-20 tokens are all equal in value, like one dollar bills. Each token is interchangeable with another.
NFTs, on the other hand, are more like different bills such as five and ten dollars. Even if they are from the same collection, each one can have a different value and unique features.
ERC-1155
ERC-1155 expands on the previous standards by allowing a single contract to manage multiple types of tokens.
It can handle both fungible AND non fungible tokens efficiently and supports batch transfers.
This is ideal for games and digital marketplaces where many assets need to be managed in one place.
SPL (Solana Program Library)
On Solana, tokens follow the SPL standard.
Like ERC 20, SPL defines how fungible tokens behave, including how they are transferred and tracked.
The main difference is that SPL is designed specifically for Solana’s architecture, which uses a completely different system than Ethereum and does not rely on the Ethereum Virtual Machine(EVM).
This allows for faster and cheaper transactions, but also means SPL tokens are not compatible with EVM-based tools and require their own set of wallets and apps.
Solana also supports its own version of NFTs, built using the same base standard but with different metadata structures.
Many more
Ethereum and Solana are not the only networks with token standards.
Other blockchains like Tezos, Cardano, NEAR, and Cosmos use their own formats to define how tokens are created and interact with apps.
These standards vary from chain to chain but serve the same basic function.
They define how tokens move, how they are stored, and how smart contracts and wallets handle them.
e) Smart Contracts Risks
As we now know, smart contracts offer a powerful way to automate transactions and remove the need for middlemen, but they are not without risks.
Once a smart contract is deployed to the blockchain, it is usually permanent. That means any bug, mistake, or hidden function in the code cannot be easily fixed or removed.
This feature is part of what makes smart contracts trustworthy, but it also introduces serious limitations.
Smart Contract Risks
Poorly written code is one of the biggest dangers. If a contract has a vulnerability, attackers can exploit it to steal funds or manipulate the system.
A well-known example is a hack called "The DAO" in 2016, where a flaw in the contract allowed someone to drain millions of dollars in ETH. It was one of the earliest and most costly lessons in how critical secure coding and proper audits are.
Even when a smart contract is functioning as intended, it may contain hidden permissions that are not obvious to most users, some can even fool experienced ones.
These can give the creator or owner special control over the contract that can later be used to manipulate the contract in ways that benefit them at the expense of users.
We will look at the 2 types of smart contract risks, bad code and bad intentions, in a later module, as they require deeper blockchain knowledge to fully understand.
Smart contracts are what turn blockchains into more than just digital ledgers. They bring automation, logic, and functionality to a system that runs without central control.
But with that power comes risk. Because they cannot be changed once deployed, smart contracts need to be written carefully and read thoroughly.
They are tools that can be used to build new systems and communities, but they can also be used to trick investors if hidden features or malicious code are written into the code.
We will dive into tools to scan smart contracts and alert you of red flags in Module 2.2.2 . We will also look into how to interact directly with them in Module 2.2.1.
Understanding how smart contracts work and how to recognize red flags gives you a serious advantage. It helps you interact with crypto safely and confidently, which is the whole point of The Pepper Academy.