Does anyone know how to properly fork BSC mainnet using hardhat?
npx hardhat node --fork https://bsc-dataseed.binance.org/
does launch a local chain with preloaded ETH addresses, but when I deploy a contract that uses the pancakeswap router I get errors about non-existing contract functions, so I'm not sure if its working
Jun 13, 2022, 3:20 PM
Also which do you guys prefer for building and testing contracts, hardhat or truffle?
Jun 13, 2022, 3:25 PM
I started with truffle but then used hardhat and haven’t gone back
Jun 13, 2022, 3:26 PM
I hear that quite a lot which is why I also recently made the switch, but I'm getting errors that I didnt get before and I feel like truffle errors were easier to figure out using google than hardhat
Jun 13, 2022, 3:27 PM
Hardhat, undoubtedly
Jun 13, 2022, 3:29 PM
Well my port is down a shit ton but At least bsc testnet seems to be working today
Hes good at explaining and teaching
Jun 13, 2022, 3:42 PM
Hey guys I have a BSC node instance running at Moralis (similar to Infura/Alchemy).
Now I'm trying to fork the BSC mainnet using hardhat as such:
npx hardhat node --fork
But I'm not sure what key to use and how to combine it with the server URL. Any help appreciated!
Now I'm trying to fork the BSC mainnet using hardhat as such:
npx hardhat node --fork
But I'm not sure what key to use and how to combine it with the server URL. Any help appreciated!
Jun 13, 2022, 4:41 PM
id like to know too man cause BSC Testnet is dead
Jun 13, 2022, 4:42 PM
Just use the endpoint of moralis what's the issue?
You should look into "speedynodes" not moralis server
Jun 13, 2022, 4:44 PM
If I just use the HTTP endpoint from that screenshot I get
Error HH110: Invalid JSON-RPC response received: {"error":"unauthorized"}
Error HH110: Invalid JSON-RPC response received: {"error":"unauthorized"}
Jun 13, 2022, 4:44 PM
Did you put also your apikey?
Jun 13, 2022, 4:45 PM
Yeah I added it to the end with a forward slash in between
Not sure if thats the correct way though
Jun 13, 2022, 4:46 PM
Just use whatever the docs tell you to use
Doesn't look like it is
Jun 13, 2022, 4:46 PM
They have archival option as well actually
Jun 13, 2022, 4:47 PM
Yes
But it's not what you showed
Usually there's written archive or snth if I remember correctly
Jun 13, 2022, 4:47 PM
the docs only have an example for ETH endpoint:
npx hardhat node --fork https://eth-mainnet.alchemyapi.io/v2/
npx hardhat node --fork https://eth-mainnet.alchemyapi.io/v2/
Jun 13, 2022, 4:47 PM
Idk what docs you are looking at
Jun 13, 2022, 4:48 PM
hardhat docs
Jun 13, 2022, 4:48 PM
I meant moralis docs ofc
Jun 13, 2022, 4:48 PM
no need, it's working
Jun 13, 2022, 4:50 PM
👍🏻
Jun 13, 2022, 4:50 PM
was able to deploy the contract on my forked chain using that endpoint
Appreciate the help Niccolo :)
Jun 13, 2022, 4:50 PM