Bitcoin Forum

Bitcoin => Electrum => Topic started by: Red-Apple on August 20, 2019, 12:29:55 PM



Title: is there a way to send "all remaining amount" when using pay to many?
Post by: Red-Apple on August 20, 2019, 12:29:55 PM
i think it is easier to explain with numbers:
lets say i have 100,000 satoshi and want to pay:
- 9500 satoshi to address_1
- (automatic 500 satoshi fee)
- send remaining 90000 satoshi to address_2 (that is not in the wallet i use)

this is easy because of round numbers:
address_1, 0.00009500
address_2, 0.00090000
works but numbers are never round :P is there any syntax i could put in place of "0.00090000" that sends all the remaining to address_2. i tried "*" and "all", nothing worked.


Title: Re: is there a way to send "all remaining amount" when using pay to many?
Post by: Rath_ on August 20, 2019, 12:54:43 PM
works but numbers are never round :P is there any syntax i could put in place of "0.00090000" that sends all the remaining to address_2. i tried "*" and "all", nothing worked.

Instead of '*' and 'all', you should use '!'. Fill the 'Pay to many' box like this:

Code:
address1, amount1
address2, !

You will be able to adjust the fee. The remaining coins will be sent to the address2. There is no such thing as 'automatic 500 satoshi fee'. Your transaction fee depends on the number of inputs and outputs, number of unconfirmed transactions in the mempool and the type of address you are using.


Title: Re: is there a way to send "all remaining amount" when using pay to many?
Post by: mocacinno on August 20, 2019, 12:55:27 PM
You could always use the console...
You'll need paytomany

Code:
./electrum help paytomany
usage: electrum paytomany [-h] [-v VERBOSITY]
                                    [-V VERBOSITY_SHORTCUTS]
                                    [-D ELECTRUM_PATH] [-P] [-w WALLET_PATH]
                                    [--testnet] [--regtest] [--simnet]
                                    [-f FEE] [-F FROM_ADDR] [-c CHANGE_ADDR]
                                    [--nocheck] [-u] [--rbf RBF] [-W PASSWORD]
                                    [--locktime LOCKTIME]
                                    outputs

Create a multi-output transaction.

positional arguments:
  outputs               list of ["address", amount]

optional arguments:
  -h, --help            show this help message and exit
  -f FEE, --fee FEE     Transaction fee (in BTC)
  -F FROM_ADDR, --from_addr FROM_ADDR
                        Source address (must be a wallet address; use sweep to
                        spend from non-wallet address).
  -c CHANGE_ADDR, --change_addr CHANGE_ADDR
                        Change address. Default is a spare address, or the
                        source address if it's not in the wallet
  --nocheck             Do not verify aliases
  -u, --unsigned        Do not sign transaction
  --rbf RBF             Replace-by-fee transaction
  -W PASSWORD, --password PASSWORD
                        Password
  --locktime LOCKTIME   Set locktime block number

global options:
  -v VERBOSITY          Set verbosity (log levels)
  -V VERBOSITY_SHORTCUTS
                        Set verbosity (shortcut-filter list)
  -D ELECTRUM_PATH, --dir ELECTRUM_PATH
                        electrum directory
  -P, --portable        Use local 'electrum_data' directory
  -w WALLET_PATH, --wallet WALLET_PATH
                        wallet path
  --testnet             Use Testnet
  --regtest             Use Regtest
  --simnet              Use Simnet


Do read BitCryptex's post first tough!!! He's spot on when he told you there is no such thing as an automatic fee!!! If you manually create a transaction using the paytomany console command, and you chose a "default" fee, you'll either be (grossly) overpaying, or (grossly) underpaying... So you'll either get a fast confirmation at a price that's way to high, or your transaction will get stuck (unconfirmed in the mempool of many nodes) for a potentially long time.

An other option would be to export your private keys, import them into core and use core's cli, or use coinb.in to create an unsigned transaction and sign it from electrum's console


Title: Re: is there a way to send "all remaining amount" when using pay to many?
Post by: Red-Apple on August 20, 2019, 01:23:13 PM
There is no such thing as 'automatic 500 satoshi fee'.

by "automatic" i meant to have the value "500" (as an example) be set automatically when i set the fee to something like 1 satoshi/byte and based on size and based on the first value and the total remaining to be sent to second address.

it is against the alternative (manual) thing i was doing:
1. total - amount1
2. guess transaction size based on input/output
3. calculate fee by hand (500 in this example)
4. (result_of_1 - result_of_3) and set it for address 2
5. preview to see if i didn't have any change left
6. repeat step 2&3 until i get it right!
result: nightmare...


the exclamation mark was exactly what i was looking for. thanks.