1

How can I have a local copy of the binance chain for use in ganache like to use BNB as default coin instead ETH?

I see here Ganache -f how can I fork the whole chain? that I must provide -f parameter but I don't know exactly how.

By the way... I need a CLI flavor because I'm using Ubuntu server.

4 Answers 4

2

Binance provide instructions how to run a full node. Then you can enable http requests and use the localhost endpoint with ganache to fork it.

There's ganache-cli that is headless.

5
  • 1
    Well I don't want to be part of Binance Chain as a full node. Can you explain a little more? Can I fork an already running node of somebody else?
    – Magno C
    May 13, 2021 at 5:15
  • @MagnoC Check BSC documentation docs.binance.org/smart-chain/developer/rpc.html for access to public RPC endpoints. Just be aware they are public so they have some restrictions like how many queries you can make.
    – Ismael
    May 13, 2021 at 6:00
  • Sorry but I realy need a LOCAL Binance Chain. I don't want someone put they hands on my contracts before I finish my ideas.
    – Magno C
    May 14, 2021 at 2:37
  • @MagnoC It doesn't seem BSC support light clients, so the only options are to run a full node or use an RPC provider. In any case when using ganache with fork option it will deploy your contract locally.
    – Ismael
    May 14, 2021 at 4:31
  • I think BSC was a fork from Ethereum therefore having same methods... I'll try it here. Thanks.
    – Magno C
    May 14, 2021 at 23:00
4

it's seems ganache-cli suport forking bsc network.

ganache-cli -f https://bsc-dataseed.binance.org

https://www.reddit.com/r/ethdev/comments/nih0zx/how_to_fork_bsc_mainet/gz3vhex?utm_source=share&utm_medium=web2x&context=3

0

You can get Json RPC Endpoint from from nodereal.io

https://bsc-mainnet.nodereal.io/v1/<API_KEY>

0
Speedrun Solution: Let's go
  1. Get your RPC Endpoint (I prefer QuickNode for BSC)
  2. Download and configure ganache-cli Github
  3. Follow this Guide, and you're good.

After testing it like that, I recommend running it in Docker. Check out this Guide:

And also, add a custom Explorer ("Etherscan for your Fork") with either Blocscout or Ethernal.

Happy Hacking & have fun 👍

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.