Contract Interactions on the Chain

In past tutorials, several main areas were discussed to offer Etherscan users a basic grasp of Ethereum-based transactions. With this segment, we drive that understanding further by breaking down the anatomy of a transaction specific to the Ethereum chain. Before the core components are presented, let us first retrace our steps and take a few moments to revisit the key takeaways from earlier modules.

Here's a quick summary of some important bullets:

  1. Ethereum accounts: the two types are (a) Externally owned accounts and (b) Contract accounts
  2. Externally owned accounts (EOAs) are user-controlled, and contract accounts are code-dependent
  3. Both types can send, hold, and receive Ether and tokens – as well as interact with smart contracts
  4. Ethereum transactions: the two types include (a) normal transactions and (b) contract interactions
  5. Account keys: the two types are (a) private keys for digital signatures (b) public keys for addresses
  6. Externally owned accounts cost nothing to create, while smart contracts require gas (a transaction fee)
Each type of Ethereum account plays a specific role for transactions. | Source: Kenneth Hu

Why is an EOA needed to perform a transaction?

Where a regular wallet holds the cash and cards we use for personal spending, an Ethereum externally owned account (EOA) is a blockchain wallet that stores cryptoassets. Creating such a wallet via an app like MetaMask (to store your Ether and transact) is both free and takes mere minutes. With the setting up of an EOA comes a wallet address. This address is exclusive to the EOA creator.

Where do the differences lie between the two types?

An EOA is human-controlled; it involves no coding activity to be operational. To be an active Ethereum user, owning such an account is a needed first step. The account acts as the portal that allows one to send or receive Ethereum’s native currency called Ether (ETH) to or from another EOA. An externally owned account may interact with a smart contract or ‘contract account,’ which is the second type of Ethereum account that lives on its platform. Controlled by private keys, EOAs are able to trigger contract code via transactions performed on the blockchain. This is how the two types are connected.

When is a contract account needed for transactions?

A contract account or smart contract is fuelled by the Ethereum Virtual Machine (EVM), where it lives. Contracts only react to incoming transactions. A transaction is the needed indicator to execute some aspect of a smart contract’s functions. Transactions are mined by block producers for a fee called gas.

Ethereum smart contracts rely on code and data. | Source: Nathan Dumlao

What is a contract interaction?

A contract account or smart contract is basically a computer program reliant upon code (the functions) and data (the state). Absent human involvement, a contract behaves in accordance with an on-chain call or message (interaction) from a human-controlled EOA or virtual entity (other contracts). This is based on language it is able to compute or understand. As contracts “control themselves” unlike EOAs, they get their ‘orders’ from coded protocols to know what to do. This is done via the Input Data field.

Example: An Etherscan transaction page.

How does a basic contract interaction look?

To observe how a contract interaction works, let’s take a look at a transaction page on Etherscan. With this example, we break down selected aspects of a particular transaction based on a few specific fields. This deconstruction will simplify your understanding of what happened when one EOA sent a message (call or interaction) to a smart contract.

In this case, the externally owned account made a call to the DAI smart contract asking to allow Gitcoin: Bulk Checkout to spend its token (DAI). The call-to-action here is a request for approval. The “From” field above represents the party executing the transaction.

The transaction above is the approving of the DAI—to be spent on the Gitcoin: Bulk Checkout contract. The party performing the approving is talking to the DAI Stablecoin contract. Per the interaction, it is saying this: Gitcoin: Bulk Checkout should be allowed to spend the token. Where the status indicates “Success,” the meaning is this: the request for approval has been granted and the token can be spent on the Gitcoin: Bulk Checkout contract. Now, let’s see the interaction displayed in the Input Data field:

Which are the main criteria that make up a transaction?

A transaction sent to Ethereum’s transaction pool must contain the following details to be processed:

A transaction is the cue to execute some aspect of a contract’s functions. | Michael Förtsch

Here is a list of Ethereum transactions for viewing on Etherscan.

Deborah Joy Peter
Deborah Joy Peter
Last updated: