Registry / database / pycardano

pycardano

JSON →
library0.19.2pypypiunverified

A Python library for interacting with the Cardano blockchain. Supports transaction building, staking, native assets, smart contracts (Plutus), and integration with blockfrost, ogmios, and kupo. Current version: 0.19.2. Release cadence: roughly monthly.

pip install pycardano
INSTALL
IMPORT
SIG · PYCARDANO
P
pycardano
databasepythonv0.19.2
Install
8.1s avg
Import
3925ms
Disk
72MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.19.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.830s · 68.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 8.1s · import 0.740s · 69MB
72MB installed
● package 72MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

PaymentSigningKey
from pycardano import PaymentSigningKey
from pycardano import PaymentSigningKey

Generates a key pair, derives an address, and attempts to build a simple transaction using Blockfrost.

import os from pycardano import ( PaymentSigningKey, PaymentVerificationKey, Address, BlockFrostChainContext, TransactionBuilder, TransactionOutput, Value, Network ) # Generate a key pair signing_key = PaymentSigningKey.generate() verification_key = PaymentVerificationKey.from_signing_key(signing_key) # Derive address (testnet) address = Address(payment_part=verification_key.hash(), network=Network.TESTNET) print(f"Address: {address}") # Create a chain context (use Blockfrost API key from env) context = BlockFrostChainContext( base_url="https://cardano-testnet.blockfrost.io/api/v0", project_id=os.environ.get("BLOCKFROST_PROJECT_ID", "") ) # Build a simple transaction (requires actual UTXOs and funds) try: builder = TransactionBuilder(context) builder.add_output(TransactionOutput(address, Value(1000000))) tx_body, tx_hash = builder.build_and_sign([signing_key], change_address=address) print(f"Transaction hash: {tx_hash}") except Exception as e: print(f"Error building transaction: {e}")
Debug
Known issues
breakingIn v0.19.0, the default CBOR library was changed to cbor2pure. If you rely on cbor2 C extension, set environment variable PYCA_CBOR2=1.
fix
export PYCA_CBOR2=1 or use cbor2 explicitly via pycardano configuration.
affects: >=0.19.0
breakingFrom v0.16.0, version capping on dependencies was removed. This may cause incompatibility with older environments due to newer transitive dependencies.
fix
Pin dependencies in your project's requirements or test thoroughly when upgrading pycardano.
affects: >=0.16.0
deprecatedSupport for Python 3.8 was dropped in v0.14.0.
fix
Upgrade to Python 3.9 or later.
affects: >=0.14.0
gotchaTransactionBuilder's build_and_sign expects a list of signing keys, not a single key. Passing a single key will cause cryptic errors.
fix
Wrap your key in a list: [signing_key]
affects: all
Upgrade
Version history
0.19.2latest on PyPI · released Mar 1, 2026
Audit
Dependencies
cbor2requiredCBOR serialization/deserialization for Cardano binary data
blockfrost-pythonoptionalBlockfrost API client for accessing chain data
httpxrequiredHTTP client for OGMios and other backends
Agent activity
13 hits · last 30 days
node
12
Resources
pycardano — pip install pycardano · libregistry