A comprehensive Rust workspace for blockchain data indexing and processing, featuring a modular architecture with multiple specialized services.
This workspace contains the following core services:
apps/cli
- Terminal UI client for interacting with the Intuition systemapps/consumer
- Event processing pipeline using Redis Streams (RAW, DECODED, and RESOLVER consumers)apps/models
- Domain models and data structures for the Intuition system
infrastructure/hasura
- GraphQL API with database migrations and configurationapps/image-guard
- Image processing and validation serviceapps/rpc-proxy
- RPC call proxy with caching foreth_call
methods
apps/histocrawler
- Historical data crawlerapps/shared-utils
- Common utilities and shared codeinfrastructure/migration-scripts
- Database migration utilities
-
Install Rust toolchain
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
-
Install required tools
# Install cargo-make for build automation cargo install --force cargo-make # Install Hasura CLI curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | bash
-
Install Node.js dependencies (for integration tests)
cd integration-tests pnpm install
-
Copy environment template
cp .env.sample .env
-
Configure required environment variables
Variable Description Source OPENAI_API_KEY
OpenAI API key for AI features OpenAI Platform PINATA_GATEWAY_TOKEN
Pinata gateway token for IPFS Pinata Dashboard PINATA_API_JWT
Pinata API JWT for IPFS uploads Pinata Dashboard RPC_URL_MAINNET
Ethereum mainnet RPC endpoint Alchemy Dashboard RPC_URL_BASE
Base network RPC endpoint Alchemy Dashboard RPC_URL_LINEA
Linea network RPC endpoint Alchemy Dashboard
Note: All scripts are located in the scripts/
directory and should be run from the project root.
# Start with local Ethereum node
cargo make start-local
# Build all Docker images from source
cargo make build-docker-images
# Start the system
cargo make start-local
# Start with tests enabled
cargo make start-local test
cargo nextest run
cd integration-tests
export VITE_INTUITION_CONTRACT_ADDRESS=0x....
pnpm test src/follow.test.ts
# Test account operations
pnpm test src/create-person.test.ts
# Test vault operations
pnpm test src/vaults.test.ts
# Test AI agents
pnpm test src/ai-agents.test.ts
# Run the CLI to verify latest data
./scripts/cli.sh
# Format code
cargo make fmt
# Run linter
cargo make clippy
# Run all checks
cargo make check
# Start services and run migrations
cargo make start-docker-and-migrate
# Manual migration (if needed)
cp .env.sample .env
source .env
Add to your .env
file:
INTUITION_CONTRACT_ADDRESS=0x04056c43d0498b22f7a0c60d4c3584fb5fa881cc
START_BLOCK=0
Create local test data:
cd integration-tests
npm install
npm run create-predicates
# Start all services
docker-compose -f docker/docker-compose-apps.yml up -d
# Stop all services
./scripts/stop.sh
# View logs
docker-compose -f docker/docker-compose-apps.yml logs -f
JSON Logging: All consumer services output structured JSON logs with the following fields:
timestamp
: ISO 8601 timestamplevel
: Log level (INFO, WARN, ERROR, DEBUG)fields.message
: Log message contenttarget
: Module pathfilename
: Source file nameline_number
: Line number in source filethreadId
: Thread identifier
Viewing Logs:
# View container logs directly
docker logs decoded_consumer | grep '"level":"INFO"'
docker logs resolver_consumer | grep '"level":"ERROR"'
docker logs ipfs_upload_consumer | grep '"level":"WARN"'
intuition-rs/
βββ apps/ # Custom Rust applications
β βββ cli/ # Terminal UI client
β βββ consumer/ # Event processing pipeline (Redis Streams)
β βββ histocrawler/ # Historical data crawler
β βββ image-guard/ # Image processing service
β βββ models/ # Domain models & data structures
β βββ rpc-proxy/ # RPC proxy with caching
β βββ shared-utils/ # Common utilities
βββ infrastructure/ # Infrastructure components
β βββ hasura/ # GraphQL API & migrations
β βββ blockscout/ # Blockchain explorer
β βββ drizzle/ # Database schema management
β βββ geth/ # Local Ethereum node config
β βββ indexer-and-cache-migrations/ # Database migrations
β βββ migration-scripts/ # Migration utilities
β βββ prometheus/ # Monitoring configuration
βββ docker/ # Docker configuration
β βββ docker-compose-apps.yml # Application services
β βββ docker-compose-shared.yml # Shared infrastructure
β βββ Dockerfile # Multi-stage build
βββ scripts/ # Shell scripts
β βββ start.sh # System startup
β βββ stop.sh # System shutdown
β βββ cli.sh # CLI runner
β βββ init-dbs.sh # Database initialization
βββ integration-tests/ # End-to-end tests
βββ README.md # This file
The system processes blockchain events through multiple stages:
- RAW - Raw event ingestion from blockchain
- DECODED - Event decoding and parsing
- RESOLVER - Data resolution and enrichment
- EthMultiVault v1.0
- EthMultiVault v1.5
- Multivault v2.0
- Base Events Indexing: To index Base events, uncomment
substreams-sink
and commentenvio-indexer
indocker-compose.yml
. The optimal process is under investigation.
The system includes comprehensive logging capabilities:
Features:
- Structured JSON Logging: All services output machine-readable logs
- Container Logs: Direct access to service logs via Docker
- Log Filtering: Easy filtering by log level and service
Benefits:
- Debugging: Quickly find and analyze issues across services
- Performance Monitoring: Track service performance and bottlenecks
- Audit Trail: Complete visibility into system operations
Getting Started:
- Start the system:
cargo make start-local
- View logs:
docker logs <service_name>
- Filter logs:
docker logs <service_name> | grep '"level":"INFO"'
See LICENSE file for details.
Note: This project is under active development. Code and APIs are subject to change.