This repository contains focused, implementation-level explorations of core blockchain and Web3 concepts. The work here prioritises first-principles understanding of how blockchain systems function under the hood, rather than framework-driven application development.
The projects are written in JavaScript using EVM-aligned cryptographic and execution models, with an emphasis on correctness, testability, and clarity.
The goal of this repository is to internalise and demonstrate:
- how cryptographic primitives enable trustless systems
- how transactions are constructed, signed, and verified
- how blocks are formed, validated, and chained
- how tampering and invalid state transitions are detected
This is a conceptual exploration repository, not a production codebase.
Ethereum cryptography utilities for message hashing, signing, and key recovery.
Features:
- Message hashing using Keccak-256
- Message signing with private keys
- Key recovery from signatures
- Address generation from public keys
Files:
hashMessage.js- Hash messages using Keccak-256signMessage.js- Sign messages with private keysrecoverKey.js- Recover public keys from signaturesgetAddress.js- Generate Ethereum addresses from public keystest.js- Test suite for all utilities
Usage:
cd cryptography
npm install
npm testA utility to find the original color from a hash value. Given a hash, it determines which color (from a predefined set) produced that hash.
Features:
- Hash color values using SHA-256
- Reverse lookup to find the original color from a hash
- Supports colors: red, green, blue, yellow, pink, orange
Files:
index.js- Main function to find colors from hashestest.js- Test suite for color finding functionality
Usage:
cd find_colours
npm install
npm testA simple blockchain miner implementation that demonstrates proof-of-work mining. It creates blocks by finding a nonce that produces a hash below a target difficulty.
Features:
- Transaction mempool management
- Proof-of-work mining with configurable difficulty
- Block creation with nonce finding
- Processes up to 10 transactions per block
- SHA-256 hashing for block validation
Files:
index.js- Mining logic with mempool and block managementtest.js- Test suite for mining functionality
Usage:
cd miner
npm install
npm testA simple blockchain implementation demonstrating the core concepts of blockchain technology, including block creation, chain validation, and tampering detection.
Features:
- Block creation with data and previous hash linking
- Blockchain validation to ensure chain integrity
- SHA-256 hashing for block verification
- Detection of tampering with previous hashes or data
- Genesis block initialization
Files:
Block.js- Block class with data and hash functionalityBlockchain.js- Blockchain class with chain management and validationvalidationTests.js- Test suite for blockchain validation
Usage:
cd blockchain
npm install
npm testA UTXO (Unspent Transaction Output) model implementation demonstrating how Bitcoin-style transactions work. This simple JS project shows how transactions consume input UTXOs and create new output UTXOs, with validation and fee calculation.
Features:
- Transaction Output (TXO) representation with owner, amount, and spent status
- Transaction execution with input and output UTXO validation
- Prevention of double-spending by checking if UTXOs are already spent
- Automatic fee calculation as the difference between input and output amounts
- Support for multiple input and output UTXOs per transaction
Files:
TXO.js- Transaction Output class representing unspent outputsTransaction.js- Transaction class for executing UTXO-based transferstest.js- Test suite for transaction execution and fee calculation
Usage:
cd utxo
npm install
npm testA binary search tree implementation demonstrating fundamental tree data structure concepts. This project shows how nodes are organized in a hierarchical structure with efficient insertion and search operations.
Features:
- Node class with data, left, and right child references
- Recursive node insertion maintaining binary search tree property
- Recursive search functionality to find nodes by value
- Tree structure with root node management
- Efficient O(log n) average case for insertion and search operations
Files:
Node.js- Node class representing tree nodes with data and child referencesTree.js- Tree class with recursive addNode and hasNode methodstest.js- Test suite for tree operations and node insertion
Usage:
cd binary-search-tree
npm install
npm testA Merkle tree implementation demonstrating how cryptographic hash trees work. This project shows how multiple data items are combined into a single root hash through recursive pairing and concatenation, a fundamental concept in blockchain data structures.
Features:
- Recursive tree construction by pairing and concatenating nodes
- Flexible concatenation function for different hashing strategies
- Root hash generation from any number of leaves
- Merkle proof generation for leaf verification
- Merkle proof verification to validate proofs against root
- Handles base cases including single leaf and empty tree scenarios
- Automatic handling of odd-numbered nodes in layers (unpaired nodes are passed through)
- Efficient hierarchical hashing structure with recursive layer building
Files:
index.js- MerkleTree class with recursive layer building, root generation, and proof generationverify.js- Proof verification function to validate merkle proofs against roottestUtil.js- Utility functions for SHA-256 hashing, hash concatenation, and proof verificationtest.js- Comprehensive test suite with 32 tests covering root generation (1-8 leaves), proof generation (10 leaves), and proof verification (11 untampered + 4 tampered scenarios)
Usage:
cd simple-merkle-tree
npm install
npm test- Node.js - Runtime environment
- ethereum-cryptography - Cryptographic utilities for Ethereum
- crypto-js - Cryptographic library for hashing
- Mocha - Testing framework
- Chai - Assertion library
Each project has its own dependencies. Navigate to the project directory and run:
npm installRun tests for each project:
npm testISC
These projects are part of my learning journey with Alchemy.