You’ve probably heard all about blockchains and how this technology promises to revolutionize finance, logistics, central banks and so on.

But did you know that a blockchain is simply a specialized kind of graph? Yep! A very special and very secure one, but still a graph. Let’s take a crash course on graphs and see how we use one to build a blockchain.

## Enter Graphs

Graphs are everywhere!

From modeling links on the WWW, to tracing contacts between patients infected with a virus, graphs are used for all kinds of useful applications.

Including our favorite data structure: blockchains! A blockchain is a graph that always moves forward, does not allow backtracking and also does not form loops. There’s a name for this kind of graph….

## The name is DAG

Graphs come in various forms and sizes.

In some graphs, the heads are allowed to meets tails, forming cycles inside the graph.

In other kinds of graphs, the edges have a direction, so you can only traverse it one way (in fact some famous computer science problems are modeled after one-way streets and alleys).

And then there’s a special kind of graph that is a generalized blockchain.

It’s called a DAG, or Directed Acyclic Graph, like the one below (courtesy of Wikipedia):

As you can see, all arrows point one way only and there are no cycles – which means once you move forward and you can never return to a previous stage.

This is exactly what a blockchain should be : a permanent data structure that never allows us to backtrack or return to a previous state (which would allow us to modify the past).

Blockchains also avoid loops, or cycles, so that one block depends on one parent block only – and always forward. So, anywhere you are in the future, you can always trace your ancestry back to one single block in the past. This guarantees that blockchain transactions always have a parent/son relation no matter how far back you go – until you reach the genesis block.

So, now we know how a DAG models a *blockchain*, what about a *blockmesh*?

## BlockMesh

What happens if we stack some DAG’s up into multiple layers of directional graphs?

You guessed it!

We get a mesh, like this one:

Do the columns in this mesh look familiar to you?

You guessed it again: each column in a mesh is a DAG! A DAG which, as we’ve seen, models a blockchain.

And, there it is.

A blockmesh is a two-dimensional mesh of blockchains! Some call them layered blockchains and other related terms. Several blockchains running side by side, freely exchanging assets while maintaining security and all the other guarantees offered by a single dimension blockchain.

Use case: This paradigm is used in the Spacemesh project.

**Note**: the **blockmesh** as described here is a technical concept, not related to the Blockmesh.io cryptocurrency.

*Featured image credit: Spacemesh project*