Crypto and Blockchain Basics — Lesson 3

Smart Contracts, Tokens, and DeFi

13 min read

Learning Objectives

  • 1Explain smart contracts as programmable agreements.
  • 2Understand token creation and its business applications.
  • 3Evaluate DeFi concepts and their risk profile.

Smart contracts: code as agreement

A smart contract is code deployed on a blockchain that executes automatically when predefined conditions are met. It is not a legal contract — it is a program that enforces rules. "When payment is received, transfer ownership" or "when all three signers approve, release funds" are smart contract patterns.

Smart contracts are useful when the agreement between parties should execute automatically, transparently, and without requiring a trusted intermediary. Escrow, royalty payments, supply chain triggers, and conditional fund releases are potential applications.

The limitation is that smart contracts only know what is on the blockchain. They cannot verify real-world events without an oracle — a service that provides off-chain data to the blockchain. This creates a trust point: the oracle must be reliable for the smart contract to work correctly.

Tokens and tokenization

Tokens are digital assets created on existing blockchains. They can represent anything: access to a service (utility tokens), voting rights (governance tokens), ownership shares (security tokens), or unique digital items (NFTs — non-fungible tokens).

Tokenization — representing real-world assets as blockchain tokens — has potential applications in real estate, securities, collectibles, and intellectual property. The promise is more efficient transfer, fractional ownership, and transparent provenance.

The reality is that most token projects have struggled with regulation, market volatility, and the fundamental question of whether tokenization provides enough benefit over traditional systems to justify the complexity. Evaluate token projects with extreme skepticism — the failure rate is very high.

DeFi: decentralized finance

DeFi (Decentralized Finance) uses smart contracts to recreate financial services — lending, borrowing, trading, insurance — without traditional intermediaries. Instead of a bank approving a loan, a smart contract handles collateral, interest rates, and repayment automatically.

DeFi offers potential benefits: permissionless access, transparent rules, composability (DeFi protocols can be combined), and programmable financial logic. But it also carries significant risks: smart contract bugs, market manipulation, regulatory uncertainty, and the loss of consumer protections that traditional finance provides.

For most businesses, DeFi is currently more relevant as a concept to understand than a tool to use. The risks are substantial, the regulatory landscape is uncertain, and the complexity is high. Monitor the space but approach participation with extreme caution.

Case Study

The smart contract that could not be stopped

Situation

In 2016, "The DAO" — a decentralized investment fund on Ethereum — had $150 million in assets managed by smart contracts. A vulnerability in the smart contract code allowed an attacker to drain $60 million. The code worked exactly as written — the problem was that the code had a bug that the attacker exploited.

Analysis

This case illustrates a fundamental property of smart contracts: code is law. The contract executed as programmed, and there was no administrator, customer support, or legal authority that could reverse the transaction. The Ethereum community ultimately chose to reverse the transaction by modifying the blockchain itself — a controversial decision that split the community.

Takeaway

Smart contracts execute as coded, not as intended. Bugs in smart contracts can be exploited with no recourse. Audit smart contract code thoroughly before deploying significant value.

Reflection Questions

  • 1. For what business processes might automatic, code-enforced agreements be useful?
  • 2. What risks would you need to mitigate before using smart contracts for any business process?

Key Takeaways

  • Smart contracts are programs that execute automatically — they enforce rules, not intentions.
  • Tokens can represent various rights and assets but most token projects fail.
  • DeFi recreates financial services without intermediaries but carries substantial risk.
  • Smart contract bugs are exploitable with no recourse — code audit is essential.