{"id":17939416,"url":"https://github.com/libitx/txforge","last_synced_at":"2025-03-24T10:32:09.714Z","repository":{"id":38414935,"uuid":"277143947","full_name":"libitx/txforge","owner":"libitx","description":"Modern Bitcoin transaction builder, capable of supporting any non-standard and custom script type.","archived":false,"fork":false,"pushed_at":"2022-05-27T17:07:34.000Z","size":1920,"stargazers_count":64,"open_issues_count":1,"forks_count":22,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-19T03:39:50.889Z","etag":null,"topics":["bitcoin","bsv","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":"2020-07-04T16:12:44.000Z","updated_at":"2024-12-05T16:13:40.000Z","dependencies_parsed_at":"2022-08-25T02:20:29.205Z","dependency_job_id":null,"html_url":"https://github.com/libitx/txforge","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%2Ftxforge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libitx%2Ftxforge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libitx%2Ftxforge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libitx%2Ftxforge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/libitx","download_url":"https://codeload.github.com/libitx/txforge/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245252433,"owners_count":20585062,"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","javascript"],"created_at":"2024-10-29T00:07:17.800Z","updated_at":"2025-03-24T10:32:09.251Z","avatar_url":"https://github.com/libitx.png","language":"JavaScript","readme":"# TxForge\n\n![Industrial strength transaction builder](https://raw.githubusercontent.com/libitx/txforge/master/media/txforge-poster.jpg)\n\n[![npm](https://img.shields.io/npm/v/txforge?color=informational)](https://www.npmjs.com/package/txforge)\n![License](https://img.shields.io/github/license/libitx/txforge?color=informational)\n![Build Status](https://img.shields.io/github/workflow/status/libitx/txforge/Node.js%20CI/v2)\n\n\nTxForge is an industrial strength transaction builder. Re-built on top of [nimble](https://github.com/runonbitcoin/nimble), TxForge 2.0 is an ultra-lightweight, ultra-flexible, essential part of any respectable Bitcoin builders' toolkit.\n\n- simple, human-friendly declarative API for composing transactions\n- extendable and flexible - can forge transactions with any script template imaginable\n- under the hood it's powered by nimble, less that 1/5 the size of [moneybutton/bsv v2](https://github.com/moneybutton/bsv) and up to 4 times as fast!\n- a robust library using well-tested, modern javascript\n\n*The legacy version of TxForge, powered by [bsv v2](https://github.com/moneybutton/bsv), can be found on the [legacy branch](https://github.com/libitx/txforge/tree/legacy).*\n\n## Sponsors\n\n\u003cp align=\"center\"\u003eSupported by:\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://coingeek.com\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\n    \u003cimg src=\"https://www.chronoslabs.net/img/badges/coingeek.png\" width=\"180\" alt=\"Coingeek\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\nYour sponsorship will help us continue to release and maintain software that Bitcoin businesses and developers depend on.\n\n#### 👉 [Sponsor Chronos Labs' open source work](https://www.chronoslabs.net/sponsor/)\n\n## Upgrading\n\nIf you've used previous versions of TxForge, conceptually everything is the same. However, v2.0 is a rewrite from top to bottom, powered by a new Bitcoin library, and incorporates some API changes, most notably with how Casts are defined and used.\n\nFull more details, check out the [TxForge 2 upgrade notes](https://github.com/libitx/txforge/wiki/Installing-and-upgrading-TxForge#txforge-2-upgrade-notes).\n\n## Quick start\n\nInstall TxForge with `npm` or `yarn`:\n\n```shell\nnpm install txforge\n# or\nyarn add txforge\n```\n\nAlternatively use in a browser via CDN:\n\n```html\n\u003cscript src=\"https://unpkg.com/@runonbitcoin/nimble\"\u003e\u003c/script\u003e\n\u003cscript src=\"https://unpkg.com/txforge/dist/txforge.min.js\"\u003e\u003c/script\u003e\n\n\u003c!-- or use the bundled version which includes nimble --\u003e\n\u003cscript src=\"https://unpkg.com/txforge/dist/txforge.bundled.min.js\"\u003e\u003c/script\u003e\n```\n\nGrab your tools and put on your safety googles. Lets forge a transaction... it's hammer time!\n\n```js\nimport { forgeTx, toUTXO, casts } from 'txforge'\n\n// We'll use these Casts in our transaction\nconst { P2PKH, OpReturn } = casts\n\n// You'll need UTXOs to fund a transaction. Use the `toUTXO` helper to turn\n// your UTXO data into the required objects.\nconst utxo = toUTXO({\n  txid,       // utxo transaction id\n  vout,       // utxo output index\n  satoshis,   // utxo amount\n  script      // utxo lock script\n})\n\n// Forge a transaction\nconst tx = forgeTx({\n  inputs: [\n    P2PKH.unlock(utxo, { privkey: myPrivateKey })\n  ],\n  outputs: [\n    P2PKH.lock(5000, { address: '1DBz6V6CmvjZTvfjvWpvvwuM1X7GkRmWEq' }),\n    OpReturn.lock(0, { data: ['meta', '1DBz6V6CmvjZTvfjvWpvvwuM1X7GkRmWEq', txid] })\n  ],\n  change: { address: '1Nro9WkpaKm9axmcfPVp79dAJU1Gx7VmMZ' }\n})\n\n// And behold! Forged by the Gods and found by a King - a transaction is born.\nconsole.log(tx.toHex())\n```\n\nAnd that's it. Really. One function that returns a fully built and signed transaction, ready to send off to your favourite transaction processor.\n\nBut there's more, much more. When you're ready, grab a coffee and dive into the following to discover how TxForge can be used to lock and unlock any combination of script template you can imagine.\n\n- [Understanding Casts](https://github.com/libitx/txforge/wiki/Understanding-Casts)\n- [Creating custom Casts](https://github.com/libitx/txforge/wiki/Creating-custom-Casts)\n- [Building Scripts with TxForge](https://github.com/libitx/txforge/wiki/Building-scripts-with-the-Tape-API)\n\n## License\n\nTxForge is open source and released under the [Apache-2 License](https://github.com/libitx/txforge/blob/master/LICENSE).\n\nCopyright (c) 2020-2022 Chronos Labs Ltd.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibitx%2Ftxforge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flibitx%2Ftxforge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibitx%2Ftxforge/lists"}