Skip to content

Latest commit

ย 

History

82 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

NeoZorKDEXArb - DEX Arbitrage Scanner

C++ CMake License Platform Tests Version

A high-performance C++ console application for scanning, analyzing, and identifying arbitrage opportunities across decentralized exchanges (DEX) on multiple blockchains.

๐Ÿš€ Features

  • Multi-Blockchain Support: Ethereum, BSC, Polygon, Fantom, Avalanche, Solana
  • DEX Discovery: Automatic detection of factory contracts and pools
  • Real-time Scanning: Multithreaded blockchain scanning with configurable ranges
  • Free RPC Integration: Uses only free, public RPC endpoints
  • Cross-platform: Windows, Linux, and macOS support
  • Performance Monitoring: Built-in statistics and performance metrics
  • Configuration Management: JSON-based configuration with automatic setup
  • Comprehensive Testing: 100% test coverage with 3 test suites (18+ tests)

๐Ÿ“‹ Prerequisites

  • C++20 compatible compiler (GCC 10+, Clang 12+, MSVC 2022+)
  • CMake 3.16 or higher
  • libcurl development libraries
  • Google Test framework for C++ testing

Quick Install Dependencies

Ubuntu/Debian:

sudo apt install build-essential cmake libcurl4-openssl-dev

macOS:

brew install cmake curl

Windows:

# Using vcpkg
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg && ./bootstrap-vcpkg.bat
./vcpkg install curl:x64-windows

๐Ÿ› ๏ธ Building

Using Container Runners (Recommended for Development)

The project includes container runners for different environments:

# Make scripts executable
chmod +x scripts/containers/*.sh

# Run in Alpine Linux (lightweight)
./scripts/containers/run-alpine-simple.sh

# Run in Ubuntu Linux (full compatibility)
./scripts/containers/run-ubuntu-container.sh

# Run Windows apps in Ubuntu via Wine
./scripts/containers/run-windows-in-ubuntu-wine.sh --create

# Show help for any runner
./scripts/containers/run-ubuntu-container.sh --help

Using CMake (Traditional)

git clone <repository-url>
cd DEXArb
mkdir build && cd build
cmake ..
cmake --build . --config Release
# Binary will be created in build/bin/NeoZorKDEXArb

๐Ÿงช Testing

The project includes comprehensive C++ unit tests using Google Test framework with 100% success rate:

# Build and run all tests
mkdir cmake-build-debug && cd cmake-build-debug
cmake -G "Unix Makefiles" ..
make -j$(sysctl -n hw.ncpu)  # macOS
# or
make -j$(nproc)              # Linux

# Run all tests
ctest --output-on-failure

# Run individual test suites
./NeoZorKDEXArbTests        # Basic functionality tests
./ModernResultTests          # Modern Result<T,E> class tests  
./ModernFormatTests          # Formatting utilities tests

Test Results

  • Total Test Suites: 3
  • Total Tests: 18+
  • Success Rate: 100%
  • Execution Time: <0.01 seconds
  • Coverage: Modern utilities, core functionality, error handling

Using Build Scripts (Recommended)

The project includes organized build scripts in the scripts/ directory:

# Make scripts executable
chmod +x scripts/**/*.sh

# Modern build (recommended)
./scripts/build/build-modern.sh

# Multi-platform build
./scripts/build/build-multi-platform.sh

# Apple Silicon container build
./scripts/build/build-apple-container.sh

# Basic CMake build
./scripts/build/cmake.sh

Using Container Scripts

For containerized development:

# Run in lightweight Alpine container (recommended)
./scripts/containers/run-alpine-simple.sh -- --help

# Quick testing
./scripts/testing/quick-test.sh

# Deploy binaries
./scripts/deployment/DeployBins.sh

Scripts Directory Structure:

  • scripts/build/ - Build and compilation scripts
  • scripts/containers/ - Container management scripts
  • scripts/docker/ - Docker files and configurations
  • scripts/testing/ - Testing and validation scripts
  • scripts/deployment/ - Deployment automation
  • scripts/utilities/ - Utility and helper scripts

See scripts/README.md for detailed usage information.

๐ŸŽฏ Usage

Basic Commands

# Scan Ethereum for DEXes (last 10,000 blocks)
./NeoZorKDEXArb -scan ethereum 10000

# Show discovered DEXes
./NeoZorKDEXArb -showDEXES ethereum

# Show pools for a specific DEX
./NeoZorKDEXArb -showPOOLS ethereum 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f

# Find a specific token
./NeoZorKDEXArb -findTOKEN ethereum 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f 0xA0b86a33E6441b8C4C8C8C8C8C8C8C8C8C8C8C8C8

Supported Blockchains

Blockchain Command Example
Ethereum ethereum ./NeoZorKDEXArb -scan ethereum 5000
Binance Smart Chain bsc ./NeoZorKDEXArb -scan bsc 5000
Polygon polygon ./NeoZorKDEXArb -scan polygon 5000
Fantom fantom ./NeoZorKDEXArb -scan fantom 5000
Avalanche avalanche ./NeoZorKDEXArb -scan avalanche 5000
Solana solana ./NeoZorKDEXArb -showSCAN-CONFIG solana

Available Flags

Flag Description Example
-scan Scan blockchain for DEXes -scan ethereum 10000
-showDEXES Show all discovered DEXes -showDEXES ethereum
-showPOOLS Show pools for a DEX -showPOOLS ethereum 0x...
-showTOKENS Show tokens for a DEX -showTOKENS ethereum 0x...
-findTOKEN Find token in a DEX -findTOKEN ethereum 0x... 0x...
-findTOKENS Find token across all DEXes -findTOKENS ethereum 0x...
-showSCAN-CONFIG Show scan configuration -showSCAN-CONFIG ethereum
-showSCAN Show scan results -showSCAN ethereum
-showSCAN-STAT Show scan statistics -showSCAN-STAT ethereum

โš™๏ธ Configuration

The application automatically creates a neozork-config file on first run:

{
  "threads": 3,
  "ethereum": {
    "rpc_endpoints": [
      {"url": "https://rpc.ankr.com/eth", "request_limit": 20},
      {"url": "https://eth.llamarpc.com", "request_limit": 25}
    ],
    "dex": []
  }
}

Configuration Options

  • threads: Number of parallel threads for scanning
  • rpc_endpoints: Array of RPC endpoints with rate limits
  • dex: Automatically populated with discovered DEX information

๐Ÿ“Š Output Files

  • neozork-config: Configuration and discovered DEX data
  • neozork-scan-stat: Performance statistics and metrics
  • Console Output: Color-coded real-time information

๐Ÿ”ง Performance Optimization

Thread Count Recommendations

CPU Cores Recommended Threads
4-core 3-4 threads
8-core 6-8 threads
16+ core 8-12 threads

Block Range Guidelines

  • Small scans (1,000-10,000): Quick testing
  • Medium scans (10,000-100,000): Good discovery
  • Large scans (100,000+): Comprehensive analysis

๐Ÿ—๏ธ Project Structure

DEXArb/
โ”œโ”€โ”€ bin/                    # Compiled binaries
โ”œโ”€โ”€ include/               # Header files
โ”œโ”€โ”€ src/                   # Source files
โ”œโ”€โ”€ docs/                  # Documentation
โ”œโ”€โ”€ CMakeLists.txt         # Build configuration
โ””โ”€โ”€ README.md             # This file

๐Ÿ“š Documentation

๐Ÿšง Current Limitations

  • Solana Support: Limited to configuration display
  • Arbitrage Execution: Core logic implemented as stubs
  • Wallet Integration: Placeholder functions
  • Profit Analysis: Basic implementation

๐Ÿ”’ Security

  • Read-only Operations: All blockchain operations are read-only
  • No Private Keys: Application doesn't handle private keys
  • Free RPC Only: Uses only free, public RPC endpoints
  • Rate Limiting: Built-in protection against RPC rate limits

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ†˜ Support

For issues and questions:

  1. Check the troubleshooting section
  2. Review the configuration file
  3. Verify RPC endpoint availability
  4. Check system resources and network connectivity

๐Ÿ”ฎ Roadmap

  • Complete arbitrage execution functionality
  • Enhanced Solana support
  • Wallet integration for automated trading
  • Advanced profit analysis and risk management
  • Web interface for data visualization
  • Real-time monitoring and alerts

Version: 1.0.7
Last Updated: March 2025
Author: Rostyslav S.

About

C++23 market-data / opportunity-detection research: low-latency scan architecture for cross-venue inefficiencies (DEX as a case study, not a crypto-only identity).

Topics

Resources

Security policy

Stars

6 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages