{"id":19291769,"url":"https://github.com/hirosystems/multisig-stx-btc","last_synced_at":"2025-04-22T06:31:46.046Z","repository":{"id":46330054,"uuid":"397989816","full_name":"hirosystems/multisig-stx-btc","owner":"hirosystems","description":"A webscript for generating, signing, decoding multisig STX operations in the STX-over-BTC wire format","archived":false,"fork":false,"pushed_at":"2023-08-02T15:09:32.000Z","size":222,"stargazers_count":4,"open_issues_count":4,"forks_count":7,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-15T21:43:53.763Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hirosystems.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"publiccode":null,"codemeta":null}},"created_at":"2021-08-19T15:28:04.000Z","updated_at":"2023-05-31T18:53:44.000Z","dependencies_parsed_at":"2024-11-09T22:28:23.957Z","dependency_job_id":"5b102fe0-3bca-4f6f-b1ba-dc3350c3080a","html_url":"https://github.com/hirosystems/multisig-stx-btc","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/hirosystems%2Fmultisig-stx-btc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hirosystems%2Fmultisig-stx-btc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hirosystems%2Fmultisig-stx-btc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hirosystems%2Fmultisig-stx-btc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hirosystems","download_url":"https://codeload.github.com/hirosystems/multisig-stx-btc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250183244,"owners_count":21388682,"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-11-09T22:27:49.293Z","updated_at":"2025-04-22T06:31:45.779Z","avatar_url":"https://github.com/hirosystems.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"**WARNING**: This script is very much a alpha-level script. It is designed to work\nunder favorable conditions, and there are many ways that it could fail. This\nscript provides a bare-bones experience and the protocol that it uses is\nfairly intricate. This script requires careful thought to use correctly, and is\ngenerally not recommended if other approaches are possible. Checking and\ndouble-checking the outputs of this script is very strongly advised. This script\nis provided as-is, and we make no guarantees that it will work for your use case.\n\nUsing the multi-sig transaction script.\n\nIn order to issue a multi-sig transaction you must, at a high-level:\n\n1. Fund the multi-sig address using Bitcoin to pay Bitcoin transaction\n   fees (STX-over-BTC transactions require Bitcoin fees).\n2. Generate a partial pre-transaction for sending the Stacks.\n3. Sign the partial pre-transaction with each participating device.\n4. Broadcast the pre-transaction.\n5. Generate the *actual* transaction for sending the Stacks.\n6. Sign the transaction with each participating device.\n7. Broadcast the transaction.\n8. The Stacks block that is elected in the Bitcoin block *after*\n   the one in which your transaction was included will process\n   your transaction. If no such block is elected, the transaction\n   *fails*, and you will need to start the whole process over again.\n\nTo figure out how much Bitcoin is required to fund the transaction,\nyou can use the index.html script to try and generate a\ntransaction. If the address needs more funds, the page will tell you how\nmuch BTC (in satoshis) to send to the correct Bitcoin address.\n\nGenerating the transaction requires manually inputting the correct\nparameters for your multi-sig wallet:\n\n1. Public Keys -- these are _all_ the participating public keys\nfor your multi-sig address (if your address is 2-of-3, you should\nenter 3 public keys). You should input these public keys in the same\norder that you did when you generated your wallet. If they are not\nin the correct order, the page will give you an error.\n\n2. The number of required signers.\n\n3. The multi-sig Stacks address you wish to send from\n\n4. The Stacks address you wish to send to\n\n5. The number of _microstacks_ to send or stack (these are 10^-6 stacks).\n\n6. The Bitcoin TXID of your Pre-transaction, and whether or not \n   to consume the whole pre-transaction's UTXO (in most cases, you\n   would want to consume the whole UTXO to pay Bitcoin transaction fees,\n   however if the Bitcoin UTXO is very large, you may not want to do this).\n\nOnce you've generated the transaction, the page will output a\npartially generated transaction as a data blob at the bottom of the\npage. You now need to iteratively sign this partial transaction.\n\n## Caveats\n\nThe STX-over-BTC wire format is burdensome in a couple ways:\n\n1. It always requires sending *two* Bitcoin transactions: a pre-transaction and \n   the actualy transaction itself. This is discussed in [SIP-007](https://github.com/stacksgov/sips/blob/main/sips/sip-007/sip-007-stacking-consensus.md#stx-operations-on-bitcoin).\n1. You cannot construct the second Bitcoin transaction until the first one has\n   been broadcasted.\n1. The Stacks block elected in the bitcoin block following the second\n   transaction processes the transaction (i.e., the second transaction\n   is included in Bitcoin block 101, it will be processed by the Stacks\n   block elected in Bitcoin block 102).\n1. If no Stacks block was elected at that height *or* if the elected\n   Stacks block ends up being forked-away-from (i.e., orphaned), then\n   your transaction will *not* be picked up by the Stacks network.\n   You will need to construct a new pre-transaction and transaction pair.\n\nOne other important note:\n\nThis script does a pretty poor job of estimating Bitcoin fees, which\nis why \"spending the whole UTXO\" on the second transaction is helpful:\nit makes the TX smaller, and therefore the fee paid is more effective.\nBecause of this, it is *strongly* recommended that you inspect the\nconstructed Bitcoin transactions for their fee rates. The way that this\nscript works requires the Pre-Transaction *completely* fund the second\ntransaction. Therefore, the UTXO from the Pre-Transaction *must* be\nlarge enough to fund the second transaction.\n\n## Signing the Transaction\n\nIn order to sign the transaction, take the data blob you wish\nto sign, and paste it into the \"Partial transaction\" form field\non the page. You need to explicitly specify the path on your\nhardware device that will sign the transaction. If you\nused the Stacks Wallet application to generate a public key,\nthat path is:\n\n\n   m/44'/5757'/0'/0/0\n\n\nWhen you plug in the hardware device and click the \"Start Sign\" button,\nyou will be prompted by your device to sign the transaction.\n\nIf it completes successfully, it will output the partially signed\ntransaction as a data blob. Copy that blob and paste it into \nthe partial transaction field, repeating this process for as many\nsignatures as are required by the multisig address. When you are\nsigning for the last signature in the address (i.e., the 2nd signature in\na 2-of-3), use the \"Finish Sign TX\" button instead of the \"Start Sign\" button.\nWhen you use the finish sign tx button, and the hardware device successfully\nsigns the transaction, it will output a raw Bitcoin transaction as a hex string.\nBroadcast that transaction from any valid Bitcoin transaction broadcaster\n(e.g., https:://www.blockchain.com/btc/pushtx).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhirosystems%2Fmultisig-stx-btc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhirosystems%2Fmultisig-stx-btc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhirosystems%2Fmultisig-stx-btc/lists"}