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.3.0.post1.tar.gz (5.3 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.3.0.post1-py3-none-manylinux_2_34_x86_64.whl (5.3 MB view details)

Uploaded Python 3manylinux: glibc 2.34+ x86-64

File details

Details for the file boltz_client-0.3.0.post1.tar.gz.

File metadata

  • Download URL: boltz_client-0.3.0.post1.tar.gz
  • Upload date:
  • Size: 5.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.8

File hashes

Hashes for boltz_client-0.3.0.post1.tar.gz
Algorithm Hash digest
SHA256 7e1527dbbfa55d308755c471b7d635fe1a0e2309d4e35b1ca48f7c69dd892878
MD5 7977bc1caae9f23173b519cf7ec1fcbe
BLAKE2b-256 4fd9b660c8492558601bd885ee0b921699065b19bb2df2f24e63cdda00db0fa8

See more details on using hashes here.

File details

Details for the file boltz_client-0.3.0.post1-py3-none-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for boltz_client-0.3.0.post1-py3-none-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 27cb7522743bb9e853808fa28b8e74bfc28108b5966682173b2c0736a134e0e0
MD5 a47ebf63738646c201753852936d5cd0
BLAKE2b-256 e61165b836fdb009d7c5507738876d19f45692bb4ba7d00ae92f9eaf66fde67d

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