Skip to main content

Python client for interacting with the Hyperlabs Bitcoin API

Project description

APIBTC - Current Status

Please Note: Currently, our publicly hosted API endpoint is available exclusively on the Bitcoin regtest network for development and testing purposes.

  • API Documentation (Swagger): The regtest API documentation is available via Swagger here.
  • Mainnet Environment: We do not provide a publicly hosted mainnet API endpoint. You can run your own mainnet instance using the provided Docker image.
  • More Information: For further details about the project, Docker images, and setup instructions, please visit the main project website.

⚠️ Important: The public API operates on regtest. Do not send real Bitcoin (BTC) to any addresses generated or used via this public regtest endpoint.

from apibtc import Wallet
from mnemonic import Mnemonic
from bip32utils import BIP32Key

# Declare API url
BASE_URL = "API_BASE_URL"

# Create two wallets
# Wallet 1 - Invoice Creator
mnemon1 = Mnemonic('english')
words1 = mnemon1.generate(128)
private_key1 = BIP32Key.fromEntropy(mnemon1.to_seed(words1)).PrivateKey().hex()
wallet1 = Wallet(base_url=BASE_URL, privkey=private_key1)

# Wallet 2 - Invoice Payer
mnemon2 = Mnemonic('english')
words2 = mnemon2.generate(128)
private_key2 = BIP32Key.fromEntropy(mnemon2.to_seed(words2)).PrivateKey().hex()
wallet2 = Wallet(base_url=BASE_URL, privkey=private_key2)

# Payment flow
# Create invoice with wallet1
invoice = wallet1.addinvoice(satoshis=1000, memo="Payment from wallet2", expiry=3600)

# Pay invoice with wallet2
wallet2.sendpayment(paymentrequest=invoice['paymentRequest'], timeout=30, feelimit=100)

# Check balances after payment
print("Wallet1 balance:", wallet1.getbalance())
print("Wallet2 balance:", wallet2.getbalance())

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

apibtc-1.0.17.tar.gz (34.5 kB view details)

Uploaded Source

Built Distribution

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

apibtc-1.0.17-py3-none-any.whl (29.2 kB view details)

Uploaded Python 3

File details

Details for the file apibtc-1.0.17.tar.gz.

File metadata

  • Download URL: apibtc-1.0.17.tar.gz
  • Upload date:
  • Size: 34.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for apibtc-1.0.17.tar.gz
Algorithm Hash digest
SHA256 cde33d3fe66f2195ed0633c8966e7a94d6da59a1ca25d5ba828cc7ec7a3f2a39
MD5 4c9f90c95d84ea16de0c58bfc46b8db0
BLAKE2b-256 b5f9351eb55e64c430eb89a6a2b5fb3dc0bd0f94247fa90dbada88a9cd56cf72

See more details on using hashes here.

File details

Details for the file apibtc-1.0.17-py3-none-any.whl.

File metadata

  • Download URL: apibtc-1.0.17-py3-none-any.whl
  • Upload date:
  • Size: 29.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for apibtc-1.0.17-py3-none-any.whl
Algorithm Hash digest
SHA256 cb3943dbbce800a705a4b91bafeccfa1f391bddc6d69e9a30866ab0b36df7a5a
MD5 53f149184ed4b01f8c07f6b7e4e140a7
BLAKE2b-256 7848d74b740d4f7bfe4db968e038db224361cddbbe1b1109e710b3d9e0413da3

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