2 Ethereum account type
1. External account
- Controlled by anyone with the private key which use to sign transactions. An account is made up of a cryptographic pair of keys: public and private. Public key is generated from the private key using the Elliptic Curve Digital Signature Algorithm. Public key prove that she originally initiated the transaction request. It is possible to derive new public keys from your private key but you cannot derive a private key from public keys.
- Costs nothing.
- Can initiate transactions.
- Transactions between externally-owned accounts can only be ETH/token transfers.
2. Contract account
- Controlled by code.
- Has a cost because you're using network storage.
- Can only send transactions in response to receiving a transaction.
- Transactions from an external account to a contract account can trigger code which can execute many different actions.
👉 Both account can:
- Receive, hold and send ETH and tokens.
- Interact with deployed smart contracts.
3. Ethereum accounts have four fields
💧nonce:
- External account: indicates the number of transactions sent from the account.
- Contract account: represents the number of contracts created by the account.
💧 balance: The number of wei owned by this address.
💧 codeHash:
- External account: code of an account on the Ethereum virtual machine (EVM). codeHash field is the hash of an empty string.
- Contract account: have code fragments programmed in that can perform different operations.
💧 storageRoot: 256-bit hash of the root node.
Note: An account is not a wallet which is an interface or application that lets you interact with your Ethereum account.
Nhận xét