Az NKFI Alapból megvalósuló program

Dorsum is proud to benefit from the European Commission's Brexit Adjustment Reserve.
Learn more about our project aimed at aligning our Wealth Management Suite to the UK market.
(Hungarian content)

MoonBlokz series part III. — Basic Algorithms

This article is part of the MoonBlokz series, which focuses on creating a hyper-local blockchain using microcontrollers and radio communication. You can find the previous articles here:

Network structure

To begin, let’s review the overall structure of the network.

There are two types of entities in the network:

  • Nodes are the active components of a network. They are usually physical devices that communicate through radio signals. Nodes are permanent elements that join the network through a decentralized registration process.
  • Addresses, on the other hand, are passive components. They are typically logical entities that facilitate money transfers by connecting to the nodes via a local network or any custom protocol. An address can be usedimmediately upon creation, and no registration is required.

The primary reason for this separation is the differing trade-offs in how we manage these entities.

Pros and cons of nodes:

  • Only nodes have the ability to create blocks and collect fees and mining rewards from the network.
  • Transactions between nodes are cheaper.
  • All money transfers between nodes are transparent and visible to anyone, meaning there is no privacy.
  • The network doesn’t count custodian fees for nodes.

Pros and cons of addresses:

  • A simple user can use multiple addresses, allowing for different addresses to be used for each transaction. This approach enhances privacy for transactions between addresses.
  • Transactions are more expensive between addresses. This is because the size of the transaction determines transaction fees, and addresses tend to be longer than node identifiers. Users who wish to maintain their privacy must pay an additional fee. While this may seem unfair, ensuring privacy requires extra resources from the network. In MoonBlokz, I adjust the pricing to reflect the resources needed for each action.
  • The network applies custodian fees for money stored in addresses.

Blockchain

It’s time to outline the working model of our blockchain. First, let’s define what a blockchain is:

A blockchain is a shared, immutable, and distributed digital ledger that records transactions across multiple computers.

When we examine the structure of blockchains, we can see that each blockchain consists of blocks, as illustrated in the following chart:

The basic structure of a blockchain

Blocks in the chain are assigned an increasing sequence number that uniquely identifies each block. Each block contains a payload representing its content (such as transactions). Every block is digitally signed to ensure protection against tampering. Additionally, all blocks include the hash of the parent block, making it impossible to alter any previous blocks in the chain.

When new information needs to be added to the blockchain, a selected node creates a new block and distributes it throughout the network. However, because every node operates separately, unreliable communication quickly transformed our blockchain into a “blocktree.” Let’s look at an example:

How blockchain turns into a block-tree

The network has five nodes: Anna, Bob, Cecil, David, and Eve. All of them received block #100. Bob then created a new block (#101) and tried distributing it across the network. Anna received this block, but Cecil, David, and Eve did not.
Subsequently, Cecil created her version of block #101, which was only received by David. This situation led to Anna, Bob, and Eve independently creating parallel blocks #102 and #103. Later, David received Eve’s block and made his own block, #105, based on it.

This situation creates chaos because each end of the chain represents different network states. The nodes perceive the network as being in various actual states. While all nodes share the same past (each has the same version of block #100), they exist in different parallel present states. This scenario resembles a kind of multiverse. To bring order to this chaos, our goal is to develop an algorithm that accomplishes two tasks:

  • Ensuring that the network can eventually achieve a consistent state
  • Managing the transition when a node must switch between parallel states.

How to reach a consistent state?

Nodes cannot achieve a consistent state if they do not have the same or nearly identical blocks. We use broadcast radio communication with dynamic nodes in a mesh network, which means the sender cannot track who has received the message. As a result, we need to manage this on the receiver’s side, which is also problematic.

If we have not received anything, how can we know if a message was sent at all?

Fortunately, a blockchain (or blocktree) is not made up of independent blocks. If a block arrives and we do not have its parent block, we can deduce that we missed a message and can ask the network for it using its sequence number and hash, which we know from the child block.

We need to store the entire tree rather than just a single chain. This is essential because we cannot predict which fork will win when we receive a message, though we can limit the possible forks (I will explain this later). Additionally, we must retain disconnected blocks, as they may eventually connect to the tree if we query their ancestors.

With this approach, the nodes will attempt to construct the same tree. However, some discontinued leaves may be permanently lost if they have no successors, and there is no indication of their absence. Still, if the network remains largely connected, the active branches will synchronize across the nodes.
At this step, we don’t have a consistent state, but we have the same multiverse on each node.

Making consensus

The next part is crucial. The most fascinating aspect of blockchains is how nodes establish a common state. Given our specific conditions, we have certain requirements for our consensus algorithm:

  • Since our communication may be unreliable and bandwidth and communication time are also bottlenecks, we should base our selection on the blockchain stored by each node without needing additional communication.
  • Our nodes have limited hardware capabilities, so we cannot use algorithms that demand high processing power, such as Proof-of-Work.
  • Our consensus algorithm must prevent double spending, like all blockchain consensus algorithms (or at least make it hard).

Double spending is the risk that a digital currency can be spent more than once, undermining the system’s integrity. This situation can occur when a blockchain forks and two separate transactions in each fork attempt to use the same balance. The receiving node may initially believe it has received the funds, but the transaction can vanish if the blockchain reverts to an alternate path. To prevent double spending, the chain should avoid forking.

Choosing a common state also determines which nodes can create the next block in the chain. We aim to reward the creators of the blocks and incentivize their efforts in maintaining the network.

How can we reward block creators (also known as miners)?

The sender includes a fee with each transaction. When miners create a block, they prioritize transactions with higher fees from their mempool (a temporary transaction storage space). When miners successfully mine a block, they receive all the transaction fees included in that block.

Additionally, the network can fund miners, which is how new currency is generated. In MoonBlokz, the operational model can be customized through chain-level configurations. Transaction fees can be set at minimal, maximal, or exact amounts. Furthermore, the additional currency created or consumed can be determined by a function that takes into account various parameters, such as the total amount of money in the network, the total number of nodes, and the average transaction fees.

Incentive flow of MoonBlokz

To select block creators, we must first identify what holds value for our blockchain. For a node, it is valuable to receive messages from other nodes in the chain. We will use the following algorithm to select miners based on this metric:

  • Every message on the network includes the identifier of the sender node.
  • Nodes keep track of how many messages they receive from each other.
  • When a node makes a transaction, it votes for the node that has sent it the most valid messages.
  • When it’s time to create a block — either because there are enough transactions to fill it or enough time has passed — the node with the most votes gets to make the block. After this, that node’s vote count resets to zero.
  • If two nodes have the same number of votes, the tie is broken using the node’s identifier, ensuring the selection process is deterministic. This means there is always one node selected.

This algorithm is extremely fast, straightforward, and prevents any forking. It works effectively as long as we have knowledge of all the node identifiers and all the miners. Since we have this information (there is no privacy for nodes), we can utilize this algorithm. But it fails in some cases. We must address situations where the selected node cannot create a block, such as when it is removed from the network. We use an additional mechanism called “approval” where the majority of the nodes approve the deviance from the basic algorithm. Approval is a time-consuming process, but it is rare during normal work.

State diagram of the approval process:

States of the approval process

Once a new block is ready to be created — due to a sufficient number of available transactions or the passage of enough time — the node with the most votes has a “grace period.” The network will only accept a block from this node during this period. If the grace period passes without a block created, the approval process begins:

  • First, the network accepts blocks from the node with the second-most votes and the first node. If double the grace period passes without a block being produced, the top three nodes will be allowed to create new blocks, and this pattern continues thereafter.
  • Next, the network decides whether to accept the block. Nodes submit digitally signed support messages for the proposed block.
  • When the block creator collects a pre-determined number of these support messages, it creates another block that serves as evidence of majority support.

If the node with the most votes fails to produce the block, it incurs a penalty, resetting its votes to zero. This penalty effectively eliminates the waiting delay for subsequent blocks. However, to optimize data, only the first node’s vote score is reset; the scores of all other nodes that missed the chance to produce the block remain unchanged. The grace period duration is a configurable parameter at the chain level based on factors like the average time between blocks.

This process can lead to multiple approvals happening simultaneously. If evidence of majority support cannot be submitted before the approval period ends, the next highest-voted node can initiate a new approval. Furthermore, if the initiating node fails to post the evidence, another node may do so after a grace period, initiating a new approval process.

When a node needs to determine the actual blockchain within the block tree, it performs a calculation: The value of each block is equal to the spent vote score associated with that block, except for the approval blocks. The score of an approval block consists of the vote score of the node with the most votes (which has been paid as a penalty) plus the vote scores of every supporter in the evidence block. After the approval process concludes, this resulting chain will hold a higher value than the one initially created by the first node, ensuring that the network follows the new chain even if the original block is added later.

A later article will discuss the details of the approval process and the entire communication model. First, we must discuss the cryptographic algorithm because special multi-signature constructions are required to create evidence efficiently.

Limitations of the approval process

To approve any deviation, the majority of active nodes (from the previous n block) or at least the majority of a randomly selected subgroup (we will talk about it later) must send their support. If a network permanently and quickly loses more than 50% of its nodes, it could become stuck indefinitely. While this scenario presents a challenge, it is not a realistic concern for any actively operating network.

How secure is this system?

We must first examine threats that algorithms cannot mitigate to assess the system’s security. As we utilize radio communication, a rogue node equipped with a powerful antenna could flood the entire network. In such cases, we can physically deactivate the rogue node. Additionally, we cannot address the scenario where someone places a node inside a Faraday cage, which blocks all communication and allows the node only to receive false messages. We operate under the assumption that many connected nodes exist within the network, with each node within several other nodes’ range.

There are two types of attacks that we aim to mitigate with the previously described working model:

  • A small group of nodes can take control of the network by adding numerous transactions to become the sole creators of every new block. To prevent this attack, we introduce an interest mechanism to the vote counts. A node with x votes receives an additional x*y (where y is a small number) votes with every new block added to the chain. This means that even if a node has only a single vote, it will eventually accumulate enough votes to create the next block. If an attacker attempts to generate all blocks, they can only do so if their group initiates all transactions, effectively turning this attack into a denial of service situation.
  • An attacker may attempt to create a fork after spending their currency to cancel the transaction after its acceptance. This is only feasible during the approval process. Once the approval process is in progress, there is no way for the attacker to control it without blocking communication between the nodes.

In summary, while there are vulnerabilities to physical attacks to undermine the network, our model incorporates mechanisms to reduce the risk of algorithmic threats.

So far, we have selected our technology, defined the high-level architecture, and outlined the framework of our consensus algorithm. Everything seems to be going well, or does it?

Initially, we stated that our blockchain should operate with only a few megabytes of persistent storage on each node. However, we also want to store the entire blockchain on every node. As the blockchain grows, we will eventually run out of storage space. Therefore, we need to find a way to maintain a constant size for our blockchain. I have named this working model “snake_chain”. We will discuss it further in the following article. You can read it here.

Author: Péter Sallai
Source: https://medium.com/@peter.sallai/moonblokz-series-part-iii-basic-algorithms-76ca1215efc4

Share this article

RELEATED ARTICLES

  • All
  • blockchain
  • crypto
  • Egyéb kategória
  • ESG
  • Events
  • Insights
  • News
  • Regulation
  • Switzerland
  • UK
  • White papers

Every good business relationship starts with a single step!

Martina Bagarić Maršić

Head of Business Development CEE Region

Martina doesn’t believe in transactional sales — she builds business ecosystems based on genuine partnership. With over 15 years in the industry, she consciously steps away from aggressive tactics, championing an “ethical sales” approach instead. For her, building transparency and trust is the absolute core of any business relationship. A secret introvert, she relies on a quiet hour of morning routine to recharge her inner peace, ensuring she can give her absolute best to her clients all day.

Her superpower? 
Reading the room. She instantly decodes true needs, so clients feel like partners, not just transactions.

What won’t she do? 
Parachute jump. She will gladly help redesign your business strategy or share practical life advice, but she will never jump out of a perfectly good airplane.

Kadra Aden

Head of UK Product

Kadra started her career writing code, which means she doesn’t just manage products, she understands their DNA. As Head of UK Product, she uses this technical fluency to translate complex business needs into reality. She digs past the initial “wish list” to find the actual root problem, ensuring Dorsum builds solutions that work in the real world, not just on a whiteboard.

Her superpower? 
The Strategic “No.” She isn’t afraid to kill a weak feature to save the product vision.

What won’t she do? 
Sit still or sing. She works from a treadmill desk to keep moving, but hand her a karaoke mic, and she’ll clear the room instantly.

Hannah Buckle

Head of UK Sales

Hannah proves that high-stakes tech sales doesn’t have to be a rigid, jargon-filled grind. She brings a genuinely fun, open, and relaxed energy to the room, believing that the best partnerships start with a simple, honest chat. And while she keeps things light, she is fiercely persistent when it comes to solving business problems. Whether she is untangling a messy digital ecosystem or helping a team scale, her secret weapon is that she simply never gives up. She operates with radical honesty, zero fluff, and a commitment to keeping the process as enjoyable as it is successful.

Her superpower? 
Relentless persistence. She never gives up on a problem, bringing a fun, conversational vibe to even the toughest business challenges.

What won’t she do? 
Use clinical buzzwords. She solves complex tech puzzles daily, but happily leaves words like “diagnostic” to the Apple Store.

Szilvia Kovácsné Szántai

HR director

Szilvia has been the heart of Dorsum’s community since 2006. While her title says HR Director, she acts more like a human bridge between business logic and employee well-being. She always looks past the bullet points on a CV to find genuine curiosity and loyalty, knowing that true team spirit cannot be automated. She is the kind of leader who will boldly trade a flashy corporate party to secure comprehensive health insurance for everyone. After a week of navigating complex group dynamics, she unplugs completely, relying on time with family and friends 
as her ultimate reset button.

Her superpower? 
Reading the room. She instantly tunes into group dynamics, sensing hidden tensions in a meeting long before anyone says a word.

What won’t she do? 
Talk strategy before coffee. She never sacrifices humanity for results and refuses deep discussions before her own system boots up.

Péter Sallai

Chief Technology Officer

Péter is the kind of CTO who doesn’t just set direction—he understands and enjoys technology all the way down to its deepest layers. He believes great architecture isn’t built for fashion, but for endurance: systems should stay strong under real load and evolve as needs change. At Dorsum, he designs and leads teams building long-lasting platforms that can modernize without big-bang rewrites—stable foundations, modular components, and the mindset of being able to “swap the engine mid-flight.”
He makes strategic choices with engineering pragmatism: spotting what will remain useful versus what’s just noise, and translating complex technical topics into clear language for developers and clients alike. And he stays hands-on—when something matters, he dives in and builds.

His superpower? 
Tech Intuition + Deep Dive. He sees the big picture, but can go all the way into the details when the root cause—or the right decision—lives there.

What won’t he do? 
Predict the lottery. He will happily predict future tech trends, but please don’t ask him about the winning numbers.

Miklós Muszkuly

Chief Project Officer

Miklós began his journey at Dorsum as a trainee in 2008. After expanding his expertise at the Big Four and major banks, he returned to lead our most complex projects with the calm focus of a seasoned athlete. He knows that software is just the final output; true delivery is about providing the stability that makes clients feel completely secure. Operating on the strict philosophy that there is a massive difference between a project being “done” and functioning “well,” he never settles for the former. When project chaos hits, his grounded approach, fueled by family time and sports, ensures our partners always know they will “never walk alone.”

His superpower? 
Elite situation awareness. He instantly decodes complex dynamics, pinpointing the hidden risks and success factors of any project.

What won’t he do? 
Settle for “just working.” He strictly separates functioning from functioning well, and flat-out refuses to compromise.

Magdolna Pánczél

Country Manager

Managing two international subsidiaries requires a rare blend of adaptability and order. While Magdi naturally approaches the corporate world with the logical rigor of a Six Sigma expert, she understands that the people behind the projects are beautifully varied. She operates as a dedicated coach for her teams, patiently explaining the “why” and “how” behind a strategy rather than simply delegating tasks. After a week of successfully organizing complex international operations, she unplugs by embracing the organized chaos of family life and spontaneous weekend travels.

Her superpower? 
Contextual empathy. She instantly tunes into the unique mindset of any new client or culture, finding the exact common ground to build trust.

What won’t she do? 
Stay home on a weekend. After a highly disciplined workweek, she absolutely refuses to sit still on a Saturday.

Gábor Jandácsik

CFO & COO

With a three-decade career spanning both risk management and sales, Gábor brings a rare dual perspective to financial leadership. He approaches his role as CFO and COO much like a classic football defender: he knows the backline offers the best strategic view of the field, but he also understands that without scoring goals, the business cannot win. For him, financial modeling isn’t a tool to hold the team back, but a transparent safety net that empowers the organization to confidently chase growth. After a fast-paced day of balancing risk and reward, he relies on quiet “processing time” to mentally organize his thoughts, keeping his mind clear for genuine human connection.

His superpower? 
Stepping into your shoes. He instantly understands the real motivations of clients and colleagues without judgment.

What won’t he do? 
Walk away wearing them. He avoids unsolicited “if I were you” advice, giving you the context but leaving you the freedom to pick your own pa

Bálint Fischer

Chief Business Development Officer 

Bálint blends banking pragmatism with a builder’s curiosity. Having spent long years sitting in the client’s chair at major financial institutions, he intuitively understands the anxieties of digital transformation before they are even spoken. He is a “visionary doer” who combines a mathematician’s logic with a deep passion for connecting people, ensuring that technology serves human goals, not the other way around. Since joining Dorsum, he has been the driving force behind our international expansion and innovation. 

His superpower? 
Finding the courage to challenge “limits” that exist only in our heads. 

What won’t he do? 
Accept “because we’ve always done it this way”
as a valid answer. He is far too curious for that. 

Róbert Kő

Chairman of the Board

Robert brings the “emotional part” to the boardroom, focusing entirely on the people and trusting the experts with the professional execution. He believes that genuine trust is what carries a project to success, not just the contract. He is the one who finds cooperation even in a defeat, always looking for the positive outcome where others might see a loss.

His superpower? 
Creating balance in any conversation. He instinctively helps partners find their place in a meeting, ensuring the discussion is authentic and leads to a real connection.

What won’t he do? 
Ask “is there another way?”. He simply creates one, even if he must build the bridge himself.

Mariann Mészáros

Chief Executive Officer

Mariann brings over 25 years of enterprise discipline to Dorsum, yet she leads with a refreshing reliance on “common sense” over rigid corporate playbooks. She understands that strategy is nothing without the people who execute it, so she focuses on aligning organizational capability with business targets. For her, profitability is key, but she isn’t afraid to override the financial targets if the long-term market position demands it. She views leadership not as a solo performance, but as a shared responsibility. She strictly adheres to the motto that “no one should be a leader without empathy,”.

Her superpower? 
Balancing Strategy, Culture, and Numbers, instinctively knowing which one needs a push.

What won’t she do? 
Play the lonely hero. Lone wolves look cool in movies, but in business, they just get tired.