This PR is motivated by #27391. And inspired by a previous PR #8849 that proposed something similar.
This issue is partially solved as this PR only prints P2WSH.
This is an example with a real mainnet transaction (3-5 multisig) and using decoderawtransaction
(also works for getrawtransaction 'raw' 1
).
0{
1 "txid": "6346e552f62281314dfeace8f977e056f251bc55d15b24ec14f73b34387357cf",
2 "hash": "6feae897bafa067ebdb37ec5459632a3d7adad7a43ba4c5cd986290601890dfc",
3 "version": 2,
4 "size": 995,
5 "vsize": 406,
6 "weight": 1622,
7 "locktime": 866335,
8 "vin": [
9 {
10 "txid": "ca7449fc71dd22be5cf5102403fa533ed1a60568be189cc2634eda7ea1cda8b0",
11 "vout": 1,
12 "scriptSig": {
13 "asm": "",
14 "hex": ""
15 },
16 "txinwitness": [
17 "",
18 "304402200d7fa3b5f9e120bc745eddc04f15a8dcc0d5de94094cfd51108a05316f6e057f02204a91eb5181de60badde799b634bea62c9c48cbf1b2db41e103683cfbdc3b27f801",
19 "30440220589560381db4faa1860fbc6062e0bbf0bdfed9fa4487a62f93138c6dfc0323c302202027c17a359d638534576c5360b8fc68370eb05dfdf0cf090421be538439500a01",
20 "304402207fa11c62520f28f1020aeaca8f33b24785adcabaf8d1b0b02cb575d0854816d5022038ebbbccff03e291f0af3ab25380b7bfae9cc0ae1894fd43de61d7dd37c4f42e01",
21 "532102315dc82d3cbfc3db0ded614b503060869f70d41a6880762d154da586f020ccee210266e3d4116335998f218bcc7287d58452552ac9b2180cdfb038f21455d058bedc21027b61ce3da654c6481cb7252f810f54a4be4e6446a9578ca6e6351f3068feab1d2102aee061de64c6cb29835d81a599b3d7b6977298b34fd50d51f8557861e71a6ffe2102e3fea7eaa609f3294b9a98037ede530afdfa6ea34bb8a93c1d15527bf026d2da55ae"
22 ],
23 "witScript": {
24 "asm": "3 02315dc82d3cbfc3db0ded614b503060869f70d41a6880762d154da586f020ccee 0266e3d4116335998f218bcc7287d58452552ac9b2180cdfb038f21455d058bedc 027b61ce3da654c6481cb7252f810f54a4be4e6446a9578ca6e6351f3068feab1d 02aee061de64c6cb29835d81a599b3d7b6977298b34fd50d51f8557861e71a6ffe 02e3fea7eaa609f3294b9a98037ede530afdfa6ea34bb8a93c1d15527bf026d2da 5 OP_CHECKMULTISIG",
25 "desc": "multi(3,02315dc82d3cbfc3db0ded614b503060869f70d41a6880762d154da586f020ccee,0266e3d4116335998f218bcc7287d58452552ac9b2180cdfb038f21455d058bedc,027b61ce3da654c6481cb7252f810f54a4be4e6446a9578ca6e6351f3068feab1d,02aee061de64c6cb29835d81a599b3d7b6977298b34fd50d51f8557861e71a6ffe,02e3fea7eaa609f3294b9a98037ede530afdfa6ea34bb8a93c1d15527bf026d2da)#yf60teq5",
26 "type": "multisig"
27 },
28 "sequence": 4294967293
29 },
30 {
31 other inputs ...
32 }
33 ],
34 "vout": [
35 {
36 outputs ...
37 }
38 ]
39}