You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This library print the address data very pretty but when you want to use it's API to get some information out of it and get different addresses it become really frustrating..Please review and setup some helper functions to retrieve each address accordingly
The text was updated successfully, but these errors were encountered:
Yeah I need to print 100 different keys and addresses and it only prints the same ones each time I run it. How do I get it to print different keys so I don't have to run the python file 100 different times?
SOLUTION: Use wallet = Wallet() every time you need new keys. Because whenever you get a private key using a function like wallet.key.__dict__['mainnet'].__dict__['wif'] for example, it is still referencing that same wallet variable that was declared earlier.
For example, this is my script:
from bitcoinaddress import Wallet
privs = []
pubs = []
addrs = []
i = -1
for i in range(100):
wallet = Wallet()
privs.append(wallet.key.__dict__['mainnet'].__dict__['wif'])
pubs.append(wallet.address.__dict__['pubkey'])
addrs.append(wallet.address.__dict__['mainnet'].__dict__['pubaddr1'])
for i in privs:
print(i)
print()
for i in pubs:
print(i)
print()
for i in addrs:
print(i)
(At first i had the wallet = Wallet() before the for loop)
This library print the address data very pretty but when you want to use it's API to get some information out of it and get different addresses it become really frustrating..Please review and setup some helper functions to retrieve each address accordingly
The text was updated successfully, but these errors were encountered: