Created
August 29, 2020 18:49
-
-
Save buzzkillb/c8c583b29aebb6692cf329557a97f704 to your computer and use it in GitHub Desktop.
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
from denariusrpc.authproxy import AuthServiceProxy, JSONRPCException | |
import json | |
from time import gmtime, strftime | |
#always backup wallet.dat before running scripts!!! | |
#use https://github.com/buzzkillb/python-denariusrpc | |
# rpc_user and rpc_password are set in the denarius.conf file | |
rpc_connection = AuthServiceProxy("http://%s:%[email protected]:32369"%("rpcuser", "rpcpassword")) | |
#change minimum amount to satisfy demands | |
minimum_amount = 0.00000001 | |
temp_list = [] | |
listunspent = rpc_connection.listunspent() | |
#remove duplicate address and put into list | |
for i in range(len(listunspent)): | |
if listunspent[i]['amount'] > minimum_amount: | |
if listunspent[i]['address'] not in temp_list: | |
temp_list.append(listunspent[i]['address']) | |
my_addresslist = temp_list | |
#sample dumpfile | |
#PRIVATEKEY 2019-10-08T16:25:51Z label=2019-12-02 # addr=ADDRESS | |
#clear dumpwallet.txt | |
open("dumpwallet.txt","w").close() | |
#setup to append a new dumpwallet.txt, also prints to screen | |
my_file=open("dumpwallet.txt","a") | |
for i in my_addresslist: | |
print (rpc_connection.dumpprivkey(i), strftime("%Y-%m-%dT%H:%M:%SZ", gmtime()), "label={}".format(strftime("%Y-%m-%d", gmtime())), "#", "addr={}".format(i)) | |
my_file.write(rpc_connection.dumpprivkey(i) + strftime(" %Y-%m-%dT%H:%M:%SZ ", gmtime()) + "label={}".format(strftime("%Y-%m-%d", gmtime())) + " # " + "addr={}".format(i)+'\n') | |
my_file.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment