Skip to content
DeWebProtocolPublic

About

MALT is an authenticated storage system for traversable structured data that decouples structure from immutable objects, enabling low-latency verifiable traversal, succinct proofs, and low-amplification updates as data evolves.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

21 stars

Watchers

0 watching

Forks

Latest commit

 

History

781 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MALT Core

Go CI License: MIT

MALT turns a collection of structured data into a compact Root. Given a Root and a traversal path, a query returns the target together with compact verification evidence.

A client can use that evidence to verify that the target follows the requested path from the selected Root, without trusting the system that answered the query.

What you can do

  • Generate compact Roots: represent a collection of structured data with a short identifier.
  • Build state with objects: connect Maps, Lists, and custom structs through ordinary Go references, then commit the collection from its root object.
  • Retrieve targets with evidence: query by Root and traversal path, then verify the returned target locally.
  • Check missing entries and partial reads: confirm absence or verify the references needed for a requested range.
  • Prepare new versions: update objects, collect changed relationships and new content, and keep earlier states available for queries and verification.
  • Use your own storage: add verification to your application without adopting a managed storage service.

Requirements and installation

This repository provides the Go implementation and SDK for MALT. You need Go 1.26.0 or newer. Go downloads the required packages automatically. The examples run locally without a server or database. They are tested on Linux. macOS and Windows builds are also checked; see the examples guide for platform coverage.

Add MALT Core to an existing Go module:

go get github.com/dewebprotocol/malt-core@v0.0.10-rc.4

After copying an example into your module, run go mod tidy to resolve its imports.

For optional KZG4096 opening acceleration, see the independent Go/CUDA module. It loads CUDA Driver/NVRTC at runtime without Python or CGO. Default CPU and portable verification builds remain independent of CUDA; hardware qualification uses the module's smoke tool.

The Object API used below is available starting with v0.0.10-rc.3. For JavaScript or TypeScript, use malt-ts, which has its own API and release schedule.

Quick start

The following snippets show Commit → Prove → Update → Verify on one Map. They are successive excerpts from the complete example, which includes imports, engine initialization (e), a context (ctx), and the materialize helper for the local query store. Each snippet runs inside a function returning an error.

Commit

Put an immutable document in a Map, then commit the Map. Its children are committed automatically:

collection, err := object.NewMap(e, object.MapConfig(maltcid.IPA256))
if err != nil {
    return err
}
content, err := object.NewImmutable([]byte("A locally verifiable report."))
if err != nil {
    return err
}
if err := collection.Set([]byte("report.txt"), content); err != nil {
    return err
}
root, err := collection.Commit(ctx)
if err != nil {
    return err
}

Prove

Collect the committed data with Delta(ctx) and supply it to the example's in-memory query store. Query report.txt, a one-step traversal path, to obtain the target and its verification evidence:

nodes := memory.NewNodes()
blocks := make(map[string][]byte)
delta, err := collection.Delta(ctx)
if err != nil {
    return err
}
if err := materialize(ctx, e, nodes, blocks, delta); err != nil {
    return err
}
label := []byte("report.txt")
result, err := e.Prove(ctx, root, label, nodes)
if err != nil {
    return err
}

The helper retains content bytes in blocks and makes the committed relationships queryable through nodes. Your application chooses where to store this data.

Binding proofs collect their bounded authentication path before opening distinct vectors concurrently, up to GOMAXPROCS jobs per binding. Storage lookup remains serial. Generation returns untrusted evidence without self-verifying prepared openings; the receiver verifies the complete caller-selected Root and query before accepting the result. Openings from the same vector retain preparation and generated-evidence reuse; proof order and serialized bytes do not depend on scheduling. The built-in KZG and IPA arithmetic also follows the process's Go scheduler budget. Applications may schedule independent ArcSet proofs separately.

The built-in KZG prover uses a sparse quotient calculation for vectors with at most 128 nonzero scalars. Its fixed unit-polynomial opening table is generated from the pinned public setup and loaded with the writer key; queries require no table precomputation. Higher occupancy uses the full-vector calculation. Both paths emit identical proof bytes and use the same verifier. Writers retain an additional 384 KiB embedded table plus 384 KiB of decoded points per process; portable verifiers do not load or link either.

Update

Replace the document and commit again. Delta(ctx) collects changes relative to the collection's previous successful Commit:

replacement, err := object.NewImmutable([]byte("An updated report."))
if err != nil {
    return err
}
if err := collection.Set(label, replacement); err != nil {
    return err
}
updatedRoot, err := collection.Commit(ctx)
if err != nil {
    return err
}
delta, err = collection.Delta(ctx)
if err != nil {
    return err
}
if err := materialize(ctx, e, nodes, blocks, delta); err != nil {
    return err
}
updatedResult, err := e.Prove(ctx, updatedRoot, label, nodes)
if err != nil {
    return err
}

Keep the returned delta until its writes have been handled; the next successful Commit advances the local comparison baseline. This example retains both versions in its query store, so the original Root remains queryable.

Verify

Use a separate verifier to check each result against its selected Root and query. Verification needs neither the mutable Objects nor the query store:

verifier, err := builtin.NewVerifier(maltcid.IPA256)
if err != nil {
    return err
}
valid, err := verifier.Verify(root, label, result)
if err != nil {
    return err
}
if !valid || !result.Present {
    return fmt.Errorf("invalid original binding")
}
updatedValid, err := verifier.Verify(updatedRoot, label, updatedResult)
if err != nil {
    return err
}
if !updatedValid || !updatedResult.Present {
    return fmt.Errorf("invalid updated binding")
}

After these checks, result.Target and updatedResult.Target are verified at their respective Roots. This example selects Roots it constructed locally; a client selects its trusted Root and query independently of a query response. The complete example also checks content bytes against those verified targets.

Run the complete program from this release:

git clone --branch v0.0.10-rc.4 https://github.com/DeWebProtocol/malt-core.git
cd malt-core
go run ./examples/basic

See the Object guide for Lists, custom structs, and nested references, and the examples guide for traversal, partial reads, and serialized queries.

VC Tree layouts

Core calls its two authentication layouts Map and List. Map organizes bindings by coordinate prefixes and suits sparse key spaces. List organizes integer positions into fixed radix intervals and suits dense sequences. The optional sdk/object containers sit above these VC Trees. List root metadata authenticates the extent. Unbound positions inside that extent have zero-scalar absence proofs. See the layout specification.

On the development branch, these are maltcid.Map (L=1) and maltcid.List (L=2). Earlier releases used Prefix / Positional names and experimental layout IDs 4/3. Current pre-beta state must be rebuilt under the Map/List IDs; the release-pinned quick start above keeps its published API.

Further reading

MALT Core is currently experimental. See the compatibility policy when choosing a release.

About

MALT is an authenticated storage system for traversable structured data that decouples structure from immutable objects, enabling low-latency verifiable traversal, succinct proofs, and low-amplification updates as data evolves.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

21 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages