Skip to main content
Course/Module 1/Topic 4 of 4Beginner

Cryptography & Block Structure

Blockchain uses cryptographic hashing to link blocks together and ensure data integrity. Learn what a hash is and how blocks are structured.

30 minBy Priygop TeamLast updated: Feb 2026

Cryptographic Hashing

A hash function takes any input and produces a fixed-length output (the hash). The same input always produces the same hash. Even a tiny change in input produces a completely different hash. It's impossible to reverse a hash to get the original input. Blockchain uses SHA-256 (Bitcoin) and Keccak-256 (Ethereum). Each block stores the hash of the previous block — this is what creates the 'chain'.

What's Inside a Block?

  • Index — Block number in the chain (0 = genesis block)
  • Timestamp — When the block was created
  • Transactions — List of all transactions in this block
  • Previous Hash — Hash of the block before it (creates the chain)
  • Nonce — Number used in mining (Proof of Work)
  • Hash — This block's own cryptographic fingerprint
  • Merkle Root — A single hash representing all transactions in the block

Block Structure Example

Example
// A simplified blockchain block structure

const genesisBlock = {
    index: 0,
    timestamp: "2009-01-03T18:15:05Z",
    transactions: ["Satoshi → Satoshi: 50 BTC (coinbase reward)"],
    previousHash: "0000000000000000000000000000000000000000000000000000000000000000",
    nonce: 2083236893,
    hash: "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",
};

const block1 = {
    index: 1,
    timestamp: "2009-01-12T03:30:25Z",
    transactions: [
        "Satoshi → Hal Finney: 10 BTC",  // First real Bitcoin transaction!
    ],
    previousHash: genesisBlock.hash,  // Links to genesis block
    nonce: 1639830024,
    hash: "00000000d1145790a8694403d4063f323d499e655c83426834d4ce2f8dd4a2ee",
};

console.log("Genesis Block:", genesisBlock.hash.substring(0, 20) + "...");
console.log("Block 1 links to:", block1.previousHash.substring(0, 20) + "...");
console.log("Chain is valid:", block1.previousHash === genesisBlock.hash);
console.log("\nIf we change Genesis Block data, its hash changes,");
console.log("breaking the link to Block 1 — tampering is detectable!");

Try It Yourself: Block Explorer

Try It Yourself: Block ExplorerHTML1 error
⚠ Syntax Issues (1)

Line 30: Malformed tag: "< str.length; i++) { h ^= str.charCodeAt(i); h = (h * 0x01000193) >"

💡 Tags must use valid HTML names and be properly formed. Example: <div>, <p class="text">

HTML Editor
1 errorTab = 2 spaces
HTML|98 lines|3737 chars|1 error, 0 warnings
UTF-8

Quick Quiz

Chat on WhatsApp
Priygop - Leading Professional Development Platform | Expert Courses & Interview Prep