Skip to main content

hashlock-sdk (Python)

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

Stable (1.x) — defaults to the production API api.hashlock.markets; set the base URL to target another deployment. Breaking changes come only with a new major version.

To test with test coins, use the testnet sandbox: base_url="https://api-sandbox.hashlock.markets/v1", with a key made on the sandbox (Sandbox).

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, quote_amount, hashlock=hashlock)  # the price you read; refused if it moved

# 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

Metadata

Release files for hashlock-sdk 1.2.1

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 1.2.1
File Size Uploaded Provenance Actions
hashlock_sdk-1.2.1.tar.gz 9.2 kB With provenance Details for hashlock_sdk-1.2.1.tar.gz

Built distribution (wheel)

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

Total release size: 20.5 kB

Release files / hashlock_sdk-1.2.1.tar.gz

Download URL hashlock_sdk-1.2.1.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
95e10356e4b4f59a78fd835221b0847cb64696309f0687033f0957cde9d7edb2
BLAKE2b-256 checksum
How to use checksums
7e26661c9f509931d72e213fdfab9e2bd45172758a64807e0e8a075b41dce232
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Nov 24, 2026.

Transparency log

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

Download URL hashlock_sdk-1.2.1-py3-none-any.whl
Size 11.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a7196847cb7e2b676f503cc030569105a8957a1fc474fdf22538f799b36850d2
BLAKE2b-256 checksum
How to use checksums
831b98e5bf9392dc2546ccff7ce66d53ed2a4cac41ab728bbb5eba8009a73a29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Nov 24, 2026.

Transparency log

Security for hashlock-sdk 1.2.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for hashlock_sdk-1.2.1.tar.gz

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 Nov 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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