Posts

Showing posts with the label deployasmartcontractusingPythonweb3tools

Using Brownie to Switch between Different Networks

Image
In this article, we are going to switch between the different available networks we can connect to, using Brownie. Then, we'll write a statement in the Deploy.py to connect to the network requested in the terminal by the user (the developer). This kind of script for network management makes it easy for us to connect to any network that we want at any time it is required for testing and other purposes. How to Switch between Networks As you know, we have different networks to work with. We have already used some of them for deploying our contracts . Sometimes we need to write our deploy.py file in a way that we can switch between different networks and accounts and the deploy.py must understand which ones are available. Switch between Different Networks Before we get started with this task, we can check the keywords when we want to connect to different accounts. To look up the keyword related to any network, we write: Coppied to clipboard. brownie ...

Testing Deploy.py Script Using Brownie: A Full Analysis

Image
In this post, we will complete testing our deploy.py script using Brownie in more detail so that we can see if there is any problem at all. And if there is, we can analyze it in more detail. This kind of detailed test and code analysis becomes handy, especially when the code is too long and complex that we cannot so easily understand where the unexpected result originates from. Detailed Testing Deploy.py Using Brownie For more detailed testing, we can write in the terminal: Coppied to clipboard. brownie test -k Which in our case will be: Coppied to clipboard. brownie test -k test_updating_storage And the result will be: Coppied to clipboard. Brownie v1.18.1 - Python development framework for Ethereum ===================================================== test session starts ===================================================== platform linux -- Python 3.8.10, pytest-6.2.5, py-1.11.0, pluggy-1.0.0 rootdir: /hom...

How to Deploy A Smart Contract Using Python Web3 Tools: A Full Coverage

Image
In this tutorial, we are going to see how we can interact with smart contracts using Solidity outside of the Remix IDE. To do this, we should somehow do the process of executing transactions and deploying the contracts with a programming language and a module. Web3 modules provide means for serving our purpose through JavaScript or python. We are going to deploy a smart contract using Python web3 tools and use VS code as our IDE. Essentials for Using Python Web3 Tools This series of tutorials is the continuation of the Solidity tutorials in Remix IDE. However, we use VS Code or sublime text instead of Remix IDE. So, it is highly recommended that you read those articles before you begin this series of tutorials. It is also useful if you read the getting started with DAPPs tutorials as well to be more familiar with how to install Web3 Python on your operating system and some web3.py hands-on sample codes. So, let’s get started with more exciting steps into developing a dec...