Building a Blockchain: Main Entities

I’m writing a blockchain in Java, as a personal project. See my public repo. Read my previous post Building a Blockchain: Introduction. In this post, I will describe the core entities: accounts, transactions and blocks.

Core Entities


My project is an Ethereum-like blockchain. So, it has accounts. On the contrary Bitcoin manage UTXOs (Unspent Transaction Output). Read UTXO vs Account/Balance model. Source code:

  • Nonce: count of transactions already sent by this account
  • Code: the hash of the code associated with this account (or null, if this account is not a smart contract)
  • Storage Root: Root hash of the Trie containing the smart contract storage of this account (or null if the account is not a smart contract)


Each transaction involves two accounts: the sender and the receiver of the transaction. In my current implementation, I still have the sender address. Using TDD (Test-Driven Development) workflow, I plan to change this field to a signature, using elliptic curves digital signature. Read Signing and Verifying Ethereum Signatures. Source code:

  • Receiver Address: the address of the account that receives and executes the transaction
  • Value: value transferred from sender to receiver (it could be zero)
  • Data: additional data to use when the receiver is a smart contract
  • Nonce: number of transaction (counting from 0) emitted by the sender account
  • Gas limit: top gas unit to pay
  • Gas price: the price of each gas unit


Finally, the block has a block header, a transaction list (it could be empty), and an uncle list (it could empty, too). Source code:

  • Hash of parent block
  • State Root Hash of the world state trie at the end of the execution of the transaction contained in the block
  • Number of transactions
  • Transaction Hash of the transactions Merkle Tree
  • Number of uncles
  • Uncles Hash of the uncles Merkle Tree
  • Timestamp
  • Coinbase (address of the miner account that generate this block)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store