Using web3 provider in moralis app

Im currently using

const serverUrl = "";
const appId = "";
Moralis.start({ serverUrl, appId });

in my app, but I would also need to use
const web3 = new Web3(Moralis.provider);

in the same app, how can I use this because I need the web3 object to have access to other web3js stuff.

I tried to just paste const web3 = new Web3(Moralis.provider);
below moralis.start() but i keep getting a provider error

How can I use web3 in my app?

you can use the normal syntax, that will take in an rpc node endpoint and then you will give it the rpc node endpoint, you can use this with Moralis.start, but moralis can do anything the library does (web3js or ethersjs) so it isnt usually done this was, only moralis is just been used but feel free to do so (there shouldn’t be any trouble)

1 Like

How can I do this with moralis?

ok this works

const web3 = new Web3(Moralis.provider);

let isweb3 =web3.utils.isAddress(inputAddress);


but you are saying this is not the best way?

1 Like