Skill 1.3.2
Distinguish calls from transactions when invoking contract functions
Key Concepts
contract.methods.fn(args).call() runs the function on one node with eth_call. Nothing is broadcast, nothing is mined, no gas is paid and any state changes are discarded; the function's return value is decoded and returned. It is the right choice for view and pure functions, and for simulating a state-changing function to see whether it would succeed.
contract.methods.fn(args).send({ from, value }) creates, signs and broadcasts a transaction. It changes state permanently, costs gas and resolves to a receipt. It does not return the function's return value, because the result is only known when the transaction executes in a block; contracts expose results to off-chain code through events or later reads. estimateGas({ from }) predicts the gas a send() would use.