# riyanda-s/blockchain-technology architecture

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

- Interactive diagram: https://gitdiagram.com/riyanda-s/blockchain-technology
- Repository: https://github.com/riyanda-s/blockchain-technology

## Overview

This repository contains several independent blockchain exercises rather than one integrated product: a Flask-based proof-of-work node, two similar in-memory Python chain prototypes, and a CourseReward smart contract with deployment and interaction scripts. The main user workflows are submitting transactions and mining/synchronizing blocks, or deploying the reward contract, managing student eligibility, and claiming tiered rewards. Solidity implementation details are unsampled, so its internal behavior is represented only at the level evidenced by the interaction script.

Main entry points: [`task-1/blockchain-1.py`](https://github.com/riyanda-s/blockchain-technology/blob/master/task-1/blockchain-1.py) (HTTP Routes), [`task-2/scripts/interact.js`](https://github.com/riyanda-s/blockchain-technology/blob/master/task-2/scripts/interact.js) (Reward Interaction), [`task-2/scripts/deploy.js`](https://github.com/riyanda-s/blockchain-technology/blob/master/task-2/scripts/deploy.js) (Deployment Script), [`task-1/blockchain.py`](https://github.com/riyanda-s/blockchain-technology/blob/master/task-1/blockchain.py) (Chain Prototype)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_node_api["Blockchain API"]
  node_flask_routes["HTTP Routes<br/>[blockchain-1.py]"]
  node_node_chain["Chain Engine<br/>[blockchain-1.py]"]
  node_peer_sync["Peer Synchronization<br/>[blockchain-1.py]"]
end

subgraph group_python_prototypes["Python Prototypes"]
  node_prototype_chain["Chain Prototype<br/>[blockchain.py]"]
  node_template_chain["Template Chain<br/>[template.py]"]
end

subgraph group_reward_contract["Course Rewards"]
  node_deploy_script["Deployment Script<br/>[deploy.js]"]
  node_reward_contract["Reward Contract<br/>[CourseReward.sol]"]
  node_interact_script["Reward Interaction<br/>[interact.js]"]
end

node_api_user(("API Client"))
node_peer_nodes(("Peer Nodes"))
node_reward_owner(("Contract Owner"))
node_students(("Students"))
node_evm_network[("EVM Network")]

node_api_user -->|"calls endpoints"| node_flask_routes
node_flask_routes -->|"handles transactions"| node_node_chain
node_flask_routes -->|"mines blocks"| node_node_chain
node_flask_routes -->|"requests sync"| node_peer_sync
node_peer_sync -->|"fetches chains"| node_peer_nodes
node_peer_sync -->|"replaces chain"| node_node_chain
node_deploy_script -->|"deploys"| node_reward_contract
node_deploy_script -->|"submits deployment"| node_evm_network
node_reward_owner -->|"uses workflow"| node_interact_script
node_students -->|"uses workflow"| node_interact_script
node_interact_script -->|"reads and updates"| node_reward_contract
node_interact_script -.->|"sends transactions"| node_evm_network
node_prototype_chain -->|"mines pending"| node_prototype_chain
node_template_chain -->|"mines pending"| node_template_chain

click node_flask_routes "https://github.com/riyanda-s/blockchain-technology/blob/master/task-1/blockchain-1.py"
click node_node_chain "https://github.com/riyanda-s/blockchain-technology/blob/master/task-1/blockchain-1.py"
click node_peer_sync "https://github.com/riyanda-s/blockchain-technology/blob/master/task-1/blockchain-1.py"
click node_prototype_chain "https://github.com/riyanda-s/blockchain-technology/blob/master/task-1/blockchain.py"
click node_template_chain "https://github.com/riyanda-s/blockchain-technology/blob/master/template.py"
click node_deploy_script "https://github.com/riyanda-s/blockchain-technology/blob/master/task-2/scripts/deploy.js"
click node_reward_contract "https://github.com/riyanda-s/blockchain-technology/blob/master/task-2/contracts/CourseReward.sol"
click node_interact_script "https://github.com/riyanda-s/blockchain-technology/blob/master/task-2/scripts/interact.js"

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_flask_routes,node_node_chain,node_peer_sync,node_api_user toneBlue
class node_prototype_chain,node_template_chain,node_evm_network toneAmber
class node_deploy_script,node_reward_contract,node_interact_script toneMint
class node_peer_nodes,node_reward_owner,node_students toneIndigo
```

## Components

### Blockchain API

- [HTTP Routes](https://github.com/riyanda-s/blockchain-technology/blob/master/task-1/blockchain-1.py): `task-1/blockchain-1.py`
- [Chain Engine](https://github.com/riyanda-s/blockchain-technology/blob/master/task-1/blockchain-1.py): `task-1/blockchain-1.py`
- [Peer Synchronization](https://github.com/riyanda-s/blockchain-technology/blob/master/task-1/blockchain-1.py): `task-1/blockchain-1.py`

### Python Prototypes

- [Chain Prototype](https://github.com/riyanda-s/blockchain-technology/blob/master/task-1/blockchain.py): `task-1/blockchain.py`
- [Template Chain](https://github.com/riyanda-s/blockchain-technology/blob/master/template.py): `template.py`

### Course Rewards

- [Deployment Script](https://github.com/riyanda-s/blockchain-technology/blob/master/task-2/scripts/deploy.js): `task-2/scripts/deploy.js`
- [Reward Contract](https://github.com/riyanda-s/blockchain-technology/blob/master/task-2/contracts/CourseReward.sol): `task-2/contracts/CourseReward.sol`
- [Reward Interaction](https://github.com/riyanda-s/blockchain-technology/blob/master/task-2/scripts/interact.js): `task-2/scripts/interact.js`

### Other components

- **API Client**
- **Peer Nodes**
- **Contract Owner**
- **Students**
- **EVM Network**

## Connections

- API Client → HTTP Routes: calls endpoints (evidence: `task-1/blockchain-1.py`)
- HTTP Routes → Chain Engine: handles transactions (evidence: `task-1/blockchain-1.py`)
- HTTP Routes → Chain Engine: mines blocks (evidence: `task-1/blockchain-1.py`)
- HTTP Routes → Peer Synchronization: requests sync (evidence: `task-1/blockchain-1.py`)
- Peer Synchronization → Peer Nodes: fetches chains (evidence: `task-1/blockchain-1.py`)
- Peer Synchronization → Chain Engine: replaces chain (evidence: `task-1/blockchain-1.py`)
- Deployment Script → Reward Contract: deploys (evidence: `task-2/scripts/deploy.js`)
- Deployment Script → EVM Network: submits deployment (evidence: `task-2/scripts/deploy.js`)
- Contract Owner → Reward Interaction: uses workflow (evidence: `task-2/scripts/interact.js`)
- Students → Reward Interaction: uses workflow (evidence: `task-2/scripts/interact.js`)
- Reward Interaction → Reward Contract: reads and updates (evidence: `task-2/scripts/interact.js`)
- Reward Interaction → EVM Network: sends transactions
- Chain Prototype → Chain Prototype: mines pending (evidence: `task-1/blockchain.py`)
- Template Chain → Template Chain: mines pending (evidence: `template.py`)
