{"id":17939408,"url":"https://github.com/libitx/txpost-js","last_synced_at":"2025-03-24T10:32:08.976Z","repository":{"id":57383054,"uuid":"327020777","full_name":"libitx/txpost-js","owner":"libitx","description":"Encode Bitcoin transactions and data in a concise and efficient binary serialisation format.","archived":false,"fork":false,"pushed_at":"2021-01-06T21:47:18.000Z","size":53,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T15:30:46.115Z","etag":null,"topics":["bitcoin","bsv","cbor","javascript"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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":"2021-01-05T14:18:45.000Z","updated_at":"2022-03-08T12:41:30.000Z","dependencies_parsed_at":"2022-09-26T16:50:21.257Z","dependency_job_id":null,"html_url":"https://github.com/libitx/txpost-js","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-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libitx%2Ftxpost-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libitx%2Ftxpost-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libitx%2Ftxpost-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/libitx","download_url":"https://codeload.github.com/libitx/txpost-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245252427,"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","javascript"],"created_at":"2024-10-29T00:07:13.405Z","updated_at":"2025-03-24T10:32:08.727Z","avatar_url":"https://github.com/libitx.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Txpost.js\n\n![npm](https://img.shields.io/npm/v/txpost?color=informational)\n![License](https://img.shields.io/github/license/libitx/txpost-js?color=informational)\n![Build Status](https://img.shields.io/github/workflow/status/libitx/txpost-js/Node.js%20CI)\n\nEncode Bitcoin transactions and data in a concise and efficient binary serialisation format.\n\nUse Txpost.js on the front end to encode Bitcoin transactions and other data in a concise binary format using [CBOR](https://cbor.io). *Server-side Txpost.js offers Express and Koa.js middlewares for parsing and decoding CBOR payloads for use in your application [coming soon\u0026hellip;]*\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### Work in progress\n\n* [x] Implement BRFC `c9a2975b3d19` - CBOR Tx Payload specification\n* [x] Implement BRFC `5b82a2ed7b16` - CBOR Tx Envelope specification\n* [x] Sign and verify CBOR Tx Envelope payloads\n* [ ] Express middleware\n* [ ] Koa.js middleware\n\n## Getting started\n\nInstall Txpost with `npm` or `yarn`:\n\n```shell\nnpm install txpost\n# or\nyarn add txpost\n```\n\nAlternatively use in a browser via CDN:\n\n```html\n\u003cscript src=\"//unpkg.com/txpost/dist/txpost.min.js\"\u003e\u003c/script\u003e\n```\n\nTxForge has a peer dependency on **version 2** the `bsv` library which must also be installed in your project.\n\n## Usage\n\nA TX Payload is an object consisting of the following properties:\n\n* `data` - is either an object containing a single raw transaction alongside any other attributes, or alternatively it can be an array of objects containing multiple sets of raw transactions with additional attributes. This allows multiple transactions to be encoded in a single payload.\n* `meta` - is an object which can contain any other arbitrary infomation which can be used to help handle the request.\n\n```javascript\nimport { Payload } from 'txpost'\n\n// Example payload containing a single transaction\nconst payload = Payload.build({\n  data: {\n    rawtx: new Uint8Array([1, 0 ,0 ,0, ...]),\n    type: 'article'\n  },\n  meta: {\n    path: '/posts'\n  }\n})\n\n// Example payload containing multiple transactions\nconst multiPayload = Payload.build({\n  data: [{\n    rawtx: new Uint8Array([1, 0 ,0 ,0, ...]),\n    type: 'article'\n  }, {\n    rawtx: new Uint8Array([1, 0 ,0 ,0, ...]),\n    type: 'article'\n  }]\n  meta: {\n    path: '/posts'\n  }\n})\n```\n\nA Payload instance can then be CBOR encoded.\n\n```javascript\nconst payloadCbor = payload.encode() // =\u003e ArrayBuffer\n```\n\nA TX Envelope is an object consisting of the following properties:\n\n* `payload` - CBOR encoded TX Payload\n* `pubkey` - Optional 33-byte ECDSA public key\n* `signature` - Optional raw ECDSA signature\n\n```javascript\nimport { Envelope } from 'txpost'\n\nconst env = Envelope.build({ payload: payloadCbor })\n\n// Sign the payload with a bsv KeyPair\nenv.sign(keyPair)\n\n// Signed payloads can be verified\nenv.verify() // =\u003e true\n\n// CBOR encode the envelope for sending to other parties\nconst envCbor = env.encode() // =\u003e ArrayBuffer\n```\n\n## License\n\nTxpost is open source and released under the [Apache-2 License](https://github.com/libitx/txpost-js/blob/master/LICENSE).\n\n© Copyright 2021 Chronos Labs Ltd.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibitx%2Ftxpost-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flibitx%2Ftxpost-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibitx%2Ftxpost-js/lists"}