-
I'm sending BTC to another address how can I change/override the change address? Tx Link: https://blockchair.com/bitcoin/testnet/transaction/964543edcaaeeecd8d77a41046369c2493b525779f1417007058b0b0f95d0228 |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
You can spend a single utxo and specify all output addresses like this: wallet = wallet_delete_if_exists('example_btctestnet', force=True)
w = Wallet.create('example_btctestnet', network='bitcoinlib_test')
w.utxos_update()
t = w.send([('blt1qwx3vf0jlwpxvc5cl9g6gj4sltpluqem9jt0cde', 50000000),
('blt1qlkwskkwudqgee9az2cjqgncns5phykwx6eav3t', 49999000)], fee=1000, max_utxos=1)
t.info() You can also use the input_arr or input_key_id argument to use specific utxo's |
Beta Was this translation helpful? Give feedback.
-
Hey @mccwdev . hoping you can build on your answer to help me understand how this works. I have this simple code example
This creates a transaction like i'd expect.
What i cannot for the life of me figure out is, how do i have the output to send the unspent UTXOs back to my wallet go back to the same address that the Inputs came from. To be clear, this address is the address with the inputs, i want everything i dont spent to then go back to this address.
so that the transaction info looks like this
appreciate any help |
Beta Was this translation helpful? Give feedback.
-
You have to send function and not the send_to, supply a list of addresses and the fee. The total value output of the addresses plus the fee has to be the same as the input value, then no extra change address will be created. In the example above there are two outputs and a fee of 1000, which adds up to 100000000, which is equal to one test utxo. |
Beta Was this translation helpful? Give feedback.
-
Not sure what you are want to achieve, but this kind of address reuse is not good for privacy and safety. However you could do something like w = wallet_create_or_open('wlt373', network='testnet')
w.scan(scan_gap_limit=1)
w.info()
output_arr = [
('tb1qyqjgxn8aycwgxjjgnzpen6u5z4tsmnyjhhf300', 400),
('tb1qplyhtmgdk0hjuevux22xvudvljkvw5cpgr4tkv', 400),
]
t = w.send(output_arr, fee=200, min_confirms=0, offline=False)
t.info() |
Beta Was this translation helpful? Give feedback.
You can spend a single utxo and specify all output addresses like this:
You can also use the input_arr or input_key_id argument to use specific utxo's