Skip to content

PHP blockchain: PoS consensus, EVM-compatible smart contracts, advanced synchronization (Fast/Light/Checkpoint), secp256k1 cryptography, mobile-optimized with 10x sync speed improvement.

License

Notifications You must be signed in to change notification settings

infosave2007/phpblockchain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ PHP Blockchain Platform

PHP Version License Version

A professional blockchain platform built with PHP 8+, featuring Proof of Stake consensus, smart contracts, advanced synchronization systems, enterprise security, and comprehensive web dashboard.

✨ Key Features

πŸ”— Core Blockchain

  • Proof of Stake Consensus - Energy-efficient consensus mechanism
  • Smart Contracts - EVM-compatible virtual machine
  • Advanced Cryptography - secp256k1, ECDSA, Keccak-256
  • High Performance - 1000+ transactions per second

πŸ–₯️ Web Interface & Management

  • Node Dashboard - Real-time health monitoring and statistics
  • Web Explorer - Built-in blockchain explorer with search
  • Wallet Interface - Complete wallet management system
  • API Documentation - Interactive API documentation page
  • Multi-language Support - English and Russian interface

⚑ Advanced Synchronization

  • Network Sync - Automated network synchronization
  • Recovery System - Automatic blockchain recovery tools
  • Node Management - Multi-node network coordination
  • Health Monitoring - Real-time node health checks

πŸ’± Decentralized Exchange (DEX)

  • Uniswap V2 Protocol - Complete decentralized exchange integration
  • AMM Calculations - Automated market maker for token swaps
  • Liquidity Pools - Create and manage token liquidity pairs
  • DEX API Suite - 14 comprehensive API endpoints for DEX operations
  • Smart Contract Integration - Factory and Router contract deployment

πŸ›‘οΈ Enterprise Security

  • Hardware Security Module - Professional key management
  • Multi-signature Support - Enhanced transaction security
  • Rate Limiting - DDoS protection
  • Secure Storage - AES-256 encryption

πŸ”§ Developer Tools

  • RESTful API - Complete blockchain interaction API
  • CLI Tools - Command-line interface for operations
  • Web Dashboard - Node management and monitoring
  • Network Tools - Sync, recovery, and node management
  • Comprehensive Tests - Full test coverage

πŸš€ Quick Start

Requirements

System Requirements

  • PHP 8.0 or higher with extensions: OpenSSL, cURL, JSON, mbstring
  • Composer (dependency management)
  • MySQL 8.0+ or MariaDB 10.4+ (for persistent storage)
  • Web server (Apache/Nginx for production)

Installation

# Clone the repository
git clone https://github.com/infosave2007/phpblockchain.git
cd phpblockchain

# Install dependencies
composer install --ignore-platform-req=ext-mysqli --ignore-platform-req=ext-pdo_mysql --ignore-platform-req=ext-gmp --no-dev

# Set proper permissions
chmod +x *.php
chmod -R 755 storage/ logs/

# Run system check
php check.php

Web-based Installation

Open browser and navigate to: http://localhost/web-installer/

wallet_step1 wallet_step2 wallet_step3 wallet_step4 wallet_step5 wallet_step6 wallet_step7

Complete installation wizard:

  1. System requirements check
  2. Database configuration
  3. Network setup
  4. Genesis block creation
  5. Admin account setup

Browser Access

After installation, access your blockchain through web interface:

# Start development server
php server.php

# Open in browser (development)
http://localhost

Note: For production, use standard HTTP (80) or HTTPS (443) ports with Apache/Nginx.

Features available in web interface:

  • πŸ”— Node Dashboard - Real-time blockchain statistics and health monitoring
  • πŸ’° Wallet Interface - Create wallets, send transactions, check balances
  • πŸ” Blockchain Explorer - Browse blocks, transactions, and network nodes
  • πŸ”Œ API Documentation - Interactive API reference
  • 🌐 Multi-language - Switch between English and Russian

πŸ–₯️ Web Interface Usage

Main Dashboard

Access your blockchain node:

  • Development: http://localhost (if using standard port)
  • Production: http://yourdomain.com or https://yourdomain.com

Features:

  • Real-time Statistics - Blocks, transactions, active nodes, hash rate
  • Network Health - Node status, component checks, network statistics
  • Quick Actions - Direct links to wallet, explorer, and API docs

Wallet Management

Click "πŸ’° Wallet" button to:

  • Create new wallets with mnemonic phrases
  • Check wallet balances
  • Send and receive transactions
  • View transaction history
  • Manage multiple wallets

Blockchain Explorer

Click "πŸ” Explorer" button to:

  • Browse recent blocks and transactions
  • Search by block height, hash, or address
  • View network nodes and validators
  • Monitor mempool status

API Documentation

Click "πŸ”Œ API" button for:

  • Complete API endpoint reference
  • Interactive examples with copy-to-clipboard
  • Request/response formats
  • Authentication and parameters guide

Advanced Tools (CLI)

For advanced users and automation:

# Network synchronization
php network_sync.php sync

# Node management
php node_manager.php

# Recovery operations
php recovery_cli.php

# Generate crypto keys
php crypto-cli.php generate

πŸ“Š Web Interface Components

Node Dashboard (index.php)

  • Health Monitoring - Real-time node status and component checks
  • Blockchain Stats - Blocks, transactions, active nodes, hash rate display
  • Quick Access Panel - One-click access to wallet, explorer, API docs
  • Multi-language - Automatic language detection and switching

API Documentation (api-docs.php)

  • Interactive Docs - Click-to-copy code examples
  • Complete Reference - All explorer, wallet, and node endpoints
  • Live Examples - Working curl commands for testing
  • Multi-language - English and Russian documentation

Additional Tools

  • network_sync.php - Network synchronization manager
  • node_manager.php - Multi-node coordination
  • recovery_cli.php - Blockchain recovery tools
  • crypto-cli.php - Cryptographic key management

Directory Structure

β”œβ”€β”€ core/               # Core blockchain logic
β”œβ”€β”€ api/               # REST API endpoints
β”œβ”€β”€ wallet/            # Wallet management
β”œβ”€β”€ explorer/          # Blockchain explorer
β”œβ”€β”€ web-installer/     # Web-based installation
β”œβ”€β”€ sync-service/      # Synchronization services
β”œβ”€β”€ storage/           # Blockchain data storage
β”œβ”€β”€ config/            # Configuration files
└── tests/             # Test suite

πŸ” API Endpoints

Explorer API

  • GET /api/explorer/stats - Blockchain statistics
  • GET /api/explorer/blocks - Recent blocks
  • GET /api/explorer/transactions - Recent transactions
  • GET /api/explorer/?action=get_nodes_list - Network nodes

Wallet API

  • POST /wallet/wallet_api.php - Wallet operations
    • action: create_wallet - Create new wallet
    • action: get_balance - Check balance
    • action: transfer_tokens - Transfer tokens

Node API

  • GET /api/health - Node health check
  • GET /api/status - Full node status

πŸ” Security Features

  • secp256k1 Elliptic Curve Cryptography
  • ECDSA Digital Signatures
  • Keccak-256 Cryptographic Hashing
  • Secure Key Generation and Storage
  • Multi-signature Transaction Support
  • Hardware Security Module Integration

πŸ§ͺ Testing & Deployment

Testing via Web Interface

  1. Development: Open http://localhost for dashboard
  2. Production: Open http://yourdomain.com for dashboard
  3. Check all components show "βœ… OK" status
  4. Click "πŸ’° Wallet" and create test wallet
  5. Click "πŸ” Explorer" and verify blockchain data
  6. Click "πŸ”Œ API" for documentation testing

Alternative Testing

# Run basic tests
php tests/AllTests.php

# System check
php check.php

Production Deployment

# Using Docker (recommended)
docker-compose up -d

# Development server (custom port if needed)
php server.php --port=8080

# Production with Apache/Nginx (standard ports 80/443)
# Configure virtual host to point to project directory

Production Access:

  • Dashboard: https://yourdomain.com
  • API Docs: https://yourdomain.com/api-docs.php
  • Wallet: https://yourdomain.com/wallet/
  • Explorer: https://yourdomain.com/explorer/

Development Access:

  • Dashboard: http://localhost
  • API Docs: http://localhost/api-docs.php
  • Wallet: http://localhost/wallet/
  • Explorer: http://localhost/explorer/

πŸ”§ Troubleshooting

Common Issues

  • Permission Errors: chmod -R 755 storage/ logs/
  • Missing Extensions: Install php-openssl, php-curl
  • Database Issues: Check config/.env settings
  • Port Conflicts: Use php server.php --port=8081 for custom port
  • Browser Access: Ensure web server is properly configured

Web Interface Issues

  • Dashboard not loading: Check web server configuration
  • Port conflicts: Use custom port with php server.php --port=8081
  • Production deployment: Use Apache/Nginx virtual hosts for standard ports (80/443)
  • API docs not working: Verify api-docs.php file exists
  • Wallet errors: Check database connection and permissions
  • Language issues: Clear browser cache and refresh

πŸš€ Deployment

Docker

docker-compose up -d

Development Server

# Start development server
php server.php

# Custom port
php server.php --port=8080

# Background mode
nohup php server.php > server.log 2>&1 &

Production Server

For production, use Apache or Nginx with virtual hosts pointing to project directory:

  • Standard HTTP port: 80
  • Standard HTTPS port: 443
  • SSL certificate recommended for HTTPS

πŸ“ˆ Roadmap

  • Enhanced mobile wallet
  • Cross-chain bridges
  • Advanced governance
  • Layer 2 scaling
  • Enterprise tools

πŸ’¬ Support

  • Issues: GitHub Issues
  • Documentation: Available in /api-docs.php
  • Development Dashboard: http://localhost
  • Production Dashboard: http://yourdomain.com

Built with ❀️ using PHP 8+ and modern blockchain technologies

About

PHP blockchain: PoS consensus, EVM-compatible smart contracts, advanced synchronization (Fast/Light/Checkpoint), secp256k1 cryptography, mobile-optimized with 10x sync speed improvement.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages