Skip to main content

No project description provided

Project description

Sentinel sdk

 Continuous Integration License python versions PyPI version

Sentinel is a blockchain data extraction and monitoring tool designed to work with the Bittensor network.

Features:

  • Extract extrinsics, events, and hyperparameters from Bittensor blockchain.
  • Provides both a Python library and a command-line interface (CLI) for ease of use.

Installation

pip install bittensor-sentinel

Usage

[!IMPORTANT] This package uses ApiVer, make sure to import sentinel.v1.

As a library

from sentinel.v1.providers.bittensor import bittensor_provider
from sentinel.v1.services.extractors.extrinsics import get_hyperparam_extrinsics
from sentinel.v1.services.sentinel import sentinel_service

provider = bittensor_provider()
service = sentinel_service(provider)
block = service.ingest_block(resolved_block)
for extrinsic in block.extrinsics:
    print(extrinsic)

Pylon integration

Sentinel supports Pylon as an alternative blockchain provider. Pylon is a caching proxy for the Bittensor network that provides faster neuron and validator queries.

Setup

  1. Run a Pylon instance (see Pylon documentation).
  2. Set the PYLON_URL environment variable (optional — defaults to http://localhost:8000):
    export PYLON_URL="http://your-pylon-instance:8090"
    export PYLON_OPEN_ACCESS_TOKEN="your-token"  # optional, only if Pylon requires authentication
    

As a library

Use PylonProvider as a drop-in replacement for BittensorProvider:

from sentinel.v1.providers.pylon import pylon_provider

# Uses PYLON_URL env var, or pass url directly
provider = pylon_provider(url="http://localhost:8090")

# Fetch metagraph (constructed from Pylon neuron data, always lite mode)
metagraph = provider.get_metagraph(netuid=1, block_number=100000, lite=True)

# Pylon-specific methods (not in the base BlockchainProvider interface)
neurons = provider.get_neurons(netuid=1, block_number=100000)
validators = provider.get_validators(netuid=1, block_number=100000)
latest = provider.get_latest_neurons(netuid=1)

[!NOTE] PylonProvider does not support block events, extrinsics listing, or subnet hyperparameters. These methods raise NotImplementedError. Use BittensorProvider for full chain access.

CLI

Use the --provider pylon flag with subnet commands:

# Query metagraph via Pylon
sentinel subnet --netuid 1 --provider pylon metagraph

# With a custom Pylon URL
sentinel subnet --netuid 1 --provider pylon --network http://my-pylon:8090 metagraph

# JSON output
sentinel subnet --netuid 1 --provider pylon -f json metagraph

CLI (general)

$ sentinel --help


Usage: sentinel [OPTIONS] COMMAND [ARGS]...

Sentinel CLI - Blockchain data extraction and monitoring tool.

╭─ Options ────────────────────────────────────────────────────────────────────╮
│ --format              -f      [table|json]  Output format. [default: table]  │
│ --install-completion                        Install completion for the       │
│                                             current shell.                   │
│ --show-completion                           Show completion for the current  │
│                                             shell, to copy it or customize   │
│                                             the installation.                │
│ --help                                      Show this message and exit.      │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────╮
│ extrinsics    Read extrinsics from a blockchain block.                       │
│ events        Read events from a blockchain block.                           │
│ hyperparams   Read hyperparameters for a subnet at a specific block.         │
│ block         Block-related commands.                                        │
╰──────────────────────────────────────────────────────────────────────────────╯

Versioning

This package uses Semantic Versioning. TL;DR you are safe to use compatible release version specifier ~=MAJOR.MINOR in your pyproject.toml or requirements.txt.

Additionally, this package uses ApiVer to further reduce the risk of breaking changes. This means, the public API of this package is explicitly versioned, e.g. sentinel.v1, and will not change in a backwards-incompatible way even when sentinel.v2 is released.

Internal packages, i.e. prefixed by sentinel._ do not share these guarantees and may change in a backwards-incompatible way at any time even in patch releases.

Development

Pre-requisites:

Ideally, you should run nox -t format lint before every commit to ensure that the code is properly formatted and linted. Before submitting a PR, make sure that tests pass as well, you can do so using:

nox -t check # equivalent to `nox -t format lint test`

If you wish to install dependencies into .venv so your IDE can pick them up, you can do so using:

uv sync --all-extras --dev

Release process

Run nox -s make_release -- X.Y.Z where X.Y.Z is the version you're releasing and follow the printed instructions.

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

bittensor_sentinel-0.2.1.tar.gz (185.4 kB view details)

Uploaded Source

Built Distribution

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

bittensor_sentinel-0.2.1-py3-none-any.whl (46.7 kB view details)

Uploaded Python 3

File details

Details for the file bittensor_sentinel-0.2.1.tar.gz.

File metadata

  • Download URL: bittensor_sentinel-0.2.1.tar.gz
  • Upload date:
  • Size: 185.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for bittensor_sentinel-0.2.1.tar.gz
Algorithm Hash digest
SHA256 017f584144ef6fbac72a3ed51db1a67863a8d6fa182e935acfb41dc81fe63713
MD5 51ce6e32c0bcf17871b9df67ab7fb80d
BLAKE2b-256 5a1d923b0c53a8be656f6bc753c97ff9903e590ca8017bb1dbf24aec75a26287

See more details on using hashes here.

Provenance

The following attestation bundles were made for bittensor_sentinel-0.2.1.tar.gz:

Publisher: publish.yml on bittensor-church/sentinel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bittensor_sentinel-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for bittensor_sentinel-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fff8b08f97af8f341f0e5af25336259015f735eb0774ea02d2b88b32a54c9d26
MD5 6f1da29dcb18c3bc80a4712d9a626016
BLAKE2b-256 cf43994b906ddf3ff670fa0285d3625b1bb794da1ad4d133d672990c5ec5719c

See more details on using hashes here.

Provenance

The following attestation bundles were made for bittensor_sentinel-0.2.1-py3-none-any.whl:

Publisher: publish.yml on bittensor-church/sentinel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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