Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better Accounting #7

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# syntax=docker/dockerfile:1

# =========== 1) BUILD STAGE =============
FROM ubuntu:24.04 AS builder

# Install dependencies needed to build trueblocks-khedra
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
cmake \
git

# Create and change to the source directory
WORKDIR /app

# Copy source into the container
COPY . /app

# Build the project
RUN mkdir build && cd build && cmake .. && make

# =========== 2) FINAL STAGE =============
FROM ubuntu:22.04

# Copy compiled binary from the builder stage
COPY --from=builder /app/build/khedra /usr/local/bin/khedra

# Copy example config (you can move or rename as preferred)
COPY --from=builder /app/config.example /root/.trueblocks/trueblocks-khedra.conf

# Set environment variables or defaults for Khedra
ENV KHEDRA_CONFIG=/root/.trueblocks/trueblocks-khedra.conf \
KHEDRA_DATA_DIR=/root/.trueblocks/data \
KHEDRA_LOG_LEVEL=INFO

# Default entrypoint runs 'khedra'
ENTRYPOINT ["khedra"]
# Default command shows help text
CMD ["--help"]
139 changes: 137 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,137 @@
# trueblocks-khedra
A multi-service EVM blockchain index/monitoring tool that indexes, monitors, and shares address appearance indexes.
# TrueBlocks Khedra

## Intro

`trueblocks-khedra` is an extension (or plugin) to the [TrueBlocks](https://github.com/TrueBlocks/trueblocks-core) system that focuses on providing specialized data extraction, analysis, or other functionality related to Ethereum blockchain indexing. Khedra aims to simplify the process of gathering on-chain data and building advanced, queryable indexes for Ethereum addresses.

Key features:

- **Custom Indexing**: Provides specialized indexing capabilities tailored to specific use-cases beyond the core TrueBlocks functionality.
- **Plugin-Based Architecture**: Easily integrates with TrueBlocks while maintaining modular, extensible design.
- **Efficient Data Retrieval**: Optimized for quick querying and data lookups, especially when dealing with large Ethereum datasets.

## Installation

### Prerequisites

- Make sure you have [TrueBlocks Core](https://github.com/TrueBlocks/trueblocks-core) installed.
- A C++ build environment (such as `g++` or `clang++`) if you plan to compile from source.
- [CMake](https://cmake.org/) (version 3.16 or higher recommended).
- (Optional) [Docker](https://docs.docker.com/get-docker/) if you plan to run via container.

### Clone this Repository

```[bash]
git clone https://github.com/TrueBlocks/trueblocks-khedra.git
cd trueblocks-khedra
```

### Build from Source

```[bash]
mkdir build && cd build
cmake ..
make
```

After a successful build, you’ll find the `khedra` executable (or library, depending on how the project is organized) in the build output.

### Install

```[bash]
sudo make install
```

## Configuration

Before using `khedra`, you may need to configure it to point at the TrueBlocks indexing data or specify custom indexing rules:

- **Config File**: By default, `khedra` may look for a configuration file at `~/.trueblocks/trueblocks-khedra.conf`.
- **Environment Variables**:
- `KHEDRA_DATA_DIR`: Path to where you want `khedra` to store or read data.
- `KHEDRA_LOG_LEVEL`: Adjusts the verbosity of logs (`DEBUG`, `INFO`, `WARN`, `ERROR`).

Refer to the sample configuration file (`.conf.example`) in this repo for a template of possible settings.

---

## Docker Version - Building & Running

Build the Docker image:

```bash
docker build -t trueblocks-khedra .
```

Run the Docker container (showing the help message by default):

```bash
docker run --rm -it trueblocks-khedra
```

Use a custom command, for example to specify a subcommand or different flags:

```bash
docker run --rm -it trueblocks-khedra some-subcommand --flag
```

Adjust paths, environment variables, or your config file strategy as needed. You can also mount external volumes (e.g., a local ~/.trueblocks directory) if you prefer to maintain data outside the container.

---

## Documentation

<!--
BEGIN SECTION: (Exact text from trueblocks-core README)
Copy/Paste the "Documentation" section here verbatim.
-->

**(Paste the *exact* Documentation text from the trueblocks-core README here.)**

---

## Linting

<!--
BEGIN SECTION: (Exact text from trueblocks-core README)
Copy/Paste the "Linting" section here verbatim.
-->

**(Paste the *exact* Linting text from the trueblocks-core README here.)**

---

## Contributing

<!--
BEGIN SECTION: (Exact text from trueblocks-core README)
Copy/Paste the "Contributing" section here verbatim.
-->

**(Paste the *exact* Contributing text from the trueblocks-core README here.)**

---

## Contact

<!--
BEGIN SECTION: (Exact text from trueblocks-core README)
Copy/Paste the "Contact" section here verbatim.
-->

**(Paste the *exact* Contact text from the trueblocks-core README here.)**

---

## Contributors

<!--
BEGIN SECTION: (Exact text from trueblocks-core README)
Copy/Paste the "Contributors" section here verbatim.
-->

**(Paste the *exact* Contributors text from the trueblocks-core README here.)**

---

This project is part of the [TrueBlocks](https://github.com/TrueBlocks) ecosystem.
Loading