A Beginner’s Guide to Blockchain Programming

<img src="https://www.javacodegeeks.com/wp-content/uploads/2019/01/A-Beginners-Guide-to-Blockchain-Programming-square-300x300.png.webp">

You’ve likely heard of the concept of cryptocurrency and their mining process, which means you have likely heard the term “blockchain” at least once or twice.

If you still aren’t really sure what it’s all about, don’t worry. You aren’t alone, as there are many programmers out there who can’t accurately describe blockchain and cryptocurrency, and a far smaller number actually puts one or both terms to use on a regular basis.


Getting to Know Blockchain Technology

As you might have deduced from the name, a blockchain is a type of digital ledger that stores blocks of data in an interconnected fashion. New data is added to the blockchain from a theoretically limitless number of nodes that a blockchain can support. As the digital ledger is also decentralized, these nodes can be located anywhere in the world.

Being decentralized also means that there does not need to be a single controlling authority telling the blockchain how to operate; it will go through the motions of taking in data, offloading the verification process, adding new blocks to the chain, and updating the nodes with the newest version of the chain, all automatically.

Aside from storing a wide variety of data, each block also includes a timestamp about its generation along with other classification data to ensure the chain easily knows how to sort the data. This is only one of the ways in which blockchain technology promotes automation and ensures its decentralized nature never needs to be compromised.

Blockchain offers an unprecedented ability to allow users access to their own transactions while at the same time ensuring that all of the data in the blockchain remains both secure and immutable. If a transaction ends up not matching what the chain expects, either when the block is first added to the chain or at a later point, it is automatically deleted and replaced with an earlier, already verified, version of the corrupted data (if applicable).

Additionally, if somehow a block is added that includes false data, it will still be detected, as 51 percent of all currently active nodes have to sign off on the logical legitimacy of the new block before it will be accepted permanently into the blockchain as a whole.

While this security protocol makes blockchain technology virtually tamper-proof these days, this may not always be the case. The way to successfully crack blockchain’s security is well-known; it is just a matter of someone coming along who is able to execute it.

Now, let’s move on to learn how one can become a blockchain programmer. Remember, learning to program a blockchain is not a sprint. It’s a marathon. You first need to learn programming languages, take blockchain programming courses online, and read eBooks and the latest news to come up with a working protocol.


The Best Programming Languages for Blockchain

Here is a look at a few blockchain programming languages, the purpose they serve, and some resources for further learning. Each section will be purely introductory, as the topic can get pretty extensive and full of code.


1. C++

Let’s start with the oldest of them all, C++. The language came to life in 1985 through the efforts of Bjarne Stroustrup. By then, the rudimentary C language existed, but it was process-oriented; C++ cropped up as an upgraded extension that is object-oriented (where data and functions are bundled up into a package called “Objects”). For the complete freshman, an object-oriented product can be reused on other platforms without the need for fresh coding.

C++ retained the efficiency, security, and flexibility of C. Its evergreen nature has made it the core language for blockchain coding, including the bitcoin blockchain. Warning to the newbies, though: As a type-only language with fairly outdated syntax, the learning curve is a bit steep. However, as most blockchain technologies are written in this language, any efforts you put in to learn this language will pay forth abundantly.

Here are a few more reasons why C++ is preferred for blockchain coding:

Better memory control. There are a lot of demands in the blockchain ecosystem. For instance, the platform needs to be a secure fortress but at the same time execute transactions and interact with all the nodes at a faster speed. For all these to happen, you need to have better control over memory and CPU usage. C++ can offer you that.

Superb multithreading. Threads are a bundle of instructions that are to be executed at the same time. During blockchain development, you will come across tasks that parallelize and those that do not. Most languages can only handle one of these tasks and not both. Guess what, C++ allows you to handle both simultaneously.

Compile time polymorphism. As was said before, C++ is an object-oriented programming (OOP) language. It also happens that polymorphism (using a certain feature in several ways) is a property of OOP. Now, by coding your blockchain through C++, you will be able to execute some tasks separately, thus enhancing the performance of the entire digital ledger.

Code isolation. This archaic but revolutionary coding language has namespace features that can be shipped from one place to another. But at times, collisions can occur and distort the entire system. However, thanks to the language’s segmentation ability that groups various APIs differently, code isolation/separation can become a little easier.

Maturity. As one of the oldest coding languages, C++ is mature and gets updated on a regular basis. Besides that, the language sports practical features like debuggers and special analytical tools that can detect or optimize various functions. This complexity and up-to-dateness of the language may be some of the reasons why Satoshi used it for bitcoin’s source code.


2. Python

Python is another simple coding language for a beginner programmer who is afraid of C++’s complex nature. It was developed in 1991 by a Dutch programmer by the name of Guido van Rossum. The language’s structure is based on a simple premise: simplicity, readability, and minimalism.

The simple nature of this language has seen it be supported by a massive crowd of both new and established developers. Rather than the curly brackets and keywords used in C++ to represent code blocks, Python uses simple and less-scary white spaces.

Simplicity can be easily translated to mean inefficiency. However, Python is good enough to build complex digital ledgers that are stable and reliable. And here is the best part: This language is scripted and can be compiled and uncompiled. For instance, when you find a bug in your code, you just fix it and reload your application.

For other languages like C++, you need to stop the app, fix the bug in your source code, and recompile it before restarting the application. It’s quite a lot of work that can be avoided by choosing Python. Additionally, the language offers developers a vast, free resource center that they can use to write their blockchain code.


3. JavaScript

JavaScript is one of the most-used languages on the World Wide Web. If you want an interactive site with beautiful UIs, this is the language to use. All the major browsers such as Google Chrome and Firefox support it.

We already said that a blockchain is, roughly put, a system of blocks placed one after the other. However, there is something special about this ledger—it’s immutable, meaning once data has been written, there is no undoing. JavaScript is one of the go-to languages when making a simple but tamperproof blockchain that is impossible for hackers and other deceitful individuals to alter. Just one setback, though: The language lacks the SHA256 hash function.


4. Solidity


This is the most complex, high-level language that applies JavaScript’s scripts and functions as well as C++’s classes. The language is not only beginner-friendly but also offers tips and instructions on how to go about using its code. While the language is not very complicated, those who have a fair grasp of modern programming languages have an advantage.

Even though Solidity is still trying to establish its footing in the coding world, Ethereum (the second-biggest cryptocurrency after bitcoin) is already using it. Well, they made the language, so it makes sense that they be the first ones to use it. Nevertheless, Ethereum blockchain is one of the most efficient when it comes to speed and ease of creating smart contracts.

So if you are looking to create a decentralized app, hold an initial coin offering, or build a secure, immutable, and multipurpose blockchain, Solidity is the language to use. It’s a must-know language for anyone who wishes to integrate smart contracts in their digital ledger. For tutorials on Solidity, you can check out ConsenSys Academy or the languages’ documentation from readthedocs.io.


5. GO

GO is the short form of GOLang, a relatively modern coding language that was developed in 2007 at Google and officially released for public use in 2012. This robust and multipurpose coding language was created in an effort to combine both the syntax and user-friendliness of other common languages like JavaScript while retaining the reliable security aspects of older languages like C and C++.

GO inherently runs in an operating system, and this means maximum flexibility, especially when dealing with several parts of a blockchain simultaneously. Ethereum’s SDK protocol is written in GO, and there are many other blockchain applicationsof this language.


How to Become a Blockchain Developer

Although blockchain represents only a single item, there are different parts in it that developers can work on. No one is restricting you from learning everything there is to a digital ledger, but it’s usually easier to start with a smaller branch and master it fully before moving to the next. The core parts of a blockchain you can develop include:

Decentralized applications (Dapps)

Smart contracts

ICOs

Don’t roll up your sleeves just yet. The most skilled programmers usually browse through a storm of resources on anything before getting started. So, once you are familiar with your preferred programming language, the next best thing to do would be to read bitcoin’s white paper (unless you don’t dream of becoming as good as Satoshi) and check out several books that go deeper into the technical details of the blockchain.

It doesn’t hurt to familiarize yourself with some of the terms and lexicons within the industry. If you want to immerse yourself deeper into the blockchain world, then you need to buy some cryptocurrencies (just a few) and play around with them to see how the platform works.

There are many entertaining yet in-depth courses out there that will teach you blockchain programming step by step. Space Doggos and CryptoZombies are some of the gamified courses that turn work into play so beginners can have an easier time coding.

Space Doggos is a space adventure game that teaches learners how to develop the Ethereum blockchain. The game is detailed with several chapters and notes for gamers. The player will code the game’s characters (the Dog, its costume, mood, etc.) and the environment in Solidity language.

As you move on to the next chapters of Space Doggos’ adventure, the code gets more complex. The concept is almost the same with CryptoZombies. Take a look at the next section for places where you can learn to code a blockchain in detail.


Advanced Courses

You won’t become an adept blockchain developer by creating zombies and space doggies. These tutorials only help to clear the foggy coding path. You need advanced courses in whichever language you prefer to create a useful, secure, and faster blockchain. 

Developing a blockchain comes with a lot of challenges. Therefore, as a budding developer, you need to constantly mix with individuals of the same passion on platforms like GitHub, Reddit, Stack Exchange, and many others. Chat with participants, ask questions, and seek assistance from the mature members of the community in order to build a project with little to no errors.

The Bottom Line

Blockchain and cryptocurrencies, particularly bitcoin, are believed to have a huge role to play in asset and data transfer. As of late 2018, only a few blockchain platforms are up and running, while many others are still in the experimental stage. So, if you dream of becoming an accomplished developer in this space, then you have to start by mastering a few of the common blockchain programming languages.

While you can do it, it’s imperative to understand that this sphere already has millions of active developers, and all of them are eyeing the few blockchain gigs out there. However, only a few firmly believe in their skills, and this means the market still needs more people who know what they are doing.

So is it too late to learn blockchain programming? No, it’s not too late for those who wish to learn from scratch. But before you grab the tools for the job, what section of the blockchain do you want to master? What problem do you want to solve? If you can provide answers to those questions, then you are ready to roll.


Top 10 Best Blockchain Programming Language for Blockchain Programmer

Top 10 Best Blockchain Programming Language for Blockchain Programmer

We aim at equipping you with every necessary knowledge of the best programming languages for blockchain and you'll learn more 10 Best Blockchain Programming Language for Programmer: C++, Java, Python, Ruby, Solidity, Go, JavaScript...

We aim at equipping you with every necessary knowledge of the best programming languages for blockchain and you'll learn more 10 Best Blockchain Programming Language for Programmer: C++, Java, Python, Ruby, Solidity, Go, JavaScript...

If you’re a tech-oriented person like me, chances are you’ve wondered at least once about all those latest fusses regarding blockchain and cryptocurrencies. So, what is this blockchain and why’d you be tempted to learn more about it? Blockchain, as the name suggests, is a chain of blocks; connected sequentially using complex cryptographic logic.

This technology was implemented first by Satoshi Nakamoto and was first used in the implementation of the popular BitCoin cryptocurrency. The blockchain technology is being used heavily in the industry, thanks to the high-level of security it provides in business transactions. From corporate firms to industrial banks, blockchain developers are sought everywhere equally. So, wielding this modern-day skill by learning the best blockchain programming language guarantee you an edge over your fellow developers.

Which are the best programming languages for blockchain? Developers are presently utilizing prevalent programming languages like C++ and Java to manufacture custom blockchain programs. What’s more, digital money specialists have made languages like Simplicity and Solidity that are explicitly intended for blockchain improvement.

The worldwide Blockchain market is right now worth an expected $1.2 billion and specialists foresee that it will arrive at a $57 billion valuation by 2025, developing at over 69% every year.

Significant enterprises and investors are teaming up with Blockchain counseling organizations to grow new digital currency innovation, savvy contracts, conveyed records for customary banks, gaming tokens, and inventory network the executives frameworks.

What Is Blockchain?

Customary financial uses a bank as the record and mediator. To move cash to a companion, an individual should initially contact their own bank and request that they move cash to a particular record number. The bank checks the sender’s record for assets, moves those assets to the goal, and records the exchange on the sender’s record. The accepting bank must accomplish something very similar.

In any case, the issue with this customary financial framework is that records are put away inside and are defenseless against hacking and control.

Blockchain disposes of this hazard by putting away all records online in a decentralized, unknown record that can be gotten to by anybody. Blockchain uses squares, or accumulations of information, like spreadsheet lines and segments, to store information. Squares are added to the “chain” in successive request.

In contrast to conventional bank records, which are put away inside, each blockchain client has a total record of the whole blockchain on their PC. This implies they can rapidly discover any exchange that has ever happened in the event that they have the comparing hash code. Since that information is put away freely, it can never be changed or erased — giving clients genuine feelings of serenity and trust in the framework.

Organizations keen on exploiting the blockchain upset should scan for up-and-comers with skill in the accompanying programming languages.

Here are the best programming languages for Blockchain

1. C++

C++ keeps on being one of the most famous programming languages in the tech world and is a prevailing power in the blockchain business also. The article arranged language is ideal for blockchain improvement, since it utilizes similar standards, for example, epitome, deliberation, polymorphism, and information covering up, as blockchain to avoid incidental alters to information.

Engineers additionally prize C++ in view of its memory control abilities. The language helps keep squares secure and deal with an enormous number of asset demands by enabling each system hub to acknowledge or dismiss individual squares.

C++ is additionally utilized broadly by blockchain advancement administrations due to the manner in which it handles parallel undertakings and stringing. The language is equipped for taking care of both parallel and non-parallel assignments, notwithstanding improving single-string execution.

EOS is an awesome case of a blockchain program worked with C++. The open source programming was discharged by Square in 2018 and is intended to process exchanges more rapidly than choices by restricting the product to only 21 square creating hubs. This enables the product to affirm an exchange in under a second and settle it in only two minutes.

2. JavaScript

GitHub as of late positioned JavaScript as the most mainstream language for developers — with a fantastic 95% of sites utilizing it here and there. Be that as it may, JavaScript isn’t just the lord of web advancement; the adaptable programming language is additionally utilized broadly for blockchain improvement.

One reason why blockchain designers prize JavaScript is a direct result of the manner in which it handles offbeat code. This is significant in blockchain, as thousands or even a great many exchanges might be started simultaneously. Offbeat, parallel programming empowers a program to finish numerous activities all the while. Standard, synchronous programming just can’t deal with that volume.

By running numerous activities on the double, offbeat code can improve programming responsiveness and application execution. This empowers blockchain projects to deal with the enormous volume of activities without hindering execution and disappointing clients.

You may also like: How to Build a Blockchain in JavaScript.

3. Java

The only language that can challenge the reign of C++ in the industry is Java, and for good reasons so. Java is in many ways similar to C++ regarding its object-oriented approach and a vast community of third-party applications and platforms. The main reason to use Java as the de-facto blockchain programming language in the industry is, however, its highly-capable portability.

Programs written in Java are portable across any computational device, as they don’t rely on system-specific architecture, instead uses the universal JVM(Java Virtual Machine) for execution. This makes Java one of the best programming languages for blockchain.

4. Python

Python is probably THE most trending programming language you can learn these days!

It's very popular because it's easy to learn and use, runs on all operating systems and allows you to build a broad variety of programs: Be that web applications, desktop applications, utility scripts or using it for data science and machine learning.

You'll do so whilst building your own Blockchain and Cryptocurrency. These are of course also highly trending topics and not a lot of people understand what a Blockchain really is, you'll learn a lot about the core concepts of the Blockchain and you'll see how Python can be used for the many aspects that make up a Blockchain and Cryptocurrency.

You may also like: Building a Blockchain with Python.

5. Solidity

Solidity is a savvy contract and blockchain improvement language that is utilized broadly by Ethereum designers. The area explicit language utilizes a significant number of indistinguishable standards and punctuation from JavaScript to make high-caliber, decentralized applications.

Engineers lean toward the language since it enables them to compose elevated level code for the Ethereum blockchain arrange, the second-most famous blockchain digital currency, which can be assembled into low-level machine code. It additionally enables people to use the Ethereum advanced exchange record to make brilliant agreements between organizations.

The agreement situated language utilizes invariants, preconditions, and post-conditions to streamline the advancement procedure and to make the agreement age process easier for clients.

Solidity is at present accessible on a scope of blockchain stages, including Ethereum, Ethereum Great, Tendermint, and Counterparty. It’s utilized for a scope of utilizations, including business contracts, barters, crowdfunding, and that’s just the beginning.

6. Ruby

Although quite old and tested by the industry, Ruby gained momentum as a blockchain programming language in the last couple of years or so. Ruby, an interpreted high-level language with object-oriented features, much like Python, can be a viable blockchain coding language for uncountable reasons. It offers developers the ability to prototype their vision rapidly using open source third-party APIs and plugins.

The Ruby ecosystem is thriving with loyal contributors since its inception as the de-facto web language starting from the first half of this millennium. It’s especially prevalent within the Asian developers, the most substantial fraction of open source blockchain developers.

7. Simplicity

Simplicity is a fresh out of the plastic new programming language that was discharged in November 2017 and planned explicitly for shrewd agreements and blockchain improvement. The language conceals low-level consistent parts from architects so as to expand efficiency and stay away from engineer interruptions, which is one motivation behind why it is quickly winding up well known in the network.

Like C++, Effortlessness is an item arranged language that uses indistinguishable standards from blockchain to forestall blunders and changes to information. It additionally utilizes Merklized Theoretical Sentence structure Trees to sort out the projects into trees — along these lines taking into account littler exchange sizes and lessening square space prerequisites.

The language’s makers, Blockstream, are as yet extending the language and its abilities. Designers can hope to see Simplicity being utilized in more applications towards mid-2020 once the language is incorporated into Bitcoin and its highlights are concluded.

8. Go

The brainchild of Robert Griesemer, Rob Pike, and Ken Thompson, pioneer of modern programming languages, Go is the best blockchain programming language for building hyper ledger fabric. The statically-typed yet compiled language is on par the performance level needed by a blockchain coding language. Go comes with every advanced feature you’d need when building your first blockchain, namely classes and inheritance, generics, annotations, constructors, and exceptions.

Go offers top-notch concurrency support in blockchain applications, thanks to its smart implementation of channels and interfaces. So, it’s one of the best programming languages for blockchain when it comes to developing a system that is not only efficient but also lightning fast.

9. Rust

The newest blockchain programming language on the block currently, Rust aims at providing open source devs the capability to build fast and efficient blockchain systems. We found Rust to be exceptionally good when it comes to CPU-bound tasks. You can take either a functional approach or an imperative one with Rust for developing your blockchain.

It’s one of the best programming languages for blockchain due to its highly-capable mechanism of handling mutable states. The Rust compiler provides awe-inspiring optimization of your blockchain. The fast, memory safe, and exclusively concurrent nature of this blockchain coding language makes it most suitable for developing real-world blockchains.

10. PHP

Although dimmed not suitable for modern web anymore, PHP still covers the majority of web systems. It can be utilized to build simple to complex blockchain systems as well, thanks to its object-oriented features and a vast active open source community.

If you’re a new programmer looking for getting your hands dirty at blockchain coding, PHP might turn out to be the best option for you. A considerable number of PHP developers will guarantee a ready workforce in case you develop something highly capable and intend on going corporate.

Summary

Blockchain is here to stay. The popular record-keeping technology is what makes cryptocurrency exchanges possible and is widely used by corporations, individuals, and blockchain consulting services for software development.

Developers can easily use popular programming languages like C++ and Java for blockchain development. Alternatively, the community has recently created blockchain-specific languages like Solidity and Simplicity which make cryptocurrency development a smooth process.

Expect to see more original languages spring up over the next several years, as the blockchain market continues to grow rapidly and cryptocurrency begins to be used by ever-larger numbers of people.

Thank for reading!

What is in a block? - Blockchain

In my previous article, I tried to described the concept of a blockchain with code. This time, I'll try to describe the structure of a single block. I will use the Bitcoin blockchain to explain blocks, but keep in mind that the concepts will remain more or less the same. It could be useful to read my&nbsp;<a href="https://dev.to/damcosset/trying-to-understand-blockchain-by-making-one-ce4" target="_blank">last article</a>to understand a few things first.

Introduction

In my previous article, I tried to described the concept of a blockchain with code. This time, I'll try to describe the structure of a single block. I will use the Bitcoin blockchain to explain blocks, but keep in mind that the concepts will remain more or less the same. It could be useful to read my last articleto understand a few things first.

Structure of a block

A block is a container data structure. In the Bitcoin world, a block contains more than 500 transactions on average. The average size of a block seems to be 1MB (source). In Bitcoin Cash ( a hard fork from the Bitcoin blockchain ), the size of a block can go up to 8MB. This enables more transactions to be processed per second.

Anyway, a block is composed of a header and a long list of transactions. Let's start with the header.

Block Header

The header contains metadata about a block. There are three different sets of metadata:

  • The previous block hash. Remember that in a blockchain, every block is inherits from the previous block because we use the previous block's hash to create the new block's hash. For every block N, we feed it the hash of the block N-1.
  • Mining competition. For a block to be part of the blockchain, it needs to be given a valid hash. This contains the timestamp, the nonce and the difficulty. Mining is another crucial part of the blockchain technology, but it is outside the scope of this article.
  • The third part is a merkle tree root. This is a data structure to summarize the transactions in the block. And we will leave it at that for now. More on this later.
Block identifiers

To identify a block, you have a cryptographic hash, a digital signature if you will. This is created by hashing the block header twice with the SHA256 algorithm. For example, this is a block. I will refer to this block as an example for this article.

The block header hash for this particular block is (right column): 000000000000000000301fcfeb141088a93b77dc0d52571a1185b425256ae2fb

We also can see the previous block's hash (right column): 0000000000000000004b1ef0105dc1275b3adfd067aed63a43324929bed64fd7

Remember that we used the second hash to create the first. Every block uses the previous block's hash to construct its own hash. The block hash is a unique identifier. You won't find two blocks with the same hash.

The other way to identify a specific block is the block height. The is the position of the block in the blockchain. Our example's block is in the 500312 position. This means that there are 500311 blocks before this one. Since the creation of the Bitcoin blockchain in 2009, 500312 blocks have been created ( at the time of writing obviously ).

A block height is not unique. Several blocks can compete for the same position in the case of a fork, like Bitcoin Cash for example.

Merkle Trees

The transactions in a block are contained in a structure called a merkle tree or binary hash tree.

I feel that topics like that are easier to understand with actual examples. So we'll go coding for this. A merkle tree is constructed by recursively hashing pairs of nodes ( in this case, transactions ), until there is only one hash, called the root or merkle root. If we stay in the Bitcoin world, the cryptographic hash algorithm used is SHA256. This is applied twice each time.

An example: We have a block with 4 transactions. For the sake of simplicity, each transaction is a string:

const tA = 'Hello'
const tB = 'How are you?'
const tC = 'This is Thursday'
const tD = 'Happy new Year'

To construct our merkle tree, we start from the bottom. We take each transaction and double-hash them. I'll use the js-sha256 package here.

const sha256 = require('js-sha256').sha256

// Double-hashing here
const hA = sha256(sha256(tA))
const hB = sha256(sha256(tB))
const hC = sha256(sha256(tC))
const hD = sha256(sha256(tD))

//Results
52c87cd40ccfbd7873af4180fced6d38803d4c3684ed60f6513e8d16077e5b8e //hA
426436adcaca92d2f41d221e0dd48d1518b524c56e4e93fd324d10cb4ff8bfb9 //hB
6eeb307fb7fbc0b0fdb8bcfdcd2d455e4f6f347ff8007ed47475481a462e1aeb //hC
fd0df328a806a6517e2eafeaacea72964f689d29560185294b4e99ca16c63f8f //hD

Ok, great. Now remember that I wrote a merkle tree is constructed hashing pairs of nodes. So, we will pair our transactions and concatenate their hashes. Then, we will double hash them too. We will create a hash using the hashes hA and hB, and another for hC and hD. Then, we repeat that process until we have only one hash left and no more pairs to work with. The last hash will be our merkle root.

With only four transactions, this will be rather quick:

//Pairing hA and hB

const hAB = sha256(sha256(hA + hB))
//5dc23d1a2151665e2ac258340aa9a11ed227a4cc235e142a3e1738333575590b

//Pairing hC and hD

const hCD = sha256(sha256(hC + hD))
//ff220daefda29821435691a9aa07dd2c47ca1d2574b8b77344aa783142bae330

// We do it again. We pair hAB and hCD
// This is our root!
const hABCD = sha256(sha256(hAB + hCD))
//301faf21178234b04e1746ee43e126e7b2ecd2188e3fe6986356cc1dd7aa1377

The node at the top of the merkle tree is called the root. This is the information that is stored in the block header in each block on the blockchain. This is how transactions are summarized in each block. In our example block given earlier, the merkle root can be found in the right column: 

a89769d0487a29c73057e14d89afafa0c01e02782cba6c89b7018e5129d475cc

It doesn't matter how many transactions are contained in a block, they always will be summarized by a 32 bytes hash.

Note: The merkle tree is a binary tree. If there is an odd number of transactions, the last one will be duplicated so we can construct our tree.

Because all the leaves in our tree depends on other leaves, it is impossible to alter one leaf without altering others. If you change only one leaf ( one transaction ), the hash changes, therefore the hash you constructed by pairing it with another leaf changes, therefore the merkle root will be different.

You can prove that any transaction is included in a block by creating a authentification path or merkle path. You only need to know log base 2(N) 32-byte hashes. For example:

-For my 4 transactions merkle tree:

log base 2( 4 ) = 2 => If I have a path of 2 hashes for a tree of 4 transactions, I can manage to prove if a transaction belongs to this merkle tree.

For a 16 transactions merkle tree:

log base 2( 16 ) = 4 => If I have a path of 4 hashes for a tree of 16 transactions, I can manage to prove if a transaction belongs to this merkle tree.

log base 2( 1500 ) = 10.55 => If I have a path of 11 hashes for a tree of 1500 transactions, I can manage to prove if a transaction belongs to this merkle tree.

Perhaps a little diagram will help.

There are 16 leaves in this tree. We construct our tree from the bottom up by pairing each leaf. Now, anybody can prove that the leaf I ( in orange ) is part of this block by having the path given in green. We have only 4 hashes, but that is enough to know if the leaf I belongs here. That is because with those informations, we are able to construct every single leaf we need( in yellow ). We can create IJIJKLIJKLMNOP and the root and check if those hashes correspond. This is why it is very complicated to cheat a blockchain. To change one thing means you must change everything.

Well, that's pretty much what a block contains in the Bitcoin blockchain. Hope it helped!


Video explanation of blockchain

Two years ago, the hack to get an investment in your startup was to shout: “We are using the Blockchain!” The Blockchain&nbsp;<a href="https://medium.com/@pavelkravchenko/decline-of-blockchain-hype-and-rise-of-a-common-sense-8de5789a794d" target="_blank">was</a>&nbsp;the magic term that nobody understood, but had the label of “the next big thing”. That is why investors were investing like mad into companies that said they are using it. If only one of those startups hit the jackpot, the investors would become (more) insanely rich.

Two years ago, the hack to get an investment in your startup was to shout: “We are using the Blockchain!” The Blockchain was the magic term that nobody understood, but had the label of “the next big thing”. That is why investors were investing like mad into companies that said they are using it. If only one of those startups hit the jackpot, the investors would become (more) insanely rich.


Did it prosper? Is it Alive?

Now two years later, we see big companies like ING executing pilots with Blockchain as a way to store contracts. Accenture and the United Nations have created a solution that will register the refugees of the world inside of a Blockchain.


I know almost nothing about the Blockchain technology and want to get some feeling about what is going on. For almost three years after the introduction of the Blockchain as a new technology in the bleeding edge tech startups, the registration of people, housing and companies were promised to be open via the Blockchain. But it is still not here. What is this Blockchain and will it really be a revolution?

No reading, here are some videos

Since a picture is worth a thousand words, here are a few videos that explain the complex technology in a way everybody can understand. I have selected these videos in such a way that you can watch them one-by-one and have a clear understanding at the end. There is some overlap between the videos but that will help getting a better understanding.


Understand the Blockchain in Two Minutes (IFTF 2m25)

This video by Institute for the Future (IFTF) is ClearFast and gives a great insight on what the Blockchain technology is.


https://www.youtube.com/watch?v=r43LhSUUGTQ


The real value of bitcoin and crypto currency technology — The Blockchain explained (DutchChain 6m15)

A bit dull :) but clear and helps to refine the message of the previous video. It only takes 6 minutes to watch. This video is created by the Dutchchainorganization.


https://www.youtube.com/watch?v=YIVAluSL9SU


Blockchain Technology Explained: What is a Blockchain? (PassKit 4m)

Pretty clear story by PassKit …..


https://www.youtube.com/watch?v=eXJHPDs4M3Y


How Bitcoin Works in 5 Minutes (Technical) (CuriousInventor 5m25)

In this video the part of voting in the network takes is explained. Voting is the essential part of the Blockchain that determines the legitimacy of the transactions in the Blockchain.


https://www.youtube.com/watch?v=l9jOJk30eQs


Blockchain definition

The definition of “blockchain” on Wikipedia is “a distributed database that is used to maintain a continuously growing list of records called blocks… By design, blockchains are inherently resistant to modification of the data.”


In its core, the database behind blockchain is a ledger containing all transaction records. The ledger is distributed, which means there isn’t a single central point where the records are saved. It provides a transparent way where transactions between two parties are verifiable and are stored permanently. Any transaction of ownership can be stored into the blockchain.

In case you have more time to read, you can check out this article on ITNEXT where the most frequently asked questions about Blockchain are answered by Ivo van der Nagel.

Another great read is this Blockchain for Dummies book, made by IBM. You can read it if you need more background information and better understanding after watching the videos and reading the article mentioned above.


Blockchain Summarized

In various videos and articles the Blockchain is summarized with the use of one of the following three set of characteristics (at least).

No consensus on key characteristics

I find this very interesting: In 2009, the Blockchain was implemented for the first time. This technology is still quite new that even on the key characteristics there is no consensus. The big question that pops up is: is this a big hype or just something so complex that not everybody understands it? And if this is only a big hype, why venture capitalists are investing millions in it. And why the United Nations is betting the lives of refugees on it?

Everybody seems to dream about a more peer-to-peer network for registration of valuables. It doesn’t really matter to people what the valuables are, it can be money, houses, documents, or identities. People dream about what would happen when they are not dependent on a governmental or financial organisation. Removing the red tape to increase the speed, reduce the cost of transactions, and create an opening for machine-to-machine transactions are the main ingredients in many Science Fiction stories.

And these dreamers ignore the complex center of the Blockchain technology. They ignore or do not know that it works only given specific rules or balance of rules. This is where I have my worries. For example: a consensus model on which transactions are valid, only works when the network is relatively big, otherwise someone with a big bot farm can take over the network.

And what does a blockchain add when there is no great incentive to create a big network of computers that want to build the blockchain?

What is your vision on Blockchain technology? Share your thoughts in the comments below!