5/5
## Deploying to pyevm With TitanoBoa We've created a virtual environment and installed TitanoBoa. Now we can start to use TitanoBoa to work with our Vyper contracts! We'll start with creating a new Python file called `deploy_favorites_pyevm.py`. We can then start to write some code in the file. ```python if __name__ == "__main__": main() ``` We'll also define a main function. We'll start out with a simple print statement for now. ```python def main(): print("Let's read in the Vyper code and deploy it!") ``` Our next step is to actually load our contract from the `favorites.vy` file. We can do this by importing the `boa` library and using the `boa.load()` function. ```python def main(): print("Let's read in the Vyper code and deploy it!") favorites_contract = boa.load("favorites.vy") ``` We can see what type of object our `favorites_contract` is using the `type()` function. ```python def main(): print("Let's read in the Vyper code and deploy it!") favorites_contract = boa.load("favorites.vy") print(type(favorites_contract)) ``` We can see from our output that our `favorites_contract` is of the type `boa.contracts.vyper.vyper_contract.VyperContract`. ```bash python deploy_favorites_pyevm.py ``` Let's read in the Vyper code and deploy it! <class 'boa.contracts.vyper.vyper_contract.VyperContract'> We can use type hints to help us understand what kind of objects our variables are. For example, we can type hint our `favorites_contract` variable to be a `VyperContract`. ```python def main(): print("Let's read in the Vyper code and deploy it!") favorites_contract: VyperContract = boa.load("favorites.vy") print(type(favorites_contract)) ``` To use the `VyperContract` type hint, we'll need to import it from the `boa.contracts.vyper.vyper_contract` module. ```python from boa.contracts.vyper.vyper_contract import VyperContract def main(): print("Let's read in the Vyper code and deploy it!") favorites_contract: VyperContract = boa.load("favorites.vy") print(type(favorites_contract)) ``` We can then run this code again. ```bash python deploy_favorites_pyevm.py ``` Let's read in the Vyper code and deploy it! <class 'boa.contracts.vyper.vyper_contract.VyperContract'> Type hints are not required in Python, but we will be using them more heavily later in the course. For now, we can ignore them.
We've created a virtual environment and installed TitanoBoa. Now we can start to use TitanoBoa to work with our Vyper contracts!
We'll start with creating a new Python file called deploy_favorites_pyevm.py
. We can then start to write some code in the file.
We'll also define a main function. We'll start out with a simple print statement for now.
Our next step is to actually load our contract from the favorites.vy
file. We can do this by importing the boa
library and using the boa.load()
function.
We can see what type of object our favorites_contract
is using the type()
function.
We can see from our output that our favorites_contract
is of the type boa.contracts.vyper.vyper_contract.VyperContract
.
Let's read in the Vyper code and deploy it!
<class 'boa.contracts.vyper.vyper_contract.VyperContract'>
We can use type hints to help us understand what kind of objects our variables are. For example, we can type hint our favorites_contract
variable to be a VyperContract
.
To use the VyperContract
type hint, we'll need to import it from the boa.contracts.vyper.vyper_contract
module.
We can then run this code again.
Let's read in the Vyper code and deploy it!
<class 'boa.contracts.vyper.vyper_contract.VyperContract'>
Type hints are not required in Python, but we will be using them more heavily later in the course. For now, we can ignore them.
A practical guide to deploying a Vyper contract to a local py-evm blockchain using TitanoBoa - The lesson walks through the process of setting up a development environment and using TitanoBoa to deploy a Vyper smart contract to a py-evm network.
Previous lesson
Previous
Next lesson
Next
Give us feedback
Course Overview
About the course
Python basics
Introduction to Web3.py
Introduction to Titanoboa
Introduction to Moccasin
How to create an ERC-20
How to test Python code and Vyper smart contract
How to deploy Vyper smart contracts on ZKsync using 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 August 11, 2025
Duration: 2h 20min
Duration: 1h 51min
Duration: 58min
Duration: 2h 23min
Duration: 53min
Duration: 2h 24min
Duration: 28min
Duration: 1h 54min
Duration: 11min
Course Overview
About the course
Python basics
Introduction to Web3.py
Introduction to Titanoboa
Introduction to Moccasin
How to create an ERC-20
How to test Python code and Vyper smart contract
How to deploy Vyper smart contracts on ZKsync using 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 August 11, 2025