Skip to main content

Boltz Swap library

Project description

Boltz Client Python Bindings

Python bindings for the Boltz Rust library, enabling atomic swaps between Bitcoin, Lightning Network, and Liquid.

Installation

pip install boltz_client

Quick Start

⚠️ WARNING: All examples are only to be used in REGTEST.

import boltz_client
import asyncio

async def main():
    # Initialize for regtest (do NOT use this example in production)
    network = boltz_client.Network.REGTEST
    boltz_api = boltz_client.BoltzApiClientV2.default(network)

    # Example: Create a submarine swap (Lightning → Bitcoin)
    key_pair = boltz_client.KeyPair()
    btc_chain = boltz_client.btc_chain_from_network(network)

    invoice = "lightning-invoice-to-pay"

    request = boltz_client.CreateSubmarineRequest(
        _from=btc_chain,
        to=btc_chain,
        invoice=invoice,
        refund_public_key=key_pair.public(),
    )

    swap = await boltz_api.create_swap(request)
    print(f"Send {swap.expected_amount} sats to {swap.address}")

asyncio.run(main())

Swap Types

  • Submarine swaps - Lightning → On-chain Bitcoin/Liquid
  • Reverse swaps - On-chain Bitcoin/Liquid → Lightning
  • Chain swaps - Bitcoin ↔ Liquid atomic swaps

Examples

Complete working examples are available in the examples/ directory:

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

boltz_client-0.4.1.tar.gz (5.4 MB view details)

Uploaded Source

Built Distribution

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

boltz_client-0.4.1-py3-none-manylinux_2_38_x86_64.whl (5.4 MB view details)

Uploaded Python 3manylinux: glibc 2.38+ x86-64

File details

Details for the file boltz_client-0.4.1.tar.gz.

File metadata

  • Download URL: boltz_client-0.4.1.tar.gz
  • Upload date:
  • Size: 5.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.8

File hashes

Hashes for boltz_client-0.4.1.tar.gz
Algorithm Hash digest
SHA256 3ebba5ef6faadd1deced94d7652eed39fd15bc8ba84565f473ad46118ef52b42
MD5 0256de4854325b9d7eeb082f8263e32d
BLAKE2b-256 d82f00b031fdfdaaf2ec09373935ca24bce9031d779be913a2f4cd16da187cea

See more details on using hashes here.

File details

Details for the file boltz_client-0.4.1-py3-none-manylinux_2_38_x86_64.whl.

File metadata

File hashes

Hashes for boltz_client-0.4.1-py3-none-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 0cbd21d8dcbca16bb6814ce25bacc0b6c333d7eed9ca6c9508d48a4f23ebd1e4
MD5 d90d514a74a5415aae78cc9def206a99
BLAKE2b-256 3dcf2e207d784ae3efcfe89b226d5437f1567d426f1fcb38a39941d5a469f3cf

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