Skip to main content

Official Python SDK for RuleRunner API

Project description

RuleRunner Python SDK

Official Python SDK for the RuleRunner API - a compliance-as-a-service platform for blockchain transactions.

Installation

pip install rulerunner-sdk

Quick Start

from rulerunner_sdk import RuleRunnerClient

# Initialize the client with your API key
client = RuleRunnerClient(api_key="your_api_key")

# Check if a transaction is compliant
result = client.is_compliant(
    from_address="0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
    to_address="0x742d35Cc6634C0532925a3b844Bc454e4438f44f",
    amount="10.0"
)

print(f"Transaction is compliant: {result['is_compliant']}")

# Verify a proof locally
if not result['is_compliant'] and result.get('from_address_proof'):
    is_valid = client.verify_proof_locally(
        address="0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
        proof=result['from_address_proof'],
        root=result['merkle_root']
    )
    print(f"Local proof verification: {is_valid}")

Features

  • Transaction compliance checking
  • Local proof verification
  • Health check endpoint
  • API key management
  • Rate limiting and quota tracking

API Reference

RuleRunnerClient

client = RuleRunnerClient(
    api_key: str,
    base_url: str = "https://api.rulerunner.com"  # Optional custom base URL
)

Methods

is_compliant

Check if a transaction is compliant with sanctions lists.

result = client.is_compliant(
    from_address: str,
    to_address: str,
    amount: str
)

verify_proof_locally

Verify a Merkle proof locally without making an API call.

is_valid = client.verify_proof_locally(
    address: str,
    proof: List[Dict[str, Any]],
    root: str
)

health_check

Check the health status of the API.

status = client.health_check()

Error Handling

The SDK raises custom exceptions for different error cases:

  • RuleRunnerAPIError: API-level errors (4xx, 5xx)
  • RuleRunnerConnectionError: Network/connection issues
  • RuleRunnerProofVerificationError: Invalid proof data

License

MIT License

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

rulerunner_sdk-0.2.0.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

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

rulerunner_sdk-0.2.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file rulerunner_sdk-0.2.0.tar.gz.

File metadata

  • Download URL: rulerunner_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for rulerunner_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 aa18af3a96bcee96bdc467571d72ff04cd92a269ba66f08d5f8171006554beec
MD5 d778275c0ceeb5f10adbc6a411e1e121
BLAKE2b-256 712892e1c1ff34ce9a9f3ce58270a02f5e1abbd959fec01cb7db97d76022b76c

See more details on using hashes here.

File details

Details for the file rulerunner_sdk-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: rulerunner_sdk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for rulerunner_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 62be755f0d268c618f1e3a52973a15b2fdd888332f1a3494462e9661901fcac5
MD5 7bd24e6d7537572c3e8ce72c71964184
BLAKE2b-256 4732ec6334f0375811379d8475a6a5344c1b37a10a87d9dc0ba9839c00df839d

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