Barreleye is an open-source multi-chain blockchain indexer and explorer.
Features:
- Easy to use β start on a single machine, scale up as needed
- Scalable β optimized for handling lots of data
- Multi-chain β designed to support multiple blockchain architectures
Important
This is a work-in-progress and not yet ready for use or production.
- Rust v1.83+ β if you're compiling from source
- Blockchain nodes β for indexing (eg: Bitcoin, Ethereum, etc)
Clone, build & install:
git clone https://github.com/barreleye/barreleye
cd barreleye
cargo build
cargo installRun locally:
cargo run
# or `RUST_LOG=trace cargo run` for more infoThis will do the following:
- Start the server, which will handle API requests
- Start the indexer, which will:
For production you'll probably want to store extracted blockchain data in the cloud (eg: Amazon S3, Cloudflare R2, etc), as opposed to your localhost:
cargo run -- \
--storage http://s3.us-east-1.amazonaws.com/bucket_name/And structured data in RDBMS like PostgreSQL or MySQL, instead of SQLite:
cargo run -- \
--storage http://s3.us-east-1.amazonaws.com/bucket_name/ \
--database postgres://postgres-host:5432/database_nameAs well as analytics data in ClickHouse, instead of DuckDB:
cargo run -- \
--storage http://s3.us-east-1.amazonaws.com/bucket_name/ \
--database postgres://postgres-host:5432/database_name \
--warehouse http://example.clickhouse.cloud:8123/database_nameBarreleye operates two parallel components: the indexer and the server. The indexer retrieves blockchain data, while the server manages API requests, handling data and address information.
Barreleye automatically runs both the indexer and server in parallel:
cargo runRun only the indexer:
cargo run -- --mode indexerRun only the server:
cargo run -- --mode httpTip
The indexer operates in failover mode, with a single primary instance running while secondary instances stand by, ready to take over if the primary fails.
Barreleye does not come with any pre-defined data. Instead, it gives you the ability to add and manage data yourself. The API calls below give an overview of how to manage data.
Add Blockchains
Add a Bitcoin RPC node:
curl -X POST \
-H 'Content-Type: application/json' \
-d '{
"id": "net_bitcoin",
"name": "Bitcoin",
"architecture": "bitcoin",
"blockTime": 600000,
"rpcEndpoint": "http://username:password@127.0.0.1:8332"
}' \
http://localhost:2277/v1/networksAdd an EVM-based RPC node (archive node is required):
curl -X POST \
-H 'Content-Type: application/json' \
-d '{
"id": "net_ethereum",
"name": "Ethereum",
"architecture": "evm",
"chainId": 1,
"blockTime": 12000,
"rpcEndpoint": "http://127.0.0.1:8545"
}' \
http://localhost:2277/v1/networksAdd Tokens
Add native Bitcoin currency:
curl -X POST \
-H 'Content-Type: application/json' \
-d '{
"network": "net_bitcoin",
"name": "bitcoin",
"symbol": "BTC",
"decimals": 8
}' \
http://localhost:2277/v1/tokensAdd native Ethereum currency:
curl -X POST \
-H 'Content-Type: application/json' \
-d '{
"network": "net_ethereum",
"name": "Ether",
"symbol": "ETH",
"decimals": 18
}' \
http://localhost:2277/v1/tokensAdd an ERC-20 token:
curl -X POST \
-H 'Content-Type: application/json' \
-d '{
"network": "net_ethereum",
"name": "USD Coin",
"symbol": "USDC",
"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"decimals": 6
}' \
http://localhost:2277/v1/tokensAdd Tags
curl -X POST \
-H 'Content-Type: application/json' \
-d '{
"id": "tag_exchange",
"name": "Exchange",
"riskLevel": "low"
}' \
http://localhost:2277/v1/tagsAdd Entities
An entity can be an item that contains one or several blockchain addresses:
curl -X POST \
-H 'Content-Type: application/json' \
-d '{
"id": "ent_coinbase",
"name": "Coinbase",
"description": "",
"tags": ["tag_exchange"]
}' \
http://localhost:2277/v1/entitiesAdd addresses:
curl -X POST \
-H 'Content-Type: application/json' \
-d '{
"entity": "ent_coinbase",
"network": "net_ethereum",
"addresses": [
{
"address": "0x71660c4005BA85c37ccec55d0C4493E66Fe775d3",
"description": "Address #1"
}, {
"address": "0x503828976d22510aad0201ac7ec88293211d23da",
"description": "Address #2"
}
]
}' \
http://localhost:2277/v1/addressesQuery information about a particular blockchain address:
curl -X GET \
-H 'Content-Type: application/json' \
http://localhost:2277/v1/info?q=<BLOCKCHAIN_ADDRESS>- Be aware of your RPC node limits. Indexer makes a significant amount of RPC calls to index historical and new blocks.
- For indexing, you might have to set ClickHouse's
max_server_memory_usage_to_ram_ratioto2(read more)
Barreleye is free, open source and permissively licensed. Except where noted (below and/or in individual files), all code in this repository is dual-licensed under either:
- MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
Your contributions
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.