< How Blockchain Works

Lesson 3: Beyond Currencies

45 minutes

Overview

Students learn about ways that Blockchain technologies can be used for more than cryptocurrencies with digital “smart contracts”. Using an Input - Processing -Storage - Output model, students create their own “smart contracts” to represent different situations. Then students analyze each other’s contracts for vulnerabilities from the perspective of someone looking to hack or exploit the contract.

Agenda

Objectives

Students will be able to:
  • Create a smart contract and analyze it for vulnerabilities
  • Explain how smart contracts use input, output, storage, and processing

Preparation

  • Review the slides and activity guides from the lesson.
  • Have post-its available for students to leave feedback during a gallery walk
  • (Optional) Have Poster Paper / Whiteboard space for students to work on

Links

Heads Up! Please make a copy of any documents you plan to share with students.

For the teachers
For the students

Vocabulary

  • Asset - Something you own that is valuable. Often, assets are exchanged or converted into currency.
  • Input - The information computers get from users, devices, or other computers
  • NFT (Non-Fungible Token) - An asset, tracked on the blockchain, associated with ownership of digital collectibles, artwork, or items in a game
  • Output - The information computers give to users, devices, or other computers
  • Processing - The thinking work computers do to turn input into output
  • Smart Contract - An autonomous program that ensures rules of a transaction are followed without the need for legal contracts
  • Storage - Saving information to use in the future

Teaching Guide

Before the Lesson

Preparing for Experiential Learning

This lesson is designed to create an immersive experience for students, where they participate in an activity or simulation which motivates the learning goals of the lesson. This creates a social, memorable, and engaging experience for students that helps transfer learning from this lesson to other aspects of their life, especially if this is the only lesson students engage in on this topic.

The pedagogy and teaching moves used in this lesson are based on Experiential Learning, which follows an Experience <> Reflect <> Think <> Act cycle. The teacher curates and guides an experience that students participate in, then students reflect on the experience leading to abstraction and meaning-making of the concepts embedded in the experience.

Because of the experiential nature, this lesson may feel messy and the classroom may feel chaotic. However, there may also be moments to elevate students' lived experiences and to capitalize on "teachable moments".

Preparing to Teach Blockchain

This lesson centers around the How Blockchain Works: Beyond Currencies video - watch this video first before exploring the lesson plan. In this particular lesson, students watch the video first which introduces key concepts and vocabulary that students will use in their activity.

(Optional) If you want to dive deeper into blockchain and cryptocurrency concepts to be prepared for student questions, consider reading the Teaching How Blockchain Works - Tips & Resources doc.

(Optional) Teaching with Code.org

If you intend to teach all of the lessons and this is your first time using Code.org, consider watching our Getting Started with Code.org video series for an overview of how to navigate lesson plans, setup a classroom section, and other important features of the Code.org platform. Each video also has a support article if you'd prefer to read or print instructions - click here to learn more.

Warm Up (5 minutes)

Prompt: Imagine you go out to dinner with a large group of friends where each person orders their meal. When the bill comes, they’re not able to split it individually - the group needs to handle it themselves.

How would you go about trying to split the bill? What are important factors to consider? How can you be sure it’s being done fairly?

Discussion Goal: There is no one right answer to this prompt - instead, this scenario helps motivate the complexities of executing an agreement amongst a group of people. Students may consider the cost of each person’s meal and whether or not someone ordered a drink, or students may go the “simple route” and split the entire check evenly which means some people may be paying more or less than their meal would have been individually.

Remarks

This scenario is just one example of how trying to coordinate with a large group of people fairly and efficiently can be difficult. Today we’re going to look at how technology can help with this - specifically, how Blockchain technology could offer some solutions to this scenario.

Activity (35 minutes)

Blockchain & Smart Contracts (15 minutes)

Distribute: Hand out a copy of Vocabulary Matching notetaker to each student.

Video: Watch the How Blockchain Works: Beyond Currencies video as a class

Vocabulary: Display the vocabulary slide and allow students to check their responses from their vocabulary notetaker.

  • Smart Contract - An autonomous program that ensures rules of a transaction are followed without the need for legal contracts
  • NFT (Non-Fungible Token) - An asset, tracked on the blockchain, associated with ownership of digital collectibles, artwork, or items in a game
  • Asset - Something you own that is valuable. Often, assets are exchanged or converted into currency.

Remarks

A smart contract is how Blockchain would solve the problem from the warm-up - it could look at what each person ate, determine how much each person should pay, and automatically pool the correct money together to pay the restaurant. Just like a computer, smart contracts use four essential components to function: input, processing, storage, and output.

Video: Watch the What Do Computers Do? video, which introduces the input - processing - storage - output model for how computers work.

Vocabulary: Display the vocabulary slide and allow students to check their responses from their vocabulary notetaker.

  • Input - The information computers get from users, devices, or other computers
  • Output - The information computers give to users, devices, or other computers
  • Processing - The thinking work computers do to turn input into output
  • Storage - Saving information to use in the future

Prompt: In the restaurant scenario...

  • What are the inputs?
  • What is being processed?
  • What is being stored?
  • What are the outputs?

Circulate: Have students discuss with their neighbors or in small groups, but don’t have them share as full group. Instead, be listening for insights that match the smart contract example that will be revealed in the next section. This can be an opportunity to highlight student insights from small group conversations as they match the next part of the activity.

Remarks

I heard some great insights into how this situation could be handled by a computer. Let’s take a look at how a smart contract specifically could address this situation.

Display: Show the example Restaurant Bill Smart Contract.

SlidesSpeaker Notes
Do This: Highlight each row of the smart contract and the purpose it serves. Shout out any students whose ideas matched the smart contract representation, but also acknowledge that there could be many different ways to write this contract and could have different results. Emphasize that the “Storage” row is always “On the blockchain” because that’s how smart contracts operate.

Creating Smart Contracts (10 minutes)

Remarks

Now that we’ve looked at one example of a situation requiring a smart contract, we’re going to try and create our own using this same template! You’ll be working with a partner to come up with a scenario that could be handled with a smart contract. You can use examples from the video, or you can think of your own - think of scenarios that involve exchanging or redistributing goods between people in complicated ways.

Group: Put students into groups of 2 to work on a smart contract together.

Distribute: Give each student a copy of the Smart Contract Template. If you have poster paper or whiteboards, also assign students a piece of poster paper or whiteboard to copy this template onto. Working on poster paper or whiteboards will make the gallery walk in the second half of this activity easier to facilitate.

(Optional) Distribute: You may decide to distribute the Example User Stories resource to groups to give them an idea of a smart contract to create.

Do This: Each group should come up with a scenario that could be made simpler with a smart contract, then represent that scenario on their smart contract template.

Teaching Tip

More Examples: If students need more examples of what smart contracts can look like, you can invite students to look at [Examples] Smart Contract Template for additional example smart contracts.

Analyzing Smart Contracts

Remarks

Smart contracts can help make complex situations simpler, but you also have to be extra careful when writing them. If you don’t account for every possible situation, your contract may be exploited and cause unintended consequences.

Display: Show the slide with the headline from the news story about the Blockchain alarm clock. Emphasize that this is an example where someone was able to find a loophole in the contract and exploit it for profit.

Remarks

We’re going to walk around and look at the smart contracts that everyone has created. However, we’re going to pretend we’re hackers looking for vulnerabilities we can exploit. This means looking for situations the creator may not have accounted for or expected. When we see this, we’ll use post-it notes to ask “What If…” questions to give feedback on each group’s smart contract.

Display: Show the slide with the bill splitting example from earlier.

SlidesSpeaker Notes
Do This: The template now shows two post-it notes asking “What if someone doesn’t have any money in their wallet?” and “What if someone only has foreign currency, like pesos or euros?”. Emphasize that in this situation, the contract may not know how to process these inputs and may make a mistake that could let someone get a free meal, or may leave the restaurant without a full payment.

Gallery Walk: Have students walk around the classroom with post-it notes visiting other smart contracts. They should only give feedback in the form of “What if…”.

Regroup: Have students return to their table and look at the feedback from their peers.

(Optional) Revise: If there’s time, you can have students revise their smart contracts based on the feedback.

Wrap Up (5 minutes)

Prompt: Which do you think is the most important part of a smart contract - input, processing, storage, or output? Why?

Discussion Goal: This is a chance for students to further solidify the connection between these four components and smart contracts. It’s also a chance to reflect on the second half of the activity where students may have discovered vulnerabilities in their smart contracts, usually stemming from the input or processing part of their contract.

After the Lesson

Teacher Survey

We'd love to learn more about the folks teaching these lessons and the classroom experience. Please let us know in this How Blockchain Works Teacher Survey.

Extended Learning

Depending on your goals and student interests, you may decide to offer optional extensions related to blockchain and cryptocurrencies. Additional resources and the rest of the How Blockchain Works video series are available on https://code.org/blockchain, including a Blockchain & Cryptocurreny Hour of Code Activity.

Creative Commons License (CC BY-NC-SA 4.0).

This work is available under a Creative Commons License (CC BY-NC-SA 4.0).

If you are interested in licensing Code.org materials for commercial purposes contact us.