Ethereum Account Guide: Understanding Wallets, Addresses, and State

·

Ethereum is a decentralized platform that enables developers and users to interact with blockchain technology through digital accounts. Whether you're sending cryptocurrency, deploying smart contracts, or exploring decentralized applications (dApps), understanding how Ethereum accounts work is essential. This comprehensive guide dives into the structure, types, and generation of Ethereum accounts, along with their internal states and security mechanisms.

Types of Ethereum Accounts

At the core of Ethereum’s architecture are two distinct types of accounts: Externally Owned Accounts (EOAs) and Contract Accounts (CAs). Both play crucial roles in the network, but they function differently.

Externally Owned Accounts (EOAs)

An EOA is controlled by a private key and is typically used by individuals to send transactions. It has no associated code and can initiate transactions such as transferring Ether or deploying smart contracts.

👉 Discover how to securely generate your first Ethereum account in seconds

Contract Accounts (CAs)

A Contract Account represents a smart contract deployed on the Ethereum blockchain. Unlike EOAs, it doesn't have a private key. Instead, its behavior is governed entirely by the code stored within it.

Understanding Account State

Every Ethereum account has a corresponding account state, which the network continuously tracks. This state evolves with every transaction involving the account. The state consists of four primary components:

Nonce

The nonce is a counter that tracks the number of transactions sent from an EOA. For contract accounts, it records the number of contracts created by that account.

For example, if your account has sent 13 transactions, the nonce will be 13. After sending another, it becomes 14.

Balance

The balance field stores the current amount of Ether (in wei) held by the account. Both EOAs and contract accounts can possess a balance.

Storage Root (Storage Hash)

This component applies only to Contract Accounts. It contains the hash of the root node of a Merkle Patricia Trie that encodes all data stored by the contract.

Code Hash

Also exclusive to Contract Accounts, this field holds the hash of the contract’s bytecode. If the code hash is empty, the account is an EOA.

Note: Hash functions like keccak256 are cryptographic tools that convert input data into a fixed-length output. They are one-way functions — easy to compute forward, nearly impossible to reverse. Even a tiny change in input results in a drastically different hash, ensuring data integrity across the blockchain.

How to Generate an Ethereum Account Without a Wallet App

You don’t need a third-party app to create an Ethereum account. Accounts can be generated offline using cryptographic principles, enhancing security and privacy.

Step 1: Generate a Private Key

A private key is a 32-byte (256-bit) random number chosen from a vast range between 1 and 2²⁵⁶. Here's an example in hexadecimal:

bdb2c8d55b47e7c37dabdead589eec3d463b2de656ed6ba9b75143e72180ae09

This randomness must come from a cryptographically secure source — such as an operating system’s entropy pool (derived from mouse movements, keyboard timings, etc.) — to prevent predictability.

const randomBytes = require('randombytes');
const createRandomPrivateKey = function () {
  return randomBytes(32); // Generates 32 random bytes
};

Step 2: Derive the Public Address

From the private key, the public address is derived in two steps:

  1. Use the secp256k1 elliptic curve algorithm to generate a public key.
  2. Apply the keccak256 hash function to the public key and take the last 20 bytes.
const secp256k1 = require('secp256k1');
const keccak = require('keccak');

const privateKeyToAddress = function (privateKey) {
  const publicKey = secp256k1.publicKeyCreate(privateKey, false).slice(1);
  return keccak('keccak256').update(publicKey).digest().slice(-20);
};

Resulting address:

0xda36cd6F5aF1CA5A226c02B3BD74E3F1BA354B9F

This address can now receive Ether from others.

Is Your Generated Account Secure?

Yes — and here's why.

The total number of possible private keys is 2²⁵⁶, an astronomically large number. To put this in perspective:

That means there are more possible Ethereum keys than atoms in the universe — by many orders of magnitude. The chance of someone randomly generating your private key is effectively zero.

Even if all humans created new accounts constantly, collisions would remain virtually impossible due to this immense keyspace.

👉 Learn how secure cryptographic generation protects your digital assets

How Smart Contract Addresses Are Generated

Unlike EOAs, smart contract addresses aren’t derived from a private key. Instead, they are deterministically generated at deployment time using two inputs:

These values are encoded using RLP (Recursive Length Prefix) encoding, then hashed with keccak256. The last 20 bytes of the resulting hash become the contract address.

const rlp = require('rlp');
const keccak = require('keccak');

var nonce = 0x00;
var sender = '0x6ac7ea33f8831ea9dcc53393aaa88b25a785dbf0';
var input_arr = [sender, nonce];
var rlp_encoded = rlp.encode(input_arr);
var contract_address_long = keccak('keccak256').update(rlp_encoded).digest('hex');
var contract_address = contract_address_long.substring(24);
console.log("contract_address: " + contract_address);

This method ensures that:

Frequently Asked Questions (FAQ)

What is the difference between an EOA and a Contract Account?

An Externally Owned Account (EOA) is controlled by a private key and used by individuals to send transactions. A Contract Account has no private key and operates based on its embedded code logic.

Can a smart contract own Ether?

Yes. Smart contracts can receive, hold, and transfer Ether just like regular user accounts. Their balance is managed entirely by their internal code.

Why does the nonce matter in Ethereum?

The nonce prevents transaction replay attacks and ensures correct ordering. Each transaction from an account must have a unique, incrementing nonce value.

How do I know my private key is truly random?

Use cryptographically secure random number generators (CSPRNGs) provided by operating systems or trusted libraries. Avoid pseudo-random methods that could be predictable.

Can two different private keys control the same address?

Theoretically possible but practically impossible due to the vast size of the keyspace. The probability is negligible — far less than winning the lottery multiple times in a row.

Are Ethereum addresses case-sensitive?

No, Ethereum addresses are hexadecimal and case-insensitive. However, many wallets use checksum formats like EIP-55 to reduce errors during transfers.

👉 Start exploring Ethereum development with secure tools today