Skip to content
Hexncoin
Track 4: DeFi & TokensLesson 1 of 3·6 min

Smart Contracts

Programs that run on-chain and power everything after money.

01

Code that is the agreement

A smart contract is a program whose state and execution are enforced by a blockchain. When someone calls it, the network applies the same rules to determine the resulting state rather than relying on one application server.

Contract bytecode and on-chain state are public, while readable source code is available only when a project publishes and verifies it. Deterministic execution is powerful, but bugs and unsafe permissions are enforced just as reliably as intended behavior.

02

Gas: paying for computation

Running contract code isn't free. Each operation costs gas, and you pay the total in the chain's native token. Gas both compensates validators and stops anyone from clogging the network with infinite loops.

When the network is busy, gas prices rise - the same transaction can cost cents one hour and dollars the next.

Concept map · schematic

What a swap actually consumes

Available depth along the execution route—not headline TVL—determines price impact.

  1. 01

    Trade size

    How much the user wants to exchange

  2. 02

    Available depth

    Executable liquidity at successive prices or bins

  3. 03

    Execution

    Output depends on fees, depth and route

Important: Pool TVL alone cannot determine slippage; request a fresh executable quote.

Self-check

Check your understanding

Choose an answer for each question, then check the results and explanations.

2 questions
Question 1

Question 1 / 2

What is a smart contract?

Question 2

Question 2 / 2

What is gas?

Primary references

Documentation and standards

References added

Official technical references for further verification. A source link is not a guarantee that every earlier editorial sentence has been reverified; provider specifications may also change over time.

The curriculum predates this reference index. These sources are offered to check technical details; no original publication date has been inferred.

Apply what you learned

Related practical guides

Continue learning