UPDATE December 7, 2019: The Metagraph and Metanaria endpoints mentioned in this article are outdated. Instead use either of the following, which are the most up-to-date versions: 1. Metanet endpoint: https://metanet.planaria.network 2. MOM: https://mom.planaria.network

Metanet is a Bitcoin protocol that lets you represent a hierarchy of objects that evolve over time. Basically, you can encode both TIME and SPACE using Metanet.

By the way, if this is the first time learning about Metanet, first check out my first article:

Last week I released an API called Metanaria, It’s a Planaria node which lets you run flexible queries into the global Metanet data structure that lives on Bitcoin.

I also released a Metanet graph explorer called Metagraph. This explorer is powered by the Metanaria API.

How it Works

There are many different ways to think of Metanet, but one analogy is a file system. You can create a hierarchical file system by creating a DAG (Directed Acyclic Graph) of Bitcoin transactions. Each file or folder object is uniquely represented as a Bitcoin address. Here’s an example:

So you could think of this as representing a “space” that contains objects.

However, there’s another dimension: Time.

Capturing Time

As we saw above, we can use the “file storage space” metaphor to make sense of the data structure. However, Metanet also allows us to represent how each node evolves over time.

For example, if you create a Metanet transaction from an existing address (Remember, using a single Bitcoin address once is the norm in both Bitcoin and Metanet. This allows us to treat a same-address-transaction as a special case and use it to represent time)

The previous version of Metagraph didn’t have a way to express this difference between “Time” and “Space”. All child nodes looked the same regardless of whether they moved forward in time or moved forward in space.

To solve this problem, the new version of Metagraph has added color codes. If two nodes have the same color and have the same parent, they represent the same object that exists over time. For example let’s look at the graph below:

The two brown nodes are the same object, but one is from “Block 588600 item 289” and the other is from “Block 588600 Item 290”. The “item” is the topological order of the transaction within the block.

So we can interpret this graph as:

The root node has ONE child which is represented by the address “16b5cNetCj…” and this child has two versions, represented by txids “fd9b…” and “1462…”. And we can tell from the order that the node with txid 1462… is the most recent version.

The same goes for the two purple leaf nodes. They are both identified by the address “159irUqbXV…”, so they exist in the same space, but different time. The left-most purple node is the most recent one since it was created more recently.

Snapshot

The implication of this feature is profound. It means you can create a snapshot of any “space” at any point in “time”.

For example we could query a Metanet snapshot at block height 588603, with a common ancestor of 04e1a7e0d325a6e986ce43d3534f34aed52d0979be12522ad28d1cc49f0199b8.

{

"v": 3,

"q": {

"find": {

"$and": [{

"ancestor.tx": "04e1a7e0d325a6e986ce43d3534f34aed52d0979be12522ad28d1cc49f0199b8"

}, {

"blk.i": {

"$lt": 588604

}

}]

}

}

}

Try: https://metagraph.planaria.network/#ewogICJ2IjogMywKICAicSI6IHsKICAgICJmaW5kIjogewogICAgICAiJGFuZCI6IFt7CiAgICAgICAgImFuY2VzdG9yLnR4IjogIjA0ZTFhN2UwZDMyNWE2ZTk4NmNlNDNkMzUzNGYzNGFlZDUyZDA5NzliZTEyNTIyYWQyOGQxY2M0OWYwMTk5YjgiCiAgICAgIH0sIHsKICAgICAgICAiYmxrLmkiOiB7CiAgICAgICAgICAiJGx0IjogNTg4NjA0CiAgICAgICAgfQogICAgICB9XQogICAgfQogIH0KfQ==

It would look like this:

Notice how the newer purple node is gone, because it doesn’t exist yet.

HEAD

Often times you may want to only see the “Present”. This means only the latest snapshot of the tree.

This was not easy to achieve with the old version of the Metanaria Metanet Query Language, because there was no way to keep track of the “most recent version”.

With this update, Metanaria has added an additional attribute called "head" , which marks the most recent version of every node.

For example, between the two brown nodes, only the most recent node will have the "head" attribute set to true .

This means we can create a snapshot of the “most recent version of the metanet” with a query like this:

{

"v": 3,

"q": {

"find": {

"ancestor.tx": "04e1a7e0d325a6e986ce43d3534f34aed52d0979be12522ad28d1cc49f0199b8",

"head": true

}

}

}

Note that there are no redundant colours anymore.

Because it’s filtering only the nodes that have the "head" attribute set to true , it only displays the most recent snapshot of the tree: The Present.

Conclusion

Many people think Metanet is just some buzzword for “data storage”, so I feel the need to keep emphasizing that it is a very specific protocol.

Also when I said “4 Dimensional Supercomputer” I meant it literally. I don’t like to package things in buzzwords unless it is factual, and as you can see from above, you can express both space AND time, using Metanet.

But these are just the basics. There are much more you can do with various combinations of the Metanet protocol.

You can imagine just from these basic features you can already build systems equivalent to Git or Wiki. But there’s so much more.

Curious?