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="0x7FF9cFad3877F21d41Da833E2F775dB0569eE3D9",
    to_address="0x742d35Cc6634C0532925a3b844Bc454e4438f44f",
    amount="1.0"
)

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

# Verify a proof locally
if not result['is_compliant'] and result.get('from_address_proof'):
    is_valid = client.verify_proof_locally(
        address="0x7FF9cFad3877F21d41Da833E2F775dB0569eE3D9",
        proof=result.get("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

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.3.0.tar.gz (10.5 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.3.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rulerunner_sdk-0.3.0.tar.gz
  • Upload date:
  • Size: 10.5 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.3.0.tar.gz
Algorithm Hash digest
SHA256 895056f23d894bb54b4df141c9d3331815860ab7179d7a66fc02819ab3a899ee
MD5 f92d939c67968a3bc50b2a90e09b1ee4
BLAKE2b-256 197f1eeb446e8e644b6b0b435c52248a190fc1ad7189a10406db555bf84457a9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rulerunner_sdk-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 7.6 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d5c1f968c0f28d0c13217fc1d06821a0477f192317debae6a2d3899dcf6110ff
MD5 fffb0446f358df11801638a6653d97e1
BLAKE2b-256 86f19a71767170d424609b88eb9d0b9597a9e81dbef5fe78c050ef9e81e29b14

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