Plutus icon indicating copy to clipboard operation
Plutus copied to clipboard

Question about def process

Open rdfbbx opened this issue 5 years ago • 4 comments

def process(private_key, public_key, address, database): """ Accept an address and query the database. If the address is found in the database, then it is assumed to have a balance and the wallet data is written to the hard drive. If the address is not in the database, then it is assumed to be empty and printed to the user. Average Time: 0.0000026941 seconds """ if address in database[0] or
address in database[1] or
address in database[2] or
address in database[3]:
with open('plutus.txt', 'a') as file: file.write('hex private key: ' + str(private_key) + '\n' + 'WIF private key: ' + str(private_key_to_WIF(private_key)) + '\n' + 'public key: ' + str(public_key) + '\n' + 'address: ' + str(address) + '\n\n')

Am I wrong, or is the script checking only 3 of all the database files?

rdfbbx avatar Jan 10 '20 01:01 rdfbbx

And this part :

with open(DATABASE + p, 'rb') as file: if c < half: if c < quarter: database[0] = database[0] | pickle.load(file) else: database[1] = database[1] | pickle.load(file) else: if c < half + quarter: database[2] = database[2] | pickle.load(file) else: database[3] = database[3] | pickle.load(file) print('DONE')

MisterTeo avatar Jan 10 '20 09:01 MisterTeo

@rdfbbx Indexes in python (and most languages) start at 0 not 1, so it's counting 0, 1, 2, 3 -- which gives us 4 in total. Everything's correct.

@MisterTeo This part has to do with limited memory issues. If you have less RAM than the database needs for processing it will error out. In this case you can pass options such as "half" or "quarter", which will only read those part of the database, respectively. I have enough RAM so didn't actually use it. If you got no errors, just ignore it.

Edit: To clarify both question: The database is intentionally split into "4" parts for reasons I mentioned above. It doesn't matter if there are 5, 12, or 185 pickle files -- these may change at any given time. 4 or "3" more precisely always equals the total number of pickle files.

secretnumber avatar Jan 13 '20 08:01 secretnumber

So, I have 12 gb of ram, will use all .pickle files ? Or I need to change something to use all database ? Can you give us a modifyed scrypt ?

MisterTeo avatar Jan 13 '20 10:01 MisterTeo

I also have 12 GB ram and it runs fine reading all the .pickle files. If it can't read them all, you will get an error and only then will you have to modify the script.

I parsed the chain incorrectly the other day and ended up with 54 pickle files (54+ million addresses), and it still ran fine. So I wouldn't worry about it for now. The only thing you need to watch out for is not to run too many other programs at the same time. Or heavy/resource intensive programs I should say. Personally, I run this script in linux as it's faster and doesn't have all the windows bloat running in the background.

secretnumber avatar Jan 13 '20 10:01 secretnumber