ThePathMark
Chapter 10 Core concepts Low risk

What is a smart contract?

Programmable rules on a blockchain that can hold and move money — not a legal contract, but the code behind almost every DeFi action.

The short version
  • A smart contract is code deployed on a blockchain that runs automatically when conditions are met — swaps, lending, bridges, and token rules all use them.
  • It is not a lawyer's contract. The name is metaphor: if-this-then-that logic that can custody assets without a bank in the middle.
  • You interact by signing transactions from your wallet; the contract address is the program you are talking to.
  • Contracts can have bugs, admin keys, or copycat phishing clones — verify addresses from official docs before you deposit.

A smart contract is a program stored on a blockchain that runs when someone triggers it. It can hold tokens, enforce rules, and move money according to code — no human clicking approve on each step.

The name sounds legal. It is not. Think vending machine with rules baked in: put in the right input, get the defined output. Nobody negotiates with the machine.

For where that code runs, see What is the EVM?. For apps built on top, see What is a dApp?.

01

What it actually is

Normal softwareSmart contract
Runs on a company’s serversRuns on a blockchain every node verifies
The company can change behaviorOften hard or impossible to change after deploy
You trust the operatorYou trust the code (and who wrote it)

Developers write contracts in languages like Solidity, compile them to bytecode, and deploy them to an address on-chain. That address is the contract’s permanent home. Anyone can call it if they pay gas (gas fees guide).

02

What they do in DeFi

Examples you will hit as a beginner:

UseWhat the contract enforces
Token swap”Send X USDC, return Y ETH at this price formula.”
Lending pool”Track deposits, charge interest, liquidate if collateral falls too low.”
Bridge”Lock tokens here; mint wrapped tokens on another chain.”
ERC-20 token”Track balances and transfers for this ticker symbol.”
Approval”This address may move up to N of your tokens.” (token approvals)

The website you click is often just a frontend. The contract holds the pool and enforces the math.

03

How you interact with one

  1. Connect your wallet to a dApp.
  2. The site proposes a transaction — which contract, which function, which amounts.
  3. You sign in your wallet. Signing does not give away your private keys.
  4. The network runs the contract code. You pay gas for the computation.

Always check:

  • Network — Ethereum, Arbitrum, HyperEVM (chain 999), etc. (crypto networks)
  • Contract address — from official docs or a block explorer, not a random link in a DM
  • What you are approving — especially unlimited token permissions
04

Key properties and risks

Deterministic — same inputs, same outputs on every node. That is how the ledger stays in sync.

Public — contract code and balances are visible on a block explorer. Privacy is limited.

Immutable (often) — bugs may be permanent if there is no admin key to upgrade the contract.

Upgradeable (sometimes) — a team may retain keys to pause or change logic. Read the docs.

Common risks:

  • Smart contract bugs or exploits — funds locked in broken or hacked code
  • Phishing frontends — a fake site pointing at a malicious contract with a familiar name
  • Admin rug — privileged keys draining or changing the protocol
  • Failed transactions still cost gas — the network attempted the work
⚑ One honest flag

A smart contract is not automatically safe because it is “on-chain” or “decentralized.” Treat every new contract like a stranger holding your money until you understand what it does and who can change it.

Related: What is the EVM? · What is a dApp? · Token approvals

If this cleared something up, you can buy me a coffee — or say hi on X.

← All guides