Swarm Primitives Playground

This demo shows the functionality covering BMT, chunks and icon generation from the nectar-primitives crate.

Text length: 0 bytes (max 4096)

BMT Hash (Hex)

0x0000000000000000000000000000000000000000000000000000000000000000

Hash Bytes Visualization

Icon Visualization Options
About BMT Hasher

The Binary Merkle Tree (BMT) hasher is a specialized content-addressing function that allows efficient verification of data segments within a larger payload. It enables inclusion proofs without requiring all data to be available.

This implementation is part of the nectar-primitives crate, compiled to WebAssembly for in-browser computation.

Span: The span represents the total length of data (in bytes) this chunk belongs to. It can be different from the actual chunk size, especially when dealing with large datasets split across multiple chunks.

Chunk Configuration

Icon Options

Generated Icon

SVG Code



                            

Example Icons

Performance Benchmark

Test the performance of the BMT hasher with different data sizes (max 4096 bytes). The benchmark generates unique random data for each iteration, ensuring that each hash operation processes completely different data. This approach prevents JIT optimizations, branch prediction, and caching effects from artificially improving the results.

Note: For large numbers of iterations, this will generate substantial amounts of random data in memory. You'll be prompted for confirmation if the total exceeds 500MB.
Benchmark results will appear here.

Chunk Creator & Analyzer

Create and analyze different types of chunks used in nectar's storage protocol.

Text
Hex
0 bytes
About Chunks

Content Chunks

Content chunks are simple content-addressed containers. Their address is derived directly from the binary Merkle tree (BMT) hash of their data, making them immutable and self-verifying.

Single Owner Chunks

Single owner chunks include a unique ID and are cryptographically signed by their owner. Their address is derived from both the ID and the owner's address, allowing for ownership verification and controlled updates.

Chunk Structure

                Content Chunk:  [data]
                Single Owner:   [ID (32 bytes)][signature (65 bytes)][span (8 bytes)][data]