Mode:
Duration:
1
Coding works best on desktop or with an external keyboard.
Coding works best on desktop or with an external keyboard.
Estimate gas usage for a smart contract function using Brownie.
from brownie import Counter, accounts
def main():
acct = accounts[0]
counter = Counter.deploy({'from': acct})
gas_estimate = counter.increment.estimate_gas({'from': acct})
print('Estimated gas for increment():', gas_estimate)Brownie is an open-source Python-based framework for Ethereum smart contract development, testing, and deployment. It integrates with Ethereum networks and provides a full-featured environment for building decentralized applications (dApps).
Origin & Creator
Brownie was created by Matt Lockyer in 2018 to simplify Ethereum smart contract development using Python, providing a familiar developer workflow for testing, deployment, and interaction.
Industrial Note
Brownie is widely used in DeFi, NFT, and other blockchain applications for rapid smart contract development and testing, particularly when Python-based workflows are preferred.