Let’s learn about blockchains real quick

Jesse Adams, Ph.D.
Nov 12, 2017 · 3 min read
Anders Brownworth’s Blockchain Demo

Here’s a gentle intro to blockchain functionality using Anders Brownworth’s blockhain demo that you can find on Github here and running on Anders’ site here. The magic of the blockchain is basically 4 things: 1] shredding data blocks through a SHA256 encryption hash function 2] mixing in a random number called a nonce until a specific number of leading zeros exist in the hash — which takes some computer time — the more zeros the more time — and then you have proof you got there and share and store the news with 3] a network of other computers, and, finally 4] you always require that each new block point back to the verified block before it (and mix that previous block’s hash into the new block’s “hash-shredder”).

So let’s hash some stuff:

Go here and type text into the data window and see how the SHA256 hash changes. This is the fist part of the magic.

After you play with this live SHA256 hash window for a bit (notice things like one space changes the hash, one period does the same, a new word..etc ) let’s mine a block.

You’ll be running the block data through the hash function like before, but now there’s a new game — you need to bascially play a lottery that takes some computer time to get a unique number called a nonce that will create a hash with 4 leading 0s (in this example) — something like rolling a hundered dice till you get the first four to land on 1.

So, go to the block demo in the caption below, enter some text in block one, press mine and watch the nonce change and the hash update after mining.

Blockchain block demo after text entry and before mining.

The mined block will have 4 leading zeros (or whatever difficulty is set .. more zeros is more difficult ) in the new hash and will show the nonce that was required for the hash to turn out this way with the given block of data. If you changed the nonce or the block data the hash would change — just like you saw with the SHA256 hash demo above.

Blockchain block demo after text entry and after mining. Note the 4 leading 0s in the Hash.

Now let’s build a blockchain! :)

Go to the blockchain demo in the caption link below and mine the first block.

Then put some data in the second block. Before you mine the second block, note the nonce that will change and the hash that doesn’t have the correct number of leading zeros yet. Also note a new field, called “Prev” which shows the mined hash from the first block — this is the chain in the word blockchain.

If the encryption and the random nonce weren’t enough to protect your data, you’ve now made a brilliant step of locking, linking or chaining, the new block to the previous block via the previous block’s verified, immutable and final hash.


Blockchain demo with first block mined and second block not mined yet. Note that the second block points to the hash of the first block via the Prev field.

Now mine the second block.

Blockchain demo with the first and second block mined. Note the 4 leading zeros in both hashs now and the nonce for the second block is different than it was before.

Note the new nonce and the 4 leading zeros now in the second block’s hash.

You’ve just mined and connected the first two blocks of your very own blockchain.


Jesse Adams, Ph.D.

Written by

CEO corcom.io

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade