Skip to main content

A collection of blockchain data pipelines built with cherry

Project description

cherry-pipelines

This is a collection of pipelines that are built using cherry and ClickHouse materialized views.

All data is stored in ClickHouse.

Python version

This project is meant to be run with Python 3.12

If you are using uv for development it should pick this up automatically because of the .python-version in the project root.

The docker image is configured to use this version of Python as well.

Running a pipeline

Use the main script to run a pipeline:

uv run scripts/main.py

It takes these parameters as environment variables:

  • CHERRY_PIPELINE_KIND, "evm" or "svm".
  • CHERRY_PIPELINE_NAME, name of the pipeline to run e.g. "erc20_transfers".
  • CHERRY_FROM_BLOCK, specify the block that the indexing should start from. defaults to 0.
  • CHERRY_TO_BLOCK, specify the block that the indexing should stop at. has no default. Indexing waits for new blocks when it reaches the tip of the chain if this argument is left empty.
  • CHERRY_EVM_PROVIDER_KIND, specify which provider to use when indexing evm chains. Can be hypersync or sqd. Has no default and is required when indexing evm.
  • CHERRY_EVM_CHAIN_ID, specify the chain_id when indexing an evm chain. has no default and is required when indexing evm.
  • CLICKHOUSE_HOST, defaults to 127.0.0.1.
  • CLICKHOUSE_PORT, defaults to 8123.
  • CLICKHOUSE_USER, defaults to default.
  • CLICKHOUSE_PASSWORD, defaults to empty string,
  • RUST_LOG as explained in env-logger docs
  • PY_LOG as explained in python logging docs. Defaults to "INFO"

An .env file placed in the project root can be used to define these for development.

Running with docker

We publish a docker image that runs the main script.

Dev Setup

Run the docker-compose file to start a clickhouse instance for development.

docker-compose up -d

Run this to delete the data on disk:

docker-compose down -v

And this to stop the container without deleting the data:

docker-compose down

Development

This repo uses uv for development.

  • Format the code with uv run ruff format
  • Lint the code with uv run ruff check
  • Run type checks with uv run pyright
  • Run the tests with uv run pytest

Data Provider

All svm pipelines use SQD.

All evm pipelines are configurable using the CHERRY_EVM_PROVIDER_KIND env variable.

Table definitions

Automatic table creation features of cherry aren't used and table definitions are managed separately.

Materialized Views

Materialized views are defined in SQL files with an accompanying script that deploys them.

EVM multi-chain structure

The evm pipelines are multi-chain and index multiple blockchains in parallel.

All chains are written to their own tables. For example the table for erc20 transfers would have a table named erc20_chain1 for ethereum and erc20_chain10 for optimism.

Specify the CHERRY_EVM_CHAIN_ID env variable to set the chain you want to index when indexing evm.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Sponsors

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cherry_pipelines-0.0.5.tar.gz (77.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cherry_pipelines-0.0.5-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file cherry_pipelines-0.0.5.tar.gz.

File metadata

  • Download URL: cherry_pipelines-0.0.5.tar.gz
  • Upload date:
  • Size: 77.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.7.4

File hashes

Hashes for cherry_pipelines-0.0.5.tar.gz
Algorithm Hash digest
SHA256 95877f3a9468df07a5ae5c777c2415167f7f4e3fb417bde9bbc56da242df8179
MD5 71b811b43cfabbda6c65f15d05f33d75
BLAKE2b-256 824fb48f98c6deac148845fd80518023044cbb529a26910418ad5c316f4e6122

See more details on using hashes here.

File details

Details for the file cherry_pipelines-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for cherry_pipelines-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 e18a27a214a1006cf4da08ac54dcbc824d581aaa43632880e190c4b07cbeb73a
MD5 b7dbf8212ccca053c243a6bfa7b7f5d6
BLAKE2b-256 2259ec75a72ac62c222a1bf1e7f64499162f4443c849b0ed7879ce0d73691dc5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page