Skip to main content

Python SDK for interacting with the Ardrive Turbo Upload and Payment Service

Project description

Turbo Python SDK

A Python SDK for interacting with the ArDrive Turbo Upload service, supporting both Ethereum and Arweave signers for permanent data storage on Arweave.

Get Started

Installation

pip install turbo-sdk

Quick Start

Ethereum Usage

from turbo_sdk import Turbo, EthereumSigner

# Create Ethereum signer
signer = EthereumSigner("0x1234567890abcdef...")  # Your private key

# Create Turbo client
turbo = Turbo(signer, network="mainnet")

# Upload data
result = turbo.upload(b"Hello, Turbo!", tags=[
    {"name": "Content-Type", "value": "text/plain"},
    {"name": "App-Name", "value": "MyApp"}
])

print(f"✅ Uploaded! TX ID: {result.id}")
print(f"🌐 View at: https://arweave.net/{result.id}")

Arweave Usage

import json
from turbo_sdk import Turbo, ArweaveSigner

# Load Arweave wallet (JWK format)
with open("test-wallet.json") as f:
    jwk = json.load(f)

# Create Arweave signer
signer = ArweaveSigner(jwk)

# Create Turbo client
turbo = Turbo(signer, network="mainnet")

# Upload data
result = turbo.upload(b"Hello from Arweave!", tags=[
    {"name": "Content-Type", "value": "text/plain"}
])

print(f"✅ Uploaded! URI: ar://{result.id}")

APIs

Core Classes

Turbo(signer, network="mainnet")

Main client for interacting with Turbo services.

Parameters:

  • signer: Either EthereumSigner or ArweaveSigner instance
  • network: "mainnet" or "testnet" (default: "mainnet")

Methods:

upload(data, tags=None) -> TurboUploadResponse

Upload data to the Turbo datachain.

result = turbo.upload(
    data=b"Your data here",
    tags=[
        {"name": "Content-Type", "value": "application/json"},
        {"name": "App-Name", "value": "MyApp"}
    ]
)

Returns: TurboUploadResponse

@dataclass
class TurboUploadResponse:
    id: str                        # Transaction ID
    owner: str                     # Owner address
    data_caches: List[str]         # Cache endpoints
    fast_finality_indexes: List[str] # Fast finality indexes
    winc: str                      # Winston credits cost
get_balance(address=None) -> TurboBalanceResponse

Get winston credit balance. Uses signed request for authenticated balance check when no address specified.

# Check your own balance (signed request)
balance = turbo.get_balance()
print(f"Balance: {balance.winc} winc")

# Check another address (no signature needed)
other_balance = turbo.get_balance("0x742d35Cc6635C0532925a3b8C17af2e95C5Aca4A")
print(f"Other balance: {other_balance.winc} winc")

Returns: TurboBalanceResponse

@dataclass
class TurboBalanceResponse:
    winc: str                      # Available winston credits
    controlled_winc: str           # Controlled amount
    effective_balance: str         # Effective balance including shared credits
get_upload_price(byte_count) -> int

Get the cost to upload data of a specific size.

cost = turbo.get_upload_price(1024)  # Cost for 1KB
print(f"Upload cost: {cost} winc")

Signers

EthereumSigner(private_key)

Ethereum signer using ECDSA signatures.

Parameters:

  • private_key (str): Hex private key with or without 0x prefix
signer = EthereumSigner("0x1234567890abcdef...")

ArweaveSigner(jwk)

Arweave signer using RSA-PSS signatures.

Parameters:

  • jwk (dict): Arweave wallet in JWK format
signer = ArweaveSigner({
    "kty": "RSA",
    "n": "...",
    "e": "AQAB",
    "d": "...",
    # ... other JWK fields
})

Signer Methods

Both signers provide:

get_wallet_address() -> str

Get the wallet address for the signer.

address = signer.get_wallet_address()
print(f"Wallet address: {address}")
create_signed_headers() -> dict

Create signed headers for authenticated API requests.

headers = signer.create_signed_headers()

Developers

Setup

  1. Crete a virtual environment:
python -m venv venv
source venv/bin/activate 
  1. Install dependencies:
pip install -e ".[dev]"
  1. Run tests:
pytest

That's it! The test suite includes comprehensive tests for all components without requiring network access.

Acknowledgments

This package leverages implementations from the Irys Python SDK for ANS-104 DataItem format and cryptographic operations. Special thanks to the Irys team for their work on permanent data storage standards.

License

MIT License - see LICENSE for details.

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

turbo_sdk-0.0.2.tar.gz (22.2 kB view details)

Uploaded Source

Built Distribution

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

turbo_sdk-0.0.2-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file turbo_sdk-0.0.2.tar.gz.

File metadata

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

File hashes

Hashes for turbo_sdk-0.0.2.tar.gz
Algorithm Hash digest
SHA256 ed39d14589579b8efc622b8038bf4476270584faad3d66e30e3be9b87c0d97a8
MD5 6e36cd362fff80b10bbe29f69300d7fb
BLAKE2b-256 4f737bb7adc9bb39a7e673977f3103baa37c28d67cbe527e28e39452f1acbe3d

See more details on using hashes here.

Provenance

The following attestation bundles were made for turbo_sdk-0.0.2.tar.gz:

Publisher: release.yml on ardriveapp/turbo-python-sdk

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

File details

Details for the file turbo_sdk-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: turbo_sdk-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 16.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for turbo_sdk-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4284ab84871393822f4884337876c4c2c8e799fa74f5cd97cc692b6499980b01
MD5 3c5a6940fe7aa53ede4286a75c5af3fc
BLAKE2b-256 7a02c8a7f7847dd9ed8a067199ae4d8a8cf49052bed7129697f0c33b716965e6

See more details on using hashes here.

Provenance

The following attestation bundles were made for turbo_sdk-0.0.2-py3-none-any.whl:

Publisher: release.yml on ardriveapp/turbo-python-sdk

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