I'm currently forking Binance Smart Chain using Brownie and Python.

The idea is to use the forked network to test if new BEP20 tokens can be traded (buy and sell) using pancakeswap, and check if the token can be sold without losing too much (I'm actually checking for crypto honeypots). So, something like:

  • Transaction 1 (block 33680726): I buy 5000 $TOKEN with 1 BNB
  • Transaction 2 (block 33680727): I sell the 5000 $TOKEN and get back ~0.999 BNB (number doesn't matter)

As the transactions follow each other, I can use the BNB output amount from transaction 2 to estimate the "tax" on the buy and sell. In this case, I "lost" 0.001 BNB for an initial transaction amount of 1 BNB, which is like a 0.10% tax for the buy and sell trades.

brownie run .\scripts\deploy.py --network bsc-main-fork

However, when I'm trying the exact two same transactions on bsc-mainnet (so same code, same token address), I get totally different results. For instance, the token can either not be sold, or the BNB amount I get back from transaction 2 is really small, like ~0.0001 BNB compared to the 0.999 in mainnet-fork.

brownie run .\scripts\deploy.py --network bsc-main

I know this is common behavior for honeypots and that's actually what I'm trying to discover using mainnet-fork before throwing real money at it. What I don't get is why my code is returning completely different results when I'm forking the network and when I'm live on mainnet.

Why is the mainnet fork not acting like mainnet ?


Your Answer

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