Looking to save money while communicating with your smart contracts? You’ll probably want to understand the difference between a `call` and a `transaction`.
Call
A call is a _local_ invocation of a function that doesn’t broadcast or publish information to the Ethereum network.
Calls are read only, synchronous, do not cost any gas to perform, and resulting state changes are discarded.
Transaction
On the other hand, a transaction is broadcast to the Ethereum network, processed by miners, and (if valid) published to the blockchain.
Transactions are persistent, asynchronous, and are typically associated with a certain gas price.
– It could be the case that miners accept transactions with a gas price of 0, but even in this case transactions would likely take a much longer time to process.
– The immediate return value of a transaction is the transaction’s hash. To get the actual return value of a function, events can be used.
One comment