Blockchain: How Tamper-Proofing Actually Works

Sarah Wiesner
Efficient Frontier
Published in
5 min readJan 28, 2019

If you are new to Blockchain, please read the previous post first. This post will go into the technical details of an actual block-chain.

A blockchain is a (potentially) tamper-proof database. A block is a nickname for any block of data you want to place in the database and the “chain”, which we‘ll go into in a bit, uses a cool mathematical hack called hashing to create a “chain” of blocks of information that contain certifiable proof that no information in this structure was changed after a certain point. Also, you have mathematical certainty that each block of data was created chronologically.

To understand how this really works there are only two things you need to know: what hashing is, and how it’s used to create chained ”blocks” of information.

First stop: hashing or digital fingerprints

A hash function is a “one directional function.” After you put data into the function, it calculates a result, but you can not take the result and run it through an opposite function to find the original input. For example, X+Y+Z =W is a very simple hash function. You can easily calculate 1+3+4=8. The result is called the hash sum or hash. If you’re only given this hash: 8 and the function X+Y+Z=W, it’s obviously impossible to know for sure what numbers were put in the function. This is what makes it a one directional function. The above hash function isn’t very sophisticated, but all hashing uses this same principle.

A cryptography grade hash sum

If you obtain a hash of a file from a trusted source, you can be sure not even one letter in the entire file, no matter how big, has been changed.

Digital fingerprints

Cryptography grade hash functions such as one named SHA-256 are used in Bitcoin and other systems. A cryptography grade hash function uses many digits and is highly tested to create, with a very high assurance, a completely different and distinct result for every different possible input in existence. In addition, it’s statistically impossible to undo a hash function or tailor the input data in order to create a specific hash sum. These attributes make hash sums perfect for using them as digital fingerprints for files of information. Checking files against their hash fingerprint is broadly used across many file systems and when downloading or sending files over the internet. The information is put through the correct hash function and if the result is indeed the known fingerprint, you can be sure it’s an exact copy of the correct file.

Source: wikipedia

An important attribute of high quality hash functions is that when a single bit is changed in the inputted data, the hash sum comes out completely different. No other file or data will have the same fixed fingerprint, and as far as computer scientists and mathematicians know, it is impossible to fake. When a file or data is altered, it can be easily detected by calculating its hash sum. You can easily see it creates a new and completely different hash fingerprint, when compared to the original fingerprint.

The final step: chaining blocks

Now that we’ve got hash fingerprints for single files, we can move on to creating a growing database — a block-chain! This special database contains blocks of data, each with their own hash fingerprint, and a clever method lets you connect them all. Before each new block of data is added to the database and gets its own hash fingerprint, the hash fingerprint of the previous block is added to its data, then this all gets hashed into a fingerprint. So the hash fingerprint of the previous block is melded into the new block’s fingerprint. Now, when the hash of a block number N is calculated, its hash fingerprint not only assures you that the block’s data was not changed, but it also assures you the information in the block that came before was not changed!

How is this certainty achieved?
1) You check block number N against its fingerprint. If the data matches the fingerprint, you know the block data is correct. The block data includes N-1’s hash fingerprint.
2)
Now you take N-1’s fingerprint and check it against N-1’s data.
3) If N-1's data matches its fingerprint, you can continue and check the block before it, until you reach the first block in the chain.

If even one letter in the entire block-chain is changed, that block that was changed will produce a completely different hash fingerprint. This will break the chain, as the change will alter the block’s own hash fingerprint, and therefore the hash fingerprints of all the blocks that come after it. So even if you only know the true hash fingerprint of one block, you can know that changes were not made at any point beforehand. If a change was made, it will be detected where the chain is broken. This is what’s called a tamper proof chain of blocks or a block-chain.

This impressive accomplishment did not originate in 2008 with Satoshi Nakamoto’s Bitcoin whitepaper, but has been around beforehand under the title of hash chains, which use the same method as block-chains to keep the chronology of additions to a databases synchronized across separate servers. This has also been used for many years in accounting programs for extra accountability.

The limitations of a block-chain

Checking a block-chain against its digital fingerprint can allow you to be sure the chain has not been altered after it was created, but even though it is certifiably chronological, creating a new “fake” block-chain and calculating its hash chains can be done by a computer in an instant. This is why the source of the digital fingerprint and the validity of new blocks added to the chain are of equal importance to the use of the block-chain method, when trying to create a fully trusted database system. These issue call for the use of consensus mechanisms and digital signatures which are all initial components in the vision of the Blockchain industry and startup scene.

--

--