Posts

Showing posts with the label browniepythongithub

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...

Using Ganache CLI with Brownie to Deploy A Smart Contract

Image
In this article, after installing Brownie , we are going to install the Ganache CLI (Command Line Interface) and use it with Brownie. The Ganache CLI is the same as Ganache IDE with the difference that it automatically runs without the need to open the Ganache IDE. At the end end of this tutorial, we will be able to deploy our smart contracts on top of Ganache CLI simulated blockchain. Installing Ganache: To continue our journey with Brownie, we need to make sure Ganache CLI has been installed successfully. To make sure that it has, and also see its virtual accounts, in your console (terminal) write: Coppied to clipboard. ganache And it should give you the test accounts like this: ganache v7.0.3 (@ganache/cli: 0.1.4, @ganache/core: 0.1.4) Starting RPC server Available Accounts ================== (0) 0x960F41C52ffAef71fFef2fFBC3C0EA5Dc5748086 (1000 ETH) (1) 0x39Cf64532C1126c6C9Fa0a02338389d1eb861A12 (1000 ETH) (2) 0xA1E47c46425e2456566...