{"id":15049282,"url":"https://github.com/biglup/cardano-c","last_synced_at":"2026-01-23T12:39:06.419Z","repository":{"id":207899387,"uuid":"688755974","full_name":"Biglup/cardano-c","owner":"Biglup","description":"A pure C library for interacting with the Cardano blockchain. Compliant with MISRA standards and binding-friendly architecture.","archived":false,"fork":false,"pushed_at":"2024-04-13T16:42:14.000Z","size":1158,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-13T20:51:19.552Z","etag":null,"topics":["c","c99","cardano","cryptocurrency","cryptography","serialization"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Biglup.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"COPYING","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}},"created_at":"2023-09-08T03:22:30.000Z","updated_at":"2024-04-17T09:46:58.463Z","dependencies_parsed_at":"2024-04-02T17:30:24.507Z","dependency_job_id":"85040624-55b7-4df5-872f-937ba51f71aa","html_url":"https://github.com/Biglup/cardano-c","commit_stats":null,"previous_names":["biglup/cardano-c"],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/Biglup/cardano-c","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Biglup%2Fcardano-c","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Biglup%2Fcardano-c/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Biglup%2Fcardano-c/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Biglup%2Fcardano-c/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Biglup","download_url":"https://codeload.github.com/Biglup/cardano-c/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Biglup%2Fcardano-c/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259431013,"owners_count":22856404,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["c","c99","cardano","cryptocurrency","cryptography","serialization"],"created_at":"2024-09-24T21:19:27.320Z","updated_at":"2026-01-23T12:39:06.413Z","avatar_url":"https://github.com/Biglup.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg align=\"middle\" src=\n  \"assets/cardano-c-logo-small.png\"\n  height=\"160\" /\u003e\n\u003c/p\u003e\n\n# Cardano-C\n\n**cardano-c** is a C library aiming to be a robust, commercial-grade, full-featured toolkit for building transaction and interacting with the Cardano blockchain. Its compliant with the MISRA 2012 standard,\nand was designed with a binding-friendly architecture to enable easy integrations across various programming languages.\n\nReady to learn? Get the latest documentation at [cardano-c.readthedocs.io](https://cardano-c.readthedocs.io/) or jump to [code examples!](examples/)\n\n---\n\u003cbr\u003e\n\n![Post-Integration](https://github.com/Biglup/cardano-c/actions/workflows/unit-test.yml/badge.svg)\n![Post-Integration](https://github.com/Biglup/cardano-c/actions/workflows/static-code-analysis.yml/badge.svg)\n[![codecov](https://codecov.io/gh/Biglup/cardano-c/graph/badge.svg?token=A5U3U5KGG7)](https://codecov.io/gh/Biglup/cardano-c)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/36ac650a4b694421bf6780a110e2f65a)](https://app.codacy.com/gh/Biglup/cardano-c/dashboard?utm_source=gh\u0026utm_medium=referral\u0026utm_content=\u0026utm_campaign=Badge_grade)\n[![Documentation Status](https://readthedocs.org/projects/cardano-c/badge/?version=latest)](https://cardano-c.readthedocs.io/en/latest/?badge=latest)\n[![Static Badge](https://img.shields.io/badge/Funded_By-Project_Catalyst-133ff0?logo=cardano\u0026logoColor=ffffff)](https://projectcatalyst.io/)\n\n## Features\n\n- Address Parsing \u0026 Generation\n- Ed25519 Cryptography\n- Transaction Serialization \u0026 Deserialization\n- Powerful Transaction Builder\n- Robust C99 implementation\n- Layered architecture offers both control and convenience\n- Flexible memory management\n- No shared global state - threading friendly\n- Proper handling of UTF-8\n- Extensive documentation and test suite\n- It has no runtime dependencies (The library depends on [libsodium](https://github.com/jedisct1/libsodium) and [libgmp](https://gmplib.org/), but they are all statically linked)\n\n## Bindings\n\nHere is a list with all the languages/bindings available.\n\n| Name                                                                                     | libcardano-c version | Language                                                             | License              |\n| :--------------------------------------------------------------------------------------- | :------------------: | :------------------------------------------------------------------: | :------------------: |\n| [libcarcano-c](https://github.com/Biglup/cardano-c)                                      | **1.2.0**            | [C](https://en.wikipedia.org/wiki/C_(programming_language))          | Apache 2.0           |\n| [cometa.js](https://github.com/Biglup/cometa.js)                                         | **1.2.0**            | [JavaScript](https://en.wikipedia.org/wiki/JavaScript)               | Apache 2.0           |\n| [cometa.py](https://github.com/Biglup/cometa.py)                                         | **1.2.0**            | [Python](https://www.python.org)                                     | Apache 2.0           |\n\nMore bindings to come, check https://cometa.dev for the upcoming list\n\n## Basic Example\n\nThis is a basic cardano-c example, it sends `LOVELACE_TO_SEND` coins to `RECEIVING_ADDRESS`. Check full example at [send lovelace](examples/src/send_lovelace_example.c).\n\n```c\n// 2 hours from now in UNIX time (seconds)\nconst uint64_t invalid_after = cardano_utils_get_time() + SECONDS_IN_TWO_HOURS;\n\n// 1.- Build transaction\ncardano_tx_builder_t* tx_builder = cardano_tx_builder_new(protocol_params, \u0026CARDANO_PREPROD_SLOT_CONFIG);\n\ncardano_tx_builder_set_utxos(tx_builder, utxo_list);\ncardano_tx_builder_set_change_address(tx_builder, payment_address);\ncardano_tx_builder_set_invalid_after_ex(tx_builder, invalid_after);\ncardano_tx_builder_send_lovelace_ex(tx_builder, RECEIVING_ADDRESS, cardano_utils_safe_strlen(RECEIVING_ADDRESS, 128), LOVELACE_TO_SEND);\n\ncardano_transaction_t* transaction = NULL;\ncardano_error_t        result      = cardano_tx_builder_build(tx_builder, \u0026transaction);\n\nif (result != CARDANO_SUCCESS)\n{\n console_error(\"Failed to build transaction\");\n console_error(\"Error [%d]: %s\", result, cardano_error_to_string(result));\n console_error(\"%s\", cardano_tx_builder_get_last_error(tx_builder));\n\n return result;\n}\n\n// 2.- Sign transaction\nsign_transaction(key_handler, SIGNER_DERIVATION_PATH, transaction);\n\n// 3.- Submit transaction \u0026 confirm\nsubmit_transaction(provider, CONFIRM_TX_TIMEOUT_MS, transaction);\n```\n\n## Conway Era Support\n\nCardano-C supports all features up to the Conway era, which is the current era of the Cardano blockchain. Conway era\nbrought to Cardano decentralized governance. You can see some of the governance related examples in the [examples](examples/) directory:\n\n- [Register as DRep (PubKey)](examples/src/drep_pubkey_example.c)\n- [Register as DRep (Script)](examples/src/drep_script_example.c)\n- [Submit governance action proposal (Withdrawing from treasury)](examples/src/propose_treasury_withdrawal_example.c)\n- [Vote for proposal (PubKey DRep)](examples/src/vote_for_proposal_pubkey_example.c)\n- [Vote for proposal (Script DRep)](examples/src/vote_for_proposal_script_example.c)\n\nThese are some of the examples illustrated in the [examples](examples/) directory. However, you should\nbe able to build any valid transaction for the current era. See the [Documentation](https://cardano-c.readthedocs.io/) for more information.\n\n## Memory Management\n\nThe Cardano C library uses a simple reference-counting model. The main goal is that the library can be easily integrated\ninto applications and languages that uses different memory management models (such as garbage collection).\n\nEvery object in our library provides functions to increase and decrease its reference count. For instance, you would use `cardano_cbor_writer_ref` to increase and `cardano_cbor_writer_unref` to decrease the reference count for a `cardano_cbor_writer_t` object.\n\nUpon creation through constructors like `cardano_cbor_writer_new`, an object's reference count is initialized to one.\nThis implies that the caller becomes the sole owner of the newly created reference.\n\nWhen the reference count drops to zero—typically when the `*_unref` function is invoked by the last entity\nholding a reference—the object gets deallocated.\n\nNote that **all** getter functions will consistently increment the reference count of the object they return. Thus, it's the caller's responsibility to invoke `*_unref` once they're done using the result.\n\n## Set up the Git hooks custom directory\n\nAfter cloning the repository run the following command in the\nrepository root:\n\n```shell\ngit config core.hooksPath .githooks\n```\n\n## Clang format integration\n\nRepository comes with always-up-to-date `.clang-format` file, an input configuration\nfor `clang-format` tool (version 15.x is a minimum). \n\n- https://apt.llvm.org/\n\n## Unit Tests\n\nThis project uses Google test framework for writing unit tests.\n\nStart by installing the gtest development package:\n\n```bash\nsudo apt-get install libgtest-dev\n```\n\nNote that this package only install source files. You have to compile the code yourself to create the necessary\nlibrary files.\n\nThese source files should be located at /usr/src/googletest.\n\n```bash\ncd $(mktemp -d)\ncmake /usr/src/googletest\nmake\nsudo make install\n```\n\n## Documentation\n\nTo generate the documentation for this project, we utilize Doxygen for source code processing, Breathe to integrate Doxygen content with Sphinx, and Sphinx to compile the entire documentation into a web-friendly format.\n\n### Setting Up Your Environment\n\n1. **Install Python 3 and pip**: Required for Sphinx and Breathe. Most Linux distributions include Python 3 by default. For Windows, download from the [Python website](https://www.python.org/downloads/), ensuring you add Python to your PATH.\n\n   Linux example (Ubuntu):\n   ```bash\n   sudo apt install python3 python3-pip\n   ```\n\n2. **Install Sphinx and Breathe**: These Python packages are installed via pip. Breathe bridges Doxygen-generated XML with Sphinx for seamless documentation integration. Additionally, the Sphinx Immaterial theme is installed for a modern web design.\n   ```bash\n   pip install sphinx sphinx-immaterial breathe\n   ```\n\n3. **Install Doxygen**: Necessary for generating XML files from source code. Install via your Linux package manager or download from the [Doxygen website](https://www.doxygen.nl/download.html) for Windows.\n\n   Linux example (Ubuntu):\n   ```bash\n   sudo apt-get install doxygen\n   ```\n\n### Generating Documentation\n\nAfter setting up your environment, generate the project's documentation by navigating to the repository root and executing:\n\n```bash\ncmake -DDOXYGEN_ENABLED=ON .\nmake doc\n```\n\nThe generated documentation will be available at `build/release/doc/html/index.html`, providing a comprehensive guide to the project's API and architecture.\n\n## Contributing\n\n\u003ca href=\"https://github.com/Biglup/cardano-c/graphs/contributors\"\u003e\n  \u003cimg src=\"https://contrib.rocks/image?repo=Biglup/cardano-c\u0026max=500\u0026columns=20\u0026anon=1\" /\u003e\n\u003c/a\u003e\n\nWe welcome contributions from the community. Please read our [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n\n## License \n\n[APACHE LICENSE, VERSION 2.0](https://apache.org/licenses/LICENSE-2.0)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiglup%2Fcardano-c","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbiglup%2Fcardano-c","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiglup%2Fcardano-c/lists"}