{"id":13428303,"url":"https://github.com/IntersectMBO/cardano-transactions","last_synced_at":"2025-03-16T01:32:18.513Z","repository":{"id":49159520,"uuid":"253565756","full_name":"IntersectMBO/cardano-transactions","owner":"IntersectMBO","description":"Library utilities for constructing and signing Cardano transactions.","archived":false,"fork":false,"pushed_at":"2023-12-16T16:28:39.000Z","size":8804,"stargazers_count":24,"open_issues_count":12,"forks_count":7,"subscribers_count":24,"default_branch":"master","last_synced_at":"2024-04-12T02:36:19.363Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Haskell","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/IntersectMBO.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-04-06T17:13:57.000Z","updated_at":"2023-12-16T15:59:14.000Z","dependencies_parsed_at":"2024-01-16T00:38:51.269Z","dependency_job_id":"9c8d6f3c-76fa-4ec2-a8fb-97c14de4cef4","html_url":"https://github.com/IntersectMBO/cardano-transactions","commit_stats":null,"previous_names":["input-output-hk/cardano-transactions"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntersectMBO%2Fcardano-transactions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntersectMBO%2Fcardano-transactions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntersectMBO%2Fcardano-transactions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntersectMBO%2Fcardano-transactions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IntersectMBO","download_url":"https://codeload.github.com/IntersectMBO/cardano-transactions/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243814900,"owners_count":20352037,"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":[],"created_at":"2024-07-31T01:00:51.755Z","updated_at":"2025-03-16T01:32:18.201Z","avatar_url":"https://github.com/IntersectMBO.png","language":"Haskell","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"\u003cp align=\"center\"\u003e\n  \u003cbig\u003e\u003cstrong\u003eCardano Transactions\u003c/strong\u003e\u003c/big\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://hackage.haskell.org/package/cardano-transactions\"\u003e\u003cimg src=\"https://img.shields.io/hackage/v/cardano-transactions?style=for-the-badge\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/input-output-hk/cardano-transactions/releases\"\u003e\u003cimg src=\"https://img.shields.io/github/v/release/input-output-hk/cardano-transactions?color=%239b59b6\u0026label=RELEASE\u0026sort=semver\u0026style=for-the-badge\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/input-output-hk/cardano-transactions/actions?query=workflow%3ATest\"\u003e\u003cimg src=\"https://img.shields.io/github/workflow/status/input-output-hk/cardano-transactions/Test?style=for-the-badge\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://input-output-hk.github.io/cardano-transactions/coverage/hpc_index.html\"\u003e\u003cimg src=\"https://input-output-hk.github.io/cardano-transactions/coverage/badge.svg\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## Overview\n\nThis library provides a simple interface for building transactions on Cardano. It also\nprovides a small command-line interface for playing around in a terminal.\n\n## Installation\n\n### Building from source\n\n1. download [haskell stack](https://docs.haskellstack.org/en/stable/install_and_upgrade/)\n2. clone this repo: `git clone https://github.com/input-output-hk/cardano-transactions.git`\n3. cd into the project: `cd cardano-transactions`\n4. install: `stack install` (the binary will be in `~/.local/bin/cardano-tx`)\n\n### Download binaries\n\nCheck the [release page](https://github.com/input-output-hk/cardano-transactions/releases) for binaries.\n\n### Docker container\n\nRun:\n\n```sh\n# build (run inside the project dir)\ndocker build -t inputoutput/cardano-transactions .\n\n# simple run\ndocker run --rm inputoutput/cardano-transactions --help\n\n# interactive shell (to pipe commands)\ndocker run --rm -ti --entrypoint sh inputoutput/cardano-transactions\n```\n\nThe docker image is `alpine`, so tools can be installed as follows in an interactive shell:\n\n```sh\napk add --no-cache nano git curl\n```\n\n## Payment\n\nWe call _Payment_ a simple UTxO transactions with no metadata, moving funds from a set of inputs to a set of outputs.\n\nPayments are constructed from a small set of primitives, following the given state-machine:\n\n![](https://mermaid.ink/img/eyJjb2RlIjoic3RhdGVEaWFncmFtXG5cdFsqXSAtLT4gQ29pblNlbGVjdGlvbjogZW1wdHlcbiAgICBDb2luU2VsZWN0aW9uIC0tPiBDb2luU2VsZWN0aW9uOiBhZGRJbnB1dFxuICAgIENvaW5TZWxlY3Rpb24gLS0-IENvaW5TZWxlY3Rpb246IGFkZE91dHB1dFxuICAgIENvaW5TZWxlY3Rpb24gLS0-IFRyYW5zYWN0aW9uOiBsb2NrXG4gICAgVHJhbnNhY3Rpb24gLS0-IFRyYW5zYWN0aW9uOiBzaWduV2l0aFxuICAgIFRyYW5zYWN0aW9uIC0tPiBbKl06IHNlcmlhbGl6ZSIsIm1lcm1haWQiOnsidGhlbWUiOiJkZWZhdWx0In0sInVwZGF0ZUVkaXRvciI6ZmFsc2V9)\n\n### Example (Haskell)\n\n\u003cdetails\u003e\n  \u003csummary\u003eImports\u003c/summary\u003e\n\n```hs\n{-# LANGUAGE NumericUnderscores #-}\n{-# LANGUAGE OverloadedStrings #-}\n\nimport Data.Function\n    ( (\u0026) )\nimport Data.Maybe\n    ( fromMaybe )\nimport Data.UTxO.Transaction.Cardano.Byron\n    ( fromBase16\n    , fromBase58\n    , mkInput\n    , mkOutput\n    , mkSignKey\n    , testnetMagic\n    )\n\nimport qualified Data.ByteString as BS\nimport qualified Data.UTxO.Transaction as Tx\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eConstructing Inputs / Outputs\u003c/summary\u003e\n\n```hs\n-- Say we want to construct a transaction from a known input to two\n-- different addresses. Let's start by constructing the primitive types\n-- for /Byron/ by using the smart-constructors from:\n--\n--   'Data.UTxO.Transaction.Cardano.Byron'\n\nlet (Just input0) = mkInput 0 =\u003c\u003c fromBase16\n      \"3b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b7\"\n\nlet Just key0 = mkSignKey =\u003c\u003c fromBase16\n      \"e0860dab46f13e74ab834142e8877b80bf22044cae8ebab7a21ed1b8dc00c155\\\n      \\f6b78eee2a5bbd453ce7e7711b2964abb6a36837e475271f18ff36ae5fc8af73\\\n      \\e25db39fb78e74d4b53fb51776d0f5eb360e62d09b853f3a87ac25bf834ee1fb\"\n\nlet oneAda = 1_000_000\n\nlet (Just output0) = mkOutput oneAda =\u003c\u003c fromBase58\n      \"2cWKMJemoBajc46Wu4Z7e6bG48myZWfB7Z6pD77L6PrJQWt9HZ3Yv7o8CYZTBMqHTPTkv\"\n\nlet (Just output1) = mkOutput oneAda =\u003c\u003c fromBase58\n      \"2cWKMJemoBaiLiNB8QpHKjkQhnPdQSyxaLb8JJFUQYpiVzgEJE59fN7V7StqnyDuDjHYJ\"\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eConstructing The Transaction\u003c/summary\u003e\n\n```hs\n-- Next, we can construct the transaction using the DSL provided by:\n--\n--   'Data.UTxO.Transaction#MkPayment'\n\nlet eitherTx = Tx.empty testnetMagic\n      \u0026 Tx.addInput input0\n      \u0026 Tx.addOutput output0\n      \u0026 Tx.addOutput output1\n      \u0026 Tx.lock\n      \u0026 Tx.signWith key0\n      \u0026 Tx.serialize\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eWriting Binary Transaction to a File\u003c/summary\u003e\n\n```hs\n-- Finally, let's export the binary transaction to a file, if we didn't screw\n-- up the in the above example ^^\"\n\ncase eitherTx of\n  Left e -\u003e\n    fail $ show e\n  Right bytes -\u003e\n    BS.writeFile \"transaction.bin\" bytes\n```\n\u003c/details\u003e\n\n### Example (CLI)\n\n```shell\ncardano-tx empty 764824073 \\\n  | cardano-tx add-input 0 3b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b7 \\\n  | cardano-tx add-output 42 Ae2tdPwUPEZETXfbQxKMkMJQY1MoHCBS7bkw6TmhLjRvi9LZh1uDnXy319f \\\n  | cardano-tx lock \\\n  | cardano-tx sign-with e0860dab46f13e74ab834142e8877b80bf22044cae8ebab7a21ed1b8dc00c155f6b78eee2a5bbd453ce7e7711b2964abb6a36837e475271f18ff36ae5fc8af73e25db39fb78e74d4b53fb51776d0f5eb360e62d09b853f3a87ac25bf834ee1fb \\\n  | cardano-tx serialize\n```\n\n## About Library Dependencies\n\nThis library requires quite a few exotic dependencies from the cardano realm which aren't\nnecessarily on hackage nor stackage. The dependencies are listed in [stack.yaml](https://github.com/input-output-hk/cardano-transactions/blob/master/stack.yaml#L7-L33),\nmake sure to also include those for importing `cardano-transactions`.\n\n## Documentation\n\nAPI documentation is available [here](https://input-output-hk.github.io/cardano-transactions/haddock).\n\n[End-to-end example](https://github.com/input-output-hk/cardano-transactions/wiki/How-to-submit-transaction-via-cardano-tx-CLI) of constructing transaction via `cardano-tx` and then submitting it.\n\n## Contributing\n\nPull requests are welcome.\n\nWhen creating a pull request, please make sure that your code adheres to our\n[coding standards](https://github.com/input-output-hk/adrestia/wiki/Coding-Standards).\n\n\u003chr/\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/input-output-hk/cardano-transactions/blob/master/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/input-output-hk/cardano-transactions.svg?style=for-the-badge\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FIntersectMBO%2Fcardano-transactions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FIntersectMBO%2Fcardano-transactions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FIntersectMBO%2Fcardano-transactions/lists"}