Bitcoin-Core

createpsbt RPC 呼叫不提供 PSBT 輸入和輸出

  • June 16, 2021

我正在嘗試使用 RPC 創建 PSBT:

bitcoin-cli createpsbt [[{"txid": "1d76879500aecafde541770b5d44ccec5955b4c1a455fae446bf1df7b5ea43e9", "vout": 0}, {"txid": "e5a8dfa9459ac154fe62652e1d43049dae13f11815da36cc32881e27917a0dff", "vout": 1}], [{"bcrt1qnv3tl3z9cll9faqf79ppfn3rrp7pn9wwmq04p5gqgqtxg55xfxuslkyk94": "0.20000000"}, {"bcrt1qa4h6amsgyc878k094grqh6ktmgvp97dt6et9cy5hjmyxlgd9q63q3p6hch": "1.79900000"}], 0, true]

這是我收到的 PSBT:

cHNidP8BALICAAAAAulD6rX3Hb9G5PpVpMG0VVnszERdC3dB5f3KrgCVh3YdAAAAAAD9/////w16kSceiDLMNtoVGPETrp0EQx0uZWL+VMGaRanfqOUBAAAAAP3///8CAC0xAQAAAAAiACCbIr/ERcf+VPQJ8UIUziMYfBmVztgfUNEAQBZkUoZJuWAOuQoAAAAAIgAg7W+u7ggmD+PZ5aoGC+rL2hgS+avWVlwSl5bIb6GlBqIAAAAAAAAAAAA=

解碼後,PSBT 的inputsoutputs部分為空。為什麼是這樣?比特幣核心應該知道填寫這些部分所需的一切。為什麼不呢?

bitcoin-cli -regtest decode <psbt>
{'inputs': [{}, {}],
'outputs': [{}, {}],
'tx': {'hash': 'fd88b50ec52948dcf04b0d802000b325f960f3333cff8bf7a274273c9d7e2ed7',
       'locktime': 0,
       'size': 178,
       'txid': 'fd88b50ec52948dcf04b0d802000b325f960f3333cff8bf7a274273c9d7e2ed7',
       'version': 2,
       'vin': [{'scriptSig': {'asm': '', 'hex': ''},
                'sequence': 4294967293,
                'txid': '1d76879500aecafde541770b5d44ccec5955b4c1a455fae446bf1df7b5ea43e9',
                'vout': 0},
               {'scriptSig': {'asm': '', 'hex': ''},
                'sequence': 4294967293,
                'txid': 'e5a8dfa9459ac154fe62652e1d43049dae13f11815da36cc32881e27917a0dff',
                'vout': 1}],
       'vout': [{'n': 0,
                 'scriptPubKey': {'addresses': ['bcrt1qnv3tl3z9cll9faqf79ppfn3rrp7pn9wwmq04p5gqgqtxg55xfxuslkyk94'],
                                  'asm': '0 '
                                         '9b22bfc445c7fe54f409f14214ce23187c1995ced81f50d100401664528649b9',
                                  'hex': '00209b22bfc445c7fe54f409f14214ce23187c1995ced81f50d100401664528649b9',
                                  'reqSigs': 1,
                                  'type': 'witness_v0_scripthash'},
                 'value': Decimal('0.20000000')},
                {'n': 1,
                 'scriptPubKey': {'addresses': ['bcrt1qa4h6amsgyc878k094grqh6ktmgvp97dt6et9cy5hjmyxlgd9q63q3p6hch'],
                                  'asm': '0 '
                                         'ed6faeee08260fe3d9e5aa060beacbda1812f9abd6565c129796c86fa1a506a2',
                                  'hex': '0020ed6faeee08260fe3d9e5aa060beacbda1812f9abd6565c129796c86fa1a506a2',
                                  'reqSigs': 1,
                                  'type': 'witness_v0_scripthash'},
                 'value': Decimal('1.79900000')}],
       'vsize': 178,
       'weight': 712},
'unknown': {}}

這是不應該的。createpsbt無法訪問錢包,因此無法填寫任何輸入或輸出資訊。如果你想填寫這些,你可以使用walletcreatefundedpsbt.

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