Rootstock Vyper Starter Kit
Rootstock is a layer 2 solution that combines the security of Bitcoin's proof of work with Ethereum's smart contract capabilities. The platform is open-source, EVM-compatible, and secured by over 60% of Bitcoin’s hashing power, offering unique benefits for developers looking to build and deploy dApps on Bitcoin. Some of these benefits include:
- Bitcoin Compatibility: Deploy smart contracts while leveraging Bitcoin's network security
- EVM Compatibility: Use familiar Ethereum tools and practices while building on Bitcoin
- Lower Fees: Benefit from low transaction fees on Rootstock
- Scalability: Handle a higher volume of transactions without congestion
This guide demonstrates how to deploy smart contracts written in Vyper to the Rootstock testnet using Python and Web3.py. We'll create a simple Vyper contract and deploy it to the Rootstock network, set up the environment, and configure the network for Rootstock.
Whether you're an experienced Ethereum developer looking to deploy smart contracts on Bitcoin (Rootstock), or just starting your blockchain journey, this guide will help you get up and running with deploying Vyper Smart Contracts on the Rootstock network.
Prerequisites
- uv
- To confirm installation, run
uv --version, it should return a version number.
- To confirm installation, run
- git
- To confirm installation, run
git --version, it should return a version number. - Helpful shortcuts:
- Bash
- ZSH
echo "source $HOME/.bashrc >> $HOME/.bash_profile"
echo "source $HOME/.zshenv >> $HOME/.zprofile"
- To confirm installation, run
Install Python
- Windows
- macOS
- Linux
- Visit the Python downloads page
- Click on the "Download Python 3.12.x" button
- Run the downloaded installer
- Important: Check the box that says "Add Python 3.12 to PATH"
- Click "Install Now"
- Once installation is complete, open Command Prompt and verify the installation:
python --version
- Visit python.org
- Under Downloads, go to macOS and download the latest Python 3.12 release
- Click the link for the Python 3.12.x macOS 64-bit universal2 installer
- Open the installer file and agree to the license agreement
- Click Continue, then Install
- Once complete, open Terminal and verify the installation:
python3 --version
# or
python --version
Most Linux distributions come with Python pre-installed. To verify, open Terminal and run:
python3 --version
If Python is not installed, you can install it using your distribution's package manager:
For Ubuntu/Debian:
sudo apt update
sudo apt install python3
For Fedora:
sudo dnf install python3
For Arch Linux:
sudo pacman -S python
Install the Vyper Starter Kit
git clone https://github.com/rsksmart/rootstock-vyper.git
cd rootstock-vyper
Syncing uv
uv sync
uv syncis a fast package management command that downloads and installs your project's Python dependencies while creating a lockfile for reproducible installations.
Pip/python
python -m venv ./venv
source ./venv/bin/activate
pip install -r requirements.txt
The pip/python creates a virtual environment (python -m venv ./venv), activates it (source ./venv/bin/activate), and installs the project dependencies from requirements.txt (pip install -r requirements.txt).
Starting a basic script
Both uv run hello.py and python hello.py will run the script and output "Hello from web3py-Vyper-RootStock!", with UV being preferred for faster, modern projects and pip for traditional Python setups.
uv run hello.py # for UV
# or
python hello.py # for pip/python
Setting up the Python Environment
To set up our Python environment and install the necessary packages, we will do the following:
# Create and activate virtual environment
python3 -m venv .venv
source .venv/bin/activate
# Install required packages
pip install python-dotenv web3 vyper