Key Characteristics of Contract Accounts:
- Controlled by Code (Smart Contracts):
- Contract accounts are not controlled by users directly. Instead, they are controlled by the code that was deployed when the smart contract was created.
- Cannot Initiate Transactions:
- A contract account cannot initiate or send transactions by itself. Instead, it can only respond to incoming transactions that originate from an Externally Owned Account (EOA) or another contract.
- Once a contract account is invoked, it can perform various actions like executing functions, modifying its internal state, or even calling other contracts.
- Contains Smart Contract Code:
- A contract account holds code that can execute arbitrary logic, including complex business rules, financial applications, and more. The code is written in a smart contract language such as Solidity and deployed to the Ethereum blockchain.
- Ether Balance:
- Like EOAs, contract accounts can hold Ether (ETH). The Ether balance of a contract can be used to pay for operations or transferred when certain contract conditions are met.
- Gas Costs:
- Contract accounts require gas (paid in Ether) to execute their functions. The gas fee is paid by the EOA that initiates the transaction. If the contract calls another contract during execution, it may use up more gas, but the original sender is responsible for the cost.
- Permanent Deployment:
- Once a smart contract is deployed to the Ethereum blockchain, it is immutable.
Aspect |
Externally Owned Account (EOA) |
Contract Account (Smart Contract) |
Definition of Nonce |
Number of transactions sent by the EOA |
Number of contracts created by the account |
Purpose |
Ensures unique transaction ordering |
Ensures unique contract addresses |
Incrementing |
Increases after each transaction |
Increases after each contract creation |
Used For |
Preventing double-spending, replay attacks, and ensuring transaction order |
Determining the address of newly created contracts |
1. Storage Hash:
- Each smart contract in Ethereum can store data in its own storage, which is a key-value store. The storage contains things like variables defined in the contract (e.g., balances, state flags).
- The storage hash is the root hash of the contract’s storage tree, which is a compact cryptographic structure used to store key-value data.