The Great Brownie Replacement
Brownie Is Dead, Long Live Brownie!
Brownie helped get my first experiment off the ground, served as the platform for my first bot, and worked beautifully for testing and deploying my first contract.
It’s a testament to its quality that I was able to build so much on top of it, and that it took me this long to reach beyond its capabilities.
Last year, a user created an issue on the Brownie Github titled Is Brownie Dead? which generated some very interesting discussion. Our beloved author replied that yes, Brownie is de facto dead unless someone was willing to take it over.
But there is hope!
The good folks at ApeWorX Ltd. have been working tirelessly to build Ape, a new Python-based EVM toolkit. Ape is a capable successor to Brownie, and I am working with it in the background to learn how to use it properly.
Going forward, exploration and development lessons will be written for Ape instead of Brownie. If I discover that an Ape feature is missing or not working correctly, I will try to identify a workaround, submit a PR, or file a bug.
Degenbot — What Do?
Many readers are frustrated by how difficult it is to install Brownie on their machines. Every day the Python ecosystem marches slowly onward, leaving Brownie behind. I don’t feel the pain quite as much since I have a special PyEnv virtual environment set up with Python 3.10 and various old dependencies that are Brownie-compatible.
One challenge of developing for a large audience is that I can’t move as fast as I’d like. It’s no problem when I’m hacking on my own, but if I introduce changes to the degenbot code base, I risk breaking thousands of scripts or bots that are live right now.
I can’t prevent all bugs, and I write with the understanding that we’re all technical people who can solve our problems, but I owe it to you to move carefully.
With that in mind, I have already started making changes to degenbot classes to facilitate a deprecation of Brownie.
Brownie, at least for my purposes, is a sophisticated wrapper over web3.py. It does a lot of really nice stuff, but I don’t use it for its main purpose: contract development, deployment, and testing.
I use Brownie for these key activities:
Fetching blockchain data
Managing private keys and public addresses
Deploying smart contracts
Interacting with smart contracts (read & write)
Managing blockchain networks
Retrieving contract data from block explorers
The first four items will be handled by web3.py.
The last three items are handled by Ape.
Python toolkits are mostly fancy wrappers for web3.py, middlewares for web3.py, or tools which read and write to
Web3 objects from web3.py.
This is very good for us, because it allows the degenbot code base to migrate from Brownie without breaking everything.
Erc20Token — A Practical Example
One of the very first classes I ever wrote was Erc20Token, a class that simplified interaction with ERC-20 tokens by fetching useful info like the token name, symbol, number of decimals, balance, and current Chainlink price (if available). It started as a simple wrapper over the Brownie
Contract class, and it worked by populating those values by sending calls to the token contract.