13
votes
Accepted
eth-brownie: Unable to expand environment variable in host setting
Typically, this means your environment variables are not set correctly, and it looks like in this case it's your WEB3_INFURA_PROJECT_ID.
Solution 1
You can fix it by setting the variable in your .env ...
11
votes
Which Ethereum framework to choose Truffle vs Brownie?
If you are equally strong in Python and JavaScript, Brownie is a better choice, because Python as a programming language is more suited for tasks needed from a smart contract programming framework.
...
8
votes
Accepted
deploying smartcontract to ganache-desktop instead of ganache-cli with brownie
okay. I found the solution. I can add a local network in my network list with :
brownie networks add Ethereum ganache-local host=http://127.0.0.1:7545 chainid=5777
where ganache-local is a name i ...
7
votes
Accepted
How to catch a `revert()` error using Brownie?
The brownie.reverts context manager handles exactly this use case. The syntax is very similar to pytest.raises:
import brownie
def test_greet(example):
with brownie.reverts("Hello World"):
...
7
votes
Accepted
Does anyone know how to fork a chain at a particular block on Brownie?
To fork a blockchain with brownie, you actually just need to create a network that uses a forked blockchain or uses a forking command.
Option 1: The built-in forked chain
Brownie actually comes packed ...
6
votes
Accepted
How to deploy Ethereum Smart Contract through Brownie to the Private Network
Connecting to the Network
First, make sure that Brownie is able to connect to your private network. You will have to add a custom network to Brownie's network settings. Here is an example command ...
6
votes
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?
To my knowledge, none of the marketplaces have this functionality of the owner being able to edit the metadata. But with that being said, there is nothing stopping you from including this ...
5
votes
Can you check if an address is a contract or an EOA with eth-brownie or some other python native package?
web3.py has web3.eth.get_code.
Returns the bytecode for the given account at the block specified by block_identifier.
From the examples in the documentation
# For a contract address.
>>> ...
5
votes
'Brownie compile' using different compiler version than specified in configuration file
Finally found the root causes of this issue which, if I understood correctly, relates to the generation of interface ABIs at the end of the compile process.
Issue #1: No check for a set solc version ...
5
votes
Accepted
How to debug Brownie in VSCode?
You can use the VSCode debugger for brownie
This is is an example of a VSCode launch.json debug configuration for running the currently opened script on brownie:
{
"name": "Brownie: ...
5
votes
Accepted
directory is not empty: brownie
This is because there is stuff in your directory already.
You can either:
Force create the directory
brownie init --force
Which will create the brownie sample directory alongside your existing code/...
5
votes
Accepted
Creating a contract contrainer with Brownie
Import the compiled contract name from brownie
from brownie import <ContractName>
contract = <ContractName>.deploy(*args)
If it is already deployed
from brownie import Contract
...
5
votes
Infura network support for sepollia in Brownie
Use this command in the terminal
brownie networks add Ethereum sepolia host="https://rpc.sepolia.dev" chainid=11155111
4
votes
Accepted
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?
It depends on how you code the NFT. But basically you'd have a function that updates the on-chain metadata and/or updates the tokenURI to reflect the changes, and you'd make it in such a way that only ...
4
votes
Accepted
Brownie cannot locate deploy.py script
It's having a hard time finding ganache. You'll need nodejs and npm installed, and then run the following:
npm install -g ganache-cli
And you should be good to go
4
votes
How to use contracts from project dependencies in Brownie scripts?
You're close.
The dependencies section identifies where you want to download. You've correctly placed that part using github syntax. You want to download organization OpenZeppelin with repo ...
4
votes
Accepted
Brownie: Constructor Sequence has incorrect length, expected 1 but got 0?
Try using this solidity code:
https://github.com/PatrickAlphaC/brownie_fund_me/issues/1
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@chainlink/contracts/src/v0.8/interfaces/...
4
votes
Accepted
How to call `brownie run` with extra script parameters
brownie run is designed to be run without any extra arguments besides the ones listed in brownie run -h.
All arguments are passed into the docopt function which parses the options based on the ...
4
votes
LINK1120 error when attempting to install Brownie with 'pipx install eth-brownie'
I too had this problem. I tried installing cytoolz on its own using
pip install cytoolz
but got an error as well. Found a solution by installing cython using
pip install cython
Additionally, this ...
4
votes
Accepted
Brownie Chainlink Import Error VSCode - 'File import callback not supported'
So, I figured out a solution.
Step 1 - brownie pm install [ORGANIZATION]/[REPOSITORY]@[VERSION]. Do this in your terminal.
In my case, it'll be
brownie pm install smartcontractkit/chainlink-brownie-...
4
votes
Accepted
What are the node providers for Genosis Network (xDai)?
I am a developer advocate at Chainstack. Using the Chainstack platform, You can set up a Gnosis node (elastic) for free and with no rate limiting.
Here's how you can get started: Build better with ...
3
votes
Accepted
'Brownie compile' using different compiler version than specified in configuration file
In your brownie-config.yaml file, you'll be able to set a specific version of solidity. However, if a contract specifies a different version, you'll run into an error.
It looks like you're using ...
3
votes
Accepted
Call fallback function from eth-brownie from proxy
You need to use
The actual ABI of the implementation instead of the ABI file of the proxy contract
Address of the proxy contract
from brownie import Box, TransparentUpgradeableProxy, Contract
...
3
votes
How can I get the deployed contract's address from a ContractContainer object in Brownie?
Here is your code with some changes that should work.
from brownie import ContractA, ContractB , accounts
def main():
acct = accounts[0]
container = ContractA.deploy({'from': acct})
...
3
votes
Accepted
How to get the return value of a transaction instead of the transaction receipt in brownie
You can use tx.return_value in the transaction receipt or make a .call request.
.call which will simulate the transaction going through. Just to note, if you send the transaction again, and then call ....
3
votes
Accepted
What is the purpose of a `// dev:` comment after a revert or require statement?
This is called a developer revert comment. From the Brownie documentation:
Each revert string adds a minimum 20000 gas to your contract deployment cost, and increases the cost for a function to ...
3
votes
Accepted
Brownie: PRIVATE_KEY issue: ValueError: The private key must be exactly 32 bytes long, instead of 0 bytes
When working with Brownie and private key environment variables, you'll need to make sure a few things are set.
In your .env file, you have your PRIVATE_KEY variable set correctly. If using a .env ...
3
votes
File outside of allowed directories on brownie compile command
So basically i accidentally created the brownie-yaml.config file outside of the project folder.
some-folder
| -project-folder
| | -src
| | -contracts
| | -...
brownie-config.yaml
once I move ...
3
votes
Accepted
Brownie - Constructor Sequence has incorrect length, expected 1 but got 0
Constructor Sequence has incorrect length means the number of parameters you're passing to the deploy function is off.
Your constructor is defined as:
constructor(address _priceFeed) public {
However,...
3
votes
'brownie' is not recognized as an internal or external command on Windows 10
I faced this problem today installing brownie on friend's machine.
Problem:
Was with Pipx paths used for installing/accessing brownie & python.
For some reason, even uninstalling and re-installing ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
brownie × 376solidity × 140
python × 113
web3.py × 40
chainlink × 28
ganache × 23
contract-deployment × 16
nft × 14
etherscan × 13
openzeppelin × 13
error × 13
ganache-cli × 13
blockchain × 12
uniswap × 12
erc-721 × 10
testing × 10
ether × 9
contract-development × 8
infura × 8
rinkeby × 8
smart-contract-wallets × 8
solidity-0.8.x × 8
vyper × 8
hardhat × 7
import × 7