Intro to Smart Contracts

If you're familiar with web3 fundamentals and already have your own crypto wallet, feel free to jump ahead to the next section!

Jump Ahead

Intro to Smart Contracts

A smart contract is a computer program compiled from code that can control events and actions according to the terms set within the contract’s code.

Much like vending machines, we can program smart contracts with various functions. Vending machines allow consumers to insert a currency and then press a button to execute that transaction. A refreshing soda or a candybar is dispensed, and any leftover change that the consumer is owed is dispensed as well.

Smart contracts can be programmed to accept payment and can return an item in place of that payment. An example of this would be a “mint” button on a project’s website. Minting is the process of taking a digital asset like a photo and publishing that asset to the blockchain. Many NFT projects with a minting website will have a smart contract designed so that whenever the buyer pays a specified fee, they can “mint” a project’s NFT. Then, the smart contract activates the function that accepts the buyer’s payment and follows that function up with another one that distributes a randomly-generated NFT to the buyer.

In another example, some websites allow you to swap one cryptocurrency into a different one. Popular sites like Uniswap have options to swap between many different cryptocurrencies. Each time a user goes to execute a swap, a function tied to a smart contract is triggered. Like the vending machine, the swapping smart contract accepts the user’s payment and then sends the user the currency they requested in return.


Writers: Kristen, Editors: Deborah Emeni, Christina Mills, Briseida Montiel