Giter Club home page Giter Club logo

bitfinex-node-blockchain's Introduction

Bitfinex node blockchain Challenge

Getting Started

Clone project

git clone [email protected]:blackshady/Bitfinex-node-blockchain.git

Install Project Dependencies

yarn install

Setting up the DHT

To set up the DHT, you will need to install and run Grape servers.

npm install -g grenache-grape

Start two Grape servers:

grape --dp 20001 --aph 30001 --bn '127.0.0.1:20002'
grape --dp 20002 --aph 40001 --bn '127.0.0.1:20001'

Start the exchange clients

yarn start

Implementation Details

  1. Decentralized Peer-to-Peer Communication:

    • Utilizes Grenache, a decentralized peer-to-peer framework, for communication between nodes.
    • Enables nodes to interact directly without relying on a central server, enhancing scalability and fault tolerance.
  2. Mutex Locking for Synchronization:

    • Implements mutex locking to ensure mutual exclusion when accessing and modifying shared resources, such as the order book.
    • Prevents race conditions and data inconsistencies by temporarily locking write operations during synchronization processes.
  3. Consistent Order Book Synchronization:

    • Maintains a synchronized order book across all nodes in the network.
    • Employs a synchronization mechanism to ensure that all nodes have access to the same version of the order book, facilitating consistent trading operations.
  4. Efficient Order Matching Algorithm:

    • Implements an efficient order matching algorithm for processing buy and sell orders within the order book.
    • Utilizes binary search for optimal order placement, enhancing the performance and scalability of the trading system.
  5. Graceful Shutdown Handling:

    • Implements graceful shutdown handling to ensure proper cleanup and termination of the client process.
    • Stops announcing services, releases mutex locks, and terminates the Grenache Link instance upon receiving a SIGINT signal, promoting system stability and reliability.

Known Issues

  1. Potential Deadlocks:

    • While mutex locking is implemented to prevent race conditions, there might be scenarios where deadlocks could occur if locks are not released appropriately.
  2. Limited Error Handling:

    • The codebase lacks comprehensive error handling mechanisms, especially in network communication and synchronization processes. This might lead to unexpected behavior or crashes under certain error conditions.
  3. Synchronization Performance:

    • The synchronization mechanism for maintaining a consistent order book across nodes might introduce performance bottlenecks, especially in large-scale networks or under high load conditions. Optimizations might be required to improve synchronization efficiency.
  4. Memory Management:

    • The codebase does not address memory management concerns explicitly. In long-running processes, memory leaks or excessive memory consumption could potentially occur, impacting system stability and performance.
  5. Graceful Shutdown Handling:

    • While graceful shutdown handling is implemented, there could be edge cases or race conditions where the cleanup process might not execute correctly, leading to resource leaks or incomplete shutdown procedures.
  6. Scalability Issues:

    • The current architecture might face scalability limitations, particularly in terms of handling a large number of concurrent connections or processing high-frequency trading requests. Scalability optimizations may be necessary for handling increased network traffic.
  7. Documentation and Testing:

    • The codebase lacks comprehensive documentation and testing.

bitfinex-node-blockchain's People

Contributors

blackshady avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.