From 70643549f0ca835537c8c6e44162a9fb6f9eaf79 Mon Sep 17 00:00:00 2001 From: Edwin Liava'a Date: Fri, 6 Dec 2024 07:23:51 +1300 Subject: [PATCH 01/30] hacktivator-program --- docs/04-resources/04-tutorials/index.md | 26 +- .../04-tutorials/rootstock-vyper.md | 222 ++++++++++++++++++ yarn.lock | 6 +- 3 files changed, 242 insertions(+), 12 deletions(-) create mode 100644 docs/04-resources/04-tutorials/rootstock-vyper.md diff --git a/docs/04-resources/04-tutorials/index.md b/docs/04-resources/04-tutorials/index.md index b203f128..4645edda 100644 --- a/docs/04-resources/04-tutorials/index.md +++ b/docs/04-resources/04-tutorials/index.md @@ -13,11 +13,19 @@ values={[ {label: 'Port to Rootstock', value: 'port-dapps'} ]}> + - \ No newline at end of file + diff --git a/docs/04-resources/04-tutorials/rootstock-vyper.md b/docs/04-resources/04-tutorials/rootstock-vyper.md new file mode 100644 index 00000000..a1d38c10 --- /dev/null +++ b/docs/04-resources/04-tutorials/rootstock-vyper.md @@ -0,0 +1,222 @@ +--- +sidebar_label: Vyper Smart Contract on RootStock +sidebar_position: 7 +title: Deploying a Vyper Smart Contract to RootStock (RSK) Testnet using Python +description: "This guide walks through the process of deploying a smart contract to the RootStock (RSK) testnet using Python and Web3.py. We'll be deploying a simple Vyper contract that demonstrates how to interact with the RSK network." +tags: + - rsk + - rootstock + - tutorials + - resources + - tests + - web3py + - vyper + - smart contracts + - python + - developers +--- + +This guide demonstrates how to deploy smart contracts written in Vyper to the RootStock (RSK) testnet using Python and Web3.py. RSK is a groundbreaking smart contract platform that's merge-mined with Bitcoin, offering unique advantages for developers: + +- **Bitcoin Compatibility**: Deploy smart contracts while leveraging Bitcoin's security and network effects +- **EVM Compatibility**: Use familiar Ethereum tools and practices while building on Bitcoin +- **Lower Fees**: Benefit from RSK's cost-effective transaction fees +- **Scalability**: Enjoy higher transaction throughput compared to the Bitcoin mainnet + +We'll walk through creating a simple Vyper contract and deploying it to RSK's testnet, covering everything from environment setup to handling RSK-specific configurations. Whether you're an experienced Ethereum developer looking to expand to Bitcoin-based smart contracts, or just starting your blockchain journey, this guide will help you get up and running with RSK. + +## Prerequisites + +- [uv](https://docs.astral.sh/uv/) + - You'll know you've done it right if you can run `uv --version` and see a version number. +- [git](https://git-scm.com/) + - You'll know you've done it right if you can run `git --version` and see a version number. + - Helpful shortcut: + +```bash +# For bash +echo "source $HOME/.bashrc >> $HOME/.bash_profile" + +# For zsh +echo "source $HOME/.zshenv >> $HOME/.zprofile" +``` + +- Python 3.x +- A text editor +- Basic understanding of smart contracts and Python +- RSK testnet RBTC (will show you how to get this) + +## Installation + +```bash +git clone https://github.com/EdwinLiavaa/Web3py-Vyper-RootStock.git +cd Web3py-Vyper-RootStock +``` + +### uv + +```bash +uv sync +``` + +### pip/python + +```bash +python -m venv ./venv +source ./venv/bin/activate +pip install -r requirements.txt +``` + +## Quickstart + +```bash +uv run hello.py # for UV +# or +python hello.py # for pip/python +``` + +## Setup Environment + +First, let's set up our Python environment and install the necessary packages: + +```bash +# Create and activate virtual environment +python3 -m venv .venv +source .venv/bin/activate + +# Install required packages +pip install python-dotenv web3 vyper +``` + +## Configuration + +Create a `.env` file in your project root with your configuration: + +```env +RPC_URL="https://rpc.testnet.rootstock.io/[YOUR-API-KEY]" +PRIVATE_KEY="your-private-key" # Never commit your real private key! +MY_ADDRESS="your-wallet-address" +``` +THIS IS ONLY FOR TESTING - TYPICALLY YOU SHOULD NEVER SHARE YOUR PRIVATE KEY. + +## Get Testnet RBTC + +Before deploying, you'll need some testnet RBTC: + +1. Go to the RSK faucet: https://faucet.rsk.co/ +2. Enter your wallet address +3. Complete the captcha and request funds +4. Wait a few minutes for the transaction to be confirmed + +## The Smart Contract + +Here's our simple Vyper contract (`favorites.vy`): + +```python +# @version ^0.3.7 + +favorite_number: public(uint256) +owner: public(address) + +@external +def __init__(): + self.owner = msg.sender + self.favorite_number = 0 + +@external +def store(new_number: uint256): + self.favorite_number = new_number +``` + +## Deployment Script + +Here's our Python script to deploy the contract (`deploy_favorites_unsafe.py`): + +```python +from web3 import Web3 +from dotenv import load_dotenv +from vyper import compile_code +import os + +load_dotenv() + +RPC_URL = os.getenv("RPC_URL") + +def main(): + print("Let's read in the Vyper code and deploy it to the blockchain!") + w3 = Web3(Web3.HTTPProvider(RPC_URL)) + with open("favorites.vy", "r") as favorites_file: + favorites_code = favorites_file.read() + compliation_details = compile_code( + favorites_code, output_formats=["bytecode", "abi"] + ) + + chain_id = 31 # RSK testnet chain ID + + print("Getting environment variables...") + my_address = os.getenv("MY_ADDRESS") + private_key = os.getenv("PRIVATE_KEY") + + # Check balance before deployment + balance = w3.eth.get_balance(my_address) + balance_in_rbtc = w3.from_wei(balance, "ether") + print(f"Account balance: {balance_in_rbtc} RBTC") + + if balance == 0: + print("Your account has no RBTC! Please get some testnet RBTC from the faucet:") + print("1. Go to https://faucet.rsk.co/") + print("2. Enter your address:", my_address) + print("3. Complete the captcha and request funds") + print("4. Wait a few minutes for the transaction to be confirmed") + return + + # Create the contract in Python + favorites_contract = w3.eth.contract( + abi=compliation_details["abi"], bytecode=compliation_details["bytecode"] + ) + + # Submit the transaction that deploys the contract + nonce = w3.eth.get_transaction_count(my_address) + + print("Building the transaction...") + transaction = favorites_contract.constructor().build_transaction( + { + "chainId": chain_id, + "from": my_address, + "nonce": nonce, + "gas": 3000000, # Higher gas limit for RSK + "gasPrice": w3.eth.gas_price * 2, # Double the gas price to ensure transaction goes through + } + ) + + print("Signing transaction...") + signed_txn = w3.eth.account.sign_transaction(transaction, private_key=private_key) + print("Deploying contract...") + tx_hash = w3.eth.send_raw_transaction(signed_txn.rawTransaction) + tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash) + print(f"Contract deployed! Address: {tx_receipt.contractAddress}") + +if __name__ == "__main__": + main() +``` + +## Key Points About RSK Deployment + +1. **Chain ID**: RSK testnet uses chain ID 31 +2. **Gas Settings**: + - We use a higher gas limit (3,000,000) for RSK + - We double the gas price to ensure the transaction goes through +3. **Transaction Type**: + - RSK works best with legacy transactions (using `gasPrice` instead of EIP-1559 parameters) + +## Running the Deployment + +Execute the deployment script: + +```bash +python deploy_favorites_unsafe.py +``` +## Useful Links + +The boilerplate used in this project was adopted from the Cyfrin Updraft Python and Viper Starter Kit: +- [Cyfrin Updraft @cyfrinupdraft](https://updraft.cyfrin.io/courses/intermediate-python-vyper-smart-contract-development) diff --git a/yarn.lock b/yarn.lock index 24289ee3..695d316e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2964,9 +2964,9 @@ caniuse-api@^3.0.0: lodash.uniq "^4.5.0" caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001587, caniuse-lite@^1.0.30001599: - version "1.0.30001617" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001617.tgz#809bc25f3f5027ceb33142a7d6c40759d7a901eb" - integrity sha512-mLyjzNI9I+Pix8zwcrpxEbGlfqOkF9kM3ptzmKNw5tizSyYwMe+nGLTqMK9cO+0E+Bh6TsBxNAaHWEM8xwSsmA== + version "1.0.30001686" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001686.tgz" + integrity sha512-Y7deg0Aergpa24M3qLC5xjNklnKnhsmSyR/V89dLZ1n0ucJIFNs7PgR2Yfa/Zf6W79SbBicgtGxZr2juHkEUIA== ccount@^2.0.0: version "2.0.1" From 342c4456309306b0db4125dab69361014d8fdf22 Mon Sep 17 00:00:00 2001 From: Edwin Liava'a <1756402+EdwinLiavaa@users.noreply.github.com> Date: Mon, 9 Dec 2024 23:38:46 +1300 Subject: [PATCH 02/30] Update docs/04-resources/04-tutorials/index.md Co-authored-by: Owanate Amachree --- docs/04-resources/04-tutorials/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/04-resources/04-tutorials/index.md b/docs/04-resources/04-tutorials/index.md index 4645edda..e77b8681 100644 --- a/docs/04-resources/04-tutorials/index.md +++ b/docs/04-resources/04-tutorials/index.md @@ -14,7 +14,7 @@ values={[ ]}> Date: Mon, 9 Dec 2024 23:38:56 +1300 Subject: [PATCH 03/30] Update docs/04-resources/04-tutorials/index.md Co-authored-by: Owanate Amachree --- docs/04-resources/04-tutorials/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/04-resources/04-tutorials/index.md b/docs/04-resources/04-tutorials/index.md index e77b8681..6026991e 100644 --- a/docs/04-resources/04-tutorials/index.md +++ b/docs/04-resources/04-tutorials/index.md @@ -18,7 +18,7 @@ title="Deploy a Vyper Smart Contract on Rootstock" subtitle="Vyper" color="orange" linkHref="/resources/tutorials/rootstock-vyper/" -description="This guide walks through the process of deploying a smart contract to the RootStock (RSK) testnet using Python and Web3.py. We'll be deploying a simple Vyper contract that demonstrates how to interact with the RSK network." +description="This guide walks through the process of deploying a smart contract to the Rootstock testnet using Python and Web3.py. We'll be deploying a simple Vyper contract that demonstrates how to interact with the Rootstock network." /> Date: Mon, 9 Dec 2024 23:39:07 +1300 Subject: [PATCH 04/30] Update docs/04-resources/04-tutorials/rootstock-vyper.md Co-authored-by: Owanate Amachree --- docs/04-resources/04-tutorials/rootstock-vyper.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/04-resources/04-tutorials/rootstock-vyper.md b/docs/04-resources/04-tutorials/rootstock-vyper.md index a1d38c10..7c202e12 100644 --- a/docs/04-resources/04-tutorials/rootstock-vyper.md +++ b/docs/04-resources/04-tutorials/rootstock-vyper.md @@ -1,5 +1,5 @@ --- -sidebar_label: Vyper Smart Contract on RootStock +sidebar_label: Vyper Smart Contract on Rootstock sidebar_position: 7 title: Deploying a Vyper Smart Contract to RootStock (RSK) Testnet using Python description: "This guide walks through the process of deploying a smart contract to the RootStock (RSK) testnet using Python and Web3.py. We'll be deploying a simple Vyper contract that demonstrates how to interact with the RSK network." From 52736903c12142254ba99e836aa27e80ad581cb7 Mon Sep 17 00:00:00 2001 From: Edwin Liava'a <1756402+EdwinLiavaa@users.noreply.github.com> Date: Mon, 9 Dec 2024 23:39:19 +1300 Subject: [PATCH 05/30] Update docs/04-resources/04-tutorials/rootstock-vyper.md Co-authored-by: Owanate Amachree --- docs/04-resources/04-tutorials/rootstock-vyper.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/04-resources/04-tutorials/rootstock-vyper.md b/docs/04-resources/04-tutorials/rootstock-vyper.md index 7c202e12..66272995 100644 --- a/docs/04-resources/04-tutorials/rootstock-vyper.md +++ b/docs/04-resources/04-tutorials/rootstock-vyper.md @@ -1,7 +1,7 @@ --- sidebar_label: Vyper Smart Contract on Rootstock sidebar_position: 7 -title: Deploying a Vyper Smart Contract to RootStock (RSK) Testnet using Python +title: Deploying a Vyper Smart Contract to Rootstock Testnet using Python description: "This guide walks through the process of deploying a smart contract to the RootStock (RSK) testnet using Python and Web3.py. We'll be deploying a simple Vyper contract that demonstrates how to interact with the RSK network." tags: - rsk From f01e4aca491d77ee4a0b0d8b7728b818279e2948 Mon Sep 17 00:00:00 2001 From: Edwin Liava'a <1756402+EdwinLiavaa@users.noreply.github.com> Date: Mon, 9 Dec 2024 23:44:22 +1300 Subject: [PATCH 06/30] Update docs/04-resources/04-tutorials/rootstock-vyper.md Co-authored-by: Owanate Amachree --- docs/04-resources/04-tutorials/rootstock-vyper.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/04-resources/04-tutorials/rootstock-vyper.md b/docs/04-resources/04-tutorials/rootstock-vyper.md index 66272995..723e7fb9 100644 --- a/docs/04-resources/04-tutorials/rootstock-vyper.md +++ b/docs/04-resources/04-tutorials/rootstock-vyper.md @@ -53,7 +53,7 @@ git clone https://github.com/EdwinLiavaa/Web3py-Vyper-RootStock.git cd Web3py-Vyper-RootStock ``` -### uv +### Syncing uv ```bash uv sync From 8ceae38226a2ab61b3adb688265c2bbb07f6eb53 Mon Sep 17 00:00:00 2001 From: Edwin Liava'a <1756402+EdwinLiavaa@users.noreply.github.com> Date: Mon, 9 Dec 2024 23:49:46 +1300 Subject: [PATCH 07/30] Update docs/04-resources/04-tutorials/rootstock-vyper.md Co-authored-by: Owanate Amachree --- docs/04-resources/04-tutorials/rootstock-vyper.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/04-resources/04-tutorials/rootstock-vyper.md b/docs/04-resources/04-tutorials/rootstock-vyper.md index 723e7fb9..c56edea0 100644 --- a/docs/04-resources/04-tutorials/rootstock-vyper.md +++ b/docs/04-resources/04-tutorials/rootstock-vyper.md @@ -2,7 +2,7 @@ sidebar_label: Vyper Smart Contract on Rootstock sidebar_position: 7 title: Deploying a Vyper Smart Contract to Rootstock Testnet using Python -description: "This guide walks through the process of deploying a smart contract to the RootStock (RSK) testnet using Python and Web3.py. We'll be deploying a simple Vyper contract that demonstrates how to interact with the RSK network." +description: "This guide walks through the process of deploying a smart contract to the Rootstock testnet using Python and Web3.py. We'll be deploying a simple Vyper contract that demonstrates how to interact with the Rootstock network." tags: - rsk - rootstock From a7354a5e62f01ce9e01b334155149d3e83c80392 Mon Sep 17 00:00:00 2001 From: Edwin Liava'a <1756402+EdwinLiavaa@users.noreply.github.com> Date: Tue, 10 Dec 2024 00:11:22 +1300 Subject: [PATCH 08/30] Update docs/04-resources/04-tutorials/rootstock-vyper.md Co-authored-by: Owanate Amachree --- docs/04-resources/04-tutorials/rootstock-vyper.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/04-resources/04-tutorials/rootstock-vyper.md b/docs/04-resources/04-tutorials/rootstock-vyper.md index c56edea0..846e15a3 100644 --- a/docs/04-resources/04-tutorials/rootstock-vyper.md +++ b/docs/04-resources/04-tutorials/rootstock-vyper.md @@ -30,7 +30,7 @@ We'll walk through creating a simple Vyper contract and deploying it to RSK's te - [uv](https://docs.astral.sh/uv/) - You'll know you've done it right if you can run `uv --version` and see a version number. - [git](https://git-scm.com/) - - You'll know you've done it right if you can run `git --version` and see a version number. + - To confirm installation, run `git --version`, it should return a version number. - Helpful shortcut: ```bash From 1b9f2568392bf4bb1d1d3e03e870fcf19377e710 Mon Sep 17 00:00:00 2001 From: Edwin Liava'a <1756402+EdwinLiavaa@users.noreply.github.com> Date: Tue, 10 Dec 2024 00:11:46 +1300 Subject: [PATCH 09/30] Update docs/04-resources/04-tutorials/rootstock-vyper.md Co-authored-by: Owanate Amachree --- docs/04-resources/04-tutorials/rootstock-vyper.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/04-resources/04-tutorials/rootstock-vyper.md b/docs/04-resources/04-tutorials/rootstock-vyper.md index 846e15a3..6fa54fb9 100644 --- a/docs/04-resources/04-tutorials/rootstock-vyper.md +++ b/docs/04-resources/04-tutorials/rootstock-vyper.md @@ -16,7 +16,7 @@ tags: - developers --- -This guide demonstrates how to deploy smart contracts written in Vyper to the RootStock (RSK) testnet using Python and Web3.py. RSK is a groundbreaking smart contract platform that's merge-mined with Bitcoin, offering unique advantages for developers: +This guide demonstrates how to deploy smart contracts written in Vyper to the Rootstock testnet using Python and Web3.py. 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 advantages for developers: - **Bitcoin Compatibility**: Deploy smart contracts while leveraging Bitcoin's security and network effects - **EVM Compatibility**: Use familiar Ethereum tools and practices while building on Bitcoin From e19fa18a41489f7624b5473c7b13ce1cb758b60f Mon Sep 17 00:00:00 2001 From: Edwin Liava'a <1756402+EdwinLiavaa@users.noreply.github.com> Date: Tue, 10 Dec 2024 00:12:11 +1300 Subject: [PATCH 10/30] Update docs/04-resources/04-tutorials/rootstock-vyper.md Co-authored-by: Owanate Amachree --- docs/04-resources/04-tutorials/rootstock-vyper.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/04-resources/04-tutorials/rootstock-vyper.md b/docs/04-resources/04-tutorials/rootstock-vyper.md index 6fa54fb9..bd68cfbe 100644 --- a/docs/04-resources/04-tutorials/rootstock-vyper.md +++ b/docs/04-resources/04-tutorials/rootstock-vyper.md @@ -20,7 +20,7 @@ This guide demonstrates how to deploy smart contracts written in Vyper to the Ro - **Bitcoin Compatibility**: Deploy smart contracts while leveraging Bitcoin's security and network effects - **EVM Compatibility**: Use familiar Ethereum tools and practices while building on Bitcoin -- **Lower Fees**: Benefit from RSK's cost-effective transaction fees +- **Lower Fees**: Benefit from low transaction fees on Rootstock - **Scalability**: Enjoy higher transaction throughput compared to the Bitcoin mainnet We'll walk through creating a simple Vyper contract and deploying it to RSK's testnet, covering everything from environment setup to handling RSK-specific configurations. Whether you're an experienced Ethereum developer looking to expand to Bitcoin-based smart contracts, or just starting your blockchain journey, this guide will help you get up and running with RSK. From 18f6a9a3d450d1ce69f14cfd23ec4ae0d2637393 Mon Sep 17 00:00:00 2001 From: Edwin Liava'a <1756402+EdwinLiavaa@users.noreply.github.com> Date: Tue, 10 Dec 2024 00:12:22 +1300 Subject: [PATCH 11/30] Update docs/04-resources/04-tutorials/rootstock-vyper.md Co-authored-by: Owanate Amachree --- docs/04-resources/04-tutorials/rootstock-vyper.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/04-resources/04-tutorials/rootstock-vyper.md b/docs/04-resources/04-tutorials/rootstock-vyper.md index bd68cfbe..df21f2b5 100644 --- a/docs/04-resources/04-tutorials/rootstock-vyper.md +++ b/docs/04-resources/04-tutorials/rootstock-vyper.md @@ -21,7 +21,7 @@ This guide demonstrates how to deploy smart contracts written in Vyper to the Ro - **Bitcoin Compatibility**: Deploy smart contracts while leveraging Bitcoin's security and network effects - **EVM Compatibility**: Use familiar Ethereum tools and practices while building on Bitcoin - **Lower Fees**: Benefit from low transaction fees on Rootstock -- **Scalability**: Enjoy higher transaction throughput compared to the Bitcoin mainnet +- **Scalability**: Handle a higher volume of transactions without congestion We'll walk through creating a simple Vyper contract and deploying it to RSK's testnet, covering everything from environment setup to handling RSK-specific configurations. Whether you're an experienced Ethereum developer looking to expand to Bitcoin-based smart contracts, or just starting your blockchain journey, this guide will help you get up and running with RSK. From b58c2c57607de38887b11d2641bf41da8473940a Mon Sep 17 00:00:00 2001 From: Edwin Liava'a <1756402+EdwinLiavaa@users.noreply.github.com> Date: Tue, 10 Dec 2024 00:12:46 +1300 Subject: [PATCH 12/30] Update docs/04-resources/04-tutorials/rootstock-vyper.md Co-authored-by: Owanate Amachree --- docs/04-resources/04-tutorials/rootstock-vyper.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/04-resources/04-tutorials/rootstock-vyper.md b/docs/04-resources/04-tutorials/rootstock-vyper.md index df21f2b5..1758e9be 100644 --- a/docs/04-resources/04-tutorials/rootstock-vyper.md +++ b/docs/04-resources/04-tutorials/rootstock-vyper.md @@ -23,7 +23,9 @@ This guide demonstrates how to deploy smart contracts written in Vyper to the Ro - **Lower Fees**: Benefit from low transaction fees on Rootstock - **Scalability**: Handle a higher volume of transactions without congestion -We'll walk through creating a simple Vyper contract and deploying it to RSK's testnet, covering everything from environment setup to handling RSK-specific configurations. Whether you're an experienced Ethereum developer looking to expand to Bitcoin-based smart contracts, or just starting your blockchain journey, this guide will help you get up and running with RSK. +We'll walk through creating a simple Vyper contract and deploying it to the Rootstock testnet, covering everything from environment setup to handling Rootstock-specific network configurations. + +Whether you're an experienced Ethereum developer looking to expand to Bitcoin-based smart contracts, or just starting your blockchain journey, this guide will help you get up and running with Vyper Contracts on Rootstock. ## Prerequisites From d20ade4652075149442394c8605e2c3b13c26c60 Mon Sep 17 00:00:00 2001 From: Edwin Liava'a <1756402+EdwinLiavaa@users.noreply.github.com> Date: Tue, 10 Dec 2024 00:13:04 +1300 Subject: [PATCH 13/30] Update docs/04-resources/04-tutorials/rootstock-vyper.md Co-authored-by: Owanate Amachree --- docs/04-resources/04-tutorials/rootstock-vyper.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/04-resources/04-tutorials/rootstock-vyper.md b/docs/04-resources/04-tutorials/rootstock-vyper.md index 1758e9be..7d88fc5c 100644 --- a/docs/04-resources/04-tutorials/rootstock-vyper.md +++ b/docs/04-resources/04-tutorials/rootstock-vyper.md @@ -30,7 +30,7 @@ Whether you're an experienced Ethereum developer looking to expand to Bitcoin-ba ## Prerequisites - [uv](https://docs.astral.sh/uv/) - - You'll know you've done it right if you can run `uv --version` and see a version number. + - To confirm installation, run `uv --version`, it should return a version number. - [git](https://git-scm.com/) - To confirm installation, run `git --version`, it should return a version number. - Helpful shortcut: From 77eac1f81942e397a98a3abecd50daae078c3977 Mon Sep 17 00:00:00 2001 From: Edwin Liava'a <1756402+EdwinLiavaa@users.noreply.github.com> Date: Tue, 10 Dec 2024 00:13:34 +1300 Subject: [PATCH 14/30] Update docs/04-resources/04-tutorials/rootstock-vyper.md Co-authored-by: Owanate Amachree --- docs/04-resources/04-tutorials/rootstock-vyper.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/04-resources/04-tutorials/rootstock-vyper.md b/docs/04-resources/04-tutorials/rootstock-vyper.md index 7d88fc5c..ef915e88 100644 --- a/docs/04-resources/04-tutorials/rootstock-vyper.md +++ b/docs/04-resources/04-tutorials/rootstock-vyper.md @@ -46,7 +46,7 @@ echo "source $HOME/.zshenv >> $HOME/.zprofile" - Python 3.x - A text editor - Basic understanding of smart contracts and Python -- RSK testnet RBTC (will show you how to get this) +- [Rootstock testnet RBTC](https://faucet.rootstock.io/) ## Installation From e2808c6fb69acc431e2323876bee70e7cd7e17a1 Mon Sep 17 00:00:00 2001 From: Edwin Liava'a <1756402+EdwinLiavaa@users.noreply.github.com> Date: Tue, 10 Dec 2024 04:31:06 +1300 Subject: [PATCH 15/30] Update docs/04-resources/04-tutorials/rootstock-vyper.md Co-authored-by: Owanate Amachree --- docs/04-resources/04-tutorials/rootstock-vyper.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/04-resources/04-tutorials/rootstock-vyper.md b/docs/04-resources/04-tutorials/rootstock-vyper.md index ef915e88..c1eadb1e 100644 --- a/docs/04-resources/04-tutorials/rootstock-vyper.md +++ b/docs/04-resources/04-tutorials/rootstock-vyper.md @@ -16,7 +16,9 @@ tags: - developers --- -This guide demonstrates how to deploy smart contracts written in Vyper to the Rootstock testnet using Python and Web3.py. 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 advantages for developers: +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 advantages for developers. + +This guide demonstrates how to deploy smart contracts written in Vyper to the Rootstock testnet using Python and Web3.py. - **Bitcoin Compatibility**: Deploy smart contracts while leveraging Bitcoin's security and network effects - **EVM Compatibility**: Use familiar Ethereum tools and practices while building on Bitcoin From ce2365d5cb9b8ca90926f02875839ec28d55ce3a Mon Sep 17 00:00:00 2001 From: Edwin Liava'a <1756402+EdwinLiavaa@users.noreply.github.com> Date: Tue, 10 Dec 2024 04:37:20 +1300 Subject: [PATCH 16/30] Update docs/04-resources/04-tutorials/rootstock-vyper.md Co-authored-by: Owanate Amachree --- docs/04-resources/04-tutorials/rootstock-vyper.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/04-resources/04-tutorials/rootstock-vyper.md b/docs/04-resources/04-tutorials/rootstock-vyper.md index c1eadb1e..fc15135d 100644 --- a/docs/04-resources/04-tutorials/rootstock-vyper.md +++ b/docs/04-resources/04-tutorials/rootstock-vyper.md @@ -81,7 +81,7 @@ python hello.py # for pip/python ## Setup Environment -First, let's set up our Python environment and install the necessary packages: +To set up our Python environment and install the necessary packages, we will do the following: ```bash # Create and activate virtual environment From da4adffcd776b32aa6d1c182750257e37bc04611 Mon Sep 17 00:00:00 2001 From: Edwin Liava'a <1756402+EdwinLiavaa@users.noreply.github.com> Date: Tue, 10 Dec 2024 04:37:46 +1300 Subject: [PATCH 17/30] Update docs/04-resources/04-tutorials/rootstock-vyper.md Co-authored-by: Owanate Amachree --- docs/04-resources/04-tutorials/rootstock-vyper.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/04-resources/04-tutorials/rootstock-vyper.md b/docs/04-resources/04-tutorials/rootstock-vyper.md index fc15135d..a22ebf9c 100644 --- a/docs/04-resources/04-tutorials/rootstock-vyper.md +++ b/docs/04-resources/04-tutorials/rootstock-vyper.md @@ -134,7 +134,7 @@ def store(new_number: uint256): ## Deployment Script -Here's our Python script to deploy the contract (`deploy_favorites_unsafe.py`): +Here's a Python script to deploy the contract (`deploy_favorites_unsafe.py`): ```python from web3 import Web3 From 5f3edfd41dcc9510b24e50b25f7e3d90452461dd Mon Sep 17 00:00:00 2001 From: Edwin Liava'a <1756402+EdwinLiavaa@users.noreply.github.com> Date: Tue, 10 Dec 2024 04:38:00 +1300 Subject: [PATCH 18/30] Update docs/04-resources/04-tutorials/rootstock-vyper.md Co-authored-by: Owanate Amachree --- docs/04-resources/04-tutorials/rootstock-vyper.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/04-resources/04-tutorials/rootstock-vyper.md b/docs/04-resources/04-tutorials/rootstock-vyper.md index a22ebf9c..dd15795a 100644 --- a/docs/04-resources/04-tutorials/rootstock-vyper.md +++ b/docs/04-resources/04-tutorials/rootstock-vyper.md @@ -204,7 +204,7 @@ if __name__ == "__main__": main() ``` -## Key Points About RSK Deployment +## Notable Info when Deploying on Rootstock 1. **Chain ID**: RSK testnet uses chain ID 31 2. **Gas Settings**: From e58ae1c0fd237e654c4ac7965839fba4b4a12fff Mon Sep 17 00:00:00 2001 From: Edwin Liava'a <1756402+EdwinLiavaa@users.noreply.github.com> Date: Tue, 10 Dec 2024 04:38:19 +1300 Subject: [PATCH 19/30] Update docs/04-resources/04-tutorials/rootstock-vyper.md Co-authored-by: Owanate Amachree --- docs/04-resources/04-tutorials/rootstock-vyper.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/04-resources/04-tutorials/rootstock-vyper.md b/docs/04-resources/04-tutorials/rootstock-vyper.md index dd15795a..ffa27a3a 100644 --- a/docs/04-resources/04-tutorials/rootstock-vyper.md +++ b/docs/04-resources/04-tutorials/rootstock-vyper.md @@ -208,7 +208,7 @@ if __name__ == "__main__": 1. **Chain ID**: RSK testnet uses chain ID 31 2. **Gas Settings**: - - We use a higher gas limit (3,000,000) for RSK + - Use a higher gas limit (3,000,000) for Rootstock - We double the gas price to ensure the transaction goes through 3. **Transaction Type**: - RSK works best with legacy transactions (using `gasPrice` instead of EIP-1559 parameters) From fd0921071d8e6e90e518d0162fe082a920d96644 Mon Sep 17 00:00:00 2001 From: Edwin Liava'a <1756402+EdwinLiavaa@users.noreply.github.com> Date: Tue, 10 Dec 2024 04:38:40 +1300 Subject: [PATCH 20/30] Update docs/04-resources/04-tutorials/rootstock-vyper.md Co-authored-by: Owanate Amachree --- docs/04-resources/04-tutorials/rootstock-vyper.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/04-resources/04-tutorials/rootstock-vyper.md b/docs/04-resources/04-tutorials/rootstock-vyper.md index ffa27a3a..780b1f4f 100644 --- a/docs/04-resources/04-tutorials/rootstock-vyper.md +++ b/docs/04-resources/04-tutorials/rootstock-vyper.md @@ -211,7 +211,7 @@ if __name__ == "__main__": - Use a higher gas limit (3,000,000) for Rootstock - We double the gas price to ensure the transaction goes through 3. **Transaction Type**: - - RSK works best with legacy transactions (using `gasPrice` instead of EIP-1559 parameters) + - Rootstock is optimized for legacy transactions, utilizing `gasPrice` rather than EIP-1559 parameters. ## Running the Deployment From 33dbfde28e15148df6cefa66d353289726cade7d Mon Sep 17 00:00:00 2001 From: Edwin Liava'a <1756402+EdwinLiavaa@users.noreply.github.com> Date: Tue, 10 Dec 2024 05:12:14 +1300 Subject: [PATCH 21/30] Update docs/04-resources/04-tutorials/rootstock-vyper.md Co-authored-by: Owanate Amachree --- docs/04-resources/04-tutorials/rootstock-vyper.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/04-resources/04-tutorials/rootstock-vyper.md b/docs/04-resources/04-tutorials/rootstock-vyper.md index 780b1f4f..7043f319 100644 --- a/docs/04-resources/04-tutorials/rootstock-vyper.md +++ b/docs/04-resources/04-tutorials/rootstock-vyper.md @@ -94,7 +94,7 @@ pip install python-dotenv web3 vyper ## Configuration -Create a `.env` file in your project root with your configuration: +Create a `.env` file in the project root and specify your custom configuration: ```env RPC_URL="https://rpc.testnet.rootstock.io/[YOUR-API-KEY]" From 96ed5098a9f7b8a5ed8173b8e73afbb6b13ecbc7 Mon Sep 17 00:00:00 2001 From: Edwin Liava'a <1756402+EdwinLiavaa@users.noreply.github.com> Date: Tue, 10 Dec 2024 05:36:48 +1300 Subject: [PATCH 22/30] Update docs/04-resources/04-tutorials/rootstock-vyper.md Co-authored-by: Owanate Amachree --- docs/04-resources/04-tutorials/rootstock-vyper.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/04-resources/04-tutorials/rootstock-vyper.md b/docs/04-resources/04-tutorials/rootstock-vyper.md index 7043f319..cfe427fe 100644 --- a/docs/04-resources/04-tutorials/rootstock-vyper.md +++ b/docs/04-resources/04-tutorials/rootstock-vyper.md @@ -107,7 +107,7 @@ THIS IS ONLY FOR TESTING - TYPICALLY YOU SHOULD NEVER SHARE YOUR PRIVATE KEY. Before deploying, you'll need some testnet RBTC: -1. Go to the RSK faucet: https://faucet.rsk.co/ +1. Go to the Rootstock faucet: https://faucet.rootstock.io/ 2. Enter your wallet address 3. Complete the captcha and request funds 4. Wait a few minutes for the transaction to be confirmed From 51f922804590d3594f76b34d6f71f91c180948cc Mon Sep 17 00:00:00 2001 From: Edwin Liava'a <1756402+EdwinLiavaa@users.noreply.github.com> Date: Tue, 10 Dec 2024 05:37:09 +1300 Subject: [PATCH 23/30] Update docs/04-resources/04-tutorials/rootstock-vyper.md Co-authored-by: Owanate Amachree --- docs/04-resources/04-tutorials/rootstock-vyper.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/04-resources/04-tutorials/rootstock-vyper.md b/docs/04-resources/04-tutorials/rootstock-vyper.md index cfe427fe..b93822f2 100644 --- a/docs/04-resources/04-tutorials/rootstock-vyper.md +++ b/docs/04-resources/04-tutorials/rootstock-vyper.md @@ -114,7 +114,7 @@ Before deploying, you'll need some testnet RBTC: ## The Smart Contract -Here's our simple Vyper contract (`favorites.vy`): +Here's a simple Vyper contract (`favorites.vy`): ```python # @version ^0.3.7 From d9eee0d2925791d8567cad8e3c442af7b1f44fd5 Mon Sep 17 00:00:00 2001 From: Edwin Liava'a Date: Tue, 10 Dec 2024 17:23:16 +1300 Subject: [PATCH 24/30] hacktivator-program --- docs/02-developers/04-quickstart/index.md | 9 ++ .../04-quickstart}/rootstock-vyper.md | 120 +++++++++++++----- docs/04-resources/04-tutorials/index.md | 8 -- 3 files changed, 95 insertions(+), 42 deletions(-) rename docs/{04-resources/04-tutorials => 02-developers/04-quickstart}/rootstock-vyper.md (57%) diff --git a/docs/02-developers/04-quickstart/index.md b/docs/02-developers/04-quickstart/index.md index 5c701930..b415e722 100644 --- a/docs/02-developers/04-quickstart/index.md +++ b/docs/02-developers/04-quickstart/index.md @@ -17,6 +17,15 @@ values={[ {label: 'Ape', value: 'ape'}, {label: 'Port to Rootstock', value: 'port-dapps'} ]}> + > $HOME/.bash_profile" echo "source $HOME/.zshenv >> $HOME/.zprofile" ``` -- Python 3.x -- A text editor -- Basic understanding of smart contracts and Python -- RSK testnet RBTC (will show you how to get this) +## Installing Python + +### Installing Python on Windows + +1. Visit the [Python downloads page](https://www.python.org/downloads/) +2. Click on the "Download Python 3.12.x" button +3. Run the downloaded installer +4. Important: Check the box that says "Add Python 3.12 to PATH" +5. Click "Install Now" +6. Once installation is complete, open Command Prompt and verify the installation: +```bash +python --version +``` + +### Installing Python on Mac + +1. Visit [python.org](https://www.python.org/downloads/) +2. Under Downloads, go to macOS and download the latest Python 3.12 release +3. Click the link for the **Python 3.12.x macOS 64-bit universal2 installer** +4. Open the installer file and agree to the license agreement +5. Click **Continue**, then **Install** +6. Once complete, open Terminal and verify the installation: +```bash +python3 --version +# or +python --version +``` + +### Installing Python on Linux + +Most Linux distributions come with Python pre-installed. To verify, open Terminal and run: +```bash +python3 --version +``` + +If Python is not installed, you can install it using your distribution's package manager: + +For Ubuntu/Debian: +```bash +sudo apt update +sudo apt install python3 +``` + +For Fedora: +```bash +sudo dnf install python3 +``` + +For Arch Linux: +```bash +sudo pacman -S python +``` ## Installation @@ -53,7 +96,7 @@ git clone https://github.com/EdwinLiavaa/Web3py-Vyper-RootStock.git cd Web3py-Vyper-RootStock ``` -### uv +### Syncing uv ```bash uv sync @@ -77,7 +120,7 @@ python hello.py # for pip/python ## Setup Environment -First, let's set up our Python environment and install the necessary packages: +To set up our Python environment and install the necessary packages, we will do the following: ```bash # Create and activate virtual environment @@ -90,7 +133,7 @@ pip install python-dotenv web3 vyper ## Configuration -Create a `.env` file in your project root with your configuration: +Create a `.env` file in the project root and specify your custom configuration: ```env RPC_URL="https://rpc.testnet.rootstock.io/[YOUR-API-KEY]" @@ -103,14 +146,14 @@ THIS IS ONLY FOR TESTING - TYPICALLY YOU SHOULD NEVER SHARE YOUR PRIVATE KEY. Before deploying, you'll need some testnet RBTC: -1. Go to the RSK faucet: https://faucet.rsk.co/ +1. Go to the Rootstock faucet: https://faucet.rootstock.io/ 2. Enter your wallet address 3. Complete the captcha and request funds 4. Wait a few minutes for the transaction to be confirmed ## The Smart Contract -Here's our simple Vyper contract (`favorites.vy`): +Here's a simple Vyper contract (`favorites.vy`): ```python # @version ^0.3.7 @@ -130,7 +173,7 @@ def store(new_number: uint256): ## Deployment Script -Here's our Python script to deploy the contract (`deploy_favorites_unsafe.py`): +Here's a Python script to deploy the contract (`deploy_favorites_unsafe.py`): ```python from web3 import Web3 @@ -200,22 +243,31 @@ if __name__ == "__main__": main() ``` -## Key Points About RSK Deployment +## Notable Info when Deploying on Rootstock 1. **Chain ID**: RSK testnet uses chain ID 31 2. **Gas Settings**: - - We use a higher gas limit (3,000,000) for RSK + - Use a higher gas limit (3,000,000) for Rootstock - We double the gas price to ensure the transaction goes through 3. **Transaction Type**: - - RSK works best with legacy transactions (using `gasPrice` instead of EIP-1559 parameters) + - Rootstock is optimized for legacy transactions, utilizing `gasPrice` rather than EIP-1559 parameters. ## Running the Deployment Execute the deployment script: +For Linux Users: + ```bash python deploy_favorites_unsafe.py ``` + +For Windows Users: + +```bash +python3 deploy_favorites_unsafe.py +``` + ## Useful Links The boilerplate used in this project was adopted from the Cyfrin Updraft Python and Viper Starter Kit: diff --git a/docs/04-resources/04-tutorials/index.md b/docs/04-resources/04-tutorials/index.md index 4645edda..0ac12678 100644 --- a/docs/04-resources/04-tutorials/index.md +++ b/docs/04-resources/04-tutorials/index.md @@ -13,14 +13,6 @@ values={[ {label: 'Port to Rootstock', value: 'port-dapps'} ]}> - Date: Tue, 10 Dec 2024 19:06:02 +1300 Subject: [PATCH 25/30] hacktivator-program --- .../04-quickstart/rootstock-vyper.md | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/docs/02-developers/04-quickstart/rootstock-vyper.md b/docs/02-developers/04-quickstart/rootstock-vyper.md index ba86e8b4..abbe733e 100644 --- a/docs/02-developers/04-quickstart/rootstock-vyper.md +++ b/docs/02-developers/04-quickstart/rootstock-vyper.md @@ -1,9 +1,18 @@ --- -sidebar_label: Vyper Smart Contract on Rootstock +sidebar_label: "Vyper Smart Contract on Rootstock" sidebar_position: 100 -title: Deploying a Vyper Smart Contract to Rootstock Testnet using Python -description: 'This guide walks through the process of deploying a smart contract to the Rootstock testnet using Python and Web3.py. We'll be deploying a simple Vyper contract that demonstrates how to interact with the Rootstock network.' -tags: [rsk, rootstock, beginner, quick starts, advanced, port to rootstock, web3py, vyper, python] +title: "Deploying a Vyper Smart Contract to Rootstock Testnet using Python" +description: "This guide walks through the process of deploying a smart contract to the Rootstock testnet using Python and Web3.py. We'll be deploying a simple Vyper contract that demonstrates how to interact with the Rootstock network." +tags: + - rsk + - rootstock + - beginner + - quick starts + - advanced + - port to rootstock + - web3py + - vyper + - python --- From e9e776e6a2b362723b22b064ce7f2a8ea9912604 Mon Sep 17 00:00:00 2001 From: Edwin Liava'a Date: Tue, 10 Dec 2024 20:18:48 +1300 Subject: [PATCH 26/30] hacktivator-program --- docs/02-developers/04-quickstart/rootstock-vyper.md | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/docs/02-developers/04-quickstart/rootstock-vyper.md b/docs/02-developers/04-quickstart/rootstock-vyper.md index abbe733e..8236b386 100644 --- a/docs/02-developers/04-quickstart/rootstock-vyper.md +++ b/docs/02-developers/04-quickstart/rootstock-vyper.md @@ -3,17 +3,7 @@ sidebar_label: "Vyper Smart Contract on Rootstock" sidebar_position: 100 title: "Deploying a Vyper Smart Contract to Rootstock Testnet using Python" description: "This guide walks through the process of deploying a smart contract to the Rootstock testnet using Python and Web3.py. We'll be deploying a simple Vyper contract that demonstrates how to interact with the Rootstock network." -tags: - - rsk - - rootstock - - beginner - - quick starts - - advanced - - port to rootstock - - web3py - - vyper - - python - +tags: [rsk, rootstock, developers, vyper, quickstart, python, Smart Contracts] --- 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 advantages for developers. From 1181e15eee77b422af4777d3f8b8999b750082a5 Mon Sep 17 00:00:00 2001 From: Edwin Liava'a Date: Wed, 11 Dec 2024 05:50:22 +1300 Subject: [PATCH 27/30] hacktivator-program --- .../04-quickstart/rootstock-vyper.md | 84 ++++++++++++++----- 1 file changed, 63 insertions(+), 21 deletions(-) diff --git a/docs/02-developers/04-quickstart/rootstock-vyper.md b/docs/02-developers/04-quickstart/rootstock-vyper.md index 3ee043f0..8236b386 100644 --- a/docs/02-developers/04-quickstart/rootstock-vyper.md +++ b/docs/02-developers/04-quickstart/rootstock-vyper.md @@ -1,29 +1,23 @@ --- -sidebar_label: Vyper Smart Contract on RootStock -sidebar_position: 7 -title: Deploying a Vyper Smart Contract to RootStock (RSK) Testnet using Python -description: "This guide walks through the process of deploying a smart contract to the RootStock (RSK) testnet using Python and Web3.py. We'll be deploying a simple Vyper contract that demonstrates how to interact with the RSK network." -tags: - - rsk - - rootstock - - tutorials - - resources - - tests - - web3py - - vyper - - smart contracts - - python - - developers +sidebar_label: "Vyper Smart Contract on Rootstock" +sidebar_position: 100 +title: "Deploying a Vyper Smart Contract to Rootstock Testnet using Python" +description: "This guide walks through the process of deploying a smart contract to the Rootstock testnet using Python and Web3.py. We'll be deploying a simple Vyper contract that demonstrates how to interact with the Rootstock network." +tags: [rsk, rootstock, developers, vyper, quickstart, python, Smart Contracts] --- -This guide demonstrates how to deploy smart contracts written in Vyper to the RootStock (RSK) testnet using Python and Web3.py. RSK is a groundbreaking smart contract platform that's merge-mined with Bitcoin, offering unique advantages for developers: +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 advantages for developers. + +This guide demonstrates how to deploy smart contracts written in Vyper to the Rootstock testnet using Python and Web3.py. - **Bitcoin Compatibility**: Deploy smart contracts while leveraging Bitcoin's security and network effects - **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 -We'll walk through creating a simple Vyper contract and deploying it to RSK's testnet, covering everything from environment setup to handling RSK-specific configurations. Whether you're an experienced Ethereum developer looking to expand to Bitcoin-based smart contracts, or just starting your blockchain journey, this guide will help you get up and running with RSK. +We'll walk through creating a simple Vyper contract and deploying it to the Rootstock testnet, covering everything from environment setup to handling Rootstock-specific network configurations. + +Whether you're an experienced Ethereum developer looking to expand to Bitcoin-based smart contracts, or just starting your blockchain journey, this guide will help you get up and running with Vyper Contracts on Rootstock. ## Prerequisites @@ -41,10 +35,58 @@ echo "source $HOME/.bashrc >> $HOME/.bash_profile" echo "source $HOME/.zshenv >> $HOME/.zprofile" ``` -- Python 3.x -- A text editor -- Basic understanding of smart contracts and Python -- RSK testnet RBTC (will show you how to get this) +## Installing Python + +### Installing Python on Windows + +1. Visit the [Python downloads page](https://www.python.org/downloads/) +2. Click on the "Download Python 3.12.x" button +3. Run the downloaded installer +4. Important: Check the box that says "Add Python 3.12 to PATH" +5. Click "Install Now" +6. Once installation is complete, open Command Prompt and verify the installation: +```bash +python --version +``` + +### Installing Python on Mac + +1. Visit [python.org](https://www.python.org/downloads/) +2. Under Downloads, go to macOS and download the latest Python 3.12 release +3. Click the link for the **Python 3.12.x macOS 64-bit universal2 installer** +4. Open the installer file and agree to the license agreement +5. Click **Continue**, then **Install** +6. Once complete, open Terminal and verify the installation: +```bash +python3 --version +# or +python --version +``` + +### Installing Python on Linux + +Most Linux distributions come with Python pre-installed. To verify, open Terminal and run: +```bash +python3 --version +``` + +If Python is not installed, you can install it using your distribution's package manager: + +For Ubuntu/Debian: +```bash +sudo apt update +sudo apt install python3 +``` + +For Fedora: +```bash +sudo dnf install python3 +``` + +For Arch Linux: +```bash +sudo pacman -S python +``` ## Installation From 2701845600bfcb5b56872c6bd2b07cb194c29615 Mon Sep 17 00:00:00 2001 From: Edwin Liava'a Date: Wed, 11 Dec 2024 06:12:25 +1300 Subject: [PATCH 28/30] hacktivator-program --- docs/02-developers/04-quickstart/rootstock-vyper.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/02-developers/04-quickstart/rootstock-vyper.md b/docs/02-developers/04-quickstart/rootstock-vyper.md index 8236b386..31fbab30 100644 --- a/docs/02-developers/04-quickstart/rootstock-vyper.md +++ b/docs/02-developers/04-quickstart/rootstock-vyper.md @@ -97,12 +97,16 @@ cd Web3py-Vyper-RootStock ### Syncing uv +uv sync is a fast package management command that downloads and installs your project's Python dependencies while creating a lockfile for reproducible installations. + ```bash uv sync ``` ### pip/python +The pip/python section 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). + ```bash python -m venv ./venv source ./venv/bin/activate @@ -111,6 +115,8 @@ pip install -r requirements.txt ## Quickstart +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. + ```bash uv run hello.py # for UV # or From 72ea5b21f2e46c201bd17733994f8c369bffee06 Mon Sep 17 00:00:00 2001 From: Owanate Amachree Date: Wed, 26 Feb 2025 22:37:23 +0000 Subject: [PATCH 29/30] minor update --- docs/02-developers/04-quickstart/index.md | 2 +- docs/02-developers/04-quickstart/rootstock-vyper.md | 6 +++--- docs/04-resources/04-tutorials/index.md | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/02-developers/04-quickstart/index.md b/docs/02-developers/04-quickstart/index.md index 2905a50e..fd233718 100644 --- a/docs/02-developers/04-quickstart/index.md +++ b/docs/02-developers/04-quickstart/index.md @@ -24,7 +24,7 @@ values={[ color="orange" linkHref="/developers/quickstart/rootstock-vyper/" linkTitle="Use the Kit" - description="This guide walks through the process of deploying a smart contract to the Rootstock testnet using Python and Web3.py. We'll deploy a simple Vyper contract that demonstrates how to interact with the Rootstock network." + description="The Rootstock Vyper Starter Kit demonstrates how to deploy smart contracts written in Vyper to the Rootstock network." /> Date: Wed, 26 Feb 2025 22:40:34 +0000 Subject: [PATCH 30/30] minor update --- docs/02-developers/04-quickstart/rootstock-vyper.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/02-developers/04-quickstart/rootstock-vyper.md b/docs/02-developers/04-quickstart/rootstock-vyper.md index fd1e41be..e13b20fb 100644 --- a/docs/02-developers/04-quickstart/rootstock-vyper.md +++ b/docs/02-developers/04-quickstart/rootstock-vyper.md @@ -281,8 +281,6 @@ To execute the deployment script, run the following command: :::danger[ModuleNotFoundError: No module named 'web3'] -Error: - ```bash python3 deploy_favorites_unsafe.py Traceback (most recent call last):