Skip to content

[FEATURE]: MiniChain – Account-Based Proof-of-Work Blockchain Core Prototype #1

@aniket866

Description

@aniket866

Feature and its Use Cases

1. Project Goal

  • Build a minimal, fully functional blockchain in Python

Core Features

  1. Account-Based Ledger
  • Use accounts model (not UTXO)

  • Each account has:

    a. Address (public key)
    
    b. Balance
    
    c. Nonce
    
    d. Transactions:
    
    e. Signed using PyNaCl
    
    f. Verified before execution
    
    g. Prevent negative balances
    
    h. Prevent replay using nonce
    

3. State Transition Logic

  • A simple function:

  • new_state = apply_tx(state, tx)

Block validation:

  • Verify signatures

  • Apply transactions sequentially

  • Check invariants (balance ≥ 0, correct nonce)

  • Deterministic state update

4. Block Structure

  • Minimal block fields:

  • Previous block hash

  • List of transactions

  • Nonce

  • Difficulty

  • Timestamp

  • Block hash

5. Proof of Work (Consensus)

6. Mempool

  • Store pending valid transactions

  • Remove transactions once included in a block

  • Reject invalid or duplicate transactions

7. Peer-to-Peer Networking

  • Use Py-libp2p

Broadcast:

  • Transactions

  • New blocks

  • Sync chain between peers

  • Bonus Feature

8. Smart Contracts (Optional)

  • Use Python as contract language

  • Execute in a controlled/sandboxed environment

Basic Project Structure (Minimal)

minichain/
│
├── blockchain.py      # Block & chain logic
├── state.py           # Accounts & state transition
├── transaction.py     # Transaction structure & signing
├── consensus.py       # Proof of Work
├── mempool.py         # Pending transactions
├── network.py         # P2P logic
└── main.py            # Node entry point

Additional Context

hi @Zahnentferner can we start with the above propsed structure and prototype?
Please feel free to assign

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