Spacemesh Deep Dive Analysis

Over the past year or so, the blockchain industry and more particularly Proof of Work networks have become the target of increasing critiscim from both mainstream media and regulators starting to perceive this new industry as a new emerging threat to global environmental policies as shows the recent regulatory chatter around a potential winter seasonal ban on crypto mining in the EU or the recent damning White House report on PoW mining.

Furthermore, from a pure networking standpoint, most PoW network are also starting to face a fair number of issues trickling down from their ever-growing mining process cartelization around a small subset of miners investing massive amount of CAPEX in order to spin up highly efficient and specialised mining facilities pricing out small casual miners out of of the ecosystem and creating a de facto a massive barrier of entry for any newcomer.

As such, in the light of this potential future regulatory breakdown on PoW network it appears interesting to start analysing other viable alternatives such as Spacemesh aiming to offer a new form of decentralised payment relying on a novel form of consensus algorithm called Proof of SpaceTime leveraging miners available disk storage space.

Spacemesh Overview

Spacemesh is usually advertised by its core project team as the natural evolution of PoW decentralisation payment network into a better and more efficient form enabling fairer token distribution and lesser energy consumption. Nonetheless, it appears important to bear in mind here that no first generation PoW blockchain ever truly succeeded to become viable decentralised payment networks (e.g Venezuela) and for the most part never got past the store of value use case.

Else relatively to its technical attributes, the Spacemesh protocol is most well described as a blockmesh protocol leveraging a custom proof of Spacetime consensus algorithm and a dedicated mesh network architecture avoiding the centralisation and energy consumption pitfalls of PoW protocols while offering at the same time a higher degree of token and network distribution.

Spacemesh Architecture

The Spacemesh protocol infrastructure is built on top of four core components each maintained separately but working in concert to enable the broader support of the Spacemesh network and ecosystem.

  • Go Spacemesh — Open source codebase implementing the bulk of the Spacemesh core protocol and enabling each miner to run a protocol-compatible full node as well as a mining node on a variety of different systems and architectures

  • PoET server — Web service enabling the implementation of temporality inside the Spacemesh network.

  • Proof of SpaceTime (PoST) — Collective set of consensus algorithms employed simultaneously to ensure the build-up of a Spacemesh ledger implementing an ordered BFT canonical view of blocks.

  • Spacemesh App — GUI-based desktop application acting as a wallet and running a Go-spacemesh full node instance in order to enable users to mine.

Spacemesh Design

PoW network, such as Bitcoin, usually tackle the Sybil attack problematic (where one entity secretly create a large number of miners) through the implementation of a computing intensive process leveraging miner’s electrical consumption cost as a scarce resource in order to impose an implicit limit on the number of nodes that a single actor can realistically spin-up.

However, as mentioned above despite being extremely robust from a technical standpoint, this solution is also extremely energy intensive. Consequently, Spacemesh is replacing Proof of Work with a novel type of consensus algorithm called Proof of SpaceTime (PoST) allowing miners to use disk space rather than computation as the scarce resource for preventing Sybil attacks.

How does it work?

Technically speaking let’s take the example of Miner A willing to pledge 500GB of disk space to the Spacemesh network to start mining. First, Miner A is going to go through a phase known as the init phase during which the network is going to require her to perform a one-time Proof of Work process in order to fill up her 500GB of storage with cryptographic junk.

Once, this phase is done, our Miner A is then set to start mining on Spacemesh and is going to be able to prove its eligibility for taking part in the mining process by just sending prior to each mining period a proof of its storage allocation, also known as activation transaction (ATX), build on top of the stored cryptographic junk.

How to make sure that miners effectively allocate space to the network between two activation transaction?

One of the issue with our previous process is that our Miner A could effectively perform the one-time proof of work process in order to be able to start mining and then supress the process output before reprocessing it right before the next period putting us back effectively in the situation where the scarce resource is not anymore the available disk space owned by Miner A but again its processing power leading us straight back to our previous PoW situation. As such, in order to avoid this problematic and enforce the disk space as the sole usable scarce resource, Spacemesh is incorporating the time primitive inside it’s ecosystem and more particurlarly in the build-up of each activation transaction in order to ensure that Miner A indeed allocated continuously her 500 GB to the network between each activation transaction.

How is time integrated in the Spacemesh protocol?

In order to implement time inside its mining process, Spacemesh is leveraging a cryptographic primitive called Proof of Elapsed Time (PoET) providing a proof that a sequential work cycle has been performed and thus that a given period of time has elapsed.

Furthermore in the case of Spacemesh, given than what is needed is merely a proof that a certain amount of time has elapsed there is no need for every miners to perform this sequential work themselves as it would defeat the initial purpose of Spacemesh to avoid continuous CPU work. Indeed, here it appears sufficient to have several PoET instances shared among multiple miners in order to minimise the overall electrical cost especially since each miner can easily check the integrity of the proof send by the PoET server and used another PoET server in case of malicious behaviour.

Consensus in Spacemesh

On the contrary of PoW networks enforcing a racing mechanism between miners where the first miner to produce and communicate a valid block to the network earns the right to produce the current block of the chain and where each block are produce one after the other. In the case of Spacemesh, multiple blocks get created simultaneously and every miner that expands sufficient space-time resource is deterministically eligible to generate a block.

As such, given its inherent lack of block ordering and randomness features normally generated by the racing mechanism, Spacemesh needs to implement a way of ordering newly creating blocks in order to form its canonical ledger as well as an external source of randomness in order to make difficult to predict who will be eligible to generate a block

Spacemesh block ordering

Spacemesh employs simultaneously two consensus mechanisms in parallel to determine the canonical set of blocks at each layer:

  • Hare protocol — Byzantine Fault Tolerant consensus algorithm

  • Tortoise Protocol — Slow vote based mechanisms requiring each node to count the votes “for” and “against” each previous block and tallying these votes to eventually achieve consensus.

Tortoise protocol

The Tortoise protocol is the mechanism by which the Spacemesh network achieves final consensus on the set of blocks and transactions that form the canonical ledger.

Technically speaking, each time a miner produces a new block, they include in that block a “votes” field that lists one or more previous blocks that the miner also considers valid at the time the block is produced.

→ Each time, a new block links to a given older block, the vote tally for that older block increases by one. On the contrary, any block generated after a given older block that doesn’t vote for that block is counted as a vote against the block.

Furthermore, the Tortoise protocol is using a majority-rule fashion such that any block with a net tally greater than the irreversibility threshold becomes part of the canonical ledger.

Observation: Currently each vote is weighted proportionally to the amount of space-time resources it represents, e.g, votes cast by a miner that has committed 200GB count twice as much as votes cast by a miner that has committed 100GB to the protocol. As such, given the current lack of upper storage limit this design feature could represent a critical risk to the network if not fixed before mainnet launch given that a cartel or single massive miner could seize control of the Tortoise protocol voting and by extension of the canonical ledger.

Why the need for two consensus protocols?

Despite being extremely robust, the Tortoise protocol is also pretty slow to run and cannot run on the most recent layer since there are not yet any newer blocks voting on these blocks. Therefore, Spacemesh is using a quicker consensus mechanism in order to bootstrap the Tortoise protocol called the Hare protocol which purpose is to allow each node to quickly determine the set of blocks in the layer to be voted on by all honest miners.

Hare protocol

The Hare protocol, run once per layer, is a BFT-compatible algorithm achieving consensus in four round and levergaing the participation of a randomly selected subset of available eligible block producers.

Technically speaking, at the beginning of each round, each miner draws through the use of a Verifiable Random function a role that tells it whether it’s active (i.e participating) or passive (i.e just observing) in this round.

If the Verifiable Random Function (VRF) output passes some threshold depending on the number of total active miners then the miner is active else it remains passive for that round.

Hare protocol flow

The protocol takes place over four rounds, which are preceded by a pre-round:

  • Pre-round — Each active participants shares their current view of blocks that are valid. At the end of the round, each then factors in the views shared by other participants and updates their view by removing blocks that didn’t receive enough support from other participants.

  • Status round — Each active participant broadcasts a status message reporting its updated view.

  • Proposal round — Each active participant broadcasts a proposal to the group, based on the results of the previous round. One of these participants will be randomly chosen to be the leader.

  • Commit round — Each active participant independently determines who was elected leader, reviews the proposal from this leader, and signal its willingness to commit to it to the group. By the end of this round, each participant that received a valid proposal from the leader and a sufficient number of commit messages from other participants creates a commit certificate including all of this information.

  • Notify round — Each active participant holding a commit certificate broadcasts it to the group. Then, if a sufficient number of commit certificates are received from other participants, the protocol terminates and each participant knows the proposed canonical set of blocks.

Finality in Spacemesh

Contrary to PoW network the Spacemesh goes through two distinct phase of finalisation. A first phase corresponding to a temporary canonical consensus produce by the Hare protocol and a second stage corresponding to the final canonical consensus once the Tortoise protocol reaffirm the Hare proposed canonical order.

Note: In the case where the Tortoise reject the proposed canonical order output by the Hare protocol, both rewards and transactions are rolled back and reapplied based on the new set of valid blocks.

See Appendix for greater details on Spacemesh block creation and transactions structure

Spacemesh features

Beacon

Spacemesh runs a beacon protocol to generate a random value at the beginning of every epoch. In order to take part in this process, a miner must satisfy the following conditions:

  • Be online

  • Be synced and having listened to network gossip for at least 2 layers

  • Be an eligible miner since at least epoch N-1

Technically speaking the beacon protocol is essentially a simplified Tortoise consensus protocol where each sampled miner first propose its own seed of randomness before the casting of all votes and the reaching of a global network consensus on the beacon value to be used in the next epoch.

Note: Having the correct beacon determines weather a miner can generate proposals and participate in the Hare consensus protocol to earn mining rewards.

Self-Healing

While the Tortoise protocol is very secure it is also fragile in the sense that its security rely solely on the assumption that the protocol holds all the way from genesis. However, over a long enough period of time, the likelihood of some events to occurs and cause the protocol to faill approaches one. As such, in order to easily recover, Spacemesh includes a feature known as self-healing through which all nodes agree at every layer on a random coin-toss in order to easily make a decision regarding a block in the case where the margin of vote casted for and against this latter is very narrow.

SMESH

Future high-level programming language that will compile to SVM WebAssembly code and enable developer to easily build on top of the Spacemesh ecosystem and integrate smart contract logic inside their dApps.

Spacemesh Governance

While being fully open source, the governance of the Spacemesh protocol still remains pretty much centralised around the core team relatively to the protocol development and other critical aspects of the projects such as the coin issuance schedule.

Furthermore, it is important to note that there is currently no plans or discussion for a potential future on-chain governance of the upcoming Spacemesh Mainnet which could appear to some a bit worrying given the current track record of the core team and the numerous development delays suffered by the project originally set to hit market years ago.

Spacemesh cryptoeconomics

As every other layer 1 blockchains aiming to become viable decentralised payment networks, Spacemesh economical design is revolving around a native token called MESH whose two sole purposes are:

  • Facilitating token denominated network reward for active agents supporting the network

  • Acting as a payment vehicle between users.

Note: The network being still in its testnet phase there is for now no actual reliable market metrics available.

Token Distribution

Accordingly to its core goal of ensuring a fairer token distribution, the core team avoided any pre-mint mechanism that would have created a front-loading situation for early adopters and innovators and hinder any future token distribution to the rest of the ecosystem.

Furthermore, from a token distribution standpoint, similarly to Bitcoin, Spacemesh is using a custom gradual decay pattern enforced after each layer in order to implement an overall token issuance half-life of 29 years. However, on the contrary of PoW network where rewards are attributed solely to the block producer, in the case of Spacemesh given that multiple blocks get produced at the same time, all fees and network reward get pooled together during each mining period before then being proportionally reallocated to each participating miner up to the extent of work effectively performed across the period.

Observation: As it stands, it appears that despite its claim of ensuring a fairer token distribution Spacemesh is here falling a bit short given its lack of innovation from a token emission standpoint compared to other existing PoW networks as well as its current network design which would in the current state of things inevitably lead to a token front-loading situation benefiting big miners right after mainnet launch due to the cryptoeconomic choice of allocating proportionally more mining slots to miners allocating more space to the network without any limitation.

Spacemesh Ecosystem

Spacemesh team

Tomer Afek, Co-founder, CEO

Extensive prior experience in M&A and finance as well as in the tech industry with various ventures in the media and and web publishing sectors.

Rami Kasterstein, Co-founder

Web entrepreneur and venture capitalist involved in several Web3 media and software related ventures.

Aviv Eyal, CPO, Co-founder

Blockchain specialist with extensive experience in mobile gaming and Web3 consulting.

Tal Moran, Chief Scientist

Blockchain specialist, computing science researcher and theoretical cryptography professor at the Reichman University.

Ecosystem current state

As of now given the current state of development of the project, there is no ecosystem per se developed around the Spacemesh protocol. Furthermore, in the light of the numerous delay in the core project development witnessed over the past threeyears, it appears sound to say that the development of the ecosystem around the core protocol will most likely require several additional years.

Roadmap

As of now the core team is currently working on the testnet version of the Spacemesh protocol and aims to release its mainnet version later in December. However, in the light of the numerous delay witnessed since the initial launch date set back in 2018 it is important to remain cautious as the team might pushed back again the launch of its mainnet toward later in 2023.

Conclusion

Given the current Spacemesh mining process rewarding miner proportionally to their allocated disk space without any max cap and the cryptoeconomic choice of using a decay pattern the claim relative to a fairer token distribution appears for now somewhat misleading given that the nature of the network itself will inevitably create a front-loading situation for professional miners in the early days of the network if no max storage cap is implemented until then. Additionally, the proportional weighting of miners votes inside the Tortoise protocol appears to also be another critical reason why the implementation of a max cap would be a critical need given the risk of Sybil attack from an entity with extensive disk-space resouces upon mainnet launch.

Additionally, the protocol claim relative to becoming the main decentralised payment network protocol seems for now quite doubtful given the current protocol technical limitations compared to other more centralised alternatives and the fact that potential users will most likely not switch towards a more decentralised alternative if not at least as efficient from a settlement time standpoint as the ones they’re currently using.

So to conclude, despite the fact that this protocol is proposing an interesting alternative network structure that could bring new opportunities for miners through its novel token distribution and network architecture it appears that for now Spacemesh still need more time to further develop and fine-tune its core network and cryptoeconomic design before being able to be considered as a viable upcoming alternative to existing PoW networks such as Bitcoin.

Appendix

Spacemesh uses the the account model for storing value, meaning that that users are encouraged to reuse accounts for multiple transactions and that from different transactions increasing the account balance become fungible and indistinguishable from on another.

Note: Each account store a transaction counter in order to avoid any possiblity of replay attack inside the network.

Transaction Structure

The transaction data structure contains the following elements:

  • Recipient’s address

  • Amount to transfer

  • Amount of the fee to be paid

  • Transaction counter

  • Signature

Note: Transaction do not mention explicitely the sender’s address given that each transaction is signed using the private key of the sender’s account from which the public key can be easily derived.

Transaction processing

Each miner receive each incoming unprocessed transactions locally over GRPC or via network gossip and automatically save those in its mempool after performing a serie of basic check ensuring the contextual validity of the transaction. Furthermore, the miner also further gossip the transaction in order to ensure its propagation to all peer in the network.

Note: A transaction is deemed contextually valid if at the moment when the transaction is applied to the global state, the following condition apply:

  • The transaction appears in a contextually valid block

  • The origin account exists

  • The counter on the account matches the transaction counter

  • The account balance is greater than or equal to the transaction amount + fee

Transaction ordering

The transaction ordering in Spacemesh is defined as follows:

  • Blocks in layer n comes before those in layer n+1

  • The IDs of all contextually valid blocks in layer n are listed in ascending order

  • These block IDs are concatenated and hashed

  • The hash sum is used as the seed for a Mersenne Twister

  • A Fisher-Yates shuffle is performed on the list of block IDs using the output of the Mersenne Twister

  • Transactions from the ordered blcoks are then applied in the order they appear in each block ignoring duplicates.

Disclaimer: All information/documents contained in this article rely solely  on my personal beliefs, and do not constitute professional investment advice.

Be careful in your investment and do not invest more than you can afford to loose.

Subscribe to CyberGen Lab
Receive the latest updates directly to your inbox.
Mint this entry as an NFT to add it to your collection.
Verification
This entry has been permanently stored onchain and signed by its creator.