Skip to content

sujay170nanj/distributed-banking-transactions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Distributed Banking System

A distributed banking system implementing two-phase commit (2PC) protocol and timestamp ordering for managing concurrent transactions across multiple server branches.

Overview

This system implements a distributed banking application where multiple server branches coordinate to handle client transactions consistently. It features:

  • Two-Phase Commit (2PC) protocol for distributed transaction management
  • Timestamp ordering for concurrent transaction handling
  • Support for multiple concurrent clients
  • Fault tolerance and transaction rollback capabilities

Architecture

The system consists of two main components:

Server

  • Implements branch coordination and transaction processing
  • Handles client connections and inter-server communication
  • Maintains account balances and transaction states
  • Supports deposit, withdraw, and balance query operations
  • Uses timestamp ordering for serializable transaction execution

Client

  • Connects to a randomly selected coordinator server
  • Sends transaction requests in a defined format
  • Handles responses and transaction status updates
  • Supports interactive command input

Supported Operations

  1. DEPOSIT <branch>.<account> <amount> - Add funds to an account
  2. WITHDRAW <branch>.<account> <amount> - Remove funds from an account
  3. BALANCE <branch>.<account> - Query account balance
  4. COMMIT - Commit a transaction
  5. ABORT - Abort and rollback a transaction

Setup and Usage

  1. Start the server branches:
go run server/server.go <branch-name> <config-file>
  1. Start a client:
go run client/client.go <client-id> <config-file>
  1. Begin a transaction by typing "BEGIN"
  2. Enter transaction commands and end with "COMMIT" or "ABORT"

Configuration

The system requires a config file specifying server branch details:

<branch> <hostname> <port>

A localhost 1111
B localhost 2222 
C localhost 3333

Error Handling

The system handles various error conditions:

  • Network failures
  • Invalid transactions
  • Concurrent access conflicts
  • Account not found
  • Insufficient funds

About

A distributed banking system implementing two-phase commit (2PC) protocol and timestamp ordering for managing concurrent transactions across multiple server branches.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors