What is Blockchain?
Blockchain is a distributed, immutable ledger that records transactions across many computers. No single person or company controls it.
What is Blockchain?
A blockchain is a chain of blocks, where each block contains a list of transactions. Once data is recorded in a block and added to the chain, it cannot be changed without changing all subsequent blocks — which requires agreement from the entire network. This makes blockchain tamper-resistant. Bitcoin (2009) was the first major blockchain. Ethereum (2015) extended it with programmable smart contracts.
Key Properties of Blockchain
- Decentralized — No single authority controls it; thousands of computers (nodes) share the ledger
- Immutable — Once recorded, data cannot be altered without network consensus
- Transparent — All transactions are publicly visible on public blockchains
- Trustless — You don't need to trust a bank or company; the code enforces the rules
- Secure — Cryptographic hashing links blocks together, making tampering detectable
- Permissionless — Anyone can participate in public blockchains like Bitcoin and Ethereum
Traditional Database vs Blockchain
// Traditional Database (centralized)
// - Controlled by one company (e.g., your bank)
// - Can be modified by the company
// - You must trust the company
// - Single point of failure
// Blockchain (decentralized)
// - Controlled by thousands of nodes worldwide
// - Cannot be modified without network consensus
// - You trust the code, not a company
// - No single point of failure
// Example: Sending money
// Traditional: Alice → Bank → Bob (bank can freeze, reverse, or delay)
// Blockchain: Alice → Network → Bob (no intermediary, irreversible)
const transaction = {
from: "Alice",
to: "Bob",
amount: 1.5, // BTC or ETH
timestamp: Date.now(),
hash: "0x3a4f...", // Cryptographic fingerprint
};
console.log("Transaction recorded on blockchain:", transaction);Try It Yourself: Blockchain Concepts
Line 27: Malformed tag: "< data.length; i++) { hash = ((hash << 5) - hash) + data.charCodeAt(i); hash |= 0; } return "0x" + Math.abs(hash).toString(16).padStart(8, "0").toUpperCase(); } let chain = []; let blockCount = 0; function createBlock(data, prevHash) { const block = { index: blockCount++, timestamp: new Date().toLocaleTimeString(), data: data, previousHash: prevHash, }; block.hash = simpleHash(JSON.stringify(block)); return block; } function renderChain() { const div = document.getElementById("chain"); div.innerHTML = chain.map((b, i) =>"
💡 Tags must use valid HTML names and be properly formed. Example: <div>, <p class="text">
Line 56: Malformed tag: "< chain.length - 1 ? '<div style="text-align:center;color:#a78bfa;font-size:20px;">"
💡 Tags must use valid HTML names and be properly formed. Example: <div>, <p class="text">
Line 57: Wrong closing tag: </div> found, expected </script> (line 57)
💡 Close <script> (opened on line 23) with </script> before closing </div>.