{"id":42042801,"url":"https://github.com/python-cardano/pycardano","last_synced_at":"2026-01-26T06:00:48.589Z","repository":{"id":37767972,"uuid":"445950118","full_name":"Python-Cardano/pycardano","owner":"Python-Cardano","description":"A lightweight Cardano library in Python","archived":false,"fork":false,"pushed_at":"2025-12-20T07:30:40.000Z","size":4408,"stargazers_count":248,"open_issues_count":17,"forks_count":80,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-12-21T18:08:15.238Z","etag":null,"topics":["blockchain","cardano","hacktoberfest","library","python"],"latest_commit_sha":null,"homepage":"https://pycardano.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Python-Cardano.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["cffls"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2022-01-08T23:21:48.000Z","updated_at":"2025-12-20T07:30:17.000Z","dependencies_parsed_at":"2023-12-30T00:37:47.032Z","dependency_job_id":"82cd6de4-2104-42e8-ac1f-62d0e79fc6f4","html_url":"https://github.com/Python-Cardano/pycardano","commit_stats":null,"previous_names":[],"tags_count":38,"template":false,"template_full_name":null,"purl":"pkg:github/Python-Cardano/pycardano","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Python-Cardano%2Fpycardano","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Python-Cardano%2Fpycardano/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Python-Cardano%2Fpycardano/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Python-Cardano%2Fpycardano/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Python-Cardano","download_url":"https://codeload.github.com/Python-Cardano/pycardano/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Python-Cardano%2Fpycardano/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28767989,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T03:54:34.369Z","status":"ssl_error","status_checked_at":"2026-01-26T03:54:33.031Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockchain","cardano","hacktoberfest","library","python"],"created_at":"2026-01-26T06:00:46.894Z","updated_at":"2026-01-26T06:00:48.583Z","avatar_url":"https://github.com/Python-Cardano.png","language":"Python","funding_links":["https://github.com/sponsors/cffls"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./.github/logo.png\" height=200 width=200 /\u003e\n\u003c/p\u003e\n\n---\n\n## PyCardano\n\n[![PyPi version](https://badgen.net/pypi/v/pycardano)](https://pypi.python.org/pypi/pycardano/)\n[![PyPI pyversions](https://img.shields.io/pypi/pyversions/pycardano)](https://pypi.python.org/pypi/pycardano/)\n[![PyPI Downloads](https://static.pepy.tech/badge/pycardano/month)](https://pepy.tech/projects/pycardano)\n\n[![PyCardano](https://github.com/Python-Cardano/pycardano/actions/workflows/main.yml/badge.svg)](https://github.com/Python-Cardano/pycardano/actions/workflows/main.yml)\n[![codecov](https://codecov.io/gh/Python-Cardano/pycardano/graph/badge.svg?token=62N0IL9IMQ)](https://codecov.io/gh/Python-Cardano/pycardano)\n[![Documentation Status](https://readthedocs.org/projects/pycardano/badge/?version=latest)](https://pycardano.readthedocs.io/en/latest/?badge=latest)\n\n[![Discord](https://img.shields.io/discord/949404918903631923.svg?label=chat\u0026logo=discord\u0026logoColor=ffffff\u0026color=7389D8\u0026labelColor=6A7EC2)](https://discord.gg/qT9Mn9xjgz)\n[![Twitter](https://img.shields.io/twitter/follow/PyCardano?style=social\u0026label=Follow%20%40PyCardano)](https://twitter.com/PyCardano)\n\n\nPyCardano is a Cardano library written in Python. It allows users to create and sign transactions without \ndepending on third-party Cardano serialization tools, such as\n[cardano-cli](https://github.com/input-output-hk/cardano-node#cardano-cli) and \n[cardano-serialization-lib](https://github.com/Emurgo/cardano-serialization-lib), making it a lightweight library, which \nis simple and fast to set up in all types of environments.\n\nCurrent goal of this project is to enable developers to write off-chain code and tests in pure Python for Plutus DApps.\nNevertheless, we see the potential in expanding this project to a full Cardano node client, which \ncould be beneficial for faster R\u0026D iterations.\n\n### Features\n\n- [x] Shelly address\n- [x] Transaction builder\n- [x] Transaction signing\n- [x] Multi-asset\n- [X] Chain backend integration\n- [X] Fee calculation\n- [X] UTxO selection\n- [X] Native script\n- [X] Native token\n- [X] Metadata\n- [X] Plutus script\n- [X] Staking certificates\n- [X] Reward withdraw\n- [X] Mnemonic \n- [X] HD Wallet\n- [x] Pool certificate\n- [x] Protocol proposal update\n- [x] Governance actions\n- [x] Byron Address\n\n\n### Installation\n\nInstall the library using [pip](https://pip.pypa.io/en/stable/):\n\n`pip install pycardano`\n\n#### cbor2\n[cbor2](https://github.com/agronholm/cbor2/tree/master) is a dependency of pycardano. It is used to encode and decode CBOR data.\nIt has two implementations: one is pure Python and the other is C, which is installed by default. The C implementation is faster, but it is less flexible than the pure Python implementation.\n\nFor some users, the C implementation may not work properly when deserializing cbor data. For example, the order of inputs of a transaction isn't guaranteed to be the same as the order of inputs in the original transaction (details could be found in [this issue](https://github.com/Python-Cardano/pycardano/issues/311)). This would result in a different transaction hash when the transaction is serialized again.\n\nTo solve this problem, a fork of cbor2 is created at [cbor2pure](https://github.com/cffls/cbor2pure). This fork removes C extension and only uses pure python for cbor decoding. By default, for correctness, pycardano uses cbor2pure in decoding. However, if speed is preferred over accuracy, users can set `CBOR_C_EXTENSION=1` in their environment, and the default C extension would be used instead.\n\n```bash\nensure_pure_cbor2.sh\n```\n\n### Documentation\n\nhttps://pycardano.readthedocs.io/en/latest/\n\n#### Frequently asked questions\n\nhttps://pycardano.readthedocs.io/en/latest/frequently_asked_questions.html\n\n### Examples\n\n#### Transaction creation and signing\n\n\u003cdetails\u003e\n  \u003csummary\u003eExpand code\u003c/summary\u003e\n  \n```python\n\"\"\"Build a transaction using transaction builder\"\"\"\n\nfrom blockfrost import ApiUrls\nfrom pycardano import *\n\n# Use testnet\nnetwork = Network.TESTNET\n\n# Read keys to memory\n# Assume there is a payment.skey file sitting in current directory\npsk = PaymentSigningKey.load(\"payment.skey\")\n# Assume there is a stake.skey file sitting in current directory\nssk = StakeSigningKey.load(\"stake.skey\")\n\npvk = PaymentVerificationKey.from_signing_key(psk)\nsvk = StakeVerificationKey.from_signing_key(ssk)\n\n# Derive an address from payment verification key and stake verification key\naddress = Address(pvk.hash(), svk.hash(), network)\n\n# Create a BlockFrost chain context\ncontext = BlockFrostChainContext(\"your_blockfrost_project_id\", base_url=ApiUrls.preprod.value)\n\n# Create a transaction builder\nbuilder = TransactionBuilder(context)\n\n# Tell the builder that transaction input will come from a specific address, assuming that there are some ADA and native\n# assets sitting at this address. \"add_input_address\" could be called multiple times with different address.\nbuilder.add_input_address(address)\n\n# Get all UTxOs currently sitting at this address\nutxos = context.utxos(address)\n\n# We can also tell the builder to include a specific UTxO in the transaction.\n# Similarly, \"add_input\" could be called multiple times.\nbuilder.add_input(utxos[0])\n\n# Send 1.5 ADA and a native asset (CHOC) in quantity of 2000 to an address.\nbuilder.add_output(\n    TransactionOutput(\n        Address.from_primitive(\n            \"addr_test1vrm9x2zsux7va6w892g38tvchnzahvcd9tykqf3ygnmwtaqyfg52x\"\n        ),\n        Value.from_primitive(\n            [\n                1500000,\n                {\n                    bytes.fromhex(\n                        \"57fca08abbaddee36da742a839f7d83a7e1d2419f1507fcbf3916522\"  # Policy ID\n                    ): {\n                        b\"CHOC\": 2000  # Asset name and amount\n                    }\n                },\n            ]\n        ),\n    )\n)\n\n# We can add multiple outputs, similar to what we can do with inputs.\n# Send 2 ADA and a native asset (CHOC) in quantity of 200 to ourselves\nbuilder.add_output(\n    TransactionOutput(\n        address,\n        Value.from_primitive(\n            [\n                2000000,\n                {\n                    bytes.fromhex(\n                        \"57fca08abbaddee36da742a839f7d83a7e1d2419f1507fcbf3916522\"  # Policy ID\n                    ): {\n                        b\"CHOC\": 200  # Asset name and amount\n                    }\n                },\n            ]\n        ),\n    )\n)\n\n# Create final signed transaction\nsigned_tx = builder.build_and_sign([psk], change_address=address)\n\n# Submit signed transaction to the network\ncontext.submit_tx(signed_tx)\n\n```\n\u003c/details\u003e\n\nSee more usages under project [examples](https://github.com/Python-Cardano/pycardano/tree/main/examples).\n\nThere is also a collection of examples under [awesome-pycardano](https://github.com/B3nac/awesome-pycardano).\n\n### Development\n\n\u003cdetails\u003e\n\u003csummary\u003eClick to expand\u003c/summary\u003e\n\n#### Workspace setup\n\nClone the repository:\n\n`git clone https://github.com/Python-Cardano/pycardano.git`\n\nPyCardano uses [poetry](https://python-poetry.org/) to manage its dependencies. \nInstall poetry for osx / linux / bashonwindows:\n\n`curl -sSL https://install.python-poetry.org | python3 -`\n\nGo to [poetry installation](https://python-poetry.org/docs/#installation) for more details. \n\n\nChange directory into the repo, install all dependencies using poetry, and you are all set!\n\n`cd pycardano \u0026\u0026 poetry install`\n\nWhen testing or running any program, it is recommended to enter \na [poetry shell](https://python-poetry.org/docs/cli/#shell) in which all python dependencies are automatically \nconfigured: `poetry shell`.\n\n\n#### Test\n\nPyCardano uses [pytest](https://docs.pytest.org/en/6.2.x/) for unit testing.\n\nRun all tests:\n`make test`\n\nRun all tests in a specific test file:\n`poetry run pytest test/pycardano/test_transaction.py`\n\nRun a specific test function:\n`poetry run pytest -k \"test_transaction_body\"`\n\nRun a specific test function in a test file:\n`poetry run pytest test/pycardano/test_transaction.py -k \"test_transaction_body\"`\n\n#### Test coverage\n\nWe use [Coverage](https://coverage.readthedocs.io/en/latest/) to calculate the test coverage.\n\nTest coverage could be generated by: `make cov`\n\nA html report could be generated and opened in browser by: `make cov-html`\n\n### Style guidelines\n\nThe package uses \n[Google style](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html) docstring.\n\nCode could be formatted with command: `make format`\n\nThe code style could be checked by [flake8](https://flake8.pycqa.org/en/latest/): `make qa`\n\n### Docs generation\n\nThe majority of package documentation is created by the docstrings in python files. \nWe use [sphinx](https://www.sphinx-doc.org/en/master/) with \n[Read the Docs theme](https://sphinx-rtd-theme.readthedocs.io/en/stable/) to generate the \nhtml pages.\n\nBuild docs and open the docs in browser: \n\n`make docs`\n\n\u003c/details\u003e\n\n## Donation and Sponsor\nIf you find this project helpful, please consider donate or sponsor us. Your donation and sponsor will allow us to\n spend more time on improving PyCardano and adding more features in the future.\n\nYou can support us by 1) sponsoring through Github, or 2) donating ADA to our ADA Handle `pycardano` or to the address below:\n\n[`addr1vxa4qadv7hk2dd3jtz9rep7sp92lkgwzefwkmsy3qkglq5qzv8c0d`](https://cardanoscan.io/address/61bb5075acf5eca6b632588a3c87d00955fb21c2ca5d6dc0910591f050)\n\n\u003cp\u003e\n  \u003cimg src=\"./.github/donate_addr.png\" height=150 width=150/\u003e\n\u003c/p\u003e\n\n\n## Sponsors :heart:\n\n\u003cp align=\"left\"\u003e\n  \u003ca href=\"https://github.com/blockfrost\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/70073210?s=50\u0026v=4\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpython-cardano%2Fpycardano","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpython-cardano%2Fpycardano","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpython-cardano%2Fpycardano/lists"}