Skip to main content

Questions tagged [brownie]

Brownie is a Python-based development and testing framework for smart contracts targeting the Ethereum Virtual Machine.

Filter by
Sorted by
Tagged with
9 votes
5 answers
5k views

eth-brownie: Unable to expand environment variable in host setting

When running a script: brownie run scripts/deploy.py --network kovan I receive this error: raise ValueError(f"Unable to expand environment variable in host setting: ‘{uri}’”) ValueError: Unable ...
Patrick Collins's user avatar
9 votes
2 answers
6k views

Which Ethereum framework to choose Truffle vs Brownie?

I know that the most used framework for smart contract that is used for testing, deployment etc is Truffle. But, since I am not very good at javascript (i am mainly coding in python)- I saw there is ...
Dennis's user avatar
  • 91
8 votes
2 answers
5k views

How to get the return value of a transaction instead of the transaction receipt in brownie

I have a function in my smart contract called getRandomNumer, and it returns a bytes32. However, in brownie, when I make a transaction it returns the transaction receipt. How do I get the return value?...
Patrick Collins's user avatar
7 votes
4 answers
1k views

How to debug Brownie in VSCode?

How to debug Brownie program in Visual Studio Code? I suppose there should be some launch.json created but don't know which one.
Vitaly's user avatar
  • 158
6 votes
3 answers
6k views

How can I make an ERC721 NFT such that the token owner can edit an attribute in the metadata? Where can they edit the metadata?

I've read that ERC721 tokens can be created such that the token owner can edit the on-chain metadata. I've been following tutorials for the brownie-nft mix and making NFTs on OpenSea, but I have yet ...
Kyle Lynch's user avatar
6 votes
1 answer
2k views

How to catch a `revert()` error using Brownie?

I am using Brownie to develop my smart contracts, which helps me to intract with the smart contracts, please see doc. When my call Example.greet() is there any way to return the error message and act ...
alper's user avatar
  • 8,394
6 votes
1 answer
2k views

How to deploy Ethereum Smart Contract through Brownie to the Private Network

I have a geth node that is connected to a private network on my computer that uses port: 8545. Hence, I have a smart contract that is tested using Brownie on the ganache-cli network. Brownie is a ...
alper's user avatar
  • 8,394
5 votes
2 answers
2k views

deploying smartcontract to ganache-desktop instead of ganache-cli with brownie

i have a smartcontract developed with brownie. I want to deploy it to ganache. If i run my deployment script brownie run scripts/deploy.py, brownie deploys the smartcontract with ganache-cli. But i ...
Khan's user avatar
  • 325
5 votes
2 answers
2k views

'brownie' is not recognized as an internal or external command on Windows 10

I downloaded eth brownie via pipx install eth-brownie and got 'eth-brownie' already seems to be installed. Not modifying existing installation in 'C:\\Users\\HP\\.local\\pipx\\venvs\\eth-brownie'. ...
AngelDev's user avatar
  • 107
5 votes
1 answer
3k views

Can you check if an address is a contract or an EOA with eth-brownie or some other python native package?

I'm trying to categorize smart contracts versus EOAs since I am treating them differently in an application. Does anyone have ideas? I know in solidity you could try address.code.length or extcodesize ...
Andrew Hong's user avatar
5 votes
0 answers
157 views

Brownie empty traceback and revert_msg

I'm trying to create a Yearn strategy following https://github.com/yearn/brownie-strategy-mix. But a transaction is failing, and brownie isn't telling me why: % brownie console Brownie environment is ...
pineda's user avatar
  • 51
4 votes
3 answers
2k views

directory is not empty: brownie

I'm getting this error when I try to setup a brownie project using brownie init. I initially installed brownie using pip install eth-brownie in the virtual environment. The folder .venv is present ...
VijitaTheCoder's user avatar
4 votes
2 answers
2k views

How to use contracts from project dependencies in Brownie scripts?

I want to deploy a contract directly accessible in OpenZeppelin/[email protected] Brownie package without changes, namely ERC1967Proxy and other non-abstract contracts from Brownie console. ...
Utgarda's user avatar
  • 791
4 votes
4 answers
3k views

Brownie Chainlink Import Error VSCode - 'File import callback not supported'

The code seems to have successfully compiled, but VSCode keeps showing this error - "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol" not found. File import callback not ...
Parteek Singh Jamwal's user avatar
4 votes
1 answer
142 views

Brownie: Hypothesis given() is not resetting chain for each function call

I have the following test code snippet in my brownie project: from hypothesis import settings, given, strategies as st from brownie import * import brownie st_buy_amount_eth = st.integers(min_value=...
Newti's user avatar
  • 365
4 votes
1 answer
430 views

AttributeError: 'UsingForDirective' object has no attribute 'typeName'

I'm trying to compile code from OHM BondDepository.sol contract however every time I do so, I get this error from brownie Compiling contracts... Solc version: 0.7.5 Optimizer: Enabled Runs: 200 ...
provsalt's user avatar
4 votes
1 answer
571 views

Cannot install eth-brownie with pipx

I have an MacBook Air M2 with python version 3.11.2 I am getting this error message when I follow the pipx instructions to install brownie I tried using pip to install each of these packages ...
Kate Johnson's user avatar
3 votes
2 answers
3k views

'Brownie compile' using different compiler version than specified in configuration file

Why does brownie attempt to compile with the latest locally available version of solc even if I set a specific older version in the config file? Example: bernat:uniswap-v3-playground bernat$ brownie ...
Bernat's user avatar
  • 183
3 votes
1 answer
2k views

Does anyone know how to fork a chain at a particular block on Brownie?

I am trying to fork the ethereum mainnet at a past block number on brownie. But I dont see any way to do that in the brownie docs .
Diganta Kalita's user avatar
3 votes
7 answers
3k views

LINK1120 error when attempting to install Brownie with 'pipx install eth-brownie'

I'm having some issues with my installation process for Brownie and wanted to reach out for some help. After getting pipx installed, my attempt to use 'pipx install eth-brownie' in the terminal of VSS ...
user79431's user avatar
3 votes
3 answers
2k views

Brownie cannot locate deploy.py script

I have python installed on my system (Windows) with Anaconda from a prior course I had taken which may be the root cause of the issue. I'm at the stage where I need to run a deploy.py script to deploy ...
NickS's user avatar
  • 33
3 votes
2 answers
835 views

Call fallback function from eth-brownie from proxy

I have a contract that has a fallback function to delegatecall all function calls to a different contract. I can't seem to use my typical API to interact with the contract it delegates a call to. I ...
Patrick Collins's user avatar
3 votes
5 answers
2k views

File outside of allowed directories on brownie compile command

trying to import to files from openzeppelin and chainlink in my contract file like so: import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@chainlink/contracts/src/v0.6/...
Mert Yurt's user avatar
3 votes
1 answer
256 views

delegatecall in Brownie

I am trying to perform delegatecall in Brownie solving the Delegation task in the Ethernaut app in order to claim ownership of the Delegate contract (see below). What is the equivalent of the ...
haraslub's user avatar
3 votes
3 answers
2k views

Brownie: Unable to launch local RPC client

I was trying to run brownie for ganachi-cli, but it keeps giving me this error. My node is up to date and I have changed my host in the ganachi-cli UI. What do I do? Brownie v1.17.2 - Python ...
Victor's user avatar
  • 51
3 votes
1 answer
261 views

What is the purpose of a `// dev:` comment after a revert or require statement?

What does it mean when a Solidity contract includes a comment starting with // dev: after a revert or require statement? For example: contract Example { function greet(){ revert(); // ...
iamdefinitelyahuman's user avatar
3 votes
2 answers
546 views

Add a 'from' account to hardhat transaction calls

I recently started learning to use hardhat to interact with and deploy smart contracts and I noticed that while brownie can accept a from address field for chain transactions, hardhat doesn't. Does ...
Destiny77's user avatar
3 votes
1 answer
382 views

how do i solve KeyError: 'wallets'?

I followed the answer to a similar question posted on here by adding dotenv: .env to the top of my brownie-config.yaml file but still having the same issue. This is my code in the brownie-config.yaml ...
Basho's user avatar
  • 31
3 votes
1 answer
808 views

Deploy to testnet with brownie

I'm looking to deploy some code to the kovan testnet with Brownie. However I keep getting an error accessing accounts. Here is the command I'm running: brownie run scripts/deploy_price_consumer_v3.py -...
Patrick Collins's user avatar
3 votes
1 answer
1k views

Brownie cannot install solc on OSX

Follow the procedures on this page brownie : create new project and compile with brownie. Encounter the following error, please comment how to fix it. Configuration and environment. Python 3.7.7 ...
madeinQuant's user avatar
3 votes
1 answer
2k views

How to re-use previously deployed contract with Hardhat?

In brownie there's a very handy syntax to avoid deploying multiple times the same contract on-chain, while developing and iterating fast: MyContract.deploy() # somewhere else, sometime later: ...
Gian Segato's user avatar
3 votes
3 answers
466 views

How to run a specific unit test in a test script in brownie?

Say I have a python test script in my brownie project's /tests directory with a number of difference test cases, is it possible to pass a flag to only execute a certain test function in brownie?
MShakeG's user avatar
  • 1,733
3 votes
2 answers
1k views

Brownie / Rinkeby ValueError: Gas estimation failed: "you must set the gas limit manually"

from brownie import AdvancedCollectible, accounts, config, network from scripts.helpful_scripts import get_breed import time static_seed = 123 def main(): dev = accounts.add(config["wallets&...
Zakariae Bekri's user avatar
3 votes
2 answers
5k views

Error: Non-hexadecimal digit found

I seem to be running the following error when I try to run this script: , from brownie import AdvancedCollectible, accounts, network, config def main(): dev = accounts.add(config['wallets']['...
rizonpoint's user avatar
3 votes
2 answers
470 views

How to run Chainlink Project using eth-brownie python

I had installed eth-brownie using command pip install eth-brownie after Brownie installed.I had bake existing Brownie project into a new directory. mkdir MyChainlinkProject cd MyChainlinkProject/ ...
Hassan ALi's user avatar
3 votes
0 answers
226 views

Does brownie have functionality to analyze gas costs for all function calls?

Does brownie have any sort of functionality that gives a breakdown of the cost to deploy all contracts and execute all function calls within a brownie project with min, max and average gas cost ...
MShakeG's user avatar
  • 1,733
3 votes
0 answers
723 views

Brownie INFO: Could not find files for the given pattern(s)

I installed Brownie succefully, and also am able to make a init project from it. But every time I run brownie I get INFO: Could not find files for the given pattern(s) I've installed ganache-cli, ...
Jaydeep Dholakia's user avatar
3 votes
1 answer
170 views

How do I automatically verify my contracts on etherscan using brownie?

I discovered truffle has truffle-plugin-verify that help you verify your contracts on etherscan. I wonder if similar functionality can be done with brownie ?
H4F's user avatar
  • 31
2 votes
2 answers
1k views

Creating a contract contrainer with Brownie

How can i replicate this functionality with brownie? // Deploy Uniswap Factory and Router this.uniswapFactory = await (new ethers.ContractFactory(factoryJson.abi, factoryJson.bytecode, ...
CuriousDweller's user avatar
2 votes
2 answers
215 views

What are the node providers for Genosis Network (xDai)?

Which node provider can be used to fork Genosis Network (xDai) using brownie? Alchemy, infura and moralis does not provide service. I tried getBlock but doesn't work at all.
Emrah's user avatar
  • 1,664
2 votes
3 answers
2k views

How to add network to brownie-config.yaml

I know you can add a network to brownie by using a command: brownie networks add Ethereum ganache-local host=http://127.0.0.1:7545 chainid=5777 or for example: brownie networks add development ...
Sky's user avatar
  • 2,332
2 votes
2 answers
660 views

Passing struct into solidity function from brownie

Similar questions have been asked before, and I have read them but am stuck after using encode_single. If I pass the resulting bytes into my solidity function it says "expected list or tuple, ...
perchlorious's user avatar
2 votes
2 answers
1k views

How to get a contracts emitted events in brownie?

Say I have a contract that emits multiple events, how do I to get a list of all events emitted in brownie and sort them by event type? contract SimpleContract { event Deposit(address indexed ...
MShakeG's user avatar
  • 1,733
2 votes
2 answers
160 views

How to use vyper's external_interface in brownie?

An external interface can be generated by vyper as such: vyper -f external_interface contracts/CurveCryptoSwap.vy Doing that results in the following output: # External Interfaces interface ...
gosuto's user avatar
  • 212
2 votes
2 answers
387 views

Brownie deployment – KeyError: 'OpenZeppelin/[email protected]/Address'

I'd been building with v3.4 of Zeppelin contracts for a while without issues. I just started a new project using v4.4.0 and I'm getting the following error when I try and publish my contract ...
edhog's user avatar
  • 165
2 votes
2 answers
1k views

Brownie - Constructor Sequence has incorrect length, expected 1 but got 0

I am trying to deploy a contract on Rinkeby by running brownie run scripts/deploy.py --network rinkeby but I get following error: Constructor Sequence has incorrect length, expected 1 but got 0 I ...
Magofoco's user avatar
  • 250
2 votes
3 answers
9k views

Brownie: PRIVATE_KEY issue: ValueError: The private key must be exactly 32 bytes long, instead of 0 bytes

I am trying to run a script in brownie, but I'm running into this error: ValueError: The private key must be exactly 32 bytes long, instead of 0 bytes. Terminating local RPC client... I'm using a ....
Fran ETH's user avatar
2 votes
1 answer
159 views

How to dump/access contract storage in Brownie console?

In Brownie console, for a deployed contract, public contract attributes can be accessed with contract.nameOfAttribute(). This does not work for private attributes - how can one access private ...
anon2328's user avatar
2 votes
1 answer
205 views

ValueError: Unknown URI

I'm following a solidity tutorial from Patrick Collins and when trying to run the following: brownie run scripts/get_weth.py --network mainnet-fork I get an error: INFO: Could not find files for the ...
Dev Ajay Mathew's user avatar
2 votes
2 answers
461 views

Convert an address into a ContractContainer in Brownie

I have a factory contract, that in a transaction: Deploys a contract Emits an event with the address of the contract it deployed I want to be able to use the address returned to interface with the ...
SuperZooper3's user avatar

1
2 3 4 5
8