JavaScript Blockchain simulator
Run a blockchain inside your browser
To aid in explaining blockchain technology, we have created a Blockchain ‘simulator’ in JavaScript. It is built in JavaScript (+ CSS/HTML) so it runs in practically any web browser. The whole thing is complementary to our website, so it uses the same coloring-scheme and design of elements to correlate with all our other explainers.
Click here to launch the blockchain simulator.
Components
The simulator is made up of three basic blockchain-components:
- A Memory Pool
- A Miner (one representing many, for the purpose of simplification)
- ‘The Blockchain’ (an overview of all blocks mined)
Features
We have tried to implement as much ‘realism’ as possible;
- SHA256 mining (you can switch to MD5 hashing, for shorter, more readable hashes)
- 32-bit string noncing
- Adjustable hash rate (with a clock-multiplier boost)
- Difficulty adjustment, each <x> blocks
- Auto-replenishing Memory Pool (generates random transactions to prevent running dry, unless paused)
- Actual individual transactions (represented as SHA256 hashes)
- Miner and Memory Pool are individually pausable (or both at once, using the master control)
About the simulator
Everything is simplified ‘to scale’, in that there is a block target time of 10 seconds, as opposed to 10 minutes, base difficulty starts at 4 bits (one leading zero) instead of 32. Furthermore, difficulty adjustment occurs every 5 blocks, and blocks only contain 9 + 1 coinbase = 10 transactions.
All this is done to benefit comprehension and because hash power via JavaScript in the browser is limited.
Click here to launch the simulator. (hosted @ hnldesign.nl)
Disclaimer
Note that we are actively working on the simulator, so defaults/values may change. And — perhaps it’s superfluous, but just in case — no; we’re not using your browser to mine any crypto. It’s just a simulator, in JavaScript.
More info & Sources
Cover photo by CHUTTERSNAP on Unsplash