Quickstart
Installation
PyCardano could be installed using pip
as follows:
$ pip install pycardano
Using PyCardano
Create a payment key and a payment address:
>>> from pycardano import Address, Network, PaymentSigningKey, PaymentVerificationKey
>>> payment_signing_key = PaymentSigningKey.generate()
>>> payment_signing_key.save("payment.skey")
>>> payment_verification_key = PaymentVerificationKey.from_signing_key(payment_signing_key)
>>> payment_verification_key.save("payment.vkey")
>>> network = Network.TESTNET
>>> address = Address(payment_part=payment_verification_key.hash(), network=network)
>>> address
'addr_test1vr2p8st5t5cxqglyjky7vk98k7jtfhdpvhl4e97cezuhn0cqcexl7'
Warning
Your address generated by the python code above will be different from the one shown. Please use the address you generated. Anything sent to the address above will be lost.
Fund the address with some tADA (test ADA) through the faucet here.
With the address and key created above, you can now create and sign transactions, and submit the transaction to Cardano network. Transaction usage guide provides detailed steps about transaction creation and signing.