Understanding What a Blockchain Block Is | Concept

Ole Ersoy
Feb - 26  -  2 min

A blockchain block contains the following:

  • Transaction Data
  • A cryptographic hash ( fingerprint / signature ) of it’s content
  • A nonce value ( A random number used for cryptographic computation )
  • The hash of the previous block
  • A time stamp of a recent verified transaction

Lets look at an example. We will use the NPM Packages CryptoJS and NanoID to generate the signature and nonce.

Here’s our block (The properties are readonly and immutable - once set they are locked):

import { SHA256 } from "crypto-js";
import { nanoid } from "nanoid";
class Block {
      public readonly index: number,
      public readonly timestamp: string,
      public readonly data: any,
      public readonly precedingHash: string,
      public readonly nonce?: string) {
        this.nonce = this.nonce ? this.nonce : nanoid();
      signature() {
        return SHA256(
            this.index + 
            this.precedingHash +
            this.timestamp +
            this.nonce +

Lets create two blocks with the same data. They should have the same signature:

const transactionData = {
sender: "Ole Ersoy",
recipient: "Satoshi Nakamoto",
quantity: 1
const block1 = new Block(0, "02/02/2021", transactionData, "0", "nonce");
const block2 = new Block(0, "02/02/2021", transactionData, "0", "nonce");
console.log(`Signature of Block 1: ${block1.signature()}`);
console.log(`Signature of Block 2: ${block2.signature()}`);

So we see that a Block has a unique signature that is determined by what it contains.

The fact that the properties are locked / immutable and now signed by the signature makes it very difficult to tamper with a block.