I'm using Web3j library to sign and interact with my smart contract through a 3rd party node. What would happen if my internet suddenly goes out during the RPC call?
I noticed that deploying my smart contract can take up to 10-20 seconds. Would the gas fees still be subtracted from my wallet?
It depends on whether your computer was able to finish submitting the deployment transaction to the 3rd party node.
If it lost the connection mid-way through the submission, the node would reject the transmission as incomplete.
But... the 10-20 sec wait time suggests that the transaction was already successfully sent from your computer to the 3rd party node, broadcasted from the node to the rest of the network, and at the time is waiting to be mined. Each Ethereum block is currently mined at average 13 seconds.
So if you lost connection to the node during the time the transaction is waiting to be mined, the transaction would still be mined, the smart contract would still be deployed, gas fees paid, ... your deployment script just wouldn't get the callback with the (newly deployed) smart contract address. So you would have to find its address through a blockchain explorer (last sent transaction from the deploying address) for example.