Anvil Chain is a sandbox recreation of Bitcoin's core mechanics in plain JavaScript. Same algorithms. Same concepts. Readable enough that a beginner can follow along.
100% local sandbox. Zero real cryptocurrency. Based on Bitcoin's design.
Scroll through the five pillars of Bitcoin. Each one builds on the last.
Everything starts with a transaction. Alice wants to send coins to Bob. She signs the transaction with her private key, producing a cryptographic signature that proves she authorized the transfer. Anyone can verify it using her public key -- but nobody can forge it.
Uses ECDSA (secp256k1) signatures. Transactions are broadcast to the mempool. Each input references a previous unspent output (UTXO model).
Uses Ed25519 signatures. Simplified account-balance model instead of UTXOs. Same core principle: cryptographic proof of authorization.
Transactions are bundled into blocks. Each block contains a list of transactions, a reference to the previous block's hash, a timestamp, and a nonce. The miner assembles all of this, then computes the block's SHA-256 hash.
Blocks hold ~2000-3000 transactions. The header is exactly 80 bytes. Includes a Merkle root that summarizes all transactions in a tree structure.
Blocks hold any number of transactions. Uses a simple JSON hash of all fields. Same concept: a tamper-evident container for transactions.
Each block stores the hash of the block before it. This creates a chain -- change one block and every block after it becomes invalid. Click "Tamper" below to see the cascade effect in action.
Click "Tamper" on any block to see how the chain breaks
The chain is ~600GB and growing. Over 800,000 blocks deep. To tamper with block N, you would need to re-mine every block after it faster than the entire network.
Same hash-linking principle. Changing any field in a block breaks the chain from that point forward. Immutability through cryptographic linking.
To add a block to the chain, a miner must find a nonce that makes the block's hash start with a certain number of zeros. This is brute force -- there is no shortcut. Click "Start Mining" to watch it happen in real time.
~600 exahashes per second across the network. Difficulty adjusts every 2016 blocks to target ~10 minutes. Requires specialized ASIC hardware costing $5K-$15K each.
Difficulty 2-3 (just a few hundred attempts). Takes under a second. Same SHA-256 algorithm, just a much easier target so you can watch the process.
In a decentralized network, nodes may disagree about which chain is correct. Nakamoto consensus solves this: everyone follows the longest valid chain. If two miners find a block simultaneously, the tie breaks when the next block is found.
~20,000 nodes worldwide enforce consensus. An attacker would need >50% of all hash power to rewrite history -- economically infeasible at current scale.
Run multiple local nodes with HTTP peers. They share chains and follow the longest valid chain rule. Same Nakamoto consensus, local scale.
The explanations above are simplified for learning. Real Bitcoin involves additional complexity (Merkle trees, script system, fee markets, etc.) that is beyond the scope of this sandbox.
A real blockchain running in your browser. Type commands below.
Bitcoin's core mechanics, simplified to under 1,000 lines of JavaScript.
Same mining algorithm as Bitcoin. Increment a nonce until the hash has enough leading zeros. Real proof-of-work, low difficulty so you can watch it happen.
Every transaction is cryptographically signed. Private key signs, public key verifies. Same principle as Bitcoin's ECDSA, using modern Ed25519.
Miners earn 50 coins per block — exactly how Bitcoin started in 2009. New coins only enter circulation through mining.
Each block stores the hash of the previous block. Tamper with one and every block after it breaks. This is what makes Bitcoin immutable.
Run multiple nodes locally. They share blocks and follow the longest valid chain rule — the same consensus mechanism Bitcoin uses.
Type /explain mine to learn how Bitcoin mining really works — the hardware, the difficulty, the economics. Built-in lessons for every concept.
Not just a script -- a full interactive CLI with menus, autocomplete, and built-in lessons.
Install once, then just type anvil-chain to launch it anytime.
git clone https://github.com/ssm-official/anvil-chain.git && cd anvil-chain && npm install && npm linkThen just run anvil-chain from anywhere to start it.
Anvil Chain is an educational sandbox. The ANV coin has no monetary value. This project is not a cryptocurrency, not an investment, and not connected to any real blockchain network. It exists solely to teach how blockchain technology works. Do not use this in production.