Skip to main content

Python library with the neurion networks

Project description

NeurionPy

NeurionPy is the official Python SDK for interacting with the Neurion blockchain, a Cosmos SDK-based network designed for privacy-preserving AI, federated learning, and decentralized automation. NeurionPy provides developers with all the necessary tools to create wallets, sign transactions, and interact with various modules on the blockchain.

Features

  • Wallet Management: Generate wallets from private keys, mnemonics, or existing addresses.
  • Transaction Signing: Sign and broadcast transactions securely.
  • Querying the Blockchain: Retrieve blockchain state, account balances, and contract data.
  • Module Interactions: Full support for all Neurion modules:
    • Sanctum: Privacy-preserving dataset sharing and usage requests.
    • Crucible: Federated learning, model training, and validation.
    • Fusion: AI model aggregation and dispute resolution.
    • Ganglion: AI agent and workflow automation.
  • GRPC & REST Support: Seamlessly interact with the Neurion blockchain via GRPC and REST APIs.

Installation

Install NeurionPy using pip:

pip install neurionpy

Package available on PyPI: NeurionPy

Getting Started

Importing NeurionPy

import grpc
from neurionpy.synapse.client import NeurionClient, NetworkConfig
from neurionpy.synapse.wallet import LocalWallet

Creating a Wallet

wallet = LocalWallet.from_mnemonic(
    "your mnemonic here",
    "neurion"
)
print("Address:", wallet.address)

Connecting to Neurion

client = NeurionClient(NetworkConfig.neurion_localnet(), wallet)

Module Interactions

Below are examples of interactions with the different Neurion modules. More operations are supported; refer to the API documentation for the full list.

Sanctum (Privacy-Preserving Dataset Management)

Example: Submitting a Dataset Application

tx = client.sanctum.tx.SubmitDatasetApplication(
    message=MsgSubmitDatasetApplication(
        creator=str(wallet.address()),
        encrypted_data_link="https://encrypted_data_link",
        explanation_link="https://explanation_link",
        contact="contact",
        stake=100000000,
        proof_of_authenticity="proof_of_authenticity",
        dataset_usage_fee=100000000
    )
)
print(f"TX {tx.tx_hash} submitted.")

Other available Sanctum operations:

  • Approve dataset applications
  • Request to use datasets
  • Manage dataset processing

Crucible (Federated Learning & Model Validation)

Example: Registering as a Model Trainer

tx = client.crucible.tx.RegisterTrainer(
    message=MsgRegisterTrainer(
        creator=str(wallet.address()),
        task_id=1
    )
)
print(f"Trainer Registration TX: {tx.tx_hash}")

Other available Crucible operations:

  • Submit training results
  • Stake tokens to tasks
  • Report model plagiarism

Fusion (AI Model Aggregation & Dispute Resolution)

Example: Proposing a Model for a Task

tx = client.fusion.tx.ProposeModel(
    message=MsgProposeModel(
        creator=str(wallet.address()),
        task_id=1,
        model_link="https://model_link",
        metadata_link="https://metadata_link"
    )
)
print(f"Model Proposal TX: {tx.tx_hash}")

Other available Fusion operations:

  • Register as a proposer or validator
  • Dispute model scores
  • Claim rewards from tasks

Ganglion (AI Agent & Workflow Automation)

Example: Registering an AI Agent (Ion)

tx = client.ganglion.tx.RegisterIon(
    message=MsgRegisterIon(
        capacities=["SCRAPER", "EXTRACTOR"],
        stake=10000000,
        endpoints=["http://localhost", "http://66.63.66.66"],
        description="A scraper and extractor",
        input_schema='{"name":"string","flag":"boolean"}',
        output_schema='{"another_flag":"boolean","fullname":"string"}',
        fee_per_thousand_calls=18,
    )
)
print(f"Ion Registration TX: {tx.tx_hash}")

Other available Ganglion operations:

  • Report and validate Ions
  • Register and update pathways
  • Stake and claim rewards from Ganglion

License

This project is licensed under the MIT License.

Disclaimer

Use NeurionPy at your own risk. Ensure you store private keys securely and follow best security practices when interacting with blockchain assets.

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

neurionpy-0.11.0.tar.gz (440.4 kB view details)

Uploaded Source

Built Distribution

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

neurionpy-0.11.0-py3-none-any.whl (1.1 MB view details)

Uploaded Python 3

File details

Details for the file neurionpy-0.11.0.tar.gz.

File metadata

  • Download URL: neurionpy-0.11.0.tar.gz
  • Upload date:
  • Size: 440.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.9.21 Linux/6.8.0-1021-azure

File hashes

Hashes for neurionpy-0.11.0.tar.gz
Algorithm Hash digest
SHA256 51e86c30b9456d4bbc1506f2da88e38ecb3aec3c9b860c6bce19fa9b846a8eb7
MD5 4505ffe0e4dc9fd8bf2ea543cd37b09a
BLAKE2b-256 3d5db1dd51bfa36960427384587ce03dbb5c005831e699e1a47ffaff47a8d51b

See more details on using hashes here.

File details

Details for the file neurionpy-0.11.0-py3-none-any.whl.

File metadata

  • Download URL: neurionpy-0.11.0-py3-none-any.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.9.21 Linux/6.8.0-1021-azure

File hashes

Hashes for neurionpy-0.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0a448455280a67ab392afc1693001817a7a637203370e6987cc9a74c3f8f6015
MD5 56ad1a28f873f09c0947b0a06f3649f3
BLAKE2b-256 671feee1e9ded8365a1377d23b77cac025fb93a4b265b67b5c81fa2b59d943f0

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