-snip-
Ah yeah, my bad, but you got it exactly right. I want to control my change addresses manually. I see you can unhook "use change address" in Electrum. I wonder how that looks... Your input gets as output as well together with the withdrawal address?
Anyway, if any of you knows the easiest way to put a P2HS as change address from a P2PKH, please let me know. This could be smart to do if you want to transfer your funds to segwit to get lower fees, huh? So you just wait to transfer them till the next time you gonna pay for something else. I know you can do "pay to many" as well in electrum, but that makes the fees higher i guess.
It cant be done in the same HD wallet since Electrum can only make one script type per wallet.
It can be done by either using "
Imported" Electrum wallet with P2SH and P2PKH addresses
or Multiple Electrum wallets, one legacy and one P2SH-SegWit (
the legacy and P2SH wallet types cannot be created in the latest version using the standard method).
Then use "
pay to many" as instructed by ranochigo.
For the fee, the trick is to minimize the input (
preferably single input) to minimize the transaction's size, then use the 'Advanced' preview to manually set the absolute fee to 300sat and the locktime as well.
Here's a sample transaction that has all of your requirements (
in Testnet), made with Electrum:
{
"addresses": [
"mnGWeTPSpDQDaAUberY2yXoUBVKdc929oQ",
"tb1qs7nsd3me4tecjy0dxtvu7fv5j77wtlyyk79g46",
"2NDtnDqpu989KZCFheNLbcyrE3Uhh39Dd37"
],
"block_height": -1,
"block_index": -1,
"confirmations": 0,
"double_spend": false,
"fees": 299,
"hash": "02131283383a61cae96659d17ba8037d1a2eb4fbf63b63a464a1ca9c8b641c28",
"inputs": [
{
"addresses": [
"mnGWeTPSpDQDaAUberY2yXoUBVKdc929oQ"
],
"age": 2131727,
"output_index": 0,
"output_value": 208136,
"prev_hash": "27df12d3196bb002529aaebc8c38c2ff9548965f1226bc863e8de2b76076fda1",
"script": "473044022025c3e1fb29d4771f77b1ed9b9f046c35ab5e92521a0c85a87caf39ff9ded4116022014566644d98f5ec0041dea6af247bb087598b7c2a90aa41f26bc8dec9e4078f9012103bb9863910b98ed804e44535ff8373df729b0d68398634ec70ebabbd399da58db",
"script_type": "pay-to-pubkey-hash",
"sequence": 4294967293
}
],
"lock_time": 1640966421,
"opt_in_rbf": true,
"outputs": [
{
"addresses": [
"tb1qs7nsd3me4tecjy0dxtvu7fv5j77wtlyyk79g46"
],
"script": "001487a706c779aaf38911ed32d9cf259497bce5fc84",
"script_type": "pay-to-witness-pubkey-hash",
"value": 100000
},
{
"addresses": [
"2NDtnDqpu989KZCFheNLbcyrE3Uhh39Dd37"
],
"script": "a914e27cd04be97a13089ba664307599dca4b379a2bb87",
"script_type": "pay-to-script-hash",
"value": 107837
}
],
}
Fee: 1.4sat/vB @ 220vB | 299 satoshi
Locktime set to 13 days from now / next year (1640966421)
P2PKH input: mnGWeTPSpDQDaAUberY2yXoUBVKdc929oQ
Sent to P2WPKH: tb1qs7nsd3me4tecjy0dxtvu7fv5j77wtlyyk79g46
P2SH-P2WPKH Change address: 2NDtnDqpu989KZCFheNLbcyrE3Uhh39Dd37
One more question (i probably get more later when i try the transaction):
In case of using locktime, does it have to require two actions? One for locking and one for receiving (broadcasting the transaction) or is it possible to like "auto broadcast" at a specific block/time?
In Electrum, you'll have to manually broadcast it and even if you save it locally, it wont be automatically sent after the
nLocktime passed.