Skip to content

[FEATURE]: Define Canonical Serialization Format for Blocks and Transactions #2

@dhruvi-16-me

Description

@dhruvi-16-me

Feature and its Use Cases

📄 Description

MiniChain aims to be a minimal, research-oriented blockchain implemented in Python using:

  • PyNaCl for hashing and digital signatures
  • Py-libp2p for peer-to-peer networking
  • An account-based ledger model
  • Proof-of-Work consensus

Before implementation of the core prototype progresses further, it may be helpful to formally define a canonical serialization format for both transactions and blocks.

Why This Matters

For consensus safety and determinism across nodes:

  • All nodes must hash the exact same byte representation of a transaction or block
  • Signature verification must operate on a deterministic byte format
  • Different Python versions must not produce different hashes
  • Serialization must not rely on str(obj) or unordered dictionaries

Without canonical serialization, two honest nodes could compute different hashes for the same logical block, potentially breaking consensus.

Suggested Direction

Define deterministic serialization early in the design process and document:

  • Transaction byte structure
  • Block header byte structure
  • Exact fields included in hashing
  • Fields excluded from hashing (e.g., block hash field itself)

Establishing this early would improve clarity, reproducibility, and align with MiniChain’s goal of being a clean research benchmark.

Additional Context

No response

Code of Conduct

  • I have joined the Discord server and will post updates there
  • I have searched existing issues to avoid duplicates

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions