Skip to content

nlkeung/blockchain_payment_system

Repository files navigation

Beautiful Venmo

By: Christine Dong, Divya Ramesh, Katherine Francke, Nicholas Keung

Overview

This project, [Beautiful Venmo], is a decentralized communal ledger for tracking debts and payments. It establishes a peer-to-peer network (P2P) to record and secure transactions on a blockchain. Users can submit payments and requests on the application which will then be securely stored on the blockchain.

Separate peer nodes are responsible for storing and updating the blockchain with new transactions. When a peer successfully adds new transactions and blocks, it is responsible for broadcasting this change to the other peers. The other peers then verify that this is a valid update and update their own copy of the ledger. Under this decentralized system, each peer is able to maintain its own record of past transactions, making it difficult for a bad actor to tamper with the ledger because there is no single point of failure.

There are three main layers in this system:

  • Application Layer: application interface with endpoints and UI where users can send money and view their balances
  • Blockchain Layer (blockchain.py, block.py, transaction.py): handles the logic for blocks and transactions, including validating history, signature verification, etc.
  • P2P Network Layer (peer.py, tracker.py, utils.py): the decentralized network of nodes (peers) that talk to one another and mine blocks, along with a tracker that helps nodes find each other.

How to Run:

Web App:

  1. Activate virtual environment. Make sure FastAPI is installed pip install fastapi uvicorn jinja2
  2. Start Tracker node. Run python tracker.py 50000
  3. Start at least one instance of Peer
    • First instance: python peer.py 127.0.0.1 50001 127.0.0.1 50000 --init_balance
  4. Start application. Run uvicorn endpoints:app
  5. Open http://127.0.0.1:8000
    • To see updates as users interact with each other, open additional tabs with url: http://127.0.0.1:8000/?user=<username>
  6. Add more peers. Run python peer.py [peer_addr] [peer_port] 127.0.0.1 50000
    • Ex. If run locally: python peer.py 127.0.0.1 50002 127.0.0.1 50000
    • Repeat to add more peers: python peer.py 127.0.0.1 50003 127.0.0.1 50000

AI Assistance

Unit tests were generated using Claude Code, and were used to verify block.py, blockchain.py, tracker.py, peer.py, and utils.py. All tests were reviewed and validated by the team.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors