/eth_brownie_vscode_example

Example VSCode Project for Brownie Ethereum Python Framework

Primary LanguagePython

Brownie VSCode Example

[YouTube] [Twitter] [Discord] [Patreon] [LinkedIn]

This repository is an example on how to use the Brownie Ethereum Python Framework to compile and run a Solidity smart contract on a local Ethereum network through the ganache-cli. Find the article for it over here: k0nze.dev/posts/solidity-smart-contract-python-vscode

Project Structure

This project follows the brownie project structure

  • brownie-config.yaml: Config file for this project.
  • contracts/Faucet.sol: smart contract in Solidity that allows to withdraw funds from it.
  • contracts/HelloWorld.sol: smart contract in Solidity that returns "Hello World!".
  • scripts/faucet.py: Python script that deploys the Faucet, transfers funds to the Faucet, and withdraws funds from the Faucet.
  • .vscode/: VScode project settings and tasks.

Prerequisites

  • Python version >= 3.9
  • ganache-cli installed
  • VSCode installed together with the Python and Solidity Extension.

Setup

git clone https://github.com/k0nze/eth_brownie_vscode_example.git
cd eth_brownie_vscode_example
python -m venv .venv
source .venv/bin/activate
python -m pip install eth-brownie
brownie run faucet.py

In VSCode you can run the task Run Faucet to execute the brownie run faucet.py.