以前の記事
y-nakajo.hatenablog.com
で、作れなかったwitness transactionだけど、createwitnessaddressが必要なかった。。
5.以降を以下の手順にしたら作れたけど。。。witnessのscript?の最後がerrorになっててsendrawtransactionできなかった。
手順だけ以下にまとめておきます。
5. 新しいwitnessaddressにbitcoinを送るtransactionを作る
< getaccountaddress nakajo_test2 > mtNQRcmp5FQzwRgojfKf28dVKDMdCMDjT8 < addwitnessaddress mtNQRcmp5FQzwRgojfKf28dVKDMdCMDjT8 > 2MzFueh418hkhRsop3iFgVRZNvYXwvDfmFL < createrawtransaction '[{"txid":"d38d37b523e1b94c40ca7a9d5c42d19bbf2437476105e36ea9599240a2bd55d7","vout":0}]' '{"2MzFueh418hkhRsop3iFgVRZNvYXwvDfmFL":0.0999}' > 0100000001d755bda2409259a96ee30561473724bf9bd1425c9d7aca404cb9e123b5378dd30000000000ffffffff01706f98000000000017a9144ce9fd235f0ec25f6cc77a7fce629525c453c53d8700000000
6. listunspentでscriptPubKeyとredeemScriptのhexを確認する
< listunspent > [ ... , { "txid": "d38d37b523e1b94c40ca7a9d5c42d19bbf2437476105e36ea9599240a2bd55d7", "vout": 0, "address": "2NEwHgunmeraQysM1cyS9Rr3952tzwyA6UM", "redeemScript": "001403f9f84721fe9c8411971992c41b5a0eaad2aba9", "scriptPubKey": "a914edee5e71d224f09b83ea4ef8f26ca21a9a3affbb87", "amount": 0.10000000, "confirmations": 16, "spendable": true, "solvable": true }, ... ]
7. 6の内容を元にsignする
< signrawtransaction 0100000001d755bda2409259a96ee30561473724bf9bd1425c9d7aca404cb9e123b5378dd30000000000ffffffff01706f98000000000017a9144ce9fd235f0ec25f6cc77a7fce629525c453c53d8700000000 '[{"txid":"d38d37b523e1b94c40ca7a9d5c42d19bbf2437476105e36ea9599240a2bd55d7","vout":0,"scriptPubKey":"a914edee5e71d224f09b83ea4ef8f26ca21a9a3affbb87","redeemScript":"001403f9f84721fe9c8411971992c41b5a0eaad2aba9","amount":0.0999}]' '["private_key"]' ALL > { "hex": "01000000000101d755bda2409259a96ee30561473724bf9bd1425c9d7aca404cb9e123b5378dd3000000001716001403f9f84721fe9c8411971992c41b5a0eaad2aba9ffffffff01706f98000000000017a9144ce9fd235f0ec25f6cc77a7fce629525c453c53d8702483045022100a006decab6c724bcd4dcae6520c9d2d64274b45ed74359823eb21da15e55dc39022060a78448dc8e1d86f107ae705193522e050e09fb439141ccc9ed1071b4f7c2dd01210327fbd8cf132044cccac3a39a38ed223795fa4b118a93e4a7374c75a9a24f335100000000", "complete": true }
8. decodeして7.の内容を確認
< decoderawtransaction 01000000000101d755bda2409259a96ee30561473724bf9bd1425c9d7aca404cb9e123b5378dd3000000001716001403f9f84721fe9c8411971992c41b5a0eaad2aba9ffffffff01706f98000000000017a9144ce9fd235f0ec25f6cc77a7fce629525c453c53d8702483045022100a006decab6c724bcd4dcae6520c9d2d64274b45ed74359823eb21da15e55dc39022060a78448dc8e1d86f107ae705193522e050e09fb439141ccc9ed1071b4f7c2dd01210327fbd8cf132044cccac3a39a38ed223795fa4b118a93e4a7374c75a9a24f335100000000 > { "txid": "bccde1f9e84f63409bc088beaf90b99c67f99b0459b92e484c90f47bc94b1ec9", "hash": "fa9ac98d8b8190aa4ed97c3a85e2724508de6b73fc6c21a567594fe322a43c2e", "size": 216, "vsize": 134, "version": 1, "locktime": 0, "vin": [ { "txid": "d38d37b523e1b94c40ca7a9d5c42d19bbf2437476105e36ea9599240a2bd55d7", "vout": 0, "scriptSig": { "asm": "001403f9f84721fe9c8411971992c41b5a0eaad2aba9", "hex": "16001403f9f84721fe9c8411971992c41b5a0eaad2aba9" }, "txinwitness": [ "3045022100a006decab6c724bcd4dcae6520c9d2d64274b45ed74359823eb21da15e55dc39022060a78448dc8e1d86f107ae705193522e050e09fb439141ccc9ed1071b4f7c2dd01", "0327fbd8cf132044cccac3a39a38ed223795fa4b118a93e4a7374c75a9a24f3351" ], "sequence": 4294967295 } ], "vout": [ { "value": 0.09990000, "n": 0, "scriptPubKey": { "asm": "OP_HASH160 4ce9fd235f0ec25f6cc77a7fce629525c453c53d OP_EQUAL", "hex": "a9144ce9fd235f0ec25f6cc77a7fce629525c453c53d87", "reqSigs": 1, "type": "scripthash", "addresses": [ "2MzFueh418hkhRsop3iFgVRZNvYXwvDfmFL" ] } } ] } < decodescript 3045022100a006decab6c724bcd4dcae6520c9d2d64274b45ed74359823eb21da15e55dc39022060a78448dc8e1d86f107ae705193522e050e09fb439141ccc9ed1071b4f7c2dd01 > { "asm": "45022100a006decab6c724bcd4dcae6520c9d2d64274b45ed74359823eb21da15e55dc39022060a78448dc8e1d86f107 OP_CHECKMULTISIG OP_2OVER 1 OP_ADD 2 [error]", "type": "nonstandard", "p2sh": "2MuiyBAkWDAAYt548Ez9JpgtxnbHd8h5svw" }
なんでOP_CHECKMULTISIGになっちゃってるんだろうか?スクリプトについてさっぱりわかってないからなぁ。。。