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
7
votes
2answers
3k 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 ...
6
votes
1answer
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 ...
5
votes
1answer
707 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 ...
5
votes
1answer
575 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'. ...
4
votes
3answers
2k 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 ...
4
votes
2answers
840 views

How to use contracts from project dependencies in Brownie scripts?

I want to deploy a contract directly accessible in OpenZeppelin/openzeppelin-contracts@4.2.0 Brownie package without changes, namely ERC1967Proxy and other non-abstract contracts from Brownie console. ...
4
votes
2answers
823 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?...
3
votes
3answers
3k 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 ...
3
votes
6answers
1k 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 ...
3
votes
1answer
130 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(); // ...
3
votes
1answer
689 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 ...
3
votes
1answer
75 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=...
3
votes
0answers
404 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, ...
3
votes
2answers
358 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/ ...
3
votes
0answers
98 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 ?
2
votes
3answers
851 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 ...
2
votes
2answers
901 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 ...
2
votes
2answers
416 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 ...
2
votes
2answers
478 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/...
2
votes
1answer
51 views

Brownie deployment – KeyError: 'OpenZeppelin/openzeppelin-contracts@4.4.0/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 ...
2
votes
1answer
143 views

Can’t Install Eth-Brownie on Windows 10: pipx fails to build cytoolz, saying that "Microsoft Visual C++ 14.0 or greater is required"

Good evening! I'm going through the Free Code Camp Solidity/Blockchain tutorial and for the life of me, I cannot get Brownie to install properly. When I try and install through pipx I get the ...
2
votes
1answer
257 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 ...
2
votes
1answer
288 views

Failed brownie import when running scripts

I am trying to setup eth-brownie to get a feel of the framework but face a couple of import-related problems. Im working from a MBP running macOS with Catalina v10.15.7 $ python --version Python 3.9.9 ...
2
votes
1answer
148 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 .
2
votes
1answer
94 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 ...
2
votes
1answer
195 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.
2
votes
1answer
78 views

Solidity | Brownie: Multiple winner lottery not working

Github repo located here: https://github.com/supsam89/digiwear_nft_drop The command I'm having problems with is brownie run scripts/deploy.py I am trying to deploy a drop/lottery contract that picks ...
2
votes
2answers
1k 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 ....
2
votes
1answer
78 views

How to use Script from Brownie Dependency

I have a brownie project containing the source code for a Vault contract as well as it's deployment script. Badger-Vaults Containing the Vault.vy contract for vaults, as well as scripts/...
2
votes
1answer
293 views

KeyError: 'wallets'

Screenshot of directory: This is the code in my brownie.config.yaml file: reports: exclude_contracts: - SafeMath dependencies: - smartcontractkit/chainlink-brownie-contracts@1.0.2 - ...
2
votes
1answer
1k views

Issue with importing Chainlink & Openzeppelin

Currently trying to run a script and keep running into an error when trying to import chainlink and openzeppelin contracts. Not sure why, I looked at brownie pm list to make sure I have the correct ...
2
votes
1answer
407 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 -...
2
votes
1answer
38 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 ...
2
votes
0answers
55 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 ...
2
votes
0answers
47 views

In brownie tests how to use interfaces defined in packages

In brownie tests how to use third party interfaces defined in brownie packages? For example how do I use @openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol from OpenZeppelin ...
2
votes
1answer
738 views

ImportError: cannot import name 'Accounts' from 'brownie.network.account'

Setup MacOS Catalina v10.15.6 IntelliJ Ultimate v2020.1.1 Python v3.7 eth-brownie v1.14.6 Ganache CLI v6.12.2 I created a VENV using my Python 3.7. Following Patricks tutorial, I have installed eth-...
2
votes
0answers
843 views

brownie steps to compile, deploy and interact on ropsten

I have created a smart contract and deployed it on ropsten with brownie framework. Here are the steps I've done: Run the command: $ brownie init projet1 I have created my contract in contracts/...
2
votes
1answer
256 views

Setup brownie to run certain test in a specific network

I am using brownie to run tests and right now my project is using two networks, development and mainnet-fork. I have a test which only runs in mainnet-fork and I am trying to figure out a way to tell ...
1
vote
2answers
102 views

Brownie throws error - ValueError(f"'{value}' is not a valid ETH address") from None

I'm using this program to make an NFT https://github.com/PatrickAlphaC/nft-mix and I get this error when I run create_collectable.py File "brownie/_cli/run.py", line 50, in main ...
1
vote
2answers
250 views

How to call `brownie run` with extra script parameters

Im trying to run brownie run ./scripts/create_myToken.py --name "Myname" --network rinkeby I have args = sys.argv[1:] to catch --name etc like normal python But brownie doesnt seem to like ...
1
vote
2answers
61 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, ...
1
vote
1answer
151 views

Getting `No Python at ...` error trying to install Brownie with pipx on Windows

When I try and pipx install eth-brownie I get the following error: PS C:\Users\karee\web3_py_simple_storage> pipx install eth-brownie No Python at 'C:\Users\karee\AppData\Local\Programs\Python\...
1
vote
1answer
75 views

Send transaction with Brownie without confirmation wait

Is there is a way in Brownie to send a transaction without waiting for confirmation, like an async way?
1
vote
1answer
167 views

Getting a compile error every time I try to compile a contract with Brownie that includes an import statement from the web

I have a contract that starts with the following import statements: import 'https://github.com/aave/protocol-v2/blob/master/contracts/flashloan/base/FlashLoanReceiverBase.sol'; import 'https://github....
1
vote
1answer
381 views

Get random number without replacement in Solidity

I am trying to sample a random number without replacement until the pool of possible numbers runs out, using Solidity. In pseudo-code, it should be something like this: 1. Initial pool of numbers: (1, ...
1
vote
1answer
418 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 ...
1
vote
2answers
22 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 ...
1
vote
2answers
57 views

i am getting rinkeby error while running my deploy_and_create.py in brownie python

PS E:\NFT-DEMO> brownie run scripts/deploy_and_create.py --network rinkeby INFO: Could not find files for the given pattern(s). Brownie v1.16.4 - Python development framework for Ethereum ...
1
vote
1answer
236 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 ...
1
vote
2answers
73 views

Why is Brownie ContractContainer empty despite Deployed Contracts?

I'm having issues with Brownie not appending the deployed contracts to the ContractContainer as when attempting to index the ContractContainer for my SimpleStorage contract I get the following error: ...