Transactions → pending pool → mining → block
This PHP demo uses MySQL. A transaction waits in a small demo mempool; the miner keeps changing a nonce until the block hash starts with 000.
1. Broadcast a transaction
2. Pending pool (demo mempool)
No waiting transactions.
The demo mines one pending transaction per block.3. Blocks in the chain
| Block | Transaction | Previous hash | Nonce | Block hash | Checks | Tamper demo |
|---|---|---|---|---|---|---|
| #1 | GENESIS | GENESIS |
2220 | 0007908a8a45ff813c0548a397e2e93e0df55ba8d47c9490b54e8d4a81f35fdb |
Hash: matches
Previous link: matches
Proof of work: valid
|
Starting block |
| #2 | PG sends SG $5 | 0007908a8a45ff813c0548a397e2e93e0df55ba8d47c9490b54e8d4a81f35fdb |
2378 | 00010938b21dbda8f9c5308f115231188f679f1642373f335540c2660d002747 |
Hash: matches
Previous link: matches
Proof of work: valid
|
|
| #3 | PG2 sends SG2 $25 | 00010938b21dbda8f9c5308f115231188f679f1642373f335540c2660d002747 |
7957 | 000f9a34c5a18347c02bfa243d48da8eca476e294329dd1f56f0445ec18ff59b |
Hash: matches
Previous link: matches
Proof of work: valid
|
Rejected edits saved in failed_transactions
| Attempt | Linked block | Original transaction | Attempted transaction | Recalculated hash | Saved hash | Failure |
|---|---|---|---|---|---|---|
| #1 | Block #2 | PG sends SG $5 | PG sends SG $1 [changed] | 4aff7262a6fd01638e5a100373d8071df920cf3a179c4d92669f8367d87a30b5 |
00010938b21dbda8f9c5308f115231188f679f1642373f335540c2660d002747 |
Recalculated hash does not match the original saved hash |
Reset demo data
Clears the blocks, pending transactions, and failed attempts in this demo, then mines a fresh starting block.
Learning demo only: each block holds one text transaction, and the target is intentionally easy (three leading zeroes). Real Bitcoin uses a much harder target, transaction signatures, many competing miners, and independent full nodes. This demo is not connected to Bitcoin.