Understanding the Block-DAG Paradigm

Reported by Michael Sutton, Core Developer

Welcome to our blog series where we break down the basics of Kaspa in easy-to-understand terms. No need to be a blockchain expert, though a little knowledge of Bitcoin might help.

 

Introducing Kaspa

Think of Kaspa as a powerhouse that takes Bitcoin’s blockchain concept to the next level.

 

Block-DAG: A New Twist on Blockchain

Kaspa shakes things up with its block-DAG mining approach. Unlike Bitcoin, where miners focus on the longest chain, Kaspa miners lay all their cards on the table. They mine on top of every block they’re aware of, not just one. This openness is what we call “the revelation principle”.

By mining this way, we get a clearer picture of the timeline of blocks – which one came after which. This creates a web of blocks, where each one points back to the ones before it, forming what’s known as a Directed Acyclic Graph (DAG).

 

Block-DAG Jargon Made Simple

Let’s talk lingo. The blocks that come before block B are its “parents”. The “past” of B includes all the blocks leading up to it. The “future” is the opposite – all the blocks that come after it. Blocks that aren’t connected to B in any way are in its “anticone” – think of them as running parallel with no interaction.

 

Putting the Block-DAG in Order

Before we dive into Kaspa’s specific ordering protocol, let’s look at how you’d order any block-DAG. Imagine a function that picks out one particular parent for each block. This creates a tree structure within the larger web of blocks. We also have a “virtual” block that represents the next block to be mined.

Using this function, we can trace a path from this virtual block all the way back to the very first block, called the genesis. This path helps us sort the whole DAG.

To do this, we need to understand what each block adds to the DAG, which we call its “mergeset”. Picturing the path as a spine, these mergesets are like ribs added one by one to form a complete skeleton.

The process is quite straightforward when you break it down:

  • Find the path using our function
  • Create an empty list for our ordering
  • Starting from the first block and moving up, add each block’s mergeset to our list
  • Voila! We have our ordered list

 

The Link Between Chain Security and Reliable DAG Ordering

Understanding how chains and DAGs are related helps us secure the ordering process. We want an ordering system that’s stable, where only recent blocks might change their position.

If our chain is stable and doesn’t change much over time, then our DAG will be too. So, we need a reliable way to find such a chain – and that’s where a secure parent selection function comes in.

 

What’s Next?

In our next post, we’ll explore Kaspa’s GHOSTDAG protocol and give clearer definitions for terms like “blue score” and “blue work”. Understanding chains is key to grasping Kaspa’s system; it’s not just about picking parents but also plays into our transaction system and DAG queries.

Stay tuned and don’t forget to check out Core Developer Series: Kaspa 101 – Part 1, originally published on Kaspa.