Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add section on data structures #33

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The remainder of this document contains a high-level overview of the Spacemesh p
- Transactions (coming soon)
- Sync (coming soon)
- P2P Networking (coming soon)
- Data structures (coming soon)
- [Data structures](datastructures/01-overview.md)

### Hare Protocol
- [Spec](/hare/README.md)
Expand Down Expand Up @@ -133,6 +133,8 @@ The basic building blocks of the Spacemesh protocol, and the overall, canonical

Other relevant data structures include the various types of proof produced and submitted by miners and other services ([PoET](mining/03-poet.md), [ATX](mining/05-atx.md)), and vote messages exchanged as part of the [Hare protocol](consensus/01-overview.md#hare).

See [data structures](datastructures/01-overview.md) for more information.

## Learn More

The documents contained in this repository are intended to provide a high-level, developer-centric overview of the Spacemesh protocol and the various infrastructure that implements the protocol. For additional resources, see the following:
Expand Down
23 changes: 23 additions & 0 deletions datastructures/01-overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Data structures

This document lays out the various top-level data structures that are used throughout the Spacemesh protocol, with details on their contents and how they're linked.

## Mesh

The mesh is the set of all layers.

## Layer

A layer is defined as a set of blocks.

## Block

A block contains a set of transactions. It may be syntactically or contextually valid or invalid. It also contains a pointer to an ATX that establishes the eligibility of the miner to produce the block in the layer.

## Transaction

## ATX

## P2P Messages

Each message is signed using the sender's public key. In addition to the message data itself (the payload), it includes a protocol, a client version, a timestamp, the public key of the message originator, a network ID, whether the message is a request or a response, the request ID, and the type of message in the specified protocol. All messages are serialized on the wire using [the XDR standard](https://en.wikipedia.org/wiki/External_Data_Representation).
2 changes: 1 addition & 1 deletion mining/05-atx.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ In addition to the full NIPoST attested to by the ATX, the ATX also contains fie

## Validity

Every valid block [LINK forthcoming] contains a pointer to a valid ATX that authorizes the miner in question to produce a block in the epoch and layer where the block was produced. In order to determine whether a given block is valid, a miner first fetches the ATX that the block points to, and validates that ATX. The ATX is considered valid if it has a valid signature from the miner, if no duplicate ATX was published, if the NIPoST it contains is valid, and if the time indicated by the ATX matches the duration attested to by the NIPoST. These validation rules prevent a dishonest miner from pre-generating ATXs for multiple identities, reusing the same storage space, and publishing them all in a single future epoch. See [the full protocol specifications](https://spacemesh.io/spacemesh-protocol-v1-0/) for a full elaboration of the validation rules for an ATX.
Every valid [block](../datastructures/01-overview.md) contains a pointer to a valid ATX that authorizes the miner in question to produce a block in the epoch and layer where the block was produced. In order to determine whether a given block is valid, a miner first fetches the ATX that the block points to, and validates that ATX. The ATX is considered valid if it has a valid signature from the miner, if no duplicate ATX was published, if the NIPoST it contains is valid, and if the time indicated by the ATX matches the duration attested to by the NIPoST. These validation rules prevent a dishonest miner from pre-generating ATXs for multiple identities, reusing the same storage space, and publishing them all in a single future epoch. See [the full protocol specifications](https://spacemesh.io/spacemesh-protocol-v1-0/) for a full elaboration of the validation rules for an ATX.


## Conclusion
Expand Down