3/5
## Designing Your First Vyper Smart Contract: Planning and Requirements Before diving into writing complex code, especially for immutable systems like smart contracts, careful planning is essential. Understanding precisely what your contract needs to achieve is the critical first step. This lesson outlines the initial design phase for a simple "Favorite Things List" smart contract using the Vyper programming language. We'll begin within a Vyper Integrated Development Environment (IDE). When starting a new Vyper contract file (typically with a `.vy` extension), you'll often see some initial lines: ```vyper # pragma version 0.4.0 # @license MIT ``` The `# pragma version` directive specifies the version of the Vyper compiler the contract is intended for. This helps ensure compatibility and prevents issues if compiler behaviour changes in future versions. The `# @license` line uses the SPDX license identifier (in this case, MIT) to declare the open-source license under which the code is released. Comments in Vyper are denoted by the `#` symbol. With the basic file structure in place, the next crucial step is defining the contract's requirements. What exactly do we want this smart contract to do? For our example, we aim to create a "Favorite Things List" with two primary functions: 1. Store a general list of favorite numbers. 2. Store specific people and associate each person with *their* individual favorite number. To keep these requirements front and center during development, it's good practice to outline them directly within the code file using comments. This acts as an initial design document embedded within the source code itself: ```vyper # pragma version 0.4.0 # @license MIT # favorite things list: # favorite numbers # favorite people with their favorite number ``` Here, we've added comments outlining the core purpose (a favorite things list) and its two specific data storage requirements. This simple specification clearly states our goals: we need a mechanism to hold a collection of numbers and another mechanism to map an identifier (representing a person) to a specific number. Having clearly defined what our contract needs to accomplish, the next logical step is to determine *how* to implement this functionality using Vyper's features and syntax. How do we translate these requirements into actual Vyper code structures?
A foundational primer to Designing Your First Vyper Smart Contract: Planning and Requirements - Understand the crucial first step of defining clear contract goals using comments before writing any code. Learn about essential Vyper file setup like `pragma` and `license` directives.
Previous lesson
Previous
Next lesson
Next
Give us feedback
Course Overview
About the course
The basics of blockchain transactions, how to send and receive money on a blockchain network.
How to write Python based smart contracts using Vyper.
How to read and understand Vyper smart contracts.
Vyper data structures, arrays, structs, hash maps.
How to build a smart contract application and deploy on ZKsync with Moccasin.
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
On-chain Data Analyst
$59,000 - $139,000 (avg. salary)
DeFi Developer
$75,000 - $200,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Last updated on June 11, 2025
Duration: 2h 08min
Duration: 2h 32min
Duration: 24min
Course Overview
About the course
The basics of blockchain transactions, how to send and receive money on a blockchain network.
How to write Python based smart contracts using Vyper.
How to read and understand Vyper smart contracts.
Vyper data structures, arrays, structs, hash maps.
How to build a smart contract application and deploy on ZKsync with Moccasin.
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
On-chain Data Analyst
$59,000 - $139,000 (avg. salary)
DeFi Developer
$75,000 - $200,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Last updated on June 11, 2025