# ionnerss/legacychain architecture

> Architecture diagram of the GitHub repository ionnerss/legacychain, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ionnerss/legacychain
- Repository: https://github.com/ionnerss/legacychain

## Overview

LegacyChain is a compact Java blockchain library, not a networked service: wallets create signed transactions, the chain validates and queues them, and mining packages them into proof-of-work blocks with transaction Merkle roots. The same chain API exposes balances and validates the ledger. This map follows the sampled runtime calls; the tree and excerpts show no separate persistence, networking, or external-service layer.

Main entry points: [`LegacyChain/src/main/java/legacychain/core/Transaction.java`](https://github.com/ionnerss/legacychain/blob/main/LegacyChain/src/main/java/legacychain/core/Transaction.java) (Transactions), [`LegacyChain/src/main/java/legacychain/core/Blockchain.java`](https://github.com/ionnerss/legacychain/blob/main/LegacyChain/src/main/java/legacychain/core/Blockchain.java) (Chain ledger), [`LegacyChain/src/main/java/legacychain/core/Block.java`](https://github.com/ionnerss/legacychain/blob/main/LegacyChain/src/main/java/legacychain/core/Block.java) (Block), [`LegacyChain/src/main/java/legacychain/crypto/HashUtil.java`](https://github.com/ionnerss/legacychain/blob/main/LegacyChain/src/main/java/legacychain/crypto/HashUtil.java) (SHA-256)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_wallets["Wallets"]
  node_wallet["Wallet keys<br/>[Wallet.java]"]
end

subgraph group_ledger["Ledger"]
  node_transaction["Transactions<br/>[Transaction.java]"]
  node_chain[("Chain ledger<br/>[Blockchain.java]")]
end

subgraph group_crypto["Cryptography"]
  node_signature["Signature verify<br/>[SignatureUtil.java]"]
  node_hash["SHA-256<br/>[HashUtil.java]"]
end

subgraph group_blocks["Blocks"]
  node_block["Block<br/>[Block.java]"]
  node_merkle["Merkle roots<br/>[MerkleUtil.java]"]
end

node_user(("Wallet user"))

node_user -->|"uses"| node_wallet
node_wallet -->|"creates signed"| node_transaction
node_transaction -->|"verifies with"| node_signature
node_transaction -->|"hashes data"| node_hash
node_user -->|"submits / queries"| node_chain
node_chain -->|"validates"| node_transaction
node_chain -->|"mines into"| node_block
node_block -->|"calculates root"| node_merkle
node_block -->|"hashes header"| node_hash
node_merkle -->|"hashes nodes"| node_hash

click node_wallet "https://github.com/ionnerss/legacychain/blob/main/LegacyChain/src/main/java/legacychain/wallet/Wallet.java"
click node_transaction "https://github.com/ionnerss/legacychain/blob/main/LegacyChain/src/main/java/legacychain/core/Transaction.java"
click node_chain "https://github.com/ionnerss/legacychain/blob/main/LegacyChain/src/main/java/legacychain/core/Blockchain.java"
click node_block "https://github.com/ionnerss/legacychain/blob/main/LegacyChain/src/main/java/legacychain/core/Block.java"
click node_merkle "https://github.com/ionnerss/legacychain/blob/main/LegacyChain/src/main/java/legacychain/merkle/MerkleUtil.java"
click node_signature "https://github.com/ionnerss/legacychain/blob/main/LegacyChain/src/main/java/legacychain/crypto/SignatureUtil.java"
click node_hash "https://github.com/ionnerss/legacychain/blob/main/LegacyChain/src/main/java/legacychain/crypto/HashUtil.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_wallet,node_user toneBlue
class node_transaction,node_chain toneAmber
class node_signature,node_hash toneMint
class node_block,node_merkle toneRose
```

## Components

### Wallets

- [Wallet keys](https://github.com/ionnerss/legacychain/blob/main/LegacyChain/src/main/java/legacychain/wallet/Wallet.java): `LegacyChain/src/main/java/legacychain/wallet/Wallet.java`

### Ledger

- [Transactions](https://github.com/ionnerss/legacychain/blob/main/LegacyChain/src/main/java/legacychain/core/Transaction.java): `LegacyChain/src/main/java/legacychain/core/Transaction.java`
- [Chain ledger](https://github.com/ionnerss/legacychain/blob/main/LegacyChain/src/main/java/legacychain/core/Blockchain.java): `LegacyChain/src/main/java/legacychain/core/Blockchain.java`

### Cryptography

- [Signature verify](https://github.com/ionnerss/legacychain/blob/main/LegacyChain/src/main/java/legacychain/crypto/SignatureUtil.java): `LegacyChain/src/main/java/legacychain/crypto/SignatureUtil.java`
- [SHA-256](https://github.com/ionnerss/legacychain/blob/main/LegacyChain/src/main/java/legacychain/crypto/HashUtil.java): `LegacyChain/src/main/java/legacychain/crypto/HashUtil.java`

### Blocks

- [Block](https://github.com/ionnerss/legacychain/blob/main/LegacyChain/src/main/java/legacychain/core/Block.java): `LegacyChain/src/main/java/legacychain/core/Block.java`
- [Merkle roots](https://github.com/ionnerss/legacychain/blob/main/LegacyChain/src/main/java/legacychain/merkle/MerkleUtil.java): `LegacyChain/src/main/java/legacychain/merkle/MerkleUtil.java`

### Other components

- **Wallet user**

## Connections

- Wallet user → Wallet keys: uses
- Wallet keys → Transactions: creates signed (evidence: `LegacyChain/src/main/java/legacychain/wallet/Wallet.java`)
- Transactions → Signature verify: verifies with (evidence: `LegacyChain/src/main/java/legacychain/core/Transaction.java`)
- Transactions → SHA-256: hashes data (evidence: `LegacyChain/src/main/java/legacychain/core/Transaction.java`)
- Wallet user → Chain ledger: submits / queries
- Chain ledger → Transactions: validates (evidence: `LegacyChain/src/main/java/legacychain/core/Blockchain.java`)
- Chain ledger → Block: mines into (evidence: `LegacyChain/src/main/java/legacychain/core/Blockchain.java`)
- Block → Merkle roots: calculates root (evidence: `LegacyChain/src/main/java/legacychain/core/Block.java`)
- Block → SHA-256: hashes header (evidence: `LegacyChain/src/main/java/legacychain/core/Block.java`)
- Merkle roots → SHA-256: hashes nodes (evidence: `LegacyChain/src/main/java/legacychain/merkle/MerkleUtil.java`)
