2

I want to create a web3 provider on a Node.js application with a specific chainID and URL. How can I do it?

    const chains: Chain[] = await this.chainRepository.find({
      relations: ['currencies'],
    });

    const providers = chains.map((chain) => {
      return new Web3(chain.chainRpc);
    });

1 Answer 1

1

Go to chainlist.org/chain/{chain-id}
    e.g. chainlist.org/chain/56 for BNB
Copy the first link under RPC Server Address
Get Web3 object as followin

return new Web3(new Web3.providers.HttpProvider(past-copied-url-here));

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.