Bitcoin Forum
June 29, 2024, 02:27:31 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1]
1  Bitcoin / Bitcoin Technical Support / Re: send returning a PSBT rather than complete boolean on: August 16, 2023, 07:54:31 PM
Getting a PSBT from send without asking it to do so means that the wallet was unable to sign the transaction. This depends on how your wallet is setup. Some possible causes are that the wallet is watch-only, or that the wallet is encrypted and hasn't been unlocked.

I tried to sign the PSBT using signrawtansactionwithwallet, but that returns an error:
signrawtransactionwithwallet does not work on PSBTs. Use walletprocesspsbt instead.

Thank you so much. The issue was it not being unlocked correctly.
2  Bitcoin / Bitcoin Technical Support / send returning a PSBT rather than complete boolean on: August 16, 2023, 06:24:05 PM
Hello,

I am developing an application in python (talking to the node directly via JSON-RPC requests over localhost) that uses bitcoin core (version 25) to send coins. I have created a wallet with the createwallet endpoint, and am able to get my wallet balance. However, I am experiencing issues actually sending coins to an address. When I call the send endpoint, it returns a partially signed bitcoin transaction rather than the complete boolean explained here: https://bitcoincore.org/en/doc/24.0.0/rpc/wallet/send/ assuming I am understanding the documentation correctly.

Per the documentation, I sent the following for each argument:

arg 1 -
Code:
{"a valid wallet": float(amt)}
arg 2 (block target) - 2
arg 3 - "economical"
arg 4 - null
arg 5 -
Code:
{"add_inputs": True, "include_unsafe": False, "add_to_wallet": True}

I tried to sign the PSBT using signrawtansactionwithwallet, but that returns an error:

Code:
{'result': None, 'error': {'code': -22, 'message': 'TX decode failed. Make sure the tx has at least one input.'}, 'id': 'BTC-3'}

To try to troubleshoot, I decoded the PSBT into:

Code:
{
    "result": {
        "tx": {
            "txid": "f4a0cfbaf70b421fb0bb8efcc1fd846147b30dcc8e37d804fd67e62daa537c60",
            "hash": "f4a0cfbaf70b421fb0bb8efcc1fd846147b30dcc8e37d804fd67e62daa537c60",
            "version": 2,
            "size": 113,
            "vsize": 113,
            "weight": 452,
            "locktime": 0,
            "vin": [
                {
                    "txid": "c27d2c5de950e926eae12baf9a64a22470f08f15fdc2937cb0e0b0a9e0be3021",
                    "vout": 1,
                    "scriptSig": {
                        "asm": "",
                        "hex": ""
                    },
                    "sequence": 4294967293
                }
            ],
            "vout": [
                {
                    "value": 0.0005665,
                    "n": 0,
                    "scriptPubKey": {
                        "asm": "0 9253f3dc5243e999b0462feaaf75892d0d15aaf0",
                        "desc": "addr(bc1qjffl8hzjg05envzx9l427avf95x3t2hsfuv7pk)#8dljy26k",
                        "hex": "00149253f3dc5243e999b0462feaaf75892d0d15aaf0",
                        "address": "bc1qjffl8hzjg05envzx9l427avf95x3t2hsfuv7pk",
                        "type": "witness_v0_keyhash"
                    }
                },
                {
                    "value": 0.00361984,
                    "n": 1,
                    "scriptPubKey": {
                        "asm": "0 66a0658cc59a8ce2ef144366bef939cc54a45155",
                        "desc": "addr(bc1qv6sxtrx9n2xw9mc5gdnta7fee322g524l7dx6u)#8y2x0pc2",
                        "hex": "001466a0658cc59a8ce2ef144366bef939cc54a45155",
                        "address": "bc1qv6sxtrx9n2xw9mc5gdnta7fee322g524l7dx6u",
                        "type": "witness_v0_keyhash"
                    }
                }
            ]
        },
        "global_xpubs": [],
        "psbt_version": 0,
        "proprietary": [],
        "unknown": {},
        "inputs": [
            {
                "witness_utxo": {
                    "amount": 0.0042,
                    "scriptPubKey": {
                        "asm": "0 518c712a304957ee0f3126e4ff5530d109399b1d",
                        "desc": "addr(bc1q2xx8z23sf9t7ure3ymj074fs6yynnxcauud86h)#tdnferpm",
                        "hex": "0014518c712a304957ee0f3126e4ff5530d109399b1d",
                        "address": "bc1q2xx8z23sf9t7ure3ymj074fs6yynnxcauud86h",
                        "type": "witness_v0_keyhash"
                    }
                },
                "non_witness_utxo": {
                    "txid": "c27d2c5de950e926eae12baf9a64a22470f08f15fdc2937cb0e0b0a9e0be3021",
                    "hash": "c27d2c5de950e926eae12baf9a64a22470f08f15fdc2937cb0e0b0a9e0be3021",
                    "version": 1,
                    "size": 113,
                    "vsize": 113,
                    "weight": 452,
                    "locktime": 0,
                    "vin": [
                        {
                            "txid": "8235da81cdae27351b91c3a8ad55b86334f75aa5d24c04a965a249865eda2e44",
                            "vout": 1,
                            "scriptSig": {
                                "asm": "",
                                "hex": ""
                            },
                            "sequence": 4294967295
                        }
                    ],
                    "vout": [
                        {
                            "value": 0.0321023,
                            "n": 0,
                            "scriptPubKey": {
                                "asm": "0 36cbc816cf79b5040db3e6dcde4ab5e7425ce654",
                                "desc": "addr(bc1qxm9us9k00x6sgrdnumwduj44uap9eej5amytgk)#y3p0qnt3",
                                "hex": "001436cbc816cf79b5040db3e6dcde4ab5e7425ce654",
                                "address": "bc1qxm9us9k00x6sgrdnumwduj44uap9eej5amytgk",
                                "type": "witness_v0_keyhash"
                            }
                        },
                        {
                            "value": 0.0042,
                            "n": 1,
                            "scriptPubKey": {
                                "asm": "0 518c712a304957ee0f3126e4ff5530d109399b1d",
                                "desc": "addr(bc1q2xx8z23sf9t7ure3ymj074fs6yynnxcauud86h)#tdnferpm",
                                "hex": "0014518c712a304957ee0f3126e4ff5530d109399b1d",
                                "address": "bc1q2xx8z23sf9t7ure3ymj074fs6yynnxcauud86h",
                                "type": "witness_v0_keyhash"
                            }
                        }
                    ]
                },
                "bip32_derivs": [
                    {
                        "pubkey": "020045babcfd4ab10a97666611a40af323d06ffcc5545f8a63d596365d05e31ff6",
                        "master_fingerprint": "423222ad",
                        "path": "m/84'/0'/0'/0/0"
                    }
                ]
            }
        ],
        "outputs": [
            {},
            {
                "bip32_derivs": [
                    {
                        "pubkey": "02e61b2dcb645c2d163388c27b6589af22f601460823fad94dabf23f785ca47f1a",
                        "master_fingerprint": "423222ad",
                        "path": "m/84'/0'/0'/1/5"
                    }
                ]
            }
        ],
        "fee": 1.366e-05
    },
    "error": null,
    "id": "BTC-2"
}

Can anyone spot what I'm doing wrong here? Is it perhaps a node config issue?


Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!