Skip to content
Back to Knowledge Base
Core Concept

What is a Smart Contract?

It’s not smart, and it’s not a contract. It is an unstoppable application that lives on the blockchain.

The Vending Machine Analogy

Coined by computer scientist Nick Szabo in the 1990s, the best way to understand a smart contract is to compare it to a vending machine. It removes the middleman (the store clerk) and replaces them with hard-coded logic.

Traditional Deal

Requires a lawyer or notary (Intermediary).

Can be breached or ignored.

Settlement takes days or weeks.

Smart Contract (Vending Machine)

Logic is baked into the machine.

Auto-secures funds until criteria are met.

Settlement is instant and atomic.

Core Properties

Immutable

Once deployed, the code cannot be changed. This guarantees that the rules of the game effectively cannot be rewritten by the creator later.

Distributed

The contract is replicated on thousands of nodes worldwide. There is no single server to hack or shut down.

Trustless

You don't need to trust the other party or a third-party intermediary. You only need to trust the open-source code.

Deterministic

Specific inputs will always produce the exact same output. The result is verifiable by anyone, anywhere.

How it Actually Works

1Write

Developers write contracts in high-level languages like Solidity or Vyper. The code defines the state variables (database) and functions (logic).

// Simple Storage Contract
contract Box {
uint256 private value;
// Stores a new value
function store(uint256 newValue) public {
value = newValue;
}
}

2Compile

The code is compiled into Bytecode (machine instructions for the EVM) and an ABI (Application Binary Interface), which tells applications how to talk to the contract.

0x608060405234801561001057600080fd5b50d3801561001d57600080fd5b50d2801561002a576000...

3Deploy

A transaction is sent to the network containing the bytecode. The network allocates an address (e.g., 0x4e6...), stores the code, and initializes the state.

Common Questions

Can a smart contract be deleted?

Generally, no. It can be 'self-destructed' if that function was written into the code originally, but this practice is now discouraged. Most contracts are permanent.

Are smart contracts legal contracts?

In most jurisdictions, no. They are simply software. However, they can be used to enforce legal agreements if structured correctly, but 'Code is Law' is a technical maxim, not a legal one.

How do contracts talk to the real world?

They can't directly. They live in a silo. To get data like stock prices or weather, they use 'Oracles' (like Chainlink), which are trusted bridges that push off-chain data onto the blockchain.