Skip to main content

hashlock-sdk (Python)

Python SDK for the Hashlock Markets developer API — non-custodial cross-chain atomic swaps (BTC ↔ EVM/TRON). Python 3.9+, built on httpx.

⚠️ Sandbox / testnet preview (0.x) — defaults to api-dev.hashlock.markets, testnets only, pre-mainnet. The API may change before the stable 1.0. Not for mainnet funds.

pip install hashlock-sdk          # add [ws] for the maker WebSocket feed: hashlock-sdk[ws]
from hashlock import HashlockClient, new_secret, verify_webhook

client = HashlockClient(api_key=os.environ["HASHLOCK_API_KEY"])
client.me()

# cursor pagination — page or auto-iterate
page = client.list_swaps(limit=20)
for swap in client.swaps():
    ...

# initiator: secret stays private; submit only the hashlock
secret, hashlock = new_secret()
client.accept_terms(thread_id, hashlock=hashlock)

# webhooks: verify a delivery against the raw body
ok = verify_webhook(secret, raw_body, request.headers.get("x-hashlock-signature"), request.headers.get("x-hashlock-timestamp"))

Settlement is custody-agnostic: build_fund / build_claim / build_refund return unsigned transactions — sign with your wallet or HSM (see ../examples/fireblocks) and broadcast(...). See the root README for the full swap lifecycle.

MIT

Release files for hashlock-sdk 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hashlock-sdk 0.4.0
File Size Uploaded
hashlock_sdk-0.4.0.tar.gz 5.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hashlock-sdk 0.4.0
File Interpreter ABI Platform
hashlock_sdk-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.5 kB

Release files / hashlock_sdk-0.4.0.tar.gz

Download URL hashlock_sdk-0.4.0.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d3611317aa8307358181b89ab667d12fb041272ec4dd52199b75eef2a05c00b4
BLAKE2b-256 checksum
How to use checksums
1bd5183e507c26e89a73af25ed47fb904c4deef7744129fde621110e60acda5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 24, 2026.

Transparency log

Release files / hashlock_sdk-0.4.0-py3-none-any.whl

Download URL hashlock_sdk-0.4.0-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f3dde71594a38e7f130fe6e3d937e8eeaf70fa5f2e89737e8e912c6fed78151e
BLAKE2b-256 checksum
How to use checksums
aa4fede23a11ac80b6ee2b8c059d9a8609fbc27b60f62131185af2487165c402
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 24, 2026.

Transparency log

Release history Release notifications | RSS feed

0.5.0

2 release files

This release

0.4.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page