Catalog npm
PACKAGE EXPLORERView in registry

@0g-brier/zg-storage

npm

Read documents from 0G Storage and prove they are the ones a Merkle root names.

0gmerklestorageverification
Versions collected3
Direct dependencies4From release 0.1.2
Last observed20 Oct, 22:10 UTC

README

Current package documentation

@0g-brier/zg-storage

Read documents from 0G Storage and prove they are the ones a Merkle root names.

npm i @0g-brier/zg-storage
import {ZgStore, zgMerkleRoot} from "@0g-brier/zg-storage";

const store = new ZgStore("https://indexer-storage-turbo.0g.ai"); // mainnet;
// Galileo is indexer-storage-testnet-turbo.0g.ai. The two networks share no data,
// and a root stored on one is not fetchable from the other.
const doc = await store.get("0x5da31d27…"); // throws unless the bytes hash back

Fetching is the easy half. get recomputes the root from the bytes it received and refuses anything else — without that step you are rendering whatever the indexer said, while the whole claim of a content-addressed document is that everyone reads the same immutable text.

zgMerkleRoot is the root by itself. It is not a textbook Merkle tree: 0G pads the chunk count to a multiple of a sixteenth of the next power of two, and an odd node is carried to the back of the queue rather than duplicated. A wrong rule agrees with the right one on most inputs and disagrees just past a power of two, which is why this is pinned to 19 vectors from 0G's own SDK.

Caching is unconditionally safe here in a way it almost never is: the key IS the hash of the value. Pass a Web Storage-like object to keep proved documents across sessions — they are re-verified on the way out.

MIT.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 3

Collected releases
VersionPublishedDirect dependenciesOpen version
0.1.2Registry latest1 Sept 20264
0.1.11 Sept 20264
0.1.029 Aug 20264

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
hevdev7/0g-brier

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 22:10 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:fefa1b8ee6d7f7ad6be729db078085039caa2ded8e40a610e8a15305f5f2640c