monero-ecosystem / monero-python

A comprehensive Python module for handling Monero cryptocurrency
BSD 3-Clause "New" or "Revised" License
246 stars 80 forks source link

Sweep function #20

Closed nyxynyx closed 5 years ago

nyxynyx commented 6 years ago

Is there a method for using the monero-wallet-cli sweep_all command to transfer all the funds from the current wallet to another wallet?

emesik commented 6 years ago

Currently it's not available, because I assumed that command is rarely used in automated environment. However, the implementation should be straightforward, so I'll try to include it in the next release.

Lafudoci commented 5 years ago

I need this function too. Since now monero have accounts system, my service needs transfer fund between accounts. I could not figure out a reliable way to withdraw all balance without use weep_all. I guess I have to calculating the tx size * fee/kb. But did not figure out.

emesik commented 5 years ago

An alternative is to call transfer() with relay=False. The resulting transaction won't be submitted to the network but you may learn the fee amount from it and recalculate amounts again. Of course, this is a nasty workaround and prone to bugs (recalculating amount may include different set of UTXOs, changing the size and resulting fee of the transaction).

I'll add it ASAP.

dginovker commented 5 years ago

I would also prefer sweep_all over this method. Are there still plans to implement it?

emesik commented 5 years ago

It has been added. Feel free to test it. I'll also run some additional checks and release it this week.