Want to save money? What are Ethereum calls and transactions?

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s