Transactions

創建 2-of-3 多重簽名原始交易

  • July 26, 2019

我想與單個輸入和支付1 BTC以下3個鍵中的任意2單個2的-3 multisig輸出創建一個比特幣交易: 02983a79d2de8e504d00ddd2343b582acef7e17ed91b308ade8dff027a92e7716d03548ca1916957bc06dd1c6e3639ebf7b2c3c8b1715915433c1d37cab56fb26ef0,和 0218a240a599ba437cb1458966eb456d9f848e5bdef45ea0ee4ec31fc40aa4ffa8

我只想要一個語法上有效的交易,對 UTXO 的引用不必存在。

你能指導我完成這些步驟嗎?

你幾乎擁有它,你只需要確保你正在創建一個帶有你的錢包可以簽名的輸出的交易。

範例(關於法律測試)

bitcoin-cli -regtest addmultisigaddress 2 '["02983a79d2de8e504d00ddd2343b582acef7e17ed91b308ade8dff027a92e7716d","03548ca1916957bc06dd1c6e3639ebf7b2c3c8b1715915433c1d37cab56fb26ef0","0218a240a599ba437cb1458966eb456d9f848e5bdef45ea0ee4ec31fc40aa4ffa8"]'

{
 "address": "2NA1HC31wqFexbpp8bGB6rsMR5Lz9SrUKkt",
 "redeemScript": "522102983a79d2de8e504d00ddd2343b582acef7e17ed91b308ade8dff027a92e7716d2103548ca1916957bc06dd1c6e3639ebf7b2c3c8b1715915433c1d37cab56fb26ef0210218a240a599ba437cb1458966eb456d9f848e5bdef45ea0ee4ec31fc40aa4ffa853ae"
}

bitcoin-cli -regtest getnewaddress

2NAsEawSCjsjJjtAZcpP9jhXojqNUevjo63

bitcoin-cli -regtest generatetoaddress 110 2NAsEawSCjsjJjtAZcpP9jhXojqNUevjo63

[
 "7e974615714bdcee6f4c69ea158b92fe2c0b728742110737e7ff13d9e8eb49ad",
 ...
]

bitcoin-cli -regtest listunspent

[
 ...
 {
   "txid": "9c9298a5d7ceca73f657110c0222ee606324263694d59722a2194b22ccc8b0ff",
   "vout": 0,
   "address": "2NAsEawSCjsjJjtAZcpP9jhXojqNUevjo63",
   "label": "",
   "redeemScript": "0014821824c23b9c82fa639789bc3314194d1e44ec4a",
   "scriptPubKey": "a914c1499c99d26f5bb7101f1213747bf730c4b9346287",
   "amount": 50.00000000,
   "confirmations": 102,
   "spendable": true,
   "solvable": true,
   "desc": "sh(wpkh([29b8db74/0'/0'/0']03557ff8751b55175307c0550460694dfe3c84598672fe5b9c53dca71bcb9122ee))#25k8n2ql",
   "safe": true
 }
]

bitcoin-cli -regtest createrawtransaction '[{"txid" : "9c9298a5d7ceca73f657110c0222ee606324263694d59722a2194b22ccc8b0ff","vout":0}]' '{"2NA1HC31wqFexbpp8bGB6rsMR5Lz9SrUKkt":49.999}'

0200000001ffb0c8cc224b19a22297d5943626246360ee22020c1157f673caced7a598929c0000000000ffffffff01606b042a0100000017a914b7d6fcff0fe015a393f8baee424ba82c4e18c6d48700000000

bitcoin-cli -regtest signrawtransactionwithwallet 0200000001ffb0c8cc224b19a22297d5943626246360ee22020c1157f673caced7a598929c0000000000ffffffff01606b042a0100000017a914b7d6fcff0fe015a393f8baee424ba82c4e18c6d48700000000

{
 "hex": "02000000000101ffb0c8cc224b19a22297d5943626246360ee22020c1157f673caced7a598929c0000000017160014821824c23b9c82fa639789bc3314194d1e44ec4affffffff01606b042a0100000017a914b7d6fcff0fe015a393f8baee424ba82c4e18c6d487024730440220249224a99d24a0ae1d91328ea2e8da0936916ea31a28e35013de003af72f658d02201c48618283ac00a8c5b362e8ade530f4cfacd396a99ab78081cea2d18ad8d165012103557ff8751b55175307c0550460694dfe3c84598672fe5b9c53dca71bcb9122ee00000000",
 "complete": true
}

bitcoin-cli -regtest sendrawtransaction 02000000000101ffb0c8cc224b19a22297d5943626246360ee22020c1157f673caced7a598929c0000000017160014821824c23b9c82fa639789bc3314194d1e44ec4affffffff01606b042a0100000017a914b7d6fcff0fe015a393f8baee424ba82c4e18c6d487024730440220249224a99d24a0ae1d91328ea2e8da0936916ea31a28e35013de003af72f658d02201c48618283ac00a8c5b362e8ade530f4cfacd396a99ab78081cea2d18ad8d165012103557ff8751b55175307c0550460694dfe3c84598672fe5b9c53dca71bcb9122ee00000000

8b0cd4413dad3e1f02f7344236ba4b3d1994c3cd3bbdda1acc9b2d2c0e184453

引用自:https://bitcoin.stackexchange.com/questions/89390