Satoshi API Python SDK
Typed Python client for the Satoshi API — Bitcoin fee intelligence that saves money on every transaction.
Zero dependencies. Uses only Python stdlib. Works with Python 3.10+.
Install
pip install satoshi-api-sdk
Quick Start
from satoshi_api import SatoshiAPI
api = SatoshiAPI() # anonymous tier (30 req/min)
# Get current fees
fees = api.fees()
print(fees.data)
# Get a block
block = api.block(840000)
print(f"Block {block.data['height']}: {block.data['tx_count']} transactions")
# Check mempool
mempool = api.mempool()
print(f"Mempool: {mempool.data['size']} transactions")
# Fee recommendation
landscape = api.fee_landscape()
print(landscape.data["recommendation"])
Authentication
# Register for a free API key at https://bitcoinsapi.com/docs
api = SatoshiAPI(api_key="your-api-key") # 100 req/min
# Or point at your own node
api = SatoshiAPI(base_url="http://localhost:9332")
Error Handling
from satoshi_api import SatoshiAPI, APIError, RateLimitError
api = SatoshiAPI()
try:
tx = api.transaction("abc123invalid")
except RateLimitError as e:
print(f"Rate limited. Retry in {e.retry_after}s")
except APIError as e:
print(f"API error [{e.status}]: {e.detail}")
except ConnectionError:
print("Cannot reach API")
Rate limiting is handled automatically — the SDK reads the Retry-After header and retries up to 3 times.
Response Object
Every method returns a Response with:
resp = api.fees()
resp.data # The response payload (dict)
resp.meta # Metadata (timestamp, node_height, chain)
resp.height # Shortcut for meta.node_height
resp.chain # Shortcut for meta.chain
resp.cached # Whether response was served from cache
resp.request_id # Request ID for support/debugging
All Methods
Status & Health
api.health()— Node health checkapi.health_deep()— Deep health (DB, jobs, caches, circuit breaker)api.status()— Full node status
Blocks
api.block(height_or_hash)— Block analysisapi.block_latest()— Latest blockapi.block_stats(height)— Raw block statisticsapi.block_header(hash)— Block headerapi.block_txids(hash)— Transaction IDs in blockapi.block_txs(hash, start, limit)— Paginated transactionsapi.tip_height()/api.tip_hash()— Chain tip
Transactions
api.transaction(txid)— Decoded transactionapi.transaction_hex(txid)— Raw hexapi.transaction_status(txid)— Confirmation statusapi.transaction_outspends(txid)— Output spending statusapi.broadcast(hex)— Broadcast signed tx (requires key)api.decode(hex)— Decode without broadcasting (requires key)api.utxo(txid, vout)— Check UTXO existence
Fees
api.fees()— All fee estimatesapi.fee_target(target)— Specific confirmation targetapi.fee_recommended()— Fast/medium/slowapi.fee_landscape()— Full analysis with recommendationapi.fee_mempool_blocks()— Projected mempool blocksapi.fee_estimate_tx(inputs, outputs)— Estimate for specific txapi.fee_history(hours, interval)— Historical data
Mempool
api.mempool()— Analysis (size, congestion, buckets)api.mempool_info()— Raw mempool infoapi.mempool_txids()— All mempool txidsapi.mempool_recent()— Recently added transactionsapi.mempool_tx(txid)— Specific mempool entry
Mining & Network
api.mining()— Difficulty, hashrate, retargetapi.mining_nextblock()— Next block predictionapi.network()— Connections, version, relay feeapi.network_difficulty()— Difficulty adjustmentapi.network_forks()— Chain tipsapi.validate_address(addr)— Address validation
Prices & Tools
api.prices()— BTC price (USD, EUR, GBP, etc.)api.exchange_compare(amount_usd)— Exchange fee comparison
Self-Hosted
Point the SDK at your own Satoshi API instance:
api = SatoshiAPI(base_url="http://my-node:9332")
License
MIT
Metadata
Release files for satoshi-api-sdk 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| satoshi_api_sdk-0.1.0.tar.gz | 7.0 kB | Without provenance | Details for satoshi_api_sdk-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| satoshi_api_sdk-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for satoshi_api_sdk-0.1.0-py3-none-any.whl |
Total release size: 14.3 kB
Release files / satoshi_api_sdk-0.1.0.tar.gz
| Download URL | satoshi_api_sdk-0.1.0.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
44c35ceede585d1006befa1f446de27de2ad543df74487ec37d20868dbd1f084
|
|
BLAKE2b-256 checksum How to use checksums |
06d8980c502c1fc68b3e25001755490fdade197e217aedad1e3475f108bd68fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / satoshi_api_sdk-0.1.0-py3-none-any.whl
| Download URL | satoshi_api_sdk-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7e888e6e1982473a94ff442d1b29615ea7c49bf4d20bf779f1d67cb1b0098c09
|
|
BLAKE2b-256 checksum How to use checksums |
6fcbce6eac2248643b59ab2b72804037bfd7a52d7cbf0c67125acc2bca0c95de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Security for satoshi-api-sdk 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.