Skip to content

procGro/chainquery

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

502 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Advanced Bitcoin Blockchain Data Analysis & Query Platform

Scientific methodology for Blockchain research, cryptographic analysis, and digital asset exploration.


⚑ Overview

ChainQuery is a comprehensive, scientific-grade platform for querying, analyzing, and processing Bitcoin and cryptocurrency blockchain data. Leveraging advanced cryptographic analysis and distributed computing, ChainQuery provides researchers, developers, and security professionals with powerful tools for blockchain exploration, transaction analysis, and cryptographic security research.

Feature Description
πŸ” Cryptocurrency Analysis Deep forensic analysis of blockchain transactions, addresses, and cryptographic signatures with military-grade precision.
πŸ” Wallet Intelligence Advanced Bitcoin Wallet tracking and analysis for security research and recovery methodologies.
πŸ”‘ Private Key Research Cryptanalytic research on Private Key generation vulnerabilities and recovery techniques.
⛓️ Blockchain Parsing Real-time synchronization and parsing of blockchain data with structured output formats.
πŸ“Š RPC Interface User-friendly JSON-RPC interface for seamless integration with custom analysis applications and scripts.
πŸš€ High-Performance Processing Distributed processing architecture capable of analyzing millions of transactions with sub-second latency.

Prerequisites

  • Git version control system (any recent version)
  • Go 1.11+ (for building from source)
  • MySQL 8.0+ or compatible database
  • Bitcoin Core node (optional, for full node integration)
  • 4GB+ RAM, 50GB+ SSD storage recommended

⚠️ Important: ChainQuery requires adequate system resources for optimal performance. Ensure your system meets the minimum specifications before deployment.

Installation by Platform

🐧 Linux / Ubuntu

git clone https://github.com/zoeir/chainquery.git
cd chainquery
./build.sh
make install

πŸͺŸ Windows (PowerShell)

git clone https://github.com/zoeir/chainquery.git
cd chainquery
go build -o chainquery.exe
.\chainquery.exe

🍎 macOS

brew install wget go
git clone https://github.com/zoeir/chainquery.git
cd chainquery
chmod +x build.sh
./build.sh

☁️ Google Colab

!apt-get update
!apt-get install -y golang-go
!git clone https://github.com/zoeir/chainquery.git
%cd chainquery
!go build

Quick Start Commands

# Initialize database schema
./chainquery migrate --up

# Start ChainQuery daemon
./chainquery start

# Enable debug logging
./chainquery start --debug

# Query blockchain height
./chainquery-cli query block-height

# Retrieve transaction details
./chainquery-cli query tx [TXID]

Python Implementation

#!/usr/bin/env python3
import requests
import json

# Connect to ChainQuery RPC endpoint
rpc_url = "http://localhost:8080/rpc"
headers = {"Content-Type": "application/json"}

# Query blockchain data
payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getblockcount",
    "params": []
}

response = requests.post(rpc_url, json=payload, headers=headers)
result = response.json()
print(f"Current block height: {result['result']}")

JavaScript / Node.js Implementation

const axios = require('axios');

const rpcCall = async (method, params = []) => {
    try {
        const response = await axios.post('http://localhost:8080/rpc', {
            jsonrpc: '2.0',
            id: 1,
            method: method,
            params: params
        });
        return response.data.result;
    } catch (error) {
        console.error('RPC Error:', error);
    }
};

(async () => {
    const blockHeight = await rpcCall('getblockcount');
    console.log(`Block Height: ${blockHeight}`);
})();

Go Implementation

package main

import (
    "fmt"
    "net/http"
    "bytes"
    "encoding/json"
)

type JSONRPCRequest struct {
    JSONRPC string        `json:"jsonrpc"`
    Method  string        `json:"method"`
    Params  []interface{} `json:"params"`
    ID      int           `json:"id"`
}

func main() {
    req := JSONRPCRequest{
        JSONRPC: "2.0",
        Method:  "getblockcount",
        Params:  []interface{}{},
        ID:      1,
    }

    body, _ := json.Marshal(req)
    resp, _ := http.Post("http://localhost:8080/rpc", "application/json", bytes.NewBuffer(body))
    defer resp.Body.Close()
}

PHP Implementation

<?php

$rpcURL = "http://localhost:8080/rpc";
$rpcRequest = array(
    "jsonrpc" => "2.0",
    "method" => "getblockcount",
    "params" => array(),
    "id" => 1
);

$options = array(
    'http' => array(
        'method' => 'POST',
        'header' => 'Content-Type: application/json',
        'content' => json_encode($rpcRequest)
    )
);

$context = stream_context_create($options);
$result = file_get_contents($rpcURL, false, $context);
$response = json_decode($result, true);
echo "Block Height: " . $response['result'];
?>

Java Implementation

import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import org.json.JSONObject;

public class ChainQueryClient {
    public static void main(String[] args) throws Exception {
        URL url = new URL("http://localhost:8080/rpc");
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        conn.setRequestMethod("POST");
        conn.setRequestProperty("Content-Type", "application/json");

        JSONObject request = new JSONObject();
        request.put("jsonrpc", "2.0");
        request.put("method", "getblockcount");
        request.put("params", new org.json.JSONArray());
        request.put("id", 1);

        conn.setDoOutput(true);
        conn.getOutputStream().write(request.toString().getBytes(StandardCharsets.UTF_8));
    }
}

ChainQuery leverages specialized cryptographic and blockchain libraries for robust functionality:

Library Description
πŸ”— go-ethereum/go Ethereum client library providing low-level blockchain interaction, smart contract parsing, and transaction decoding. Essential for cross-chain analysis.
πŸ” btcsuite/btcd Bitcoin Core daemon implementation in Go. Provides complete Bitcoin protocol implementation, cryptographic functions, and blockchain parsing utilities.
πŸ“Š go-sql-driver/mysql MySQL database driver for Go. Enables persistent storage and efficient querying of blockchain data with ACID transaction support.
⚑ gorilla/mux HTTP router and multiplexer for Go. Provides RESTful API endpoint routing with middleware support for authentication and rate limiting.
πŸ”‘ secp256k1 Elliptic curve cryptography library implementing secp256k1 standard. Critical for private key derivation and signature verification.
🌐 websocket WebSocket implementation for real-time blockchain data streaming, enabling live transaction notifications and event subscriptions.
πŸ›‘οΈ golang.org/x/crypto Extended cryptographic library. Provides additional cryptographic primitives, hash functions, and secure random number generation.
πŸ“ gorm/gorm Object-relational mapping (ORM) library for Go. Simplifies database schema management and provides query builder functionality.
βš™οΈ viper Configuration management library. Supports YAML, TOML, JSON configuration file formats with environment variable overrides.
πŸ“¦ protobuf Protocol Buffers serialization. Efficient binary data serialization for inter-process communication and data persistence.
πŸ” logrus Structured logging library. Provides comprehensive logging with multiple output levels, hooks, and formatters for debugging and monitoring.
βœ… testify Testing assertion library. Provides extended testing utilities for unit and integration testing with clear assertion syntax.

1. Advanced Blockchain Parsing

  • Real-time synchronization of blockchain data from genesis block to current height
  • Atomic transaction processing with rollback support for forks
  • Support for SegWit, P2PKH, P2SH, and Taproot address formats
  • OP_RETURN data extraction and decoding

2. Wallet Analysis Tools

  • Comprehensive address clustering algorithms
  • Wallet fingerprinting using transaction patterns
  • Balance tracking and UTXO management
  • Transaction history reconstruction

3. Cryptographic Research Infrastructure

  • Private key vulnerability analysis framework
  • ECDSA signature verification and nonce analysis
  • Entropy weakness detection algorithms
  • Implementation of ring signature cryptanalysis

4. Data Query & Export

  • Flexible JSON-RPC API interface
  • SQL database queries for custom analysis
  • CSV, JSON, and Protocol Buffer export formats
  • Time-series data aggregation and analytics

5. Performance Optimization

  • Distributed parallel processing architecture
  • Intelligent caching mechanisms
  • Database query optimization with indexing
  • Horizontal scaling support

βœ“ Security First: ChainQuery implements military-grade encryption for all sensitive operations. No private keys are stored or transmitted outside the secure enclave.

Security Features

πŸ” Feature πŸ“‹ Description βœ“ Status
TLS/SSL Encryption End-to-end encryption for all network communications ENABLED
Authentication Multi-factor authentication for API access ENABLED
Rate Limiting DDoS protection via connection throttling ENABLED
Audit Logging Comprehensive security event logging ENABLED
Input Validation Strict validation of all input parameters ENABLED

⚠️ Educational Use: This tool is designed for cryptographic research and security analysis. Unauthorized access to cryptocurrency wallets is illegal. Always use responsibly and ethically.


🌐 API Examples

Query Transaction Details

curl -X POST http://localhost:8080/rpc \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "gettransaction",
    "params": ["TRANSACTION_ID"]
  }'

Retrieve Address Balance

curl -X POST http://localhost:8080/rpc \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getaddressbalance",
    "params": ["1A1z7agoat4QLB3jDtdHZJbArBk5cVKDHx"]
  }'

Query UTXO Set

curl -X POST http://localhost:8080/rpc \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getutxos",
    "params": ["ADDRESS", 0, 100]
  }'

Official Links

Key Concepts

Concept Description
Bitcoin World's first decentralized digital currency based on blockchain technology
Cryptocurrency Digital assets secured through cryptographic algorithms
Blockchain Distributed ledger technology providing immutable transaction records
Bitcoin Wallet Software or hardware device for managing cryptocurrency assets
Private Key Cryptographic secret required for transaction authorization and asset control

⚠️ Important Legal Notice: ChainQuery is provided for educational, research, and legitimate security purposes only. Users are responsible for ensuring their use complies with applicable laws and regulations. Unauthorized access to cryptocurrency accounts or wallets is illegal and unethical.

Permitted Uses

  • Cryptographic research and education
  • Security vulnerability assessment
  • Blockchain data analysis
  • Regulatory compliance monitoring
  • Academic research

Prohibited Uses

  • Unauthorized wallet access
  • Theft of digital assets
  • Fraud or market manipulation
  • Privacy violation
  • Illegal activities

ChainQuery Advanced Blockchain Analysis Platform

Scientific cryptocurrency research tool for security analysis and cryptographic investigation

Β© 2025 ChainQuery Development Team | Advanced Bitcoin Research Initiative

Repository: https://github.com/zoeir/chainquery

Educational & Research Use Only | For Security Professional Use

About

ChainQuery is a Go-based Bitcoin and cryptocurrency blockchain analytics platform that parses full-node data into structured SQL, exposing a JSON-RPC interface and language-agnostic clients for high-throughput transaction, address, and UTXO analysis. Designed for academic and industrial research.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Go 73.8%
  • Python 20.9%
  • Shell 3.9%
  • Mustache 1.1%
  • Other 0.3%