This is from the Cyfrin Updraft Vyper Course.
- uv
- You'll know you've done it right if you can run
uv --version
and see a version number.
- You'll know you've done it right if you can run
- git
- You'll know you've done it right if you can run
git --version
and see a version number.
- You'll know you've done it right if you can run
- anvil
- You'll know you've done it right if you can run
anvil --version
and see a version number. - Helpful shortcut:
- You'll know you've done it right if you can run
# For bash
echo "source $HOME/.bashrc >> $HOME/.bash_profile"
# For zsh
echo "source $HOME/.zshenv >> $HOME/.zprofile"
If you're an advanced python user, you can use virtual environments and classic python/pip to work here.
If you can't or don't want to run and install locally, you can work with this repo in Gitpod. If you do this, you can skip the clone this repo
part.
git clone https://github.com/cyfrin/web3py-favorites-cu
cd web3py-favorites-cu
uv sync
python -m venv ./venv
source ./venv/bin/activate
pip install -r requirements.txt
uv run hello.py # for UV
# or
python hello.py # for pip/python
Go to tenderly and sign up, and then select Create Virtual TestNet
.
Your config should look like this:
Select your network, and hit Fund Account
and paste in an address.
We recommend using 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
since it's a well-known testing address.
Create a .env
file, get your RPC URL from the tenderly dashboard, and add it to your .env
file.
Example .env
:
RPC_URL=https://asdfasdfs
Add your private key to your .env
file. This should be the private key associated with the account you funded. If you used the address above, use the following:
example .env
RPC_URL="your_rpc_url"
# NEVER DO THIS WITH A REAL KEY!!!
PRIVATE_KEY="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
MY_ADDRESS="0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
This is OK since the address and private key are well known testing keys.
Then, you can run:
uv run deploy_favorites_unsafe.py # uv
# or
python deploy_favorites_unsafe.py # pip/python
And you'll deploy the contract!
We want you to practice not having your private key in plain text! So run the following:
uv run encrypt_key.py # uv
# or
python encrypt_key.py # pip/python
This will prompt you for a password and private key. We recommend using the following:
0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
Since this is a well-known testing key, feel free to use an easy password - TYPICALLY YOU SHOULD NEVER SHARE YOUR PRIVATE KEY.
uv run deploy_favorites.py # uv
# or
python deploy_favorites.py # pip/python
This will prompt you for a password to decrypt, and then you'll deploy your contract without exposing your private key! Huzzah!
If you're a student, ignore this section!
uv pip compile pyproject.toml -o requirements.txt