{"id":17939415,"url":"https://github.com/libitx/txpost","last_synced_at":"2025-03-24T10:32:09.348Z","repository":{"id":62430571,"uuid":"325675774","full_name":"libitx/txpost","owner":"libitx","description":"Send and receive Bitcoin transactions from your Elixir application in a concise and efficient binary serialisation format.","archived":false,"fork":false,"pushed_at":"2021-02-12T16:52:07.000Z","size":111,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-19T03:41:22.910Z","etag":null,"topics":["bitcoin","bsv","cbor","elixir","plug"],"latest_commit_sha":null,"homepage":"https://hexdocs.pm/txpost","language":"Elixir","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/libitx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-31T00:23:49.000Z","updated_at":"2025-01-23T21:19:05.000Z","dependencies_parsed_at":"2022-11-01T20:22:38.558Z","dependency_job_id":null,"html_url":"https://github.com/libitx/txpost","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libitx%2Ftxpost","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libitx%2Ftxpost/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libitx%2Ftxpost/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libitx%2Ftxpost/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/libitx","download_url":"https://codeload.github.com/libitx/txpost/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245252429,"owners_count":20585060,"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":["bitcoin","bsv","cbor","elixir","plug"],"created_at":"2024-10-29T00:07:15.905Z","updated_at":"2025-03-24T10:32:08.979Z","avatar_url":"https://github.com/libitx.png","language":"Elixir","readme":"# Txpost\n\n![Receive Bitcoin transactions in your Elixir app](https://github.com/libitx/txpost/raw/master/media/poster.png)\n\n![Hex.pm](https://img.shields.io/hexpm/v/txpost?color=informational)\n![License](https://img.shields.io/github/license/libitx/txpost?color=informational)\n![Build Status](https://img.shields.io/github/workflow/status/libitx/txpost/Elixir%20CI)\n\nSend and receive Bitcoin transactions from your Phoenix or Plug-based Elixir application.\n\nTxpost implements a standard for encoding and decoding Bitcoin transactions and other data in a concise binary format using [CBOR](https://cbor.io). A number of modules following the Plug specification can easily be slotted in your Phoenix or Plug-based application's pipeline. An optional Router module is available, allowing you to implement routing logic for different types of transactions from a single endpoint.\n\n* Receive Bitcoin transactions in a concise and efficient binary serialisation format\n* Simple and flexible schema for sending Bitcoin data with other data parameters\n* Send multiple transactions in a single request, or build streaming applications\n* Sign and verify data payloads with ECDSA signatures\n\n### BRFC specifications\n\nTxpost is an implementation of the following BRFC specifications. They describe a standard for serialising Bitcoin transactions and associated parameters, along with arbitrary meta data, in a concise binary format using CBOR:\n\n* BRFC `c9a2975b3d19` - [CBOR Tx Payload specification](https://github.com/libitx/txpost/blob/master/brfc-specs/cbor-tx-payload.md)\n* BRFC `5b82a2ed7b16` - [CBOR Tx Envelope specification](https://github.com/libitx/txpost/blob/master/brfc-specs/cbor-tx-envelope.md)\n\n## Installation\n\nThe package can be installed by adding `txpost` to your list of dependencies in `mix.exs`.\n\n```elixir\ndef deps do\n  [\n    {:txpost, \"~\u003e 0.1\"}\n  ]\nend\n```\n\nAdd `Txpost.Parsers.CBOR` to your endpoint's list of parsers.\n\n```elixir\nplug Plug.Parsers,\n  parsers: [\n    :json,\n    Txpost.Parsers.CBOR\n  ]\n```\n\nFinally create any routes needed to handle transaction requests and add `Txpost.Plug` to the plug pipeline. For example, adding a route to a Phoenix router:\n\n```elixir\ndefmodule MyAppWeb.Router do\n  use MyAppWeb, :router\n\n  pipeline :tx_api do\n    plug :accepts, [\"cbor\"]\n    plug Txpost.Plug\n  end\n\n  scope \"/tx\" do\n    pipe_through :tx_api\n    post \"/create\", MyAppWeb.TxController, :create\n  end\nend\n```\n\nFor detailed examples, refer to the [full documentation](https://hexdocs.pm/txpost).\n\n## Transaction routing\n\nThe example above creates a single route passing all transactions to the same controller. You could create many routes for different transactions but in some applications it may be desirable to advertise a single endpoint to receive different types of transactions, each handled by different controllers. In this case `Txpost.Router` can be used to route transactions to different controllers, using any logic you need.\n\nA tx router is a module that implements the `Txpost.Router.handle_tx/2` callback.\n\n```elixir\ndefmodule MyApp.TxRouter do\n  use Txpost.Router\n\n  def handle_tx(conn, _params) do\n    case get_req_meta(conn) do\n      %{\"type\" =\u003e \"article\"} -\u003e ArticleController.call(conn, :create)\n      %{\"type\" =\u003e \"image\"} -\u003e ImageController.call(conn, :create)\n    end\n  end\nend\n```\n\nFor more details, refer to the [full documentation](https://hexdocs.pm/txpost).\n\n## License\n\nTxpost is open source and released under the [Apache-2 License](https://github.com/libitx/txpost/blob/master/LICENSE).\n\n© Copyright 2021 Chronos Labs Ltd.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibitx%2Ftxpost","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flibitx%2Ftxpost","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibitx%2Ftxpost/lists"}