Skip to content

Instantly share code, notes, and snippets.

@EgosOwn
Last active June 15, 2023 03:05
Show Gist options
  • Select an option

  • Save EgosOwn/021c5093f829cc1e2f1004b8605187b3 to your computer and use it in GitHub Desktop.

Select an option

Save EgosOwn/021c5093f829cc1e2f1004b8605187b3 to your computer and use it in GitHub Desktop.
combine all monero accounts in a wallet to a single address (sweep all accounts)
# public domain/creative commons 0, use at your own risk
from typing import List
import traceback
from decimal import Decimal
# Please note that this script will have some amount of negative privacy impact.
from monero.wallet import Wallet
w = Wallet(port=28088, user="", password="")
sweep_target = "target monero address here"
for account in w.accounts:
balances = account.balances()
if balances[0] != balances[1]:
print("Skipping account", account.index, "because balance is not entirely unlocked")
continue
if balances[0] == Decimal("0.0"):
print("Skipping account", account.index, "because balance is zero")
continue
try:
account.sweep_all(sweep_target, 1)
except Exception as e:
print("Skipping account", account.index, "because\n", traceback.format_exc())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment