decrypt101
SocialOpen ProjectsSupport me My Resumes
  • Preface
    • Motivation
    • Roadmap’s
  • Introduction to Blockchain
    • A Brief History
    • Growth of Blockchain
    • Structure of Blockchain
    • Types of Blockchain
    • Key Technologies of Blockchain
    • Features of Blockchain
    • How Blockchain Works ?
    • Implementation of Blockchain
    • Summary
  • Components of Blockchain Architecture
    • Distributed Ledger
    • Blocks
    • Transaction
    • Chain
    • Peer-to-Peer Network
    • Blockchain Layers
    • Off-Chain & On-Chain
    • Wallet
    • Mining
    • Tokens
    • Assets
    • State Channels
    • Sidechains
    • Oracles on Blockchain
    • Atomic Swaps
    • Decentralized Identity (DID)
    • Blockchain Data Storage
    • Interoperability
    • Data structures for Scaling Blockchain
    • Maximal Extractable Value (MEV)
  • Consensus Mechanisms
    • Proof of Work (PoW)
      • Implemation Using Rust
    • Proof of Stake (PoS)
    • Proof of Burn (PoB)
    • Proof of Capacity (PoC)
    • Proof of Activity (PoAc)
    • Proof of Weight (PoWe)
    • Proof of Luck (PoL)
    • Proof of Ownership (PoO)
    • Proof of Existence (PoE)
    • Proof of Believability (PoBe)
    • Proof of History (PoH)
    • Proof of Authority (PoA)
    • Proof of Elapsed Time (PoET)
  • Cryptographics
    • Encryption & Decryption
      • Symmetric Encryption
      • Asymmetric Encryption
      • Key Management and Exchange
      • Implementation
    • Cryptographic Hashing
      • Secure Hash Algorithms (SHA)
      • Message Digest Algorithms
      • Ethash
      • Blake2
      • SCrypt
      • RIPEMD-160
    • Digital Signature
      • Digital Signature Algorithms
      • Digital Signature in Blockchain
    • Zero-Knowledge Proofs (ZKPs)
      • Types of Zero-Knowledge Proof and Protocols
      • A Case Study of Polygon Platform
    • Multi-Party Computation (MPC)
    • Cryptanalysis
    • Practical Implementation
  • Decentralized Application (DApp)
    • Design and UX in Web3
  • Smart Contract
    • Development Tools
    • Solidity
    • Testing Smart Contract
    • Developing Smart Contract
    • Interacting & Deploying with Smart Contract
    • Verifying Smart Contracts
    • Upgrading Smart Contracts
    • Securing Smart Contract
    • Smart Contract Composability
    • Testnet and Mainnet
    • Blockchain Platform Using Smart Contract
    • Application of Smart Contract
    • Practical Implementation
  • Blockchain Platforms
    • Ethereum
      • Ethereum Virtual Machine (EVM)
      • ETHER and GAS
      • Ethereum transaction
      • Ethereum Accounts
      • Ethereum Stacking
      • Ethereum Network
      • Ethereum Scaling Solutions
      • Ethereum Use-Cases
      • Getting Started with Ethereum
      • Ethereum Ecosystem and Support
    • Solana
      • Solana Architecture
        • Solana Account Model
        • Solana Wallet
        • Transactions and Instructions
        • Solana Programs
        • Program Derived Address (PDA)
        • Cross Program Invocation (CPI)
        • Tokens on Solana
        • Clusters and Public RPC Endpoints
        • Transaction Confirmation & Expiration
        • Retrying Transactions
        • Versioned Transactions
        • Address Lookup Tables
        • State Compression
        • Actions and Blinks
      • Solana Developments
      • Solana Client
      • Advanced Solana
      • Solana Scaling and Performance Architecture
      • Solana Solutions and cases
      • Practical Implemenation
    • Binance Smart Chain (BSC)
      • Create a BEP20 Token
    • Hyperledger Fabric
    • Cosmos
    • Polkadot
    • Quorum
    • Polygon
    • Algorand
    • Corda
    • Avalanche
    • TRON
    • Summary
  • Decentralized Finance (DeFi)
    • DeFi Components
    • DeFi Protocols
    • DeFi Platforms
    • DeFi Risk Classification
      • Infrastructure-layer Attacks
      • Smart Contract Layer-attacks
      • Application Layer-attacks
      • DeFi Risks
    • DeFi and Blockchain
    • DeFi Impact
  • Decentralized Ecosystem and Digital Innovation
    • Layer 2 Scaling Fundamental
    • Tokenomics
    • Cryptocurrency
    • Quantative Trading
    • NFTs
    • GameFi
    • Metaverse
  • Blockchain as a Service (BaaS)
    • Building Fullstack Blockchain Platform
    • Decentralized Digital Identity
    • Build a Cryptocurrencies Exchange
    • Play-to-Earn Gaming
    • Solana Token Airdrop Manager
    • Smart Contract Development on Solana with Rust
    • Quantitative Trading Platform
    • Insurances protocols
    • Flash Loans
    • Asset Management
    • Tokenized Derivatives
    • Automated Market Makers (AMMs)
    • Staking
    • Lending and Borrowing Platforms
    • Yield Farming
    • Stablecoin System
    • Security Token Offerings (STOs)
    • Initial Coin Offerings (ICOs)
    • On-Chain Voting Systems
    • Decentralized Autonomous Organizations (DAOs)
    • NFT Marketplaces
    • Provenance Verification
    • Supply Chain Tracking
    • Commodities Tokenization
    • Real Estate Tokenization
    • Digital Certificates
    • KYC (Know Your Customer)
  • Blockchain Development Across Languages
    • Blockchain using Go(Golang)
    • Blockchain using Rust
    • Blockchain using Python
    • Blockchain using Cairo
  • Distributed Systems & Infrastructure Technology
    • Classification of Distributed Systems
    • Networked systems versus Distributed systems
    • Parallel systems vs Distributed systems
    • Distributed versus Decentralized systems
    • Processes of Distributed Systems
    • Architecture of Distributed systems
    • Infrastructure Technologies
  • Distributed System Patterns
    • Distributed Agreements Algorithms
      • HoneyBadgerBFT
    • Data Replications
    • Data Partition
    • Consistency
    • Distributed Time
    • Cluster Management
    • Communication between Nodes
    • Fault Tolerance and Resilience
      • How to design better fault tolerance systems
      • Resilience Patterns
    • Coordination systems
      • Clock synchronization
    • Security
      • Trust in distributed systems
      • Design of Principal Security
      • Security threats, policies, and mechanisms
      • Authentication and Authorizations
      • Cryptography
      • Monitoring in Security
  • Distributed System Design
    • Page 1
    • Distributed Shared Memory
    • Distributed Data Management
    • Distributed Knowledge Management
    • Distributed Ledger
  • FAQs
  • Support and Community
Powered by GitBook
On this page
  • Externally Owned Accounts (EOAs)
  • Key Characteristicsof EOAs:
  • Advantages of EOAs:
  • Security Considerations:
  • Contract Accounts
  • Key Characteristics of Contract Accounts:
  • Advantages of Contract Accounts:
  • Security Considerations:
  • Differences Between EOAs and Contract Accounts
  • The Role of Accounts in Ethereum Ecosystem
  • Account Abstraction / ERC-4337
  • What is Account Abstraction?
  • ERC-4337: A Solution for Account Abstraction
  • How Does ERC-4337 Work?
  • Use Cases for Account Abstraction and ERC-4337
  • Challenges of Account Abstraction and ERC-4337
  1. Blockchain Platforms
  2. Ethereum

Ethereum Accounts

In Ethereum, accounts are a fundamental part of how the blockchain operates. Accounts represent entities (whether individuals, contracts, or organizations) that interact with the Ethereum network by sending and receiving transactions, storing data, or running smart contracts. Every account in Ethereum holds a balance of Ether (ETH), can send transactions, and can interact with smart contracts. Broadly, Ethereum accounts are classified into two types: Externally Owned Accounts (EOAs) and Contract Accounts.

Both account types have the ability to:

  • Receive, hold and send ETH and tokens

  • Interact with deployed smart contracts

Externally Owned Accounts (EOAs)

An Externally Owned Account (EOA) is controlled by a private key, which belongs to an individual or an entity outside the blockchain itself. EOAs are the most common type of account on Ethereum, as they represent people, wallets, and other external entities that interact with the blockchain. An EOA has the following characteristics:

Key Characteristicsof EOAs:

Controlled by Private Keys: An EOA is linked to a public-private key pair. The public key generates the address associated with the EOA, while the private key is needed to sign transactions. Whoever holds the private key controls the account.

Initiating Transactions: Only EOAs can initiate transactions on the Ethereum blockchain. This means that every transaction, whether it is to send Ether or to call a smart contract, must be initiated by an EOA.

Ether Balance: An EOA holds a balance of Ether. This Ether is used to pay for transaction fees (gas) when performing actions on the Ethereum network.

Nonce: Each EOA has a nonce, a counter that starts at 0 and increments by 1 with each new transaction. This ensures that transactions are processed in order and prevents replay attacks (i.e., resubmitting an old transaction).

Interaction Example:

  • Sending Ether: When a user sends Ether to another account, the transaction is signed with the private key of the EOA, deducting the Ether from their balance and transferring it to the recipient’s account.

  • Calling a Contract: When interacting with a smart contract, the EOA initiates a transaction that calls a function on the contract, passing the necessary data and paying for the execution with gas.

Advantages of EOAs:

  • Simple and straightforward: Only a private key is needed for control.

  • Suitable for individual users who want to send transactions, store Ether, and interact with dApps (decentralized applications).

Security Considerations:

The security of an EOA relies entirely on the private key. If the private key is lost or compromised, control of the account is irreversibly lost, and all Ether or tokens stored in that account are at risk.

Contract Accounts

A Contract Account represents a smart contract deployed on the Ethereum network. Unlike EOAs, contract accounts are controlled by their contract code, and they cannot initiate transactions on their own. Contract accounts only respond to incoming transactions from EOAs or other contracts. These accounts enable the creation of decentralized applications (dApps) and are the core of Ethereum’s programmability.

Key Characteristics of Contract Accounts:

Controlled by Code: A contract account is controlled by the logic written in its smart contract. The contract code defines what actions can be performed, including how Ether is handled, what data is stored, and how external contracts are called.

Cannot Initiate Transactions: A contract account can only act when it receives a transaction, either from an EOA or another contract. This is known as a “message call.” Once triggered, the contract will execute its code based on the transaction data.

Ether Balance: Like EOAs, contract accounts can hold Ether. This Ether can be sent and received by the contract based on its code.

Storage: Contract accounts have a storage structure, where data can be stored permanently on the blockchain. This is useful for dApps that need to maintain state, such as decentralized finance (DeFi) protocols or non-fungible token (NFT) platforms.

Interaction Example:

Executing Smart Contracts: When an EOA sends a transaction to a contract account, the contract’s code is executed. For instance, a user might call a function on a DeFi contract to lend Ether, or interact with an NFT marketplace to purchase a digital asset.

Advantages of Contract Accounts:

Programmable and automated: The logic written into a smart contract executes automatically when triggered.

Can perform complex functions: From token transfers and voting systems to decentralized exchanges and lending protocols, contract accounts power the Ethereum ecosystem’s dApps.

Security Considerations:

Contract accounts are as secure as the code written into them. If a contract has vulnerabilities, attackers can exploit these to steal funds or perform unauthorized actions. Unlike EOAs, contract accounts cannot be updated after deployment (unless specifically designed with an upgrade mechanism), so flaws are often permanent.

Differences Between EOAs and Contract Accounts

Both account addresses are in hexadecimal, which starts with the 0x prefix. The Ethereum public address of an EOA and a contract is always a 20 bytes (160 bits) address represented in hexadecimal form:

Feature
Externally Owned Accounts (EOAs)
Contract Accounts

Control

Controlled by a private key

Controlled by code (smart contract)

Initiates Transactions

Yes

No

Receives Transactions

Yes

Yes

Holds Ether

Yes

Yes

Executes Code

No

Yes

Requires Gas

Yes (for transactions)

Yes (for code execution)

State Storage

No

Yes

Upgradeability

Not applicable

Generally no, unless explicitly designed

The Role of Accounts in Ethereum Ecosystem

Ethereum accounts are crucial to the decentralized nature of the network, as they facilitate all interactions between users and smart contracts. The separation between EOAs and contract accounts enables the flexibility and programmability that Ethereum is known for, allowing a variety of use cases to flourish:

  • Decentralized Finance (DeFi): EOAs and contract accounts interact in decentralized lending, borrowing, and trading platforms. EOAs initiate transactions, while contract accounts execute the core logic of these financial services.

  • Non-Fungible Tokens (NFTs): NFTs are issued and managed by contract accounts, while EOAs can own, trade, and interact with these digital assets.

  • dApps (Decentralized Applications): EOAs act as the user interface for interacting with dApps, while contract accounts store logic and execute the operations behind the scenes.

  • DAOs (Decentralized Autonomous Organizations): Contract accounts serve as the governance mechanisms for DAOs, where EOAs vote and submit proposals, and the contract executes decisions based on predefined rules.


Ethereum accounts, whether EOAs or contract accounts, are essential to the operation of the Ethereum blockchain. EOAs are controlled by private keys and can initiate transactions, while contract accounts are governed by code and can only respond to transactions. Together, these accounts enable the wide range of decentralized applications that make Ethereum a leading platform for decentralized finance, NFTs, and more. Understanding the distinction between EOAs and contract accounts is key to navigating the Ethereum ecosystem effectively.

Account Abstraction / ERC-4337

Account Abstraction (AA) and ERC-4337 are groundbreaking concepts aimed at improving how accounts and transactions function on the Ethereum blockchain. They introduce flexibility in the way users interact with smart contracts, giving developers and users more control over their accounts. Here's a detailed explanation:

First Understanding Accounts on Ethereum

Ethereum has two types of accounts: Externally Owned Accounts (EOAs), Contract Accounts

What is Account Abstraction?

Account Abstraction (AA) proposes to unify the properties of both types of accounts, blurring the distinction between EOAs and smart contract accounts. In simpler terms, it means turning EOAs into smart contracts that users can customize.

Motivation Behind Account Abstraction:

  • Customizable Security: Today, EOAs rely on private keys, and if a private key is lost or stolen, funds are gone. With Account Abstraction, users can implement customizable security features like multi-signature (multisig) wallets, social recovery, or even biometric authentication.

  • User Experience Improvements: Account abstraction can allow for features like:

    • Gasless transactions: Users don’t need ETH to pay for gas.

    • Bundling multiple actions into a single transaction.

    • Improved onboarding: Simplifying wallet management and key recovery.

ERC-4337: A Solution for Account Abstraction

ERC-4337 is a standard that introduces Account Abstraction without requiring changes to the Ethereum protocol (as earlier proposals did). It leverages smart contracts and infrastructure at the application layer, leaving the core Ethereum protocol untouched.

Key Concepts of ERC-4337:

  • UserOperations: In the traditional model, transactions are signed and sent by EOAs. In ERC-4337, transactions are replaced by UserOperations. These UserOperations are collected and included in blocks by special entities called Bundlers.

  • Bundlers: Similar to miners/validators in the current Ethereum architecture, Bundlers are responsible for aggregating UserOperations and including them in a block. They can also pay the gas fee on behalf of the user.

  • EntryPoint Contract: This is a crucial component of ERC-4337. It acts as a middleman between the UserOperations and the network, ensuring all UserOperations are processed securely. It includes mechanisms for validating user signatures, ensuring correct gas payments, and more.

  • Smart Contract Wallets: In ERC-4337, wallets are smart contracts, not EOAs. This means the wallet’s logic is defined by code, enabling advanced functionality like:

    • Multisig: Requiring multiple signatures for transactions.

    • Social Recovery: Recovering a wallet using trusted individuals.

    • Custom Signature Schemes: Developers can implement their own cryptographic signature mechanisms.

Advantages of ERC-4337:

  • No Protocol Changes: One of the significant advantages of ERC-4337 is that it does not require changing the Ethereum protocol. Everything is implemented using smart contracts, allowing developers to start using it without waiting for consensus changes or forks.

  • Gas Payment Flexibility: Users can pay for gas fees in any ERC-20 token, or even delegate the payment of gas fees to someone else (e.g., a DApp sponsor).

  • Improved Wallet Security and Usability: By using smart contract wallets, users can implement enhanced security measures (like requiring multiple keys for high-value transactions) and recover wallets through other means (e.g., trusted friends).

How Does ERC-4337 Work?

Here’s a step-by-step flow of a typical transaction under ERC-4337:

  1. UserOperation: The user creates a UserOperation. This includes details like the account they want to interact with, the action they want to take (e.g., sending funds), and the maximum gas they're willing to pay.

  2. Bundler Aggregation: Bundlers collect multiple UserOperations from users. Instead of each user sending a transaction to the Ethereum network, a bundler batches them together, reducing network congestion.

  3. EntryPoint Contract: The EntryPoint smart contract validates each UserOperation, checking that the user has signed it properly and that the account has enough funds to pay for gas.

  4. Execution: Once validated, the operations are executed. Since this is happening at the application level, all of this is handled within smart contracts.

  5. Finalization: The result of the UserOperation is finalized and included in the blockchain, while the gas fee is paid either by the user or an external party (if gasless transactions are implemented).

Use Cases for Account Abstraction and ERC-4337

  • Simplified User Onboarding: New users could interact with blockchain applications without needing ETH in their wallets. Instead, a DApp could cover the gas fees, creating a smoother onboarding process.

  • Improved Wallet Management: Users can set up smart contract wallets with custom recovery methods, reducing the risk of losing funds permanently if they lose access to their private keys.

  • DeFi Automation: By using smart contract wallets, users can automate DeFi activities (e.g., lending, borrowing) and interact with multiple protocols in a single transaction.

  • Custom Transaction Flows: With UserOperations, users could bundle multiple actions (e.g., swap tokens, deposit into a yield farm, and take out a loan) into one operation, streamlining complex workflows.

Challenges of Account Abstraction and ERC-4337

  • Complexity: Implementing smart contract wallets introduces complexity for developers. Ensuring that these wallets are secure and efficient requires rigorous audits.

  • Bundler Centralization: If bundlers become too centralized, they could control which UserOperations get included in blocks, creating a potential point of failure or censorship.

  • Gas Efficiency: While ERC-4337 improves user experience, the bundling of operations may increase gas costs in some scenarios, especially if not implemented efficiently.

Conclusion

Account Abstraction and ERC-4337 represent a significant leap forward in making Ethereum more user-friendly, flexible, and secure. By moving wallet functionality to smart contracts, users can enjoy enhanced security, streamlined transaction flows, and improved onboarding experiences. Although challenges remain, especially around complexity and bundler centralization, these innovations are expected to play a pivotal role in the future of Ethereum and Web3.

Let me know if you need further clarification or specific use cases!

PreviousEthereum transactionNextEthereum Stacking

Last updated 8 months ago