@solana/web3.js works without supplying a provider node?

Today, I successfully transferred sol from one account to another on mainnet-beta using @solana/web3.js, without giving a provider url.

const connection = new Connection(clusterApiUrl(‘mainnet-beta’), ‘confirmed’);

This line of code did all the work. If I was doing the same thing with, ethereum and lets say, web3.js, I would have to get a provider node, from Infura, or elsewhere.

So, what does this mean, @solana/web3.js has a default provider node? Do I even need my own node, if this one does the job? Can I go to production with this?

That function call clusterApiUrl('mainnet-beta') simply returns https://api.mainnet-beta.solana.com I believe, which is the URL of the Solana-operated RPC node.

I think it’s fine to use that node in production in some cases, but most serious projects, and definitely NFT minting projects, will need to run their own or use a service I think. This service seems to be one of the popular ones for running RPC nodes:

https://rpcpool.com/#/

1 Like