# mawaaw/blockchain-example architecture

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

- Interactive diagram: https://gitdiagram.com/mawaaw/blockchain-example
- Repository: https://github.com/mawaaw/blockchain-example

## Overview

NoobChain is a small educational Java blockchain demo: its entry point builds and mines three local blocks, validates their hashes and links, then prints the chain as JSON. Block stores block data and performs proof of work; StringUtil provides hashing and formatting helpers. The excerpts show these calls, but also reveal a spelling mismatch: Block calls getDificultyString while StringUtil defines getDifficultyString, so that mining dependency is shown as unverified.

Main entry points: [`NoobChain.java`](https://github.com/mawaaw/blockchain-example/blob/master/NoobChain.java) (Chain demo), [`Block.java`](https://github.com/mawaaw/blockchain-example/blob/master/Block.java) (Block and mining), [`StringUtil.java`](https://github.com/mawaaw/blockchain-example/blob/master/StringUtil.java) (Hash and JSON helpers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_demo["Demo"]
  node_noobchain["Chain demo<br/>[NoobChain.java]"]
end

subgraph group_chain["Blockchain"]
  node_block["Block and mining<br/>[Block.java]"]
end

subgraph group_helpers["Utilities"]
  node_stringutil["Hash and JSON helpers<br/>[StringUtil.java]"]
end

node_runner(("Demo runner"))

node_runner -->|"runs"| node_noobchain
node_noobchain -->|"creates and mines"| node_block
node_noobchain -->|"validates hashes"| node_block
node_block -->|"hashes data"| node_stringutil
node_block -.->|"requests target"| node_stringutil
node_noobchain -->|"formats output"| node_stringutil
node_noobchain -->|"gets difficulty"| node_stringutil

click node_noobchain "https://github.com/mawaaw/blockchain-example/blob/master/NoobChain.java"
click node_block "https://github.com/mawaaw/blockchain-example/blob/master/Block.java"
click node_stringutil "https://github.com/mawaaw/blockchain-example/blob/master/StringUtil.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_noobchain toneBlue
class node_block toneAmber
class node_stringutil toneMint
class node_runner toneIndigo
```

## Components

### Demo

- [Chain demo](https://github.com/mawaaw/blockchain-example/blob/master/NoobChain.java): `NoobChain.java`

### Blockchain

- [Block and mining](https://github.com/mawaaw/blockchain-example/blob/master/Block.java): `Block.java`

### Utilities

- [Hash and JSON helpers](https://github.com/mawaaw/blockchain-example/blob/master/StringUtil.java): `StringUtil.java`

### Other components

- **Demo runner**

## Connections

- Demo runner → Chain demo: runs (evidence: `README.md`)
- Chain demo → Block and mining: creates and mines (evidence: `NoobChain.java`)
- Chain demo → Block and mining: validates hashes (evidence: `NoobChain.java`)
- Block and mining → Hash and JSON helpers: hashes data (evidence: `Block.java`)
- Block and mining → Hash and JSON helpers: requests target (evidence: `Block.java`)
- Chain demo → Hash and JSON helpers: formats output (evidence: `NoobChain.java`)
- Chain demo → Hash and JSON helpers: gets difficulty (evidence: `NoobChain.java`)
