Skip to content

Conversation

Shradhesh71
Copy link

This PR introduces the foundational architecture and code for a simplified Bitcoin‑style network, built on a UTXO model. It establishes four core services—central server, miner server, fund (faucet) server, and wallet server—as well as a Next.js frontend to interact with the network.

Key Components

  1. Central WebSocket Server (central-server/)

    • Manages peer connections via WebSocket
    • Relays block and transaction messages between all miners
    • Tracks the canonical blockchain height and broadcasts chain reorgs
  2. Miner Server (miner-server/)

    • Mines new blocks using proof‑of‑work (adjustable difficulty)

    • Validates incoming blocks and transactions:

      • Verifies digital signatures
      • Checks UTXO existence and balances
      • Rejects orphaned or smaller chains
    • Syncs with central server on startup to catch up to the latest chain tip

    • Broadcasts newly mined blocks back to the central server

  3. Fund (Faucet) Server (faucet-server/)

    • Dispenses small test‐net coins via a simple “claim” API
    • Records UTXOs for faucet payouts
    • Prevents double‐claims through rate‑limiting per wallet address
  4. Wallet Server (wallet-server/)

    • Exposes REST endpoints to:

      • Create and manage local keypairs (Bitcoin‑style WIF)
      • Build and sign UTXO transactions
      • Query balance by scanning UTXO set from central server
    • Submits signed transactions to the network via the central server

  5. Next.js Frontend (wallet-ui/)

    • User interface for:

      • Generating a new BTC‑style wallet (seed & address)
      • Displaying current UTXO balance and transaction history
      • Creating, signing, and broadcasting transactions
      • Claiming from the faucet and viewing airdrop events
    • Connects to wallet server over REST and listens to block events via WebSocket


Installation & Running Locally

  1. Clone & Install

    git clone https://github.com/shradhesh71/request-for-code
    cd request-for-code
    cd rfc-1
    ./start-all.sh
    • Visit http://localhost:3000 to access the wallet interface.

Testing

  • Block Propagation:

    1. Mine a block on one miner; ensure it appears on all connected miners.
  • UTXO Validation:

    1. Send a transaction from Wallet A to Wallet B; confirm UTXO is created/consumed properly.
  • Faucet Rate Limit:

    1. Claim coins multiple times; verify rate‑limit enforcement.
  • Chain Reorg Handling:

    1. Simulate conflicting chains with different lengths; verify that miners adopt the longest valid chain.

Next Steps

  • Add automated tests for consensus rules and wallet operations
  • Implement transaction mempool with fee prioritization
  • Enhance UI with real‑time block & mempool status
  • Deploy to a cloud environment with Docker and Kubernetes manifests

Merging this PR will lay the groundwork for all subsequent feature development, including advanced transaction types, peer discovery, and production‑grade security improvements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant