ZOSCII Tamperproof Blockchain - User Guide

(c) 2026 Cyborg Unicorn Pty Ltd - MIT License

About block IDs: every tool below takes block IDs you supply yourself — there is no auto-generated numbering. Use GUIDs, or any string up to 36 characters. You are responsible for keeping track of which ID is the "tip" of each chain; the tools don't remember this for you between runs.

ztbcreate - Create Your Blockchain Foundation

What it does:

Creates the genesis block - the immutable "seed" that anchors your entire blockchain.

Why you need it:

Every blockchain starts here. This 64KB file of high-entropy data becomes the root of trust. Without it, nothing else works.

When to use it:

Once, at the very beginning, before creating any blocks.

What happens:

Important: Keep this file safe and backed up! If you lose it, you can never decode your blocks again. All verification depends on this file (until a checkpoint + truncate establishes a new self-contained root).

Example:

ztbcreate selfie.jpg . A0000001-0000-4000-8000-000000000001

ztbcreate <source1> [source2] [source3] <workdir> <new_block_id>

Note: 1 to 3 source files are recommended to be JPEGs, MP3s, or some other capture of real-world physics.

ztbaddblock - Add Data to Your Chain

What it does:

Adds a new block of data to an existing chain (trunk or branch).

Why you need it:

This is how you store data on the blockchain - documents, transactions, records, anything.

When to use it:

Every time you want to add new data to your chain.

What happens:

Required arguments:

Examples:

# First block on a new trunk
ztbaddblock . MyTrunk A0000001-0000-4000-8000-000000000002 00000000-0000-0000-0000-000000000000 -t "Invoice #001"

# Second block, linked to the first
ztbaddblock . MyTrunk A0000001-0000-4000-8000-000000000003 A0000001-0000-4000-8000-000000000002 -t "Invoice #002"

# Add a file as the payload
ztbaddblock . MyTrunk A0000001-0000-4000-8000-000000000004 A0000001-0000-4000-8000-000000000003 -f contract.pdf

ztbaddbranch - Create a Parallel Chain

What it does:

Creates a new branch that splits off from any existing block — typically the current tip of a trunk.

Why you need it:

Perfect for organizing data hierarchically. Think: trunk = company, branches = departments. Or trunk = financial year, branches = accounts.

When to use it:

When you want to create a separate but linked chain of blocks.

What happens:

Examples:

# Create main company trunk
ztbaddblock . CompanyLedger B0000001-0000-4000-8000-000000000002 00000000-0000-0000-0000-000000000000 -t "2025 Books"

# Branch off for departments
ztbaddbranch . CompanyLedger Sales     B0000001-0000-4000-8000-000000000003 B0000001-0000-4000-8000-000000000002 -t "Sales Q1"
ztbaddbranch . CompanyLedger Marketing B0000001-0000-4000-8000-000000000004 B0000001-0000-4000-8000-000000000002 -t "Marketing Q1"

# Now add blocks to a branch using ztbaddblock
ztbaddblock . Sales B0000001-0000-4000-8000-000000000005 B0000001-0000-4000-8000-000000000003 -t "Sale #001"

ztbfetch - Read Your Data Back

What it does:

Retrieves and decodes a specific block by its ID.

Why you need it:

To actually read the data you stored! Blocks are ZOSCII-encoded, so you need this tool to decode them.

When to use it:

Whenever you want to see what's in a block.

What happens:

Example:

ztbfetch . A0000001-0000-4000-8000-000000000003

# Output shows:
# - Block header (block ID, prev ID, trunk ID, branch flag, block type)
# - Hash and prev-hash verification results
# - Your decoded payload

ztbverify - Prove Integrity

What it does:

Verifies that your blockchain is intact and untampered, starting at a given block.

Why you need it:

To prove your data hasn't been altered. If anyone modifies even one byte in an earlier block, verification fails as soon as that block is reached.

When to use it:

What happens:

Options:

Examples:

# Verify just one block
ztbverify . A0000001-0000-4000-8000-000000000004

# Verify the whole chain back to the start
ztbverify . A0000001-0000-4000-8000-000000000004 -walk

Result: if any block has been tampered with, verification stops and reports failure at that block.

ztbcheckpoint - Mark an Archival Boundary

What it does:

Writes a documented anchor point into the chain — a block whose only job is to carry a human-readable label, ready to be the basis of a later truncation.

Why you need it:

It's the first step in archiving old data: you mark a point in the chain, then use ztbtruncate to actually cut history off below it.

When to use it:

What happens:

Example:

ztbcheckpoint . FY2025 C0000001-0000-4000-8000-000000000004 C0000001-0000-4000-8000-000000000003 "End of financial year 2025"

ztbtruncate - Archive Old Data

What it does:

Cuts a chain's history off at a checkpoint, so everything below it can be moved to cold storage while the active chain stays fully verifiable on its own.

Why you need it:

Over time, chains grow huge. Truncation lets you archive historical data without breaking the chain above the cut point.

When to use it:

Right after you've placed a checkpoint, and before adding any further blocks above it.

What happens:

Order matters: always checkpoint, then truncate, then continue adding blocks — in that order. If you add blocks above a checkpoint before truncating, then truncate afterwards, those already-written blocks will fail verification, because truncation changes what their Rolling ROM resolves to. Truncate first, then build forward from there.

Example:

# Build to the checkpoint
ztbaddblock   . FY2025 C0000001-...0002 00000000-...-000000000000 -t "Block 1"
ztbaddblock   . FY2025 C0000001-...0003 C0000001-...0002          -t "Block 2"
ztbcheckpoint . FY2025 C0000001-...0004 C0000001-...0003          "End of FY2025"

# Truncate immediately
ztbtruncate   . C0000001-...0004

# Now keep going — new blocks build correctly on the truncated chain
ztbaddblock   . FY2026 C0000001-...0005 C0000001-...0004          "First FY2026 entry"

Real-World Workflow Example

Scenario: Accounting firm tracking invoices for separate clients

# 1. Start fresh
ztbcreate selfie.jpg . D0000001-0000-4000-8000-000000000001

# 2. Create main trunk for 2025
ztbaddblock . FY2025 D0000001-0000-4000-8000-000000000002 00000000-0000-0000-0000-000000000000 -t "Financial Year 2025"

# 3. Create branches for different clients
ztbaddbranch . FY2025 ClientA D0000001-0000-4000-8000-000000000003 D0000001-0000-4000-8000-000000000002 -t "Client A Account"
ztbaddbranch . FY2025 ClientB D0000001-0000-4000-8000-000000000004 D0000001-0000-4000-8000-000000000002 -t "Client B Account"

# 4. Add invoices to Client A
ztbaddblock . ClientA D0000001-0000-4000-8000-000000000005 D0000001-0000-4000-8000-000000000003 -t "Invoice #1001"
ztbaddblock . ClientA D0000001-0000-4000-8000-000000000006 D0000001-0000-4000-8000-000000000005 -f invoice_1002.pdf

# 5. Add an invoice to Client B
ztbaddblock . ClientB D0000001-0000-4000-8000-000000000007 D0000001-0000-4000-8000-000000000004 -t "Invoice #2001"

# 6. Retrieve a specific invoice
ztbfetch . D0000001-0000-4000-8000-000000000006

# 7. Verify everything is intact
ztbverify . D0000001-0000-4000-8000-000000000006 -walk

# 8. At year-end, checkpoint and truncate
ztbcheckpoint . FY2025 D0000001-0000-4000-8000-000000000008 D0000001-0000-4000-8000-000000000002 "End of FY2025"
ztbtruncate   . D0000001-0000-4000-8000-000000000008

# 9. Archive everything below the truncated block, keep building forward for FY2026

Key Concepts for Users

Tamperproof

If you change any byte in a block, every later block whose Rolling ROM sampled that block fails verification. The ZOSCII pointer encoding makes forgery combinatorially impossible (10^152900 combinations).

Block IDs Are Yours to Manage

There is no auto-generated numbering. Every block ID — a GUID or any string up to 36 characters — is supplied by you on the command line, and you're responsible for tracking which ID is the current "tip" of each chain between commands.

Dual-Hash Block Binding

Every block commits to two integrity hashes: a hash covering just the payload data (calculated before the data is encoded), and a hash of the previous block's complete file. The current block's hash is deliberately payload-only — it doesn't cover the header fields (block ID, previous block ID, branch info). That's intentional: keeping the hash limited to the payload means it can eventually be computed as the data streams in, rather than needing the whole block finished first. Header tampering is still caught, just by a different mechanism — the header sits within the portion of each block sampled into the Rolling ROM of later blocks, so it's protected the same combinatorial way the payload is. This dual-hash binding is a standard feature of all blocks — there are no optional modes. The first block of a chain has no predecessor; its prev-hash is zero by design.

The C command-line tools use CRC32 over the full payload as their hash algorithm. The C# reference library additionally supports a ZRollingHash algorithm and a 1KB-window variant of each, selectable per block — these are recognized but not yet computed by the C tools.

Block Types

Every block carries a block_type field in its header. The types are: Genesis (the root 64KB block), Normal (standard data — also used for branch blocks), Checkpoint (documented anchor point), Truncation (written by ztbtruncate; makes a chain self-contained without its original genesis block), Finalise (soft close marker), and Bridge (reserved).

No Decryption Needed

This isn't encryption - it's addressing. The data is encoded as pointers into the Rolling ROM. Without the exact Rolling ROM, the pointers are meaningless.

Independent Archives

Checkpoints plus truncation let you create self-contained archives that verify independently. Perfect for legal compliance, backups, and long-term storage.

Branch Organization

Use branches like folders. Trunk = main timeline, branches = parallel sub-timelines. Both verify together by walking back through the branch into the trunk.

Quick Reference

CommandPurposeExample
ztbcreateCreate genesis blockztbcreate selfie.jpg . <new_id>
ztbaddblockAdd data blockztbaddblock . chain <new_id> <prev_id> -t "text"
ztbaddbranchCreate new branchztbaddbranch . trunk branch <new_id> <prev_id> -t "text"
ztbcheckpointMark archival boundaryztbcheckpoint . chain <new_id> <prev_id> "label"
ztbtruncateArchive below checkpointztbtruncate . <checkpoint_id>
ztbfetchRead block dataztbfetch . <block_id>
ztbverifyVerify integrityztbverify . <block_id> -walk