Decentralized adjudication for onchain contracts, powered by Bittensor.
Pelion routes contract questions (prediction-market resolutions, insurance claims, DAO disputes) to a council of frontier AI models on Bittensor subnets, aggregates their verdicts with evidence and reasoning, and returns a signed result that any contract on Base can consume.
This repository is the Python core: the canonical schemas, the frontier-model judgment council, and runnable Bittensor miner and validator services.
Read more about the protocol at docs at pelionprotocol.github.io.
Requires Python 3.11 or newer.
git clone https://github.com/pelionprotocol/pelion-protocol
cd pelion-protocol
pip install -e ".[dev]"Optional extras:
pip install -e ".[bittensor]" # Bittensor SDK (miner + validator)
pip install -e ".[frontier]" # Anthropic, OpenAI, Google SDKs
pip install -e ".[bittensor,frontier,dev]" # everythingRun the test suite:
pytestThe default suite runs without the bittensor extra installed. tests/conftest.py stubs the SDK so schemas, judgment, miner, and validator unit tests are all fast and dependency-light.
| Module | Purpose |
|---|---|
pelion.schemas |
Canonical Question, Verdict, and PelionSynapse types. Pydantic v2, frozen, camelCase wire format. |
pelion.judgment |
Frontier AI council. Fans a question to Anthropic, OpenAI, and Google in parallel and aggregates into a single Verdict. |
pelion.miner |
Runnable Bittensor miner. Wraps FrontierModelClient behind a bt.Axon. |
pelion.validator |
Runnable Bittensor validator. Queries miners with a backtest set, scores responses, sets weights. |
Two console scripts are installed with the package:
pelion-miner --config miner.yaml
pelion-validator --config validator.yamlPelion runs as a five-layer stack. This repo implements the Judgment layer (and the miner/validator that participate in it).
| Layer | Runtime | Role |
|---|---|---|
| Application | Base (Solidity) | Prediction markets, insurance contracts, DAOs. The consumers of verdicts. |
| Adapter | Base (Solidity) | Accept questions, escrow bonds, handle challenges, fire payout callbacks. |
| Router | Off-chain (Python) | Translate questions to subnet queries, aggregate responses, pin evidence. |
| Judgment | Bittensor subnets | Miners produce verdicts, validators score, TAO-backed economic security. |
| Relay | Bonded cross-chain | Permissionless messengers carry verdicts back to Base with challenge windows. |
User / Contract on Base
│
▼
submitQuestion() ──► QuestionSubmitted event
│
▼
Router translates to subnet query
│
▼
Miners verdict, validators score
│
▼
Verdict bundle assembled
│
▼
Relayer posts to Base (with bond)
│
▼
Challenge window (1–6 hours)
├── no challenge ──► Finalize / payout callback
└── challenge ──► Counter bond + sig verification ──► Finalize
Build a Question and serialize to canonical JSON:
from pelion.schemas import Question, EvidencePolicy
q = Question(
version="0.1",
question_id="0x" + "a" * 64,
requester="0x" + "b" * 40,
text="Did SpaceX launch Starship on 2026-04-01?",
resolution_criteria="YES iff a Starship reached orbit on the stated date.",
resolution_time=1743465600,
expiration_time=1743552000,
evidence_policy=EvidencePolicy(
allowed_source_categories=["news"],
allowed_domains=["nasa.gov", "spacex.com"],
max_age_hours=72,
min_source_count=2,
),
subnet_routing=[6, 28],
reward="1000000",
bond_amount="500000",
submitted_at=1743379200,
)
canonical = q.model_dump_json(by_alias=True) # camelCase wire formatResolve a question with the frontier council (no Bittensor required):
import asyncio
from pelion.judgment import FrontierModelClient
from pelion.judgment.providers import AnthropicProvider, OpenAIProvider, GeminiProvider
async def main():
client = FrontierModelClient(
providers=[AnthropicProvider(), OpenAIProvider(), GeminiProvider()],
min_responses=2,
per_provider_timeout_s=60.0,
)
verdict = await client.judge(q)
print(verdict.outcome_label, verdict.confidence)
asyncio.run(main())Set ANTHROPIC_API_KEY, OPENAI_API_KEY, and GOOGLE_API_KEY before running.
Run a miner on Bittensor testnet:
pip install -e ".[bittensor,frontier]"
btcli wallet new_coldkey --wallet.name pelion
btcli wallet new_hotkey --wallet.name pelion --wallet.hotkey miner-01
btcli subnet register --wallet.name pelion --wallet.hotkey miner-01 \
--netuid <NETUID> --subtensor.network test
export ANTHROPIC_API_KEY=...
export OPENAI_API_KEY=...
export GOOGLE_API_KEY=...
pelion-miner --config miner.yamlSee pelion/miner/README.md for the full configuration reference.