Brownie 101- New Project

Creating a New Project

The first step to using Brownie is to initialize a new project. To do this, create an empty folder and then type:

brownie init

Structure of a Project:

Every Brownie project includes the following folders:

  • contracts/: Contract sources
  • interfaces/: Interface sources
  • scripts/: Scripts for deployment and interaction
  • tests/: Scripts for testing the project
  • brownie-config.yaml: Configuration file for the project

The following folders are also created and used internally by Brownie for managing the project. You should not edit or delete files within these folders.

  • build/: Project data, such as compiler artifacts and unit test results
  • reports/: JSON report files for use in the GUI

Brownie mixes

Aside from using the above code, you may also initialize “Brownie mixes” (these are Brownie project templates). There are many templates available. The code you can see below refers to the token mix. By initializing any Brownie mix, a specific subdirectory is created. Within it the template project downloads. Here’s how the code looks like:

brownie bake token

Compiling your Contracts:

To compile your project:

brownie compile

Brownie will compile your contracts, start the local RPC client, and give you a command prompt. From here you may interact with the network with the full range of functionality offered by the Brownie API .Also, keep in mind that you can change the compiler version and optimization settings via the config file(yaml file).

The console is useful when you want to interact directly with contracts deployed on a non-local chain, or for quick testing as you develop. It’s also a great starting point to familiarize yourself with Brownie’s functionality.

The console feels very similar to a regular python interpreter. From inside a project directory, load it by typing:

brownie console


Access to local accounts is through accounts, a list-like object that contains account objects capable of making transactions.


Brownie offers programmers a particular object, ‘ContractContainer,’ for each deployable contract in a project. Essentially, these objects are list-like elements used to deploy new contracts. A great example is provided below.

Whenever you deploy a contract, the console returns a ‘Contract’ object, which you can use to interact with the contract. Moreover, that object is added to the ‘ContractContainer.’


Yes, you’ve guessed it! ETH Brownie also offers the ‘TransactionReceipt’ object. It contains all relevant information regarding a transaction. On top of that, it also packs various methods to aid in debugging.

Brownie Scripts:

Using Brownie, you may also automate contract deployment and interactions by writing scripts. To do so, you need to place ‘from brownie import *’ at the beginning of your particular script. On top of that, you must store the script in the ‘script/’ folder.

running script

Testing Your Project:

brownie test

& that’s it for today!





Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Starting with Spark and Zeppelin in 2 Minutes Using Docker — Create Your First Data Frame

why did I start to learn FLUTTER?

Flutter Image

This Golang Project That Every Data Scientist Should Use

How to get started with Competitive Programming

TOP Mining ROI is 651%! The Mining is Coming Up Soon!

BitTorrent Pro Mod APK Download

BitTorrent Pro Mod APK Download

Ruby Collections and Methods

Upgrading Pinterest to HBase 1.2 from 0.94

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
M-Zohaib Nasir

M-Zohaib Nasir


More from Medium

File handling at gigify

Blockchain Security DevSecOps (Smart Contract)

Smart contract address creation method & difference between smart contract address and wallet…

A Journey Into The Blockchain Protocol Design Space (with knowledge map)