ReasonJun

Ethereum : Account structure 본문

Blockchain/Ethereum

Ethereum : Account structure

ReasonJun 2024. 1. 5. 18:12
728x90
  • In the case of Bitcoin blockchain, state values are managed based on UTXO. The user's balance is managed by updating the UTXO usage status whenever a new block is created.
  • In the case of the Ethereum blockchain, the state value of balance data is stored in the Account based on the state, and the balance is updated every time a block is created.

Types of Accounts:

There are two main types of accounts in Ethereum:

  1. Externally Owned Accounts (EOA): These are user-controlled accounts, often accessed through software wallets like MetaMask or MyEtherWallet. EOAs are represented by a public address (derived from the private key) and hold balances in Ether (ETH). They lack their own code and rely on user interaction through private key signatures to initiate transactions.
  2. Contract Accounts: These are accounts created by deploying smart contracts onto the Ethereum Virtual Machine (EVM). They're controlled by the code embedded within the smart contract and can hold balances, execute their programmed functions, and interact with other accounts. Unlike EOAs, they don't have private keys and can't initiate transactions by themselves.

Account Components:

Every account (EOA or contract) consists of several key components:

  • Address: This is a unique identifier for the account on the Ethereum network, typically represented as a 42-character hexadecimal string. It's derived from the public key of the corresponding key pair.
  • Balance: This represents the amount of Ether (ETH) held by the account. Any change in balance occurs through transactions (sending or receiving ETH).
  • Nonce: This is a counter that keeps track of the number of transactions sent from the account. It prevents replay attacks and ensures transaction uniqueness. (0 ~ +1)
  • StorageRoot: This is the hash value of the root node of the account Merkle Patricia Trie. The default is empty. Used together with Account Storage.
  • CodeHash: This is the bytecode of the smart contract deployed to the account. It defines the logic and functionality of the contract and determines how it interacts with the Ethereum network. In the case of EOA this is empty.

 

How to make EOA? 

 

Bitcoin and Ethereum use the same ECDSA Alogorithm. => ECC elliptic curves are also used in the same way. => The same applies to using secp256k1 among elliptic curves. Therefore, if you create an account in Bitcoin and Ethereum with an already created private key, the same address is created.

 

Private Key => (secp256k1) => Public Key =>. Keccak-256 Hash (Result value lower 20 bytes) => address

 

How to make CA?

 

1. Network Deploy

When EOA creates a CA or uses CREATE (OPCODE) on the contract, the network creates and returns an Address in the same manner as the code below.

 

 

2. Using CREATE2

Using CREATE2, you can know the Contract Address in advance before network distribution.

 

Address Checksum

In the case of Ethereum Address, unlike Bitcoin, checksum is not included in the creation process, so it is difficult to check whether the address is accurate. To solve this problem, a checksum function is provided by converting the case of the address through EIP-55.

 

Ethereum Naming Service (ENS)

Like DNS, it is registered and used in a language that is easy for users to understand. Purchase the name using Smart Contract. This is a function that automatically converts and delivers the name to the address when you enter the name as the recipient in a supported wallet.

728x90

'Blockchain > Ethereum' 카테고리의 다른 글

Ethereum : Transaction Structure  (0) 2024.01.16
Ethereum : Block Structure  (0) 2024.01.16
Ethereum : Patricia Merkle Tries  (0) 2024.01.05
Ethereum : ERC721  (0) 2023.10.22
Etherscan : Verify  (0) 2023.10.21
Comments