So, I want to know if I make an RPC call from my client-side and my account has 0 balance. Does the RPC call go till the validator and get rejected or does the RPC call itself reject the program?
2 Answers
Most RPC
calls are read
hence you don't even sign them, so the RPC
doesn't even know if you have lamports
or not.
I think it's only relevant for:
https://solana-labs.github.io/solana-web3.js/classes/Connection.html#sendTransaction
https://solana-labs.github.io/solana-web3.js/classes/Connection.html#sendRawTransaction
Client-side is inherently unsafe. For this reason the check will always happen on the validator side. On the client side it can only happen as convenience to avoid sending a transaction to the validator that is guaranteed to fail anyway, but the validator will always check it.
Also you have to watch what RPC call you are doing. If you are only reading data - no transaction will execute and hence lamports do not matter.
If you are sending a transaction to add/mutate some data on chain - you will have to pay transaction costs/rent as required for such a transaction and the validator will check that you have enough to cover it.