Allow specify block to fork at for "mainnet-fork"
See original GitHub issueGanache supports specifying the block to fork at:
-f or --fork: Fork from another currently running Ethereum client at a given block. Input should be the HTTP location and port of the other client, e.g. http://localhost:8545. You can optionally specify the block to fork from using an @ sign: http://localhost:8545@1599200.
Would it be possible to surface this as a config or CLI option in brownie?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Forking other networks | Ethereum development ... - Hardhat
Hardhat Network will by default fork from a recent mainnet block. ... depends on forking we recommend forking from a specific block number....
Read more >Does anyone know how to fork a chain at a particular block on ...
To fork a blockchain with brownie, you actually just need to create a network that uses a forked blockchain or uses a forking...
Read more >Fork the actual mainnet from a specific block - Stack Overflow
You can run Ganache with the --fork option. Fork from another currently running Ethereum client at a given block. Input should be the...
Read more >How to Fork Ethereum Mainnet - Alchemy Docs
Hardhat will allow you to fork Mainnet to a local blockchain so that we can test and ... To confirm that we have...
Read more >How To Fork Ethereum Mainnet with Hardhat - QuickNode
Forking the chain at an older block of the blockchain is helpful if you want to ... Now that we have our Hardhat...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
i like that work-around @0xalfalfa! i was thinking something similar but with some bash magic and run it through
brownie run
.a proper implementation doesn’t seem far away though, after finding out that
ganache-cli
already has the parameter--fork_block_number
: https://github.com/trufflesuite/ganache/blob/master/README.md#options.appears to me it only needs to be supported by the
cmd-settings
part of the app that passes args to ganache? egbrownie run --network mainnet-fork --fork_block_number 13131313
.dont know if i am the one to tackle this, but if anyone could give pointers on where to look in the code in order to prep a pr that would be cool 😃 initial thought is to start by adding the cli flag here: https://github.com/eth-brownie/brownie/blob/master/brownie/network/rpc/ganache.py
Here’s my workaround:
ALCHEMY_KEY=<ALCHECHMY_KEY>
FORK_BLOCK_NUMBER=@12710000
in the .env file.This will only work when starting your python script yourself or through your VSCode debugger or such. If you start with
brownie run
orbrownie test
, you have to set all env variables before starting brownie.