What Is Genesis Block In A Blockchain

Genesis Block
 
A block is a fundamental element of a blockchain. A block is a data structure that consists of a block number also known as an index, a timestamp, a previous hash, hash, and data.
 
Common attributes of a block
  • A block number is a unique number that identifies a block.
  • A timestamp is the date and time when the block was created.
  • Previous hash is the hash of the previous block. For the first block, the previous has is empty.
  • A hash is the unique encrypted hash of the current block and its content including block number, nonce, and data and is used to validate a block.
  • Data part of a block a transaction or list of transactions.
  • A nonce is a random number that is used to create a signed block. 
In code, a block is a data structure and can easily be represented by a structure or a class. Listing 1 is an example of the Block class with its properties. 
  1. public class Block  
  2. {  
  3. public int Index { get; set; }  
  4. public DateTime Timestamp { get; set; }  
  5. public string PreviousHash { get; set; }  
  6. public string Hash { get; set; }  
  7. public string Data { get; set; }  
  8. }  
A block can store any kind of data you with to store on the blockchain. 
 
A genesis block is the first block (block number 0) in a blockchain. This is the only block in a blockchain that does not have a valid reference to a previous block and does not have any transactions.