跳到主要内容
英国伦敦 · 创立于 1994 年
中文

Unit 4: Smart Contracts, Tokens and Platforms

What smart contracts are and where they go wrong, the main types of tokens and digital assets, and the platforms, oracles and applications built on blockchains.

Unit 4 of 5 · about 54 minutes

4.1 Smart contracts

Early blockchains were designed mainly to record transfers of a digital currency. Later platforms, most notably Ethereum, which launched in 2015, made it possible to store and run programs on the blockchain itself. These programs are called smart contracts. They allow blockchains to do much more than record payments: they can hold assets, enforce rules and coordinate actions between parties automatically.

What a smart contract is

A smart contract is a piece of code deployed to a blockchain that runs exactly as written when certain conditions are met. Like other blockchain data, its code and its record of actions are shared across the network, and its execution is checked by the nodes. Once deployed, many smart contracts cannot be changed, unless they were deliberately designed with an upgrade mechanism.

A simple way to think about a smart contract is as an "if this, then that" rule that nobody can quietly ignore. A familiar comparison is a vending machine: if the correct payment is inserted and a product is selected, the machine releases the product, without needing a shop assistant to decide.

Examples

  • Escrow: a buyer's payment is held by a contract and released to the seller automatically when delivery is confirmed.
  • Token issuance: a contract defines a token, records who owns how many units and enforces the rules for transferring them.
  • Parametric insurance: a policy pays out automatically if a measurable event occurs, such as a flight delay of more than three hours or rainfall below a set level, based on agreed data sources.
  • Supply chain payments: payment to a supplier is triggered when goods are recorded as received and inspected.
  • Voting and governance: token holders vote on proposals, and the contract counts votes and carries out approved actions.

Are smart contracts legal contracts?

Despite the name, a smart contract is not necessarily a contract in the legal sense. It is software that carries out actions. Whether a particular arrangement creates legally binding obligations depends on the applicable law and on the agreements between the parties. In many business uses, a conventional written agreement sits alongside the code, describing what the parties intend, how disputes are handled and what happens if the code behaves unexpectedly. Some jurisdictions have studied or clarified how existing contract law applies to smart contracts, but approaches vary.

Remember: A smart contract does exactly what its code says, which is not always what its authors intended. "Code is law" is a slogan, not a legal principle, and courts and regulators may take a different view.

Benefits

  1. Automation: fewer manual steps and less paperwork.
  2. Consistency: rules are applied the same way every time.
  3. Transparency: on public blockchains, anyone can inspect the code and the record of its actions.
  4. Reduced reliance on intermediaries: some functions previously performed by a trusted third party can be handled by code.

Limitations and risks

  • Bugs are costly: because contracts often hold valuable assets and may not be changeable, a single coding error can be exploited to drain funds. Many of the largest losses in the blockchain sector have resulted from smart contract vulnerabilities.
  • Rigidity: real business relationships involve judgement, exceptions and changing circumstances, which are hard to express fully in code.
  • Dependence on external data: a smart contract cannot see the outside world by itself, so it relies on data feeds, discussed later in this unit.
  • Running costs: on public networks, every action costs a transaction fee, often called "gas" on Ethereum, which varies with demand.
  • Privacy: on public blockchains, contract data is visible to everyone.

Good practice in development

Organisations building or relying on smart contracts usually apply strict controls: using well-tested standard code libraries, independent security audits by specialist firms, extensive automated testing, formal verification for high-value contracts, limits on the value held, emergency pause functions controlled by multisig governance, and "bug bounty" programmes that reward people for reporting vulnerabilities responsibly. Even so, audits reduce risk rather than eliminating it.

Before relying on a smart contract, ask whether it has been independently audited, whether the audit findings were fixed, who can upgrade or pause it, and what happens to assets if something goes wrong.

In practice

Suppose a procurement team is offered a smart contract system that releases payments to suppliers automatically. Useful questions include: which events trigger payment, and who records them? What happens if goods arrive damaged or partly complete? Is there a legal agreement covering disputes? Can a payment be stopped if fraud is suspected? A design that handles exceptions and disputes clearly is far more valuable than one that only works when everything goes to plan.

4.2 Tokens and digital assets

A token is a digital unit recorded on a blockchain that represents something of value or a right. Tokens are usually created by smart contracts on an existing blockchain, rather than requiring a new blockchain of their own. They have become one of the most widespread uses of blockchain technology and one of the areas of greatest regulatory attention.

Native coins and tokens

It is useful to distinguish between a blockchain's native coin, such as bitcoin on the Bitcoin network or ether on Ethereum, which is built into the protocol and used to pay fees and reward validators, and tokens, which are created on top of a platform by smart contracts. Shared technical standards define how tokens behave, so that wallets and applications can handle many different tokens in the same way.

Fungible and non-fungible tokens

  • Fungible tokens are interchangeable, like banknotes: one unit is equivalent to any other unit of the same token. They are used for digital currencies, loyalty points and shares in an asset.
  • Non-fungible tokens (NFTs) are unique, each with its own identifier. They can represent ownership records for digital art, event tickets, certificates or a specific physical item. An NFT usually points to the item or file rather than containing it, and owning an NFT does not automatically grant copyright or other legal rights in the underlying work unless the terms say so.

Common categories of tokens

CategoryDescriptionExample use
CryptocurrencyNative or independent digital currency with a market-determined valuePeer-to-peer payments, paying network fees
StablecoinToken designed to keep a stable value, usually against a national currencyTrading, cross-border transfers, settlement
Utility tokenGives access to a product or service on a platformPaying for data storage on a network
Security or tokenised assetRepresents rights such as ownership, debt or a share of profitsTokenised bonds, fund units or property shares
Governance tokenGrants voting rights over a protocol or organisationVoting on changes to a lending platform

The same token can fit more than one category, and regulators look at its economic substance rather than its label.

Stablecoins

Cryptocurrency prices can move sharply, which makes them impractical for many everyday uses. Stablecoins aim to maintain a stable value, usually one unit of a national currency such as the US dollar or the euro. The most common type is backed by reserves of cash and short-term government securities held by the issuer. Others are backed by crypto-assets or rely on algorithms. Algorithmic designs have a poor record: at least one large algorithmic stablecoin collapsed in 2022, causing heavy losses. The quality, transparency and legal protection of reserves are key questions for any stablecoin, and several jurisdictions now regulate stablecoin issuers specifically.

Central bank digital currencies

Many central banks are researching or piloting central bank digital currencies (CBDCs): digital forms of national currency issued directly by the central bank. Some designs use distributed ledger technology and others do not. CBDCs differ fundamentally from cryptocurrencies, because they are issued and controlled by a public authority and represent a claim on the central bank.

Tokenisation of real-world assets

Tokenisation means representing rights to an existing asset, such as a bond, fund, property or commodity, as tokens on a blockchain. Supporters argue it can enable faster settlement, operation outside normal business hours, smaller ownership units and easier transfer. Financial institutions have run a number of pilots and issued tokenised bonds and fund units. The token, however, is only as good as the legal arrangement linking it to the underlying asset: if that link is unclear, the holder may have no enforceable right.

Tip: For any token, ask three questions: what right does it actually give the holder, who stands behind that right, and what law governs it? Clear answers matter far more than the technology.

Risks for holders

  1. High price volatility for most cryptocurrencies and many tokens.
  2. Fraud, including tokens promoted with misleading promises and then abandoned.
  3. Failure of issuers, exchanges or custodians.
  4. Limited or no investor protection in some cases.
  5. Smart contract vulnerabilities in the code that defines the token.

This course is general education and does not provide investment advice.

In practice

If a colleague suggests launching a loyalty token, you can bring clarity by asking: is it fungible or non-fungible? Could it be traded, and if so, might it be treated as a financial product? Who issues it, and what happens if the scheme ends? Does it need a blockchain at all, or would a conventional points database do the same job more simply?

4.3 Platforms, oracles and decentralised applications

Blockchain technology is delivered through a wide range of platforms and surrounding services. This lesson gives an overview of the landscape, introduces the role of oracles in connecting blockchains to the outside world, and explains decentralised applications, decentralised finance and decentralised autonomous organisations.

Public platforms

Public blockchains differ in their purpose and design:

  • Bitcoin focuses on being a digital currency and store of value, with a deliberately limited programming language and a conservative approach to change.
  • Ethereum is a general-purpose platform for smart contracts and tokens, with a large ecosystem of developers, applications and layer 2 networks.
  • Other smart contract platforms make different trade-offs, often aiming for higher speed or lower fees, sometimes at the cost of decentralisation.

When evaluating a public platform, consider its security track record, how decentralised its validators are, fees and speed, the size and maturity of its developer community, and how its rules are changed.

Enterprise platforms

For permissioned business networks, organisations often use enterprise-focused frameworks. Examples include Hyperledger Fabric, an open-source project hosted by the Linux Foundation, and Corda, designed with financial services in mind. These typically support known identities, private data sharing between subsets of members, flexible consensus and integration with existing systems. Major cloud providers have offered managed blockchain services, although some have later withdrawn them, which illustrates the importance of considering long-term support.

Oracles

Smart contracts cannot access information outside their blockchain by themselves. A contract that pays out on flight delays cannot check an airline's website. Oracles are services that bring external data, such as prices, weather readings, shipment events or sports results, onto the blockchain so that contracts can use it.

Oracles create what is often called the oracle problem: a blockchain may be highly tamper-resistant, but if the oracle feeding it is wrong or manipulated, the contract will act on false information. Common safeguards include:

  1. using several independent data sources and combining them;
  2. using decentralised oracle networks where many providers report and are penalised for false data;
  3. signing data at the source, for example by a trusted sensor or institution;
  4. setting limits and delays so that extreme values can be checked before large payments are made.

Remember: A system is only as trustworthy as its weakest link. For many blockchain applications, that link is the point where real-world data enters the chain, not the chain itself.

Decentralised applications

A decentralised application, or dApp, uses smart contracts on a blockchain for some or all of its core logic, usually with a conventional web or mobile interface. Users connect their own wallets rather than creating an account with a company. In practice, many dApps still depend on centralised components, such as the website hosting the interface or the company that develops the code, so the degree of decentralisation varies widely.

Decentralised finance

Decentralised finance, or DeFi, refers to financial services such as trading, lending and borrowing provided through smart contracts rather than through traditional institutions. For example, decentralised exchanges let users swap tokens using pools of assets supplied by other users, and lending protocols let users borrow against crypto collateral. DeFi has demonstrated new ways of building financial services, but it has also experienced frequent hacks, manipulation of price oracles, sudden collapses and use by criminals. Regulators in many countries are considering how existing financial rules apply to it.

Decentralised autonomous organisations

A decentralised autonomous organisation (DAO) is a group that coordinates decisions and manages shared funds through smart contracts and token-based voting. Members propose and vote on actions, and approved actions can be carried out automatically. DAOs raise unresolved questions about legal status, liability of members and how voting power is distributed, and several jurisdictions have begun to address their legal treatment.

Interoperability

Because there are many blockchains, moving assets and data between them is a growing need. Bridges lock assets on one chain and issue equivalents on another. They have been the target of some of the largest thefts in the sector, because they often hold large pools of assets and involve complex code. Standards and messaging protocols for interoperability continue to develop.

In practice

When assessing any blockchain-based service, draw a simple map of its components: the blockchain, the smart contracts, the oracles, any bridges or layer 2 networks, the user interface, the wallets and the organisations behind each. Then ask, for each component, who controls it and what would happen if it failed. This exercise often shows that a service described as "decentralised" relies on a small number of central points.

Case study: Designing a parametric insurance pilot

Haverleigh Mutual, a fictional agricultural insurer, wanted to offer small farms a simple policy that would pay out automatically if rainfall during a growing season fell below an agreed level. The innovation team proposed using a smart contract on a permissioned network shared with two reinsurers.

The compliance and claims teams raised several questions. Where would the rainfall data come from? The team agreed to use readings from two independent weather data providers, with the contract using the lower of the two values only if they differed by less than an agreed margin; otherwise, a human claims handler would review the case. The contract was independently audited, and a pause function could be triggered by two of three senior managers.

The team also confirmed that the policy wording, written in plain English and governed by the insurer's usual contract law, remained the legal agreement, with the smart contract acting as the payment mechanism. Payments were made in the national currency through the insurer's normal banking channels. Farmers' personal details were kept off the chain, which recorded only policy references and payment triggers.

Activity

Choose a simple agreement that involves a payment triggered by an event, such as a deposit returned at the end of a rental or a bonus paid when a delivery arrives on time. Describe how a smart contract could automate it, what external data it would need and where that data would come from. List two things that could go wrong and how you would handle them.

Compare with a model answer

A good answer clearly states the rule, for example: if a parcel is scanned as delivered before the agreed deadline, release a bonus payment to the courier. It identifies the data needed, such as delivery scans and timestamps, and a credible source, such as the logistics platform's signed data feed acting as an oracle.

It names realistic problems. The data feed could be wrong or manipulated, so the answer might use a second confirmation, such as the recipient's acknowledgement, or allow a review period before payment. A dispute about whether goods arrived damaged cannot be judged by code, so a written agreement and a human review process are needed. Strong answers also mention testing, an independent audit and whether a blockchain is genuinely needed.

Key takeaways

  • Smart contracts are programs on a blockchain that run exactly as written; they enable automation but are not automatically legal contracts.
  • Coding errors in smart contracts can be exploited to drain funds, so audits, testing, value limits and governance controls are essential.
  • Tokens can be fungible or non-fungible and include cryptocurrencies, stablecoins, utility, governance and tokenised assets; what matters is the right a token gives and who stands behind it.
  • Oracles bring external data onto blockchains and are often the weakest link, so they need independent sources and safeguards.
  • DeFi, DAOs and bridges show new possibilities but carry significant technical, legal and security risks.

Unit check

Create a free account to answer the check, save your progress and receive your free certificate.

Create a free account Log in
← Unit 3 Unit 5 →
WhatsApp