Glossary

What Is a Smart Contract?

Intermediate · 5 min read
What Is a Smart Contract?

A smart contract is a program stored on a blockchain: code (what it can do) and state (what it currently stores) at a specific contract address. A smart contract is on-chain software that runs when someone calls it.

Definition

A smart contract is a program stored on a blockchain: code (what it can do) and state (what it currently stores) at a specific contract address.

In plain English:

A smart contract is on-chain software that runs when someone calls it. Same inputs, same rules — the network executes the code, not a clerk.

Traders care because wallet-first markets are mostly contract calls. A swap, a deposit, and many “approvals” are you authorizing code at an address to move value or change allowances under its rules.

In Trading

The real trading question

Knowing that “DEXs use smart contracts” is only the label. The useful question is:

Which contract am I calling, what can it do with my tokens or position after I sign, and do I understand that outcome well enough to pay gas for it?

If you cannot answer that at least roughly, you are not trading a venue — you are trusting a button.

How a call actually runs

  1. A developer deploys bytecode. The chain gives the contract an address.
  2. You (or a router you use) send a transaction that targets that address and names a function plus inputs.
  3. Validators / provers execute the same logic and agree on the result.
  4. Balances, pool reserves, allowances, or positions update on-chain. That settlement is normally final for you.

A simple mental model is a vending machine: correct payment and selection → item; wrong inputs → no item. The machine does not “decide to be nice.” It runs its rules. Smart contracts are the same idea with financial state.

Where traders meet contracts every day

Action you feel in the UIWhat often happens underneath
Connect walletApp reads your address; usually not a contract spend grant
Approve tokenYou set an allowance so a spender contract may pull that token later
Swap / tradeYou call a router or pool contract; it moves tokens per its math and permissions
Deposit / withdrawYou lock or release assets under vault or margin contract rules
Claim / mint / “verify” promptsOften a contract call or a signature that grants rights — treat as high attention

The website is a remote control. The contract is the machine that can touch funds.

Worked path: one swap clip

You want to buy TOKEN with USDC on a wallet-first venue.

  1. If the router needs permission, you first approve USDC spending for that router contract (or a permit-style signature that grants similar power).
  2. You sign a swap transaction aimed at the router or pool.
  3. The contract checks allowances, prices along its curve or matching rules, takes fees as coded, and writes new balances.
  4. You pay gas for the execution. If the call reverts, tokens may not move — gas can still be gone.

Nothing magic “in the app” completed the trade. The contracts did, after your key authorized the calls.

Two short trading scenes

Scene A — same logo, different contract.

A phishing site clones a familiar DEX layout. You connect and sign what looks like a routine approve. The spender address is an attacker contract, not the real router. The UI brand was theater. The allowance is real. Always read token, spender, and amount — not only the favicon.

Scene B — “immutable” product, upgradeable guts.

A protocol advertises audited contracts. The address you use is a proxy: your calls hit a stable front address while an admin can later point that proxy at new logic. Day-one bytecode at the implementation can be fine and still leave an upgrade key as a trust surface. The practical judgment is not “never use proxies.” It is “know whether logic can change, and who can change it,” then size exposure accordingly. Deep exploit catalogs belong on Smart Contract Risk.

Immutability, upgrades, and finality

  • Default story: once deployed, that bytecode does not silently rewrite itself in place. Bugs stay until users migrate or stop calling it.
  • Upgradeable story: many production systems separate a proxy address (what you call) from implementation logic (what runs). Replacing implementation can patch bugs — and can also change rules under admin or governance control.
  • Finality for the trader: a settled malicious drain, wrong approval, or bad swap path is rarely undone by support chat. Code execution does not come with a chargeback desk.

Oracles and other contracts (keep it light)

Contracts see on-chain state well. Many need oracles or other contracts for prices and external facts. Your risk is not only “this one file of Solidity” — it is the bundle of code and data dependencies your position relies on. Composability (contracts calling contracts) multiplies usefulness and multiplies surfaces.

Design moves before you sign

  1. Separate UI from address. Prefer verified links and known contract addresses from official docs or explorers.
  2. Read the permission. Approve and permit flows grant lasting power to a spender; unlimited allowances are convenience with a longer tail.
  3. Size the first touch. New or unaudited contracts deserve small clips, not full-size conviction.
  4. Budget gas and reverts. Execution cost is part of the trade; repeated failed experiments are still paid experiments.
  5. Ask if logic can move. Proxy plus admin is a different trust model than a frozen implementation.
  6. Stop on opaque signing. If the wallet shows undecodable data and the stakes are material, do not blind-sign — wait for clearer detail or skip.

On wallet-first venues such as edgeX, the habit is concrete: every trade path is a contract path. Sign as if the code — not the marketing page — will move the funds.

Don’t Confuse With

  • Smart contract ≠ traditional legal contract. On-chain code executes rules. It is not automatically a court-enforceable agreement just because the word “contract” appears. Legal effect depends on jurisdiction and facts; this page teaches the technical object traders touch.
  • Smart contract ≠ unhackable. Immutability means deployed logic is hard to patch in place. It does not mean the logic was correct. Bugs, bad permissions, and hostile upgrades are why Smart Contract Risk exists as its own topic.
  • Smart contract ≠ the website. Frontends can lie, geoblock, or disappear. Allowances and balances live with contracts and your keys.
  • Smart contract ≠ the token itself. A token contract defines a asset’s rules. A router or pool is a different contract you may approve and call.
  • Smart contract ≠ token approval. Approval is a permission record (often inside a token contract) naming a spender. The spender is commonly another smart contract. See What Is Token Approval?
  • Smart contract ≠ gas. Gas is the execution fee for running code or transferring value. Contracts are what that fee often pays to run.

Ready for the next step?

Continue to registration or trading from this page using the official links.

Start trading on edgeX

Disclaimer

This content is for educational purposes only and does not constitute investment advice. Trading digital assets and derivatives involves risk. Make sure you understand the products and consider your own circumstances before trading.