Could not detect network

I’m trying to connect to my bsc testnet server using this code:

const provider = new ethers.providers.JsonRpcProvider(‘https://aicocv7pccef.usemoralis.com:2053/server’)

console.log('Waiting for network')
const network = await provider.detectNetwork()
console.log(network)


I get the error ‘could not detect network’
What am I doing wrong?

You need to use a speedy node for your provider, not your Moralis server.

you can find your speedy node url on this page: https://admin.moralis.io/speedyNodes

Fantastic!
Thank you everybody

1 Like