Junaeth Series #4 – Hybrid Ledger
August 5, 2021
The Stealth blockchain offers five second blocks and exceptional scalability because its consensus protocol, called Junaeth, has a number of innovations that improve efficiency over other consensus protocols. Among these innovations is a hybrid ledger that separates blockchain data from stateful information that tracks the performance and rewards of block validators. This latter information is kept in a data structure known as the registry. In short, the Stealth hybrid ledger information is divided between the blockchain and the registry.
What is a blockchain?
A blockchain is a distributed data structure that stores all transfers between addresses. The Stealth blockchain has a defined structure, the largest subunit of which is a block. Blocks are ordered within a blockchain where each block has one and only one immediate predecessor and one and only one immediate successor. The exception is the so-called genesis block that has no predecessors. The genesis block is numbered 0, and each successive block has a number, or block height, that is 1 greater than its predecessor.
Blocks are simply a grouping of transactions that have an implicit ordering. Interestingly, the transactional ordering within blocks influences the validity of transactions therein. For example, let’s imagine two transactions, called A and B, are within the same block. Transaction B spends money that is spent in transaction A. Transactional order dependence means that transaction A must precede transaction B within a block.
Transactions themselves are composed of two types of subunits called inputs and outputs. For each transaction, the inputs are money spent and the outputs are money received. For example, imagine that address X sends money to address Y. This means that address X spends one or more inputs and address Y receives an output. While it doesn’t matter to block validity, we consider that inputs are ordered and outputs are ordered, and furthermore, inputs precede outputs.
Because everything in a blockchain is implicitly ordered by the structure of the data, each transaction effectively can be considered a state transition, where the blockchain ledger has a state preceding the application of a transaction and a different state after application of a transaction. In this sense, the blockchain is essentially a computer program that modifies a ledger wherein each transactional recipient has a balance. Implicit ordering of transactions is subject to the condition that balances can never be 0.
— — — — — — —
What is the registry?
If a computer runs the Stealth cryptocurrency reference client, then the registry is a data structure fully contained within this computer’s memory. The registry has three main components: (1) a list of StealthNodes, (2) the queue, and (3) the registry ledger.
— — — — — — —
StealthNodes
The list of StealthNodes (or technically, a mapping of StealthNodes) is simply a data structure wherein StealthNodes may be accessed by their identification number (ID). The reason for this type of access is because the blockchain stores all references to StealthNodes by their IDs. A StealthNodes is also a data structure with many attributes. Several of the most important StealthNode attributes are the public keys corresponding to the owner, manager, delegate, and controller authorities. These public keys (called “pubkeys” for short) specify who can do things like enable and disable the StealthNode (controller), sign blocks on its behalf (delegate), and transfer ownership (owner). Also the manager and delegate pubkeys get payouts for block rewards, in a ratio specified by the manager or owner. Other StealthNode attributes include the number of blocks assigned to the StealthNode and the number of these assigned blocks the StealthNode failed to sign, called missed blocks.
— — — — — — —
The Queue
The queue is a list of StealthNodes that specifies an ordering for the current round of block signing. Each StealthNode is put into the queue in a pseudo-random order and is assigned a block based on this ordering. Every round, a new queue is created. If the StealthNode fails to sign its block in the allotted time window (slot), then its count of missed blocks is increased by 1. The queue also keeps track of the current slot and the time windows for each slot. Additionally, the queue tracks the missed blocks for the current queue, which is useful for users and service providers who track or report Stealth blockchain performance.
— — — — — — —
The Registry Ledger
The registry ledger is the second part of Junaeth’s hybrid ledger system. It tracks all unclaimed block rewards. Every time a StealthNode produces a block, the manager and/or delegate keys are credited with a fraction of that block’s reward. For example, imagine that a StealthNode shares 20% of its earnings with the delegate who signs blocks on behalf of the StealthNode. If the block reward is 1 XST, for example, then this delegate pubkey will get credited with 0.2 XST and the manager pubkey will get credited with 0.8 XST. Note that we are using 1 XST for clarity;
actual block rewards are currently about 0.0574 XST. Since these pubkeys are also valid XST destinations, these rewards can be claimed on the blockchain in a manner very similar to spending XST. The registry ledger, therefore, is simply a listing of pubkeys and their associated balances.
The importance of the registry ledger, and more generally the registry, is that it stores a lot of state information like reward balances and StealthNode performance, off chain, reducing memory and network bandwidth. As a result, communication between nodes, disk access, and other resource requirements are significantly reduced. For example, if each block reward were kept on chain, then this would increase the growth of the Stealth blockchain by approximately 1.5 GB per year. While this unnecessary blockchain bloat would likely not be prohibitive, it represents significant inefficiency that is easily avoided by Junaeth’s hybrid ledger system.
actual block rewards are currently about 0.0574 XST. Since these pubkeys are also valid XST destinations, these rewards can be claimed on the blockchain in a manner very similar to spending XST. The registry ledger, therefore, is simply a listing of pubkeys and their associated balances.