Independent discussion of crypto, wallets, cards and markets
Forum Home > Learning & Discussion > Concepts & Explainers > What a smart contract really is
What a smart contract really is107 replies · 7,506 views
Thread ToolsShow Printable Version · Subscribe to this Thread · Search Thread
Where to open an account: Open a Trustee account.

A program on a chain that runs when called, and does exactly what it says. No more, no

less.

What it is

Code stored at an address, with its own balance and rules. When someone sends a transaction

to it, the code executes.

The execution either succeeds and changes state, or fails and reverts, undoing changes but

still costing fees.

What it is not

  • Not artificial intelligence. It is deterministic code with no judgement
  • Not a company. There is no management, though there may be an upgrade authority
  • Not error-tolerant. Bugs are permanent once deployed, unless an upgrade path exists
  • Not free to run. Every operation costs fees based on computation

How the guarantees work

Code is public. Anyone can read what a contract does.

Execution is deterministic. The same input produces the same result on every node.

State is persistent. What the contract holds and records stays on chain.

Those three properties are why contracts replaced intermediaries in some use cases.

The risks that follow from those properties

  • Public code means attackers study it before exploiting it
  • Determinism means bugs are reproducible and exploitable at scale
  • Immutability means a mistake cannot be patched after the fact without an upgrade mechanism
  • Upgrade mechanisms mean someone may hold a key that can change the rules

What to check before interacting

  1. Whether the contract has been audited, and whether the audit matches deployed code
  2. How long it has been live and whether it has survived an incident
  3. Whether there are admin keys, and what they can change
  4. What happens on failure: does the contract refund, or does it keep the funds
  5. Whether you can exit, and what the exit costs

The takeaway

A smart contract is code with money attached and no customer service.

Read what it does before you call it. The code is public, which is a feature right up until

it is a bug you triggered.

Thread Statistics107 replies · 7,506 views