How to build Ethereum blockchain applications
If you are new to the blockchain technology, taking our Introduction to Blockchain Technology self-paced course is highly recommended. Also, for a comprehensive coverage of blockchain development in Ethereum or mastering Solidity programming, taking our below self paced courses is highly recommended:
In our previous series, we covered the following articles:
In this article, we learn how accounts are created and managed in Ethereum.
As we discussed earlier, instead of the UTXO model, Ethereum manages accounts and transactions differently than Bitcoin. In Ethereum, it introduces the world state concept, the collection of all accounts on the blockchain network. World state presents the global state of the Ethereum network, which is constantly updated following any transaction execution. It is a kind of a global database, which is replicated to all Ethereum nodes behind the scene.
Like your bank account, an Ethereum account is used for holding ethers and transacting with each other. It has a 20-byte cryptographic address, an account balance, and state transitions between accounts. The address identifies the owner of the account.
In addition to the address, an Ethereum account contains four fields:
The following diagram further illustrates the structure of an Ethereum account:
In Ethereum, a transaction is a state transition of account from one state to another, which is initiated by an external entity. All transactions, whether it is ether movement from one account to another or smart contract code execution, will be collated into a block. Also, the resulting account states and transaction receipts are added to the block too. The new block will be mined by the blockchain network and added to the blockchain. Data in the blockchain is stored in supporting storage, usually a database. Depending on the Ethereum client implementation, it may be stored into a different type of database. For example, the Geth implementation uses Google LevelDB as the underlying database implementation for the global state, as shown here:
We will get into different types of accounts in the next section.
Accounts play an essential role in Ethereum. Ethereum introduces two types of accounts:
They are both state objects; an EOA has a balance, and a CA has both a balance and storage. Without CAs, Ethereum would be limited to the mere transfer of value between accounts, as with Bitcoin.
Just like your personal or business account in a financial institute, an EOA is associated with an external entity as an owner who has an interest in the account or has ownership of the underlying cryptoassets. Every EOA has a pair of cryptographic keys. It is controlled by the owner's private key. The owner uses its private key to digitally sign all transactions so that the EVM can securely validate the identity of the senders. In the world state, the account is linked to a public address, which is generated based on the owner's public key. We will talk about the address in detail in the Address and walletarticle, as part of the discussion about the Ethereum wallet.
The following diagram shows the structure of the EOA:
As shown here, EOA has a balance associated the address, mainly used for ether transfer.
A CA, or a contract, has an ether balance and associated code, which is linked to the smart contract code in an EVM. It may have optional storage, which is pointing to EVM storage. A state change in a contract account may involve an update of the ether balance, the associated data in the storage, or both. A contract account has an associated address too, which is calculated using the Keccak-256 hash function, based on the address of its creator (sender) and the nonce:
The associated smart contract code is executed when it is triggered by transactions or messages received from other contracts. Once a new block is added to the blockchain, all participating nodes will execute the contract code again as part of the block verification process.
In our next article (How Ethereum Manages Transactions), we discuss how transactions are processed and managed in Ethereum.
This article is written in collaboration with Brian Wu who is a leading author of “Learn Ethereum: Build your own decentralized applications with Ethereum and smart contracts” book. He has written 7 books on blockchain development.
Here is the list of our free webinars that are highly recommended:
Here is the list of our 10 free self-paced courses that are highly recommended:
If you like to learn more about Hyperledger Fabric, Hyperledger Sawtooth, Ethereum or Corda, taking the following self-paced classes is highly recommended:
If you want to master Hyperledger Fabric, Ethereum or Corda, taking the following live classes is highly recommended:
If you like to learn more about blockchain technology and how it works, reading the following articles is highly recommended:
If you like to learn more about blockchain development in Ethereum with Solidity, reading the following articles and tutorials is highly recommended:
If you like to learn more about blockchain development with Hyperledger, reading the following articles and tutorials is highly recommended:
If you like to learn more about blockchain development on Corda , reading the following articles and tutorials is highly recommended:
If you like to learn more about blockchain development in other platforms, reading the following articles and tutorials is highly recommended:
We offer private custom tutoring classes both online and in DC, MD and VA for almost all of our courses or bootcamps. Give us a call or email us to discuss your needs.
$50 Limited OfferREGISTER NOW