barreleye

Crates.iobarreleye
lib.rsbarreleye
version0.0.1
sourcesrc
created_at2023-01-03 17:56:41.523821
updated_at2023-01-03 17:56:41.523821
descriptionOpen-source blockchain analytics tool.
homepagehttps://barreleye.com
repositoryhttps://github.com/barreleye/barreleye
max_upload_size
id750291
size251,640
Ivan Akimov (4kimov)

documentation

https://docs.rs/barreleye

README

Barreleye

Github Actions dependency status MSRV License: MPL 2.0 contributions - welcome discord twitter

What is Barreleye?

Barreleye is an open-source, multi-chain blockchain analytics tool. It's goal is to help answer the following questions:

  1. What assets does an address hold?

  2. Where did these assets come from?

  3. What other wallets might be related?

Note: This is an actively developed work-in-progress and not yet ready for production. Use at your own risk

Try

Requires Rust 1.65.0+:

git clone https://github.com/barreleye/barreleye
cd barreleye
cargo run

Notes:

  • A default config file will be generated on the first run. Optionally, rename barreleye.sample.toml to barreleye.toml

  • Clickhouse is a requirement for warehouse data storage (default configs point to a locally running server)

  • Out of the box Barreleye is configured to use SQLite (MySQL and PostgreSQL are also supported)

How does it work

Barreleye consists of two parts: the indexer and the server. The indexer will connect to specified RPC nodes and continuously process new blocks, and the server will handle requests for processed output. You can decouple the two using CLI params.

Running multiple indexers in parallel is supported, but only one will be active at a time. To start indexing without the server: cargo run -- --indexer

To run the server without indexing: cargo run -- --server

To run them all together: cargo run

Add networks

A default API key is generated on the first run, so to get it:

select uuid from api_keys;

Add a Bitcoin RPC node:

curl -i -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <API_KEY>" \
  -d '{
    "name": "Bitcoin",
    "tag": "Bitcoin",
    "env": "mainnet",
    "blockchain": "bitcoin",
    "chainId": 0,
    "blockTimeMs": 600000,
    "rpcEndpoints": ["http://username:password@127.0.0.1:8332"],
    "rps": 100
  }' \
  http://localhost:22775/v0/networks

Add an Ethereum RPC node:

curl -i -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <API_KEY>" \
  -d '{
    "name": "Ethereum",
    "tag": "Ethereum",
    "env": "mainnet",
    "blockchain": "evm",
    "chainId": 1,
    "blockTimeMs": 12000,
    "rpcEndpoints": ["http://127.0.0.1:8545"],
    "rps": 100
  }' \
  http://localhost:22775/v0/networks

MVP Todos

🚧 This project is a work-in-progress and not ready for prod use. Most APIs are under "v0/" and crate versions are "v0.x.x". A quick glance at the current todos:

  • Basic indexing for Bitcoin and EVM-based chains
  • v0/networks
  • v0/addresses
  • v0/labels
  • v0/keys
  • v0/heartbeat
  • Basic v0/stats
  • Minimal v0/assets
  • Minimal v0/upstream
  • Minimal v0/related

Random Notes

  • For indexing, you might have to set Clickhouse's max_server_memory_usage_to_ram_ratio to 2. Read more

Contributing

See CONTRIBUTING.

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

Mozilla Public License 2.0 (LICENSE or https://opensource.org/licenses/MPL-2.0)

Commit count: 300

cargo fmt