Author

Topic: How do you transfer all the funds in a bitcoind wallet via RPC? (Read 364 times)

staff
Activity: 3458
Merit: 6793
Just writing some code
Many thanks for the reply, I have changed it as you've said and so far so good.


Do you know what happens if you construct a transaction which used loads of inputs therefore requiring a larger fee?
The fee returned by estimatefee and the fee entered into settxfee is actually the fee rate in BTC/kB. So if you have a large transaction, it will pay a higher fee which is still using the fee rate specified in settxfee.

(Also has it already been discussed changing the RPC methods to just use satoshis?  Having it return floating point bitcoin has already flagged one rounding problem today Smiley )
There is discussion about making it all in satoshis instead of BTC. See  https://github.com/bitcoin/bitcoin/pull/9855 and https://github.com/bitcoin/bitcoin/pull/9882
s2
full member
Activity: 198
Merit: 123
Many thanks for the reply, I have changed it as you've said and so far so good.


Do you know what happens if you construct a transaction which used loads of inputs therefore requiring a larger fee?

(Also has it already been discussed changing the RPC methods to just use satoshis?  Having it return floating point bitcoin has already flagged one rounding problem today Smiley )
staff
Activity: 3458
Merit: 6793
Just writing some code
Run
Code:
estimatefee 
where is the number of blocks that you want your transaction to be confirmed within. Note that you cannot choose 1 because that is too soon and not enough data can be gathered for 1 block. I recommend using 3.

Take the result of the estimatefee command above and run
Code:
settxfee 
where is the output of the estimatefee command.

Then whenever you send using the wallet RPCs in the same session, it will use the fees set by settxfee.
s2
full member
Activity: 198
Merit: 123
I'm curious what the RPC approach is to transfer all the funds in a wallet to an external address but with a reasonable transaction fee?

(This is version 0.13.1 if that matters)

E.g. If I have 20,000,000 satoshi balance in the bitcoind controlled wallet and want to transfer as much as possible to a new address but with sufficient fees it's likely to be in the next block, what do I provide to sendToAddress?

Jump to: