Ethereum Accounts

Learn what Ethereum accounts and smart contracts are and how they interact with each other.

Now that we’ve covered the basics of blockchain technology, we can take a high-level view of how the Ethereum network works. We'll first look into what Ethereum accounts are and what role they play. We'll also learn how Ethereum networks authenticate users who perform network transactions.

Accounts

All operations on Ethereum are interactions between its accounts, of which there are two types:

  • Externally-owned accounts (EOA): These are accounts controlled by Ethereum users.

  • Smart contracts: These are accounts controlled by code deployed to Ethereum.

EOA and smart contracts have many features in common, such as the following:

  • Both have an Ether balance associated with them.

  • Both can receive payments in Ether and send payments to other users or smart contracts.

  • Both can deploy smart contracts and interact with other smart contracts.

  • Both are identified by a unique ID, called an account address.

The biggest difference between the two is that the behavior of a smart contract is controlled by its code, while the behavior of an EOA is controlled by the account owner.

Smart contracts

How are smart contracts organized? We'll look into this in more detail in the next chapter, but in a nutshell, a smart contract is somewhat similar to a class in an object-oriented language. A smart contract developer defines what variables a smart contract has and what methods allow it to query and change contract data. Once a smart contract is developed, a developer can deploy one or multiple instances of this smart contract to the Ethereum network.

Let’s look at an example of a smart contract we could implement on Ethereum. We can have a smart contract that implements a land registry that keeps track of who owns which plot of land in a country. In this case, a smart contract’s data could store which Ethereum account owns which plot of land. This smart contract could provide methods for querying its state and changing this data. It could have methods to change ownership of a plot of land, start an auction to sell a plot of land, or any other relevant action.

A significant difference between object-oriented programming (OOP) and smart contracts is that smart contracts in Ethereum can't initiate actions. For example, they can't perform some actions periodically or sleep for some time before doing something. All actions on the Ethereum network are initiated by EOA accounts when they send Ether, interact with smart contracts, or deploy a new smart contract.

There are two types of operations an EOA can perform with a smart contract:

  • Call: This is a read-only operation that allows reading the state of the smart contract.

  • Transaction: This is an operation that can change the state of a smart contract.

If a smart contract receives a transaction from an EOA, a smart contract can then interact with other smart contracts, but only as part of handling a user’s transaction.

Get hands-on with 1400+ tech skills courses.