Last active
October 2, 2026 07:34
-
-
Save provegard/9294617 to your computer and use it in GitHub Desktop.
Python script for dumping wallet addresses and private keys
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| # --------------------------------------------------------------------------- | |
| # This software is in the public domain, furnished "as is", without technical | |
| # support, and with no warranty, express or implied, as to its usefulness for | |
| # any purpose. | |
| # | |
| # Usage: | |
| # ./dump_wallet_addresses.py <wallet binary> | |
| # | |
| # Simple Python program that communicates with your <whatever>coin wallet | |
| # (assuming it's bitcoin wallet compatible) in order to list all addresses | |
| # together with their private keys. Both normally visible and hidden/secret | |
| # addresses are listed. | |
| # | |
| # There is no error handling. Make sure the wallet binary is in the search | |
| # path, or pass its full path. | |
| # | |
| # Author: Per Rovegård | |
| # --------------------------------------------------------------------------- | |
| import sys | |
| import subprocess | |
| import json | |
| walletBin = "" | |
| def execWalletCommand(cmd, expectsJson): | |
| p = subprocess.Popen([walletBin] + cmd, stdout=subprocess.PIPE) | |
| out, err = p.communicate() | |
| if expectsJson: | |
| return json.loads(out) | |
| return out | |
| def addAddressesFromGroupings(target): | |
| result = execWalletCommand(["listaddressgroupings"], True) | |
| for grouping in result: | |
| for group in grouping: | |
| addr = group[0] | |
| if addr not in target: | |
| target[addr] = {} | |
| target[addr]["balance"] = group[1] | |
| if len(group) > 2: | |
| target[addr]["account"] = group[2] | |
| def addAddressesFromAccounts(target): | |
| accounts = execWalletCommand(["listaccounts"], True) | |
| for key in accounts: | |
| addresses = execWalletCommand(["getaddressesbyaccount", key], True) | |
| for addr in addresses: | |
| if addr not in target: | |
| target[addr] = {} | |
| target[addr]["account"] = key | |
| def getPrivKeyForAddress(address): | |
| return execWalletCommand(["dumpprivkey", address], False).strip() | |
| def main(): | |
| global walletBin | |
| if len(sys.argv) < 2: | |
| print "Usage: %s <wallet binary>" % (sys.argv[0], ) | |
| sys.exit(1) | |
| walletBin = sys.argv[1] | |
| target = {} | |
| addAddressesFromAccounts(target) | |
| addAddressesFromGroupings(target) | |
| for addr in target: | |
| obj = target[addr] | |
| balance = obj["balance"] if "balance" in obj else 0 | |
| account = obj["account"] if "account" in obj else "<unknown>" | |
| if account == "": | |
| account = '""' | |
| print "%s\t%s\t%.8f\t%s" % (addr, getPrivKeyForAddress(addr), balance, account) | |
| if __name__ == "__main__": | |
| main() |
And also show me how to run it to function well.Thank
Author
Hi! The usage is in the script:
./dump_wallet_addresses.py <wallet binary>
You can pass in the full path to your Bitcoin-compatible wallet binary.
I do undersatnd it,may you help me and explain how i may use it to solve my
problem sir?
…On Tue, Mar 14, 2023 at 6:26 PM Per Rovegård ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
Hi! The usage is in the script:
./dump_wallet_addresses.py <wallet binary>
You can pass in the full path to your Bitcoin-compatible wallet binary.
—
Reply to this email directly, view it on GitHub
<https://gist.github.com/9294617#gistcomment-4502372> or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ARA7M654CZX663AYVSULMNTW4CEZNBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFQKSXMYLMOVS2I5DSOVS2I3TBNVS3W5DIOJSWCZC7OBQXE5DJMNUXAYLOORPWCY3UNF3GS5DZVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFU44TEOJUGYYTPJ3UOJUWOZ3FOKTGG4TFMF2GK>
.
You are receiving this email because you commented on the thread.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>
.
Bitcoin address දුන්නහම ඒකෙ ප්රයිවට් keyගන්න පුළුවන් වෙන්න
0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
I have a very fast and powerful seed phrase checker you can use price is
$1000 and you can simply get back your return on investment in a day
because it searches for solana wallets.
…On Sun, Oct 6, 2024, 11:43 PM Jxkcguh ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
—
Reply to this email directly, view it on GitHub
<https://gist.github.com/provegard/9294617#gistcomment-5222637> or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/A2MQ3F5FHVVEHGFO35GPQSTZ2G4JZBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDUOJ2WLJDOMFWWLO3UNBZGKYLEL5YGC4TUNFRWS4DBNZ2F6YLDORUXM2LUPGBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFU44TEOJUGYYTPJ3UOJUWOZ3FOKTGG4TFMF2GK>
.
You are receiving this email because you are subscribed to this thread.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Dear sir,
I like the way you wrote about your software,But I want to know how to use it to fine my trust wallet phrase.
Thank