Blockchain Developer, Vyper Smart Contract & Python Career Path - Powered By AI - Beginner to Expert Course
| Moccasin Edition 2025 |
Learn smart contract development, and level up your career
This repository houses course resources and discussions for the course.
Please refer to this for an in-depth explanation of the content:
- Website - Join Cyfrin Updraft and enjoy 50+ hours of smart contract development courses
- Twitter - Stay updated with the latest course releases
- LinkedIn - Add Updraft to your learning experiences
- Discord - Join a community of 3000+ developers and auditors
- Codehawks - Smart contracts auditing competitions to help secure web3
Nice to have:
- A little understanding of python
All the sections on this repo are for several courses on the Vyper Developer Career path of Cyfrin Updraft.
Resources
Welcome & Course Introduction
Vyper 101
Moccasin Fundamentals
- Section 1: Python Crash Course
- Local Development Introduction
- Section 2: Web3.py Favorite's List
- Section 3: Titanoboa Favorite's List
- Moccasin Version
- Section 4: Moccasin Favorite's List
- Section 5: Moccasin Five More
- βοΈ Section 6: Moccasin Buy Me A Coffee (GET HERE!)
- Section 7: HTML/JS Buy Me A Coffee
- Section 8: Moccasin ERC20
- Section 9: How to get hired
Advanced Moccasin
Course Completion
- Recommended Testnet: Sepolia (Or Tenderly Virtual Network)
If you receive a flag pop-up requiring you to have 0.001 ETH on mainnet, you may be able to wait 10 to 20 minutes and try again to avoid adding the 0.001 ETH on the mainnet.
- Main (Sepolia): Sepolia GCP Faucet
- Tenderly Virtual Testnet: Tenderly
- Alchemy Faucet (Sepolia): https://sepoliafaucet.com/
- Infura Faucet (Sepolia): https://www.infura.io/faucet/sepolia
- Chainlink Faucet (Sepolia): https://faucets.chain.link/sepolia
- No need for 0.001 ETH on mainnet
- ZKsync Faucets (ZKsync Sepolia): https://docs.zksync.io/build/tooling/network-faucets.html
- ZKsync Bridge: https://portal.zksync.io/bridge/
β οΈ All code associated with this course is for demo purposes only. They have not been audited and should not be considered production ready. Please use at your own risk.
- vyper-by-example
- Tenderly
- AI Frens
- claude.ai
- cursor IDE
- ChatGPT
- Phind
- Like ChatGPT, but it searches the web
- Google Gemini
- Other AI extensions
- Github Discussions
- Ask questions and chat about the course here!
- Stack Exchange Ethereum
- Great place for asking technical questions about Ethereum
- Peeranha
- Decentralized Stack Exchange!
- Cookbook
- A smart contract registry and co-pilot
If you want to work with real funds on ZKsync for any challenges that we deploy there, you can follow this list.
Please do not use real funds unless you are confident of what you are doing, especially when it comes to private key safety.
- The process for bridging looks like the following:
- Send ETH -> one of your wallets like:
- Use the ZKsync Bridge
- Follow the repository: While going through the course be 100% certain to follow along with the github repository. If you run into an issue check the chronological-updates in the repo.
- Be Active in the community: Ask questions and engage with other developers going through the course in the discussions tab, be sure to go and say hello or gm! This space is different from the other industries, you don't have to be secretive; communicate, network and learn with others :)
- Learn at your own pace: It doesn't matter if it takes you a day, a week, a month or even a year. Progress >>> Perfection
- Take Breaks: You will exhaust your mind and recall less if you go all out and watch the entire course in one sitting. Suggested Strategy every 25 minutes take a 5 min break, and every 2 hours take a longer 30 min break
- Refer to Documentation: Things are constantly being updated, so whenever Patrick opens up some documentation, open it on your end and maybe even have the code sample next to you.
- Use ChatGPT and/or the course chat
(back to top) β¬οΈ
[!IMPORTANT] Please be sure to go through blockchain basics before coming here! The GitHub repository for that curriculum can be found here:
π± GitHub repository : https://github.com/Cyfrin/blockchain-basics-cu
(back to top) β¬οΈ
π» Code: https://github.com/Cyfrin/remix-favorites-cu
πΈπ¦ Tweet Me (add your contract in)!
Spend at most 25 minutes on all of these prompts without the aide of AI. If you're unable to solve them after 25 minutes, stop, take a break, and then work with an AI or the discussions to help you solve them. Good luck!
- Create a function called
add
that adds1
to whatever is inself.favorite_number
- Have the starting favorite number different from
7
, check to make sure it's the number you set! - (Challenging) Create a new type using the "struct" keyword, and create a function that will save a new variable of that type to a state/storage variable.
π» Code: https://github.com/Cyfrin/remix-buy-me-a-coffee-cu
Spend at most 25 minutes on all of these prompts without the aide of AI. If you're unable to solve them after 25 minutes, stop, take a break, and then work with an AI or the discussions to help you solve them. Good luck!
- (Optional) Get the price of a different asset using Chainlink price feeds on your fake chain
- Write a function to get the total amount of funds in the contract
- Loop through the array of funders, and how much they've funded!
- Try not to just use
self.balance
!
- (Challenging!) Write a function that allows you to change the owner of the contract
- Hint: You'll need to make sure
OWNER
isn't immutable!
- Hint: You'll need to make sure
(back to top) β¬οΈ
No code here!
Get a good idea for "how good" your AI is. Maybe shop around for an AI you like. Ask them some softball questions to figure out how smart they are. Like:
- Make a minimal vyper contract
- What's the difference between a dynamic array and a fixed sized array?
- Here is some vyper code:
@external
def add_person(name: String[100], favorite_number: uint256):
new_person: Person = Person(favorite_number = favorite_number, name = name)
self.list_of_people[self.list_of_people_index] = new_person
self.list_of_numbers[self.list_of_people_index] = favorite_number
self.list_of_people_index += 1
self.name_to_favorite_number[name] = favorite_number
What does it do?
- Is this vyper code safe?
send(OWNER, self.balance)
(back to top) β¬οΈ
Python Version: 3.11
Full code: https://github.com/Cyfrin/python-in-updraft-cu
- Special Guest Vasiliy
- WSL
- When working in WSL, use Linux commands instead of Windows commands
- TroubleShooting
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
β οΈ Please use Gitpod as an absolute last resort
- Gitpod
- If using this, NEVER share a private key with real money on Gitpod
- Ideally you figure out the MacOS, Linux, or Windows install though
To check for python, run:
which python
python --version
which python3
python3 --version
To install a specific version of python:
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.11
CMD + K
orCTRL + K
clears the terminalcode .
to open VSCode in a new VSCode window
Spend at most 25 minutes on all of these prompts without the aide of AI. If you're unable to solve them after 25 minutes, stop, take a break, and then work with an AI or the discussions to help you solve them. Good luck!
Here is your final project, make a function that takes 2 inputs, the first is a year, and the second is a number of days. The function should print out either:
Y days after Jan 1st, X, it will still be the year X
or
Y days after Jan 1st, X, it will be the year Z
Where:
X
is the starting year, the first input to the functionY
is the number of days, the second input to the functionZ
is the year after the X number of days
Examples
The function invocations will look like this:
what_year(1985, 376)
Which should print:
376 days after Jan 1st, 1985, it will be the year 1986
Or
what_year(1985, 200)
Which should print:
200 days after Jan 1st, 1985, it will still be the year 1985
Or
what_year(1985, 1098)
Which should print:
1098 days after Jan 1st, 1985, it will be the year 1988
Notice how "still" is added to the second sentance, but not the first!
Assumptions
- Assume a year is 365 days (but, if you're off by a day or two, that's ok)
- Don't worry about leap years
- Don't use the datetime package!
-
Virtual environments image
(back to top) β¬οΈ
π» Code: https://github.com/Cyfrin/web3py-favorites-cu
Spend at most 25 minutes on all of these prompts without the aide of AI. If you're unable to solve them after 25 minutes, stop, take a break, and then work with an AI or the discussions to help you solve them. Good luck!
Do one of the following:
- (Optional) Deploy the
favorites.vy
contract to your tenderly RPC URL! - Deploy the
favorites.vy
contract to anvil with a different wallet address, and a new encrypted key!
(back to top) β¬οΈ
π» Code: https://github.com/Cyfrin/boa-favorites-cu
- Titanoboa
- Pyevm image
Spend at most 25 minutes on all of these prompts without the aide of AI. If you're unable to solve them after 25 minutes, stop, take a break, and then work with an AI or the discussions to help you solve them. Good luck!
- Create your own contract that you can:
- Deploy to your local anvil instance
- Call
set_bool(boolean)
which which change a variable namedmy_bool
to theboolean
you pass it - Call
get_bool()
which will return the value ofmy_bool
- Deploy to your local tenerly network (if you still have the free trial!)
0.3.6
uv tool install 'moccasin==0.3.6'
π» Code: https://github.com/Cyfrin/mox-favorites-cu
wget -O zkvyper <RELEASE_VERSION>
chmod +x zkvyper
mv zkvyper /usr/local/bin
πΈπ¦ Tweet Me (add your contract in)!
Spend at most 25 minutes on all of these prompts without the aide of AI. If you're unable to solve them after 25 minutes, stop, take a break, and then work with an AI or the discussions to help you solve them. Good luck!
- Deploy your contract to your tenderly virtual network
- Write your own deploy script, and deploy it to the pyevm network
- Write your own deploy script, and deploy it to the eravm network
- Write a new test in your testfile, and run it!
(back to top) β¬οΈ
π» Code: https://github.com/Cyfrin/mox-five-more-cu
create_copy_of
image
Spend at most 25 minutes on all of these prompts without the aide of AI. If you're unable to solve them after 25 minutes, stop, take a break, and then work with an AI or the discussions to help you solve them. Good luck!
- Add a second module to
five_more
- Initialize it
- And call one of the functions from it. For example, in your
five_more
contract:
initializes: my_contract def some_func(): my_contract.set_bool(True)
- Try to export functions from 2 different modules
- (Challenging) Make a contract that successfully compiles with the
uses
keyword - (Challenging) Make a contract that uses the contract from #3!
(back to top) β¬οΈ
π» Code: https://github.com/Cyfrin/mox-buy-me-a-coffee-cu
- Storage Images:
There are many types of tests:
- Unit: Test a single function/part of your code.
- Integration: Test how different parts of your code work together.
- Staging: Test your code in a production-like environment.
- Forked (Staging): Test your code in a production-like environment, but with a forked version of the blockchain.
- Fuzz: Test your code with random inputs.
- Formal Verification: Prove that your code is correct.
Spend at most 25 minutes on all of these prompts without the aide of AI. If you're unable to solve them after 25 minutes, stop, take a break, and then work with an AI or the discussions to help you solve them. Good luck!
Write a test that:
- Funds the contract with 10 different funders
- Withdraws the funds using the owner
- Asserts that:
- The ending balance of
buy_me_a_coffee
is 0 - The ending balance of the owner is the addition of all the amounts the funders added
- The ending balance of
- Write enough tests to get you over 95% code coverage for
buy_me_a_coffee.vy
- Sign up for Cyfrin Profiles! (And then tweet at me!)
- Push your code up to GitHub
- Add a new commit up to your GitHub repo
(back to top) β¬οΈ
π» Code: https://github.com/Cyfrin/html-fund-me-cu
None, Just enjoy the section!
π» Code: https://github.com/Cyfrin/mox-erc20-cu
We teach how to build minimal ERC20 tokens like WETH, LINK, USDC, and DAI!
- snekmate
- mamushi
- ruff
- vheader (py)
- vheader (rust)
- events
- Testing Events
- Introduction to fuzz testing
- Random Numbers
- CEI
- Console
Spend at most 25 minutes on all of these prompts without the aide of AI. If you're unable to solve them after 25 minutes, stop, take a break, and then work with an AI or the discussions to help you solve them. Good luck!
If you do the stateful fuzzer challenge, 1 hour is ok!
- Write tests for your
snek_token
ERC20, try to get to 80% coverage! - (Challenging!) Write a stateful fuzzer for your ERC20 token!
The workshop of the next section is what you should do. DO NOT CONTINUE TO ADVANCED MOCCASIN UNTIL YOU'VE COMPLETED THE WORKSHOP OF SECTION 9! You'll only be cheating yourself.
(back to top) β¬οΈ
- βοΈ Aricle: https://medium.com/cyfrin/how-to-become-a-smart-contract-developer-or-security-researcher-c665e50515c9
- π₯ Video: https://www.youtube.com/watch?v=e1N4aWIJMN0
- Write down your reasons why
- Do 1 full course Cyfrin Updraft
- Get through
Advanced Moccasin
- Get through
- Apply your knowledge and get real experience
- Hackathons like ETH Global
- Competitive Audits like CodeHawks
- Make pull requests to open sourced projects
- Build projects and add them to your GitHub
- Update your Cyfrin Profile
- Apply to jobs, start a company, or freelance
- Repeat steps 3 and 4
- You should always be learning more by doing more!
Spend at most 1 week on this :)
Feel free to use some AI!
Build a smart contract lottery/raffle yourself, using minimal AI help. You can build a "weak randomness" lotttery, using on-chain randomness (but just know, it's not secure!). Or go the extra mile and use Chainlink VRF 2.5 to build a secure lottery.
You should:
- Have test coverage of over 80% of your lines of code
- Have a function called
enter_raffle
for people to enter your raffle - The raffle should pick 1 winner after X seconds
- Have this be a customizable variable
- The winner should get the sum of all the entrance fees added by the other participants
- Anyone can call a
pick_winner
orrequest_winner
function, that will randomly select the winner.
Here are some example code bases to help you:
-
π» Weak Randomness Code: https://github.com/Cyfrin/mox-raffle-cu
-
π» Chainlink VRF 2 (Not 2.5 - this code is slightly outdated) Code: https://github.com/Cyfrin/mox-raffle-cu/tree/e41e3216137ff86c1f663a6730c52dd38586ec12
π» Code: https://github.com/Cyfrin/mox-nft-cu
Spend at most 25 minutes on all of these prompts without the aide of AI. If you're unable to solve them after 25 minutes, stop, take a break, and then work with an AI or the discussions to help you solve them. Good luck!
- Upload your own dog image to IPFS, mint it as an NFT, and then see it in your Metamask!
- Write tests to get to at least 80% coverage!
Spend at most 25 minutes on all of these prompts without the aide of AI. If you're unable to solve them after 25 minutes, stop, take a break, and then work with an AI or the discussions to help you solve them. Good luck!
- Deploy your mood NFT to a locally running chain, flip it's mood, and view it in metamask!
- Get to 80% test coverage!
π» Code: https://github.com/Cyfrin/mox-algorithmic-trading-cu
We will rebalance a portfolio using USDC and WETH.
Spend at most 25 minutes on all of these prompts without the aide of AI. If you're unable to solve them after 25 minutes, stop, take a break, and then work with an AI or the discussions to help you solve them. Good luck!
- Copy the code you wrote in your notebook into some scripts
- Run your scripts on a Tenderly virtual network, or a forked network
- Start with your target allocations not being correct, but then correct them!
π» Code: https://github.com/Cyfrin/mox-stablecoin-cu
You'll learn how to build your own stablecoin! Pick collateral like WETH, WBTC, and USDC to make your own stablecoin! Stablecoins one of the most POWERFUL applications on earth!
Spend at most 25 minutes on all of these prompts without the aide of AI. If you're unable to solve them after 25 minutes, stop, take a break, and then work with an AI or the discussions to help you solve them. Good luck!
- Get your unit test coverage above 80%!
Spend at most 25 minutes on all of these prompts without the aide of AI. If you're unable to solve them after 25 minutes, stop, take a break, and then work with an AI or the discussions to help you solve them. Good luck!
- Complete your own fuzz tests!
- Look into the audit report, see if you can spot some issues with this codebase yourself!
π» Code: https://github.com/Cyfrin/mox-signatures-cu
Spend at most 25 minutes on all of these prompts without the aide of AI. If you're unable to solve them after 25 minutes, stop, take a break, and then work with an AI or the discussions to help you solve them. Good luck!
- Deploy to ZKsync (era test node, sepolia, or tenderly ETH virtual network)
- Try to make a bigger merkle tree with 8 leaves!
π» Code: https://github.com/Cyfrin/mox-upgrades-cu
Spend at most 25 minutes on all of these prompts without the aide of AI. If you're unable to solve them after 25 minutes, stop, take a break, and then work with an AI or the discussions to help you solve them. Good luck!
- Try to write a contract that has a function selector collision with the proxy
- Write a contract where the storage variables change order!
(back to top) β¬οΈ
ππππππππππππ Completed all The Course! ππππππππππππ
- Top 10 learning resources
- Patrick Collins
- CryptoZombies
- Alchemy University
- Speed Run Ethereum
- Ethereum.org
Be sure to check out project grant programs!
And make today an amazing day!
(back to top) β¬οΈ
Transparency is important! So we want to disclose any potential conflicts that might have affected my judgement so you can pick tools that are right for you. Patrick is co-founder of Alpha Chain, a blockchain infrastructure company. Alpha Chain runs Chainlink, Ethereum, Binance, Polygon, Harmony, Solana, Moonbeam, and Moonriver blockchain services. Alpha Chain often works with Alchemy and receives discounted services. Patrick is the co-founder of Cyfrin, and they do smart contract security & auditing services. Patrick is also the co-founder of Chain Accel, who is an advisor on the Peeranha project.
Because of all this, I have added alternatives to each section where we suggest a tool.
(back to top) β¬οΈ
A huge thank you to our sponsors. These are the groups and technologies
Thanks to everyone who is taking, participating in, and working on this course. It's been a passion project and a data dump of everything I've learnt in the web3 space to get you up to speed quickly. Also, a big thank you to Cyfrin & Chain Accel for encouraging this course to come to light, and many, many, many people from the community.
And thanks to the Cyfrin team for making this possible!
Cyfrin Updraft content is open-sourced licensed as GPLv3.