Skip to content

DaveBank is a distributed banking system built in Python as part of a level 4 university module (CSC4010: Parallel and Distributed Programming). It demonstrates peer-to-peer networking, replication, and fault tolerance—without using external distributed systems frameworks. Includes a simple API and GUI for node interaction.

License

Notifications You must be signed in to change notification settings

BHarris02/DaveBank

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DaveBank Distributed Banking System

Project Overview

DaveBank is a distributed banking system built from scratch using Python as part of CSC4010: Parallel and Distributed Programming. The project demonstrates the fundamental concepts of distributed and parallel programming without use of dedicated distributed systems libraries or frameworks.

  • Unique Aspect: All core mechanisms — networking, consensus, data replication, node discovery, file sharing — are implemented using Python's standard libraries.

  • Goal: To simulate a robust, fault-tolerant banking platform in a peer-to-peer (P2P) network.


Table of Contents


Features

  • P2P node network (UDP communication, node discovery)
  • Account creation, storage, and replication across nodes
  • Transaction processing (deposits & withdrawals) and distribution
  • Super Node management and fail-over
  • File sharing for binary data (transaction "attachments")
  • Custom distributed index for lookup, routing, and recovery
  • Fault tolerance: Node failures, recovery, and heartbeat monitoring
  • RESTful API via Flask
  • Data import/export from CSV, JSON, XML
  • Simple HTML UI (for demonstration)

Technologies Used

  • Python 3
  • Flask
  • Jinja2
  • Standard Libraries:
    socket
    threading
    uuid
    pickle
    json
    xml
    csv
  • get_free_port

Project Structure

DaveBank/
    api/
        __init__.py
        factory.py
        routes.py
    data/
        ...complex data files...
    davebank/
        adapters/       #adapter pattern used for handling complex data
        core/           #core functionality for the node class
        utils/
        __init.__.py
        node.py         #base node class - core functionality is "monkey-patched"
    files/              #binary (.bin) files outputted by the system
    gui/
        __init__.py
        gui_utils.py
        node_gui.py
    tests/
    web/
        static/
        styles/
        templates/
    davebot.py
    main.py
    requirements.txt


How it Works

  • Every node runs its own server (UDP socket) and can join, discover, and synchronize with other nodes.
  • Supernodes provide global coordination, handle node failure detection (heartbeats), and act as recovery points.
  • All accounts and transactions are distributed and replicated across nodes for reliability.
  • The system supports recovery from node loss and simulates realistic distributed failure scenarios.

How to Run

Disclaimer: This project was created for academic purposes. It is not actively maintained and may require additional setup depending on your environment.

Steps:

  1. Clone the Repository:
git clone https://gitlab.com/BHarris02/davebank.git
cd davebank
  1. Install Dependencies:
pip install -r requirements.txt
  1. Run a Server Node:
python main.py server 127.0.0.1 5001 SuperNode --gui
  1. Run a Client Node:
python main.py client 127.0.0.1 5002 Worker1 --target_host 127.0.0.1 --target_port 5001 --gui
  • Each Client node must use a unique port and name
  1. (Optional) Run additional Client Nodes to simulate the distributed network.

  2. Access the REST API:

http://localhost:8080/

Note:

  • Depending on your system, you may need to change default ports if they are already in use. This project was last tested on Windows 10, Python 3.11.

Example API Usage:

Get account balance:

GET /accounts/<account_num>/balance

Get transactions:

GET /transactions/<account_num>

Post transaction:

POST /transactions/
Content-Type: application/json

{
  "account_num": "12345678",
  "transaction_type": "deposit",
  "amount": 100.0
}

Documentation

Comprehensive documentation and supporting materials for this project are included in the Docs directory:

  • Assignment Specification: The assignment specification outlining the requirements of the project (Assignment Specification).
  • Assignment Submission: Full academic report detailing how the system works, how each feature is implemented, etc (Assignment Submission).
  • Assignment Feedback: General class-wide and my specific feedback (Assignment Feedback).

License

This project is licensed under the MIT License. See LICENSE for details


Contact

If you have any questions or would like to discuss this project, feel free to contact me:

About

DaveBank is a distributed banking system built in Python as part of a level 4 university module (CSC4010: Parallel and Distributed Programming). It demonstrates peer-to-peer networking, replication, and fault tolerance—without using external distributed systems frameworks. Includes a simple API and GUI for node interaction.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published