Decentralized Databases: The Power of Layered Computation

Gustav Corpas
3 min readNov 15, 2023
Photo by Tom Hermans on Unsplash

Recently I have been thinking about establishing my own best practices when working with decentralized databases. While this endeavor is primarily for my benefit, I though I would share it so that others might benefit, or perhaps just provide some food for thought… — after all, I’m just a passionate enthusiast trying to make sense of it all!

Over the coming weeks I plan on publishing a couple of stories with whatever insights I discover. 🕵️ I’d love your company, hit that follow button and all that jazz 🎷, otherwise — happy reading!

Principle: Use layered calculations

  • Create a pyramid of computation where each peer is in charge of specific calculations,
  • that can be based on values created by other peers,
  • typically sums etc. calculated by that peer own their own data.

Reason and explanation

When doing calculations on streaming data, the amount of calculations needed can quickly become unwieldy.
This is because we essentially need to re-calculate every time new data arrives.
This is inefficient as every peer has to redo the same work over and over again, and individually — i.e. all of them has to do the work.

For this reason, it is better to do calculations locally, and then store the result (or intermediate result) in the decentralized database.

This way other peers can run further calculations based on the stored values, that may not need to change as often.

The goal of this principle is that as computations get more complex, the data on which they rely should change less and less.
By establishing a pyramid of computation, where each layer is building on the calculations of other peers, no peer is overwhelmed.

Some Examples

In the examples I am using a decentralized database system called gun. You don’t need to use gun to gain some take aways from the examples, but if you are curious I have written about gun in some of my other articles! :D



Gustav Corpas

I write about technology and society. Or anything that is interesting to me.