An open API service indexing awesome lists of open source software.

https://github.com/tangle-network/reth-node-blueprint-template


https://github.com/tangle-network/reth-node-blueprint-template

Last synced: 23 days ago
JSON representation

Awesome Lists containing this project

README

          

# Reth Node Tangle Blueprint

A Tangle Blueprint for deploying and managing a Reth Ethereum node with Prometheus and Grafana monitoring.

## Overview

This Tangle Blueprint integrates the [local_reth](https://github.com/paradigmxyz/local_reth) repository to provide a simple way to run a Reth Ethereum node with built-in monitoring via Prometheus and Grafana. The blueprint exposes job functions for state-changing operations like starting and stopping the node, while providing direct monitoring access through web interfaces.

## Features

- Deploy a Reth Ethereum node via Docker Compose
- Monitor node performance with Prometheus
- Visualize metrics with pre-configured Grafana dashboards
- Tangle Network integration for node lifecycle management
- Clean separation between state-changing operations and monitoring
- Standalone CLI tool for direct interaction with the Reth node

## Prerequisites

- [Docker](https://docs.docker.com/get-docker/) and [Docker Compose](https://docs.docker.com/compose/install/)
- [Rust](https://www.rust-lang.org/tools/install) (1.70.0 or later)
- The Cargo Tangle CLI (`cargo tangle`) installed

## Installation

Clone this repository:

```bash
git clone https://github.com/tangle-network/reth-docker-template.git
cd reth-docker-template
```

Build the blueprint:

```bash
cargo build --release
```

## Usage

### Using the Tangle Blueprint

Start the blueprint service:

```bash
./target/release/reth-docker-template-bin
```

This will start the Tangle Blueprint service, which will listen for job calls from the Tangle Network.

### Available Job Functions

The blueprint follows a best practice of only using job functions for state-changing operations:

| Job ID | Function | Description |
| ------ | ------------ | ----------------------------------------------- |
| 1 | `reth_start` | Start the Reth node with Prometheus and Grafana |
| 2 | `reth_stop` | Stop the Reth node and associated services |

### Using the Standalone CLI Tool

For testing and direct interaction without going through the Tangle Network, you can use the standalone CLI tool:

```bash
# Build the CLI tool
cargo build --bin reth-cli

# Start the Reth node
./target/debug/reth-cli start

# Check status
./target/debug/reth-cli status

# View logs
./target/debug/reth-cli logs

# Stop the node
./target/debug/reth-cli stop
```

For more information on the CLI tool, see [reth-cli README](reth-docker-template-lib/src/bin/README.md).

### Monitoring and Data Access

Monitoring data is available through web interfaces:

- **Grafana Dashboard**: http://localhost:3000 (login with admin/admin)
- **Prometheus Interface**: http://localhost:9090
- **Raw Metrics Endpoint**: http://localhost:9000

These endpoints allow you to visualize and query node metrics directly without going through the job system.

### Monitoring

Once the Reth node is running, you can access the monitoring dashboard:

1. Open Grafana at [http://localhost:3000](http://localhost:3000)
2. Log in with username: `admin`, password: `admin`
3. Navigate to the Reth dashboard

## Configuration

The blueprint can be configured through environment variables:

- `RETH_TIP`: Set a custom block hash for the Reth node to sync up to (default: block 5,000,000)
- `ENABLE_DOCKER_TESTS`: Set to `1` to enable Docker-based tests

## Project Structure

- `/reth_docker` - Submodule containing the local_reth repository
- `/reth-node-blueprint-template-lib` - Library code for the blueprint
- `lib.rs` - Core functionality and state-changing job functions
- `monitoring.rs` - Data retrieval and monitoring functions
- `/bin/reth_cli.rs` - Standalone CLI tool for direct interaction
- `/reth-node-blueprint-template-bin` - Binary code for running the blueprint

### Running Tests

```bash
# Run tests without Docker integration
cargo test

# Run tests with Docker integration (requires Docker)
ENABLE_DOCKER_TESTS=1 cargo test
```

### Architecture

The blueprint follows a clean architecture pattern:

1. The library (`reth-node-blueprint-template-lib`) provides core functionality:
- State-changing operations as job functions
- Monitoring utilities for data retrieval
- A standalone CLI tool for direct interaction
2. The binary (`reth-node-blueprint-template-bin`) integrates with the Tangle Network and exposes job functions
3. The `reth_docker` directory contains the Docker Compose configuration for running the Reth node

## License

This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.

## Acknowledgements

- The Reth Docker Compose setup is based on the [local_reth](https://github.com/paradigmxyz/local_reth) project by Paradigm
- Reth is maintained at [paradigmxyz/reth](https://github.com/paradigmxyz/reth)