Paying for Transactions
Explore how paying for transactions works on Ethereum by understanding the role of gas and fees. Learn the difference between calls and transactions, how smart contract bytecode affects costs, and how gas prices are determined, including the impact of EIP-1559 on fee adjustments.
We've already mentioned that we need to pay a fee for interacting with an Ethereum network, and in this lesson, we'll look into how this fee is calculated and what it depends on. We'll also learn about the concept of gas and how it's used to calculate transaction fees in Ethereum.
Interacting with a smart contract
It turns out that we don’t need to pay a fee for all the operations within an Ethereum network; but first, let’s look into what types of operations we can perform. There are two different ways to interact with a smart contract: call and transaction.
The main difference between them is that a call can only read data from an Ethereum network and can't change the state of the network, can’t send payments, and can’t deploy new contracts. Transactions, on the other hand, can change the state of the network, for example, update the state variable of a state contract or deploy a new smart contract.
We need to pay only to execute a transaction, and transactions are recorded on the blockchain, while calls that are free are not stored in the blockchain history. ...