Skip to main content

SatRank SDK for autonomous agents on Bitcoin Lightning. Discover, pay, and self-list Lightning-native HTTP services.

Project description

satrank — Python SDK

Python client for SatRank. One verb — fulfill() — that discovers, pays, and reports a Lightning-native HTTP service in a single call with a hard budget guarantee.

Install

pip install satrank                 # core
pip install "satrank[nwc]"          # + Nostr Wallet Connect driver

Python 3.10+.

Quickstart

import asyncio
from satrank import SatRank
from satrank.wallet import LndWallet

async def main() -> None:
    async with SatRank(
        api_base="https://satrank.dev",
        wallet=LndWallet(
            rest_endpoint="https://127.0.0.1:8080",
            macaroon_hex="...",  # admin macaroon (hex)
        ),
        caller="my-agent",
    ) as sr:
        result = await sr.fulfill(
            intent={"category": "data/weather", "keywords": ["paris"]},
            budget_sats=50,
        )
        print(result["response_body"] if result["success"] else result["error"])

asyncio.run(main())

Discovery only (no wallet)

async with SatRank(api_base="https://satrank.dev", caller="explorer") as sr:
    cats = await sr.list_categories()
    res = await sr.resolve_intent(category="data/weather", limit=10)
    for c in res["candidates"]:
        print(c["rank"], c.get("price_sats"), c.get("service_name"))

Wallet drivers

  • LndWallet — LND REST, macaroon auth.
  • NwcWallet — NIP-47 Nostr Wallet Connect (needs satrank[nwc]).
  • LnurlWallet — LNbits-style HTTP wallets.

See docs/sdk/wallet-drivers.md in the repo.

Documentation

License

MIT.

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

satrank-1.2.0.tar.gz (36.5 kB view details)

Uploaded Source

Built Distribution

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

satrank-1.2.0-py3-none-any.whl (33.7 kB view details)

Uploaded Python 3

File details

Details for the file satrank-1.2.0.tar.gz.

File metadata

  • Download URL: satrank-1.2.0.tar.gz
  • Upload date:
  • Size: 36.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.6

File hashes

Hashes for satrank-1.2.0.tar.gz
Algorithm Hash digest
SHA256 9768a53be84b62db999ded0ae074d708179f8cc345f5e0b210893b3abf6a698f
MD5 0836ea8c98c6b1a19e303978738d4ae0
BLAKE2b-256 e4124f2f845f14db46db214ad4da798e425ad60977e3d13975fcebf4d4e4f723

See more details on using hashes here.

File details

Details for the file satrank-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: satrank-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 33.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.6

File hashes

Hashes for satrank-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 00c4b757e99aeccce78a08c82c50de13f4dbdf7d7a3e05cdf47474c0e2cb39af
MD5 af5b35045261237f94d7422a5b0e2a1f
BLAKE2b-256 46b0b16f4494248e081333fbe7f2301e8e06c7574e06bad948ada9489061bfef

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