Crypto

What Is a Smart Contract?

By Lucas, CFGI ResearchUpdated June 28, 2026Reviewed by Jesse
Diagram of a smart contract: when a condition is met the contract code runs automatically and the action happens, with no bank or escrow in the middle.
Code that executes itself when its conditions are met. Source: CFGI.

Quick answer

A smart contract is a program stored on a blockchain that runs automatically when its conditions are met, with no middleman to approve it. It is the building block behind tokens, decentralised finance and most crypto apps. Because it is immutable once deployed, its code is final, which makes it powerful but also unforgiving if it contains a bug. The platforms that run them, led by Ethereum, each carry their own market mood, which CFGI scores separately. This is education, not financial advice.

CFGI data

Each smart-contract platform carries its own mood. CFGI scores them individually on a 0 to 100 scale, and Solana, the busiest chain after Ethereum, reached a high of 90 on 23 December 2023 during its breakout, refreshed every 15 minutes since March 2022. Platform sentiment can be read on its own.

Source: CFGI dataset, March 2022 to June 2026.

Key takeaways

What Is a Smart Contract?

A smart contract is a small program that lives on a blockchain. It holds a set of rules, and when the conditions are met it carries them out automatically. Think of a vending machine: put the right input in, and the output is released without anyone approving it. No bank, broker or lawyer sits in the middle. Ethereum was the first platform built for them, and most are still written there, though Solana and others compete to run the same kind of self-executing code faster and more cheaply.

How Smart Contracts Work

At their core, smart contracts are "if this, then that" logic written in code and deployed onto a blockchain, where the network’s thousands of computers all run and verify them. Once deployed, a contract is typically immutable: it cannot be changed or stopped, and it will execute exactly as written, by anyone, forever. Running it costs a small fee (often called "gas") that pays the network for the computation. The profound feature is that this makes agreements "trustless": because the code is transparent, public and self-enforcing, two strangers can transact without trusting each other or relying on a bank, a court or any middleman to enforce the deal, they simply trust the code, which cannot be bribed, cannot change its mind, and cannot refuse to perform. This is the idea captured in the phrase "code is law".

What Do Smart Contracts Power?

  • Tokens: most crypto tokens are simply smart contracts on a platform like Ethereum.
  • Decentralised finance (DeFi): lending, trading and saving without a bank, run by code.
  • NFTs and apps: ownership records and on-chain applications of every kind.
  • Stablecoins: many are issued and managed by smart contracts.
  • DAOs: member-run organisations whose rules are enforced entirely in code.

In short, almost everything in crypto beyond simply holding a coin, the entire world of decentralised applications, is built out of smart contracts. They are the foundational building block of the on-chain economy.

The Risks of Smart Contracts

The very feature that makes smart contracts powerful, their immutable, unstoppable nature, is also their greatest danger. Because a deployed contract cannot easily be changed, any bug or vulnerability in its code is permanent, and "code is law" cuts both ways: if a flaw lets an attacker drain the funds, the contract will faithfully execute that theft too, with no bank to reverse it and no recourse for the victims. The history of crypto is littered with costly exploits, from the infamous DAO hack to countless DeFi protocol drains, that have collectively cost users billions of dollars. Professional audits and battle-testing reduce the risk but never eliminate it. The lesson is sobering: a smart contract is exactly as trustworthy as its code, and interacting with an unaudited or poorly written one means trusting that its author made no mistakes, a trust that has often proven misplaced.

Code Is Law, for Better and Worse

Immutability makes smart contracts unstoppable, but it also means a bug is permanent. If a flaw lets funds be drained, the contract executes it faithfully, with no bank to reverse it.

Why Does Platform Sentiment Matter?

Because so much is built on a handful of platforms, the mood of each platform ripples through everything on top of it. When confidence in a platform rises or cracks, the tokens and apps that depend on it feel it too, a major outage, exploit or upgrade on a chain can shift the sentiment of its entire ecosystem at once. This is why treating "crypto" as a single mood misses so much: the fortunes of the leading smart-contract platforms can diverge sharply, as when Solana surged to a high of 90 during a breakout while other chains were far calmer. CFGI scores the major platforms individually on the Fear and Greed Index, so you can read Ethereum sentiment separately from Solana or the wider market, rather than treating all of crypto as one undifferentiated mood.

Crypto Fear and Greed Index, live

Loading the live score…

See the live index →

Read platforms individually on the directory.

See it live

Track the market mood in real time, free.

See the live Crypto Fear and Greed Index

Frequently asked questions

What is a smart contract?

A program stored on a blockchain that runs automatically when its conditions are met, with no middleman to approve it. Like a vending machine, the right input triggers the output, enforced by code rather than a bank or lawyer.

How do smart contracts work?

They are "if this, then that" logic deployed onto a blockchain, where the network runs and verifies them. Once deployed they are typically immutable and execute exactly as written, making agreements "trustless": you trust the transparent code, not a counterparty.

What are the risks of smart contracts?

Their immutability means bugs are permanent. "Code is law" cuts both ways: if a flaw lets an attacker drain funds, the contract executes that too, with no recourse. Exploits like the DAO hack and DeFi drains have cost users billions. Audits help but do not guarantee safety.

Which blockchains run smart contracts?

Ethereum is the largest and pioneered them, with Solana and others competing. CFGI scores the major platforms individually so their sentiment can be compared. This is education, not financial advice.

Lucas, CFGI Research

Lucas is the founder of CFGI and leads its research. He built the platform that scores Fear and Greed across 100+ crypto assets and the equity market from a 0 to 100, 10-indicator model, and has tracked crowd emotion through multiple full crypto and equity cycles. He writes about market sentiment, behavioural finance and how emotion shapes price.

Think we missed something?

Spotted a gap, disagree with a take, or think we should cover a new topic? Message us and we'll act on your input.

Message us on Telegram

Keep reading

This article is educational and is not financial advice. Crypto and equities are volatile and you can lose money. See our disclaimer.