Aim
In this blog post, I would like to record how to prepare development environment for web3 applications. The target of this development environment is focusing on python and smart contract. To be specific, I will only pin point to the following list of tools.
Setup
- Ubuntu 20.04
- Python 3.8
- Solidity
- Remix --- the web IDE
- Brownie
- Nodejs
- npm, the package manager of Nodejs
- ganache-cli
- Ganache on linux
- Infura --- web3 API provider
Development stack 1 --- Remix
This solution leveraging the solidity environment from Remix --- the online IDE. One can run the Ganache locally to simulate a local block chain and make a connection from the Remix to it for smart contract deployment and testing. In addition, python web3 library can connect to the Ganache local block chain for further interaction with the smart contract.
Setup
Installation steps
You need to create API keys from Infura. After that, you can get different end points to access different network.
Development stack 2 --- Brownie
The different of the solution from the last one is that you have the solidity development environment locally. You can compile you smart contract and upload to different network of your choice. Further more, Brownie provides you the entire project structure to help you to standardize it and make the python smart contract interaction easier.
Setup
- Ubuntu 20.04
- Brownie --- the web3 development framework
- Python 3.8
- web3
- Nodejs
- npm --- the package manager of Nodejs
- ganache-cli --- enable Brownie to control the ganache for development
- Infura --- web3 API provider
Installation steps
Please refer to the above installation steps to prepare the Infura API key first.
# prepare python project $ poetry init $ poetry install $ poetry add web3 # install brownie $ sudo apt-get install python3.8-venv $ poetry add pipx $ poetry run pipx install eth-brownie $ brownie --version # install ganache-cli $ sudo apt-get install nodejs $ sudo apt-get install npm $ sudo npm install –g ganache-cli
Project creation and development
# init brownie project $ cd <your project root> $ brownie init # compile $ brownie compile # deploy --- you need to prepare your deployment script first $ brownie run scripts/deploy.py
Reference
[1] Before you continue to YouTube. (n.d.). https://www.youtube.com/playlist?list=PLCwnLq3tOElrubfUWHa1qKrJv1apO8Aag


Comments
Post a Comment