Skip to main content

A self-contained service for transmitting analysis signals to an Ethereum-compatible blockchain via smart contracts.

Project description

Oracle Service

A self-contained Python service for transmitting analysis signals to an Ethereum-compatible blockchain via smart contract interactions.

What This Project Is

This is a backend service that:

  1. Monitors a database for high-severity analysis results.
  2. Transmits signed transactions to a Guardian smart contract on-chain.
  3. Exposes a FastAPI REST API for managing oracle signals (create, retry, list, stats).
  4. Integrates with a DAO governance framework (proposals, voting, IP licensing).

What This Project Is NOT

  • This is NOT a price oracle (e.g., Chainlink-style).
  • This does NOT make autonomous financial decisions.
  • This does NOT require blockchain to function — it runs in simulation mode without Web3 credentials.

Architecture

oracle_service/
├── service.py      — Web3 connection, transaction building, signal monitor
├── routes.py       — FastAPI REST API endpoints
├── config.py       — Environment-based settings
├── db.py           — SQLAlchemy session management
├── worker.py       — Job queue stub (replace with Celery for production)
├── models/         — SQLAlchemy models (OracleSignal, AnalysisResult, Job)
└── schemas/        — Pydantic response schemas

API Endpoints

Method Path Description
GET / Health check
GET /status Oracle configuration status
GET /signals List signals (filterable)
GET /signals/{id} Get signal details
POST /signals/create Create signal from analysis result
POST /signals/{id}/retry Retry failed signal
GET /stats/summary Signal statistics
GET /transactions/{hash} Transaction status (placeholder)

Prerequisites

  • Python 3.10+
  • PostgreSQL or SQLite
  • Redis (optional, for production job queue)
  • Ethereum RPC endpoint (optional, runs in simulation without it)

Installation

pip install -r requirements.txt

Configuration

Set environment variables:

# Required for blockchain mode
export ORACLE_ENABLED=true
export ETHEREUM_RPC=https://your-rpc-endpoint
export ORACLE_PRIVATE_KEY=0x...
export GUARDIAN_CONTRACT=0x...
export DAO_CONTRACT=0x...
export CHAIN_ID=1

# Database
export DATABASE_URL=postgresql://user:pass@localhost/oracle

# Optional
export REDIS_URL=redis://localhost:6379/0
export DEBUG=false

Usage

Run the signal monitor:

python -m oracle_service.service

Run the API server (integrate with FastAPI app):

from fastapi import FastAPI
from oracle_service.routes import router

app = FastAPI()
app.include_router(router, prefix="/oracle")

Smart Contracts

The service interacts with three Solidity contracts (see contracts/test/):

  • YOUDAO — Governance: proposals, voting, staking, IP licensing
  • YOUAIGuardian — Oracle signal submission, heartbeat monitoring
  • TreasuryMultiSig — Multi-signature fund management

Disclaimer

This software is provided "as is" without warranty. The authors are not responsible for any financial losses resulting from blockchain transactions.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oracle_signal_service-1.0.0.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oracle_signal_service-1.0.0-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file oracle_signal_service-1.0.0.tar.gz.

File metadata

  • Download URL: oracle_signal_service-1.0.0.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for oracle_signal_service-1.0.0.tar.gz
Algorithm Hash digest
SHA256 541d484929ce8b88f57c15d350a511995f1bf8c591419935c14e0528d10dc1ec
MD5 2bfc5c91a1e72ddfa63c0e84322aba56
BLAKE2b-256 2d46a370e69df47fc38aa163d0433f9cf41ffcc820384aab63c3c6879e857bc2

See more details on using hashes here.

File details

Details for the file oracle_signal_service-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for oracle_signal_service-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cca29090c53d461ad47826bcad6624acf9f3fe7599671a7627b961209fb6f0c9
MD5 3ce8cac60eb60f74165bb60363eb4025
BLAKE2b-256 c6ed8237717a2009134653a17dc658664762274e15b36012b8fe2179a92b6813

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page