Thanks to visit codestin.com
Credit goes to github.com

Skip to content

agnosticeng/clickhouse-evm

Repository files navigation

clickhouse-evm

EVM-focused UDFs for ClickHouse – Accelerate Ethereum & EVM-compatible blockchain analytics

Overview

clickhouse-evm is a collection of high-performance user-defined functions (UDFs) that extend ClickHouse with capabilities tailored for Ethereum Virtual Machine (EVM) data processing.

Whether you're building blockchain explorers, indexing on-chain data, or running deep analytics on Ethereum or other EVM-compatible chains, this project brings native decoding, parsing, and querying support into your ClickHouse workflows.

✨ Features

📦 Use Cases

  • Quickly extract function parameters from calldata in a ClickHouse query
  • Filter and parse smart contract events by ABI signature
  • Analyze token transfers, contract interactions, or DeFi protocol data at scale
  • Query live on-chain data through efficient RPC calls from within ClickHouse
  • Integrate with your existing ClickHouse-based blockchain indexing pipeline

📦 Artifact: The Bundle

The output of the build process is distributed as a compressed archive called a bundle. This bundle includes everything needed to deploy and use the UDFs in ClickHouse.

📁 Bundle Contents

Each bundle contains:

  • 🧩 Standalone binary implementing the native UDFs (compiled with ClickHouse compatibility)
  • ⚙️ ClickHouse configuration files (.xml) to register each native UDF
  • 📝 SQL files for SQL-based UDFs (used for lightweight functions where SQL outperforms compiled code)

📦 Bundle Usage

🛠️ Build the Bundle

make bundle              # Build for native execution
GOOS=linux make bundle   # Cross-compile for use in Docker (Linux target)

This will:

  • Generate the bundle directory at tmp/bundle/
  • Create a compressed archive at tmp/bundle.tar.gz

The internal file structure of the bundle reflects the default layout of a basic ClickHouse installation.
As a result, decompressing the archive at the root of a ClickHouse server filesystem should "just work" with no additional path configuration.


▶️ Run with clickhouse-local

clickhouse local \
    --log-level=debug \
    --path tmp/clickhouse \
    -- \
    --user_scripts_path="./tmp/bundle/var/lib/clickhouse/user_scripts" \
    --user_defined_executable_functions_config="./tmp/bundle/etc/clickhouse-server/*_function.*ml" \
    --user_defined_path="./tmp/bundle/var/lib/clickhouse/user_defined"

This runs ClickHouse in local mode using the provided config and a temporary storage path.


🐳 Run in development mode with clickhouse-server in Docker

docker compose up -d

This launches a ClickHouse server inside a Docker container using the configuration and UDFs from the bundle.

🐳 Run in production mode with clickhouse-server in Docker (bundle fetched from latest release on GitHub)

docker compose -f docker-compose.prod.yaml up -d

About

Native EVM integration for Clickhouse

Resources

License

Stars

Watchers

Forks

Packages

No packages published