How batistedecat/bapicoin-blockchain- works
BapiCoin is an educational blockchain with a Streamlit interface and a Flask REST node. Users submit transactions to a pending pool, mine blocks that include those transactions and a reward, and inspect the chain. Nodes can register peers and replace their chain when a longer valid chain is found. The graph reflects the sampled Python code and README; peer-chain retrieval is documented and implemented, but deployment wiring for the Streamlit app is not established by the repository.
Main entry points: bapicoin.py Blockchain instance · streamlit_interface.py Streamlit controls
Components 15
Streamlit interface
- Streamlit controls
streamlit_interface.py
REST API
- Chain endpoint
bapicoin.py - Transaction endpoint
bapicoin.py - Mining endpoint
bapicoin.py - Registration endpoint
bapicoin.py - Resolution endpoint
bapicoin.py
Blockchain core
- Blockchain instance
bapicoin.py - Transaction pool
bapicoin.py - In-memory chain
bapicoin.py - Proof of Work
bapicoin.py - Block hashing
bapicoin.py - Chain validation
bapicoin.py
Peer network
- Peer registry
bapicoin.py - Registered peer nodes
Other components
- User
Connections 25
- User → Streamlit controls: interacts
- Streamlit controls → Chain endpoint: GET chain
- Streamlit controls → Transaction endpoint: POST transaction
- Streamlit controls → Mining endpoint: GET mine
- Chain endpoint → In-memory chain: reads
- Transaction endpoint → Blockchain instance: adds transaction
- Blockchain instance → Transaction pool: queues
- Mining endpoint → Blockchain instance: reads last block
- Mining endpoint → Proof of Work: finds proof
- Proof of Work → Block hashing: checks proof
- Mining endpoint → Blockchain instance: adds reward
- Mining endpoint → Block hashing: hashes previous block
- Mining endpoint → Blockchain instance: forges block
- Blockchain instance → Transaction pool: takes pending transactions
- Blockchain instance → In-memory chain: appends block
- Registration endpoint → Blockchain instance: registers nodes
- Blockchain instance → Peer registry: stores addresses
- Resolution endpoint → Blockchain instance: resolves conflicts
- Blockchain instance → Peer registry: reads peers
- Blockchain instance → Registered peer nodes: requests chain
- Registered peer nodes → Blockchain instance: returns chain data
- Blockchain instance → Chain validation: checks candidate
- Chain validation → Block hashing: checks links
- Chain validation → Proof of Work: checks proofs
- Blockchain instance → In-memory chain: replaces chain