Published on:

October 11, 2022
How to Deploy a Smart Contract with Brownie

Share

Not too long ago, the smart contract world used JavaScript predominantly despite the glaring testing and auditing framework drawbacks. 

Python, with its reliable and easy-to-navigate syntax, was the obvious replacement choice for most developers, and the name “Brownie” became delectable in more ways than one. 

Before learning how to deploy a smart contract, here’s a small introduction to Brownie. 

An Introduction to Brownie

In simple terms, Brownie is the Python framework for deploying, testing, and interacting with Ethereum smart contracts. 

Some of the major advantages of Brownie are

  1. Brownie stands apart from other frameworks as it offers a built-in area where project interactions occur. 
  1. Brownie fully supports the popular smart contract programming languages – Vyper and Solidity. 
  1. Brownie has the unique ability to notify the user when a test fails while running. 
  1. As Brownie is based on Python, all the benefits of Python are carried forward to Brownie.
  1. It is significantly easier to deploy local blockchains on Brownie. 

Introduction

Now that you have a grasp of Brownie, let us see what else you will learn in this guide. 

  1. How to use Solidity to build a basic Ethereum wallet. 
  2. How to deploy a wallet to Zeeve using Brownie. 
  3. How to send & receive Ether. 
  4. How to deploy a smart contract. 

Prerequisites to understanding the guide: 

  1. Fundamentals knowledge of Python and Solidity. 
  2. Building two Metamask accounts on Rinkeby testnet. 
  3. Ensuring the latest versions of Brownie and Solidity are installed.  

Preparing Brownie

The first step is installing browning with “pip” or “pipx” so go to your terminal/cmd and type the following: 

pip install eth-brownie

Step two is creating a new directory and switching “cd” to this directory. The codes for this is: 

mkdir project
cd project

Step three is running the command to start a new Brownie project and this will create boilerplate content that will help you carry on the subsequent steps with Brownie: 

brownie init

Creating Ethereum Wallet with Solidity

The next step is to create an Ethereum wallet to transact Eth via Solidity, where the addresses of users will be mapped and stored. 

For this, you need to create a function that has the ability to receive payments, map