Skip to content

proposal: NeoFS block storage format #194

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AliceInHunterland
Copy link
Contributor

No description provided.

Copy link
Contributor

@roman-khimov roman-khimov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Index files? Synchronization algorithm?

Its structure is described further below.

<pre>
block_binary
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can just refer to "standard Neo block serialization", that's what it is in its essence.


==Abstract==

This proposal outlines the methodology and specifications for storing Neo blockchain blocks within
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

methodology is too strong word for this.


==Motivation==

Neo node synchronization via P2P requires all block headers (~700 bytes each, over 1 GB per year with
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

headers and blocks

Neo node synchronization via P2P requires all block headers (~700 bytes each, over 1 GB per year with
15-second blocks) to remain available, limiting scalability as chains grow. Storing blocks in NeoFS
provides a distributed alternative, reducing local storage, enabling on-demand fetches, and speeding
up sync with snapshots or checkpoints. This proposal defines a NeoFS storage schema, building on
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

snapshots and checkpoints are for a different proposal.

15-second blocks) to remain available, limiting scalability as chains grow. Storing blocks in NeoFS
provides a distributed alternative, reducing local storage, enabling on-demand fetches, and speeding
up sync with snapshots or checkpoints. This proposal defines a NeoFS storage schema, building on
experiments (e.g., nspcc-dev/neo-go#3496) and future enhancements (#1526).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Experiments are for a different proposal section (rationale).

has network magic attribute (`Magic:56753`). Each block is stored in a binary
form as a separate object with a unique OID and a set of attributes:
- block object identifier with block index value (`Block:1`)
- primary node index (`Primary:0`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have it now, but I'm still thinking if its useful. I can imagine searches for block hashes/timestamps, but primary index is not so obvious (especially without a verification script hash).

A single NeoFS container is used to store blocks. Each container
has network magic attribute (`Magic:56753`). Each block is stored in a binary
form as a separate object with a unique OID and a set of attributes:
- block object identifier with block index value (`Block:1`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Define field names first, then describe them. Examples are for a different section.

form as a separate object with a unique OID and a set of attributes:
- block object identifier with block index value (`Block:1`)
- primary node index (`Primary:0`)
- block hash in the LE form (`Hash:5412a781caf278c0736556c0e544c7cfdbb6e3c62ae221ef53646be89364566b`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LE/BE are a bit different in C#, we can say "in hex hash representation"


These attributes are stored as NeoFS object metadata alongside the binary block data.
Multibyte data items are always stored in little-endian order, where the low bytes come first.
Its structure is described further below.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a not that the object MAY have additional data after the block, it can be useful for future extensions.

var-byte transactions[]; // Array of serialized transactions
}
</pre>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need an example of object.

@Jim8y
Copy link
Contributor

Jim8y commented Apr 11, 2025

@AliceInHunterland please update accordingly, this is not likely can be reviewed with any useful suggestions from other coredevs since we know little about neofs, please just follow roman's suggestion


===Block Storage Schema===
A single NeoFS container is used to store blocks and index files per network. Each container
has network magic attribute (`Magic:56753`). Each block is stored in a binary
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace direct example of Magic:56753 with description of attribute name and the form of attribute value, because this section is a specification description, examples shouldn't be placed here.

===Block Storage Schema===
A single NeoFS container is used to store blocks and index files per network. Each container
has network magic attribute (`Magic:56753`). Each block is stored in a binary
form as a separate object with a unique OID and a set of attributes:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in a binary form

in a binary form following standard Neo block serialization rules

Comment on lines 27 to 32
form as a separate object with a unique OID and a set of attributes:
* Block: block object identifier with block index value.
* Hash: block hash in the in hex hash representation.
* PrevHash: previous block hash in the in hex hash representation.
* BlockTime: millisecond-precision block creation timestamp.
* Timestamp: second-precision block uploading timestamp.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ref. #194 (comment), from this description it's not quite clear that Block, Hash, etc. are attribute names and they are strictly fixed. I'd say that we either need additional note about it or may be even a table, something like that:

Attribute name Attribute value
Block String representation of block index in the base of 10.
...

The same stile can be applied to container attributes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same stile can be applied to container attributes.

We have, for now, only one. Would you like a separate table for it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's nice to have things unified, so table also suits even for one attribute. If we won't use table, then we need at least to adjust description wrt #194 (comment).

Comment on lines 38 to 53
An [https://rest.fs.neo.org/v1/objects/3RCdP3ZubyKyo8qFeo7EJPryidTZaGCMdUjqFJaaEKBV/by_id/Fu7yQzspvLJwSGJNK64xeeyMdWXtU5B5b1es6KSxUag1 example]
of a block object is as follows:
<pre>
ID: Fu7yQzspvLJwSGJNK64xeeyMdWXtU5B5b1es6KSxUag1
CID: 3RCdP3ZubyKyo8qFeo7EJPryidTZaGCMdUjqFJaaEKBV
Owner: NVvY1FF67XJ2GTVhy9FqiZGC4jEQtvjmHt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it correct to attach object link as an example? This object/container may be removed in future whereas we expect NEP to be consistent. @roman-khimov?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example can be a proper example with this data if needed. It doesn't imply any of the IDs are relevant for mainnet or whatever else.

* BlockTime: millisecond-precision block creation timestamp.
* Timestamp: second-precision block uploading timestamp.

These attributes are stored as NeoFS object metadata alongside the binary block data and can be extended.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
These attributes are stored as NeoFS object metadata alongside the binary block data and can be extended.
These attributes are stored as NeoFS object metadata; the list of attributes MAY be extended.

Comment on lines 102 to 104
==Rationale==
This proposal defines a NeoFS storage schema, building on experiments (e.g., nspcc-dev/neo-go#3496)
and future enhancements (#1526).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not the proper section for the rationale. Also, the text itself may be improved, see as an example https://github.com/neo-project/proposals/blob/master/nep-25.mediawiki#user-content-Rationale.



== Implementation ==
* Go: https://github.com/nspcc-dev/neo-go/blob/61992405983ddfb5547ae3afab75c22186dc966f/cli/util/uploader.go
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to attach an example of NeoFSBlockFetcher as far? I think it will be useful since synchronisation algorythm is also a part of this proposal. @roman-khimov?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be referenced.

* [https://github.com/neo-project/neo/issues/2373 Neo Issue#2373]
* [https://github.com/neo-project/neo/issues/1526 Neo Issue#1526]
* [https://github.com/nspcc-dev/neo-go/issues/3496 NeoGo Issue#3496]
* [https://github.com/nspcc-dev/neofs-api/issues/285 NeoFS API Issue#285]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that this issue is directly related to the proposal. @roman-khimov?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, a different story. Even quite old one.

Comment on lines 107 to 110
* [https://github.com/neo-project/neo/issues/3463 Neo Issue#3463]
* [https://github.com/neo-project/neo/issues/2373 Neo Issue#2373]
* [https://github.com/neo-project/neo/issues/1526 Neo Issue#1526]
* [https://github.com/nspcc-dev/neo-go/issues/3496 NeoGo Issue#3496]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These issues should have readable description instead of just Issue#.... See https://github.com/neo-project/proposals/blob/master/nep-23.mediawiki#references as an example.

NEP: TBD
Title: NeoFS block storage format
Author: Ekaterina Pavlova <[email protected]>
Type: Informational
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To me the type of this standard looks more like Standard rather than Informational because we directly standardize NeoFS storage schema and building node synchronization mechanism over it. Or may be even Meta standard, since it's not directly related to the Neo protocol, ref https://github.com/neo-project/proposals/blob/master/nep-1.mediawiki#nep-types. @roman-khimov?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To me it's Informational since there is no obligation for N3 protocol to store blocks in NeoFS and be able to synchronize from it. It's for interoperability if anyone wants to fetch blocks this way, but it's far from P2P getblocks for example.

Signed-off-by: Ekaterina Pavlova <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants