Unable to use speedy node with web3

We currently are authenticating to Moralis using the “metamask” connector. However, we’ve been getting the default Ethers RateLimit error in the browser console…

========= NOTICE =========
Request-Rate Exceeded  (this message will not be repeated) 
<empty string> 
The default API keys for each service are provided as a highly-throttled, 
community resource for low-traffic projects and early prototyping. 
<empty string> 
While your application will continue to function, we highly recommended
signing up for your own API keys to improve performance, increase your
request rate/limit and enable other perks, such as metrics and advanced APIs. 
<empty string>
For more details: https://docs.ethers.io/api-keys/ 
==========================

We’d like to allow use of Metamask as the wallet but to have it utilize the Speedy Node provider for all Web3 calls, not only for Moralis.authenticate() but also for Moralis.executeFunction().

We saw reference to the NetworkWeb3Connector, but Moralis.authenticate({provider: 'network'}) is not valid. Wondering if it was deprecated with the 1.0 version.

https://docs.moralis.io/moralis-server/web3/web3#connectors mentions You enable web3 with any connector (such as WalletConnect, Metamask, Network etc.), but there is no example and we can’t find a way to get it to work?

To summarize, we need a working example on how to switch off the default Ethers RPC nodes and instead use the Moralis Speedy Nodes.

You want to use Moralis speedy node in front end?

That would mean that anyone can see your speedy node url and use it.

Is there another way to avoid getting the ethers rate limiting message? The assumption is that message is showing because calls are using the default Ethers RPC providers.

I was under the impression that Moralis was also an RPC provider that we could use instead of Infura or Alchemy for frontend RPC node calls.

Also, your docs https://docs.moralis.io/speedy-nodes/connecting-to-rpc-nodes/connect-to-polygon-node#ethers-js specifically show an example of using your Speedy Node on the frontend. If its not recommended, why is it documented?

sometimes it is easier to test some code in browser than starting nodejs server side (related to that example in documentation)

you can use it if you want in front end, but I don’t think that it will solve your problems

how many requests are you making when you get that message?

I’m unable to determine that since they don’t get recorded in web inspector. Do you know of a way I can determine which requests are being made with the default Ethers providers?

if the requests are made from the browser, you should see them in the network tab of the browser in web inspector

They aren’t any there.

Regardless, can you please comment on whether or not Moralis can be used as an RPC node for frontend dapps? Not the Moralis Web3 REST API, but specifically as an RPC node, akin to Infura or Alchemy.

it can be used if you really want, but I would not recommend to do that

you can try it to see if it fixes the problem, maybe you understand better after that what is the main problem that it happens

Ok, I’d like to use it. But I still need a working example of how to use it. How can we get Moralis to use a custom RPC node (doesn’t matter if it’s Speedy Node, Infura, whatever) for all Web3 operations, especially Moralis.executeFunction?

I thought that you wanted to add the node RPC address directly in metamask for a specific chain

No, that was never something we requested.

Ethers allows you to specify a custom RPC node for all Web3 operations…

// To connect to a custom URL:
let url = "http://something-else.com:8546";
let customHttpProvider = new ethers.providers.JsonRpcProvider(url);

How can we do this with Moralis? How can we get Moralis to use a custom RPC node for all Web3 operations?

you have here an example on how to use Moralis.transfer from nodejs:

:man_facepalming: In no way does your provided example explain how to get Moralis to use a custom RPC node for Web3 operations. All it does is provide an example for transferring tokens from one address to another using a specific private key. I am so frustrated.

What custom RPC node you want to use?

Any. It doesn’t matter. Please just answer the question. How can we get Moralis to use a custom RPC node for all Web3 operations?

I feel like I just continue repeating the same question and you keep deflecting.

That code uses the RPC url from your Moralis account.

I don’t know other option. You can write your code if you want something different.