def test_migration_user(check_user): for entry in migration_users.find(): if entry['username'] != check_user: continue hex_privkey = aes_decrypt(entry['encrypted_privkey'], SECRET_KEY) nmc_privkey = NamecoinPrivateKey(hex_privkey) btc_privkey = BitcoinPrivateKey(hex_privkey) print hex_privkey print nmc_privkey.to_wif() print get_addresses_from_privkey(hex_privkey)
def add_migration_user(username, profile): check_entry = migration_users.find_one({"username": username}) if check_entry is not None: print "already in migration DB" return new_entry = {} new_entry['username'] = username new_entry['profile'] = profile new_entry['profile_hash'] = get_hash(profile) privkey = BitcoinPrivateKey() hex_privkey = privkey.to_hex() new_entry['encrypted_privkey'] = aes_encrypt(hex_privkey, SECRET_KEY) #hex_privkey_test = aes_decrypt(new_entry['encrypted_privkey'], SECRET_KEY) #print hex_privkey #print hex_privkey_test nmc_address, btc_address = get_addresses_from_privkey(hex_privkey) new_entry['nmc_address'] = nmc_address new_entry['btc_address'] = btc_address print new_entry migration_users.save(new_entry)
def test_btc_migration(blockstore_db_file, check_username, namespace): btc_migration = open(blockstore_db_file, 'r').read() btc_migration = json.loads(btc_migration) btc_registrations = btc_migration['registrations'] for entry in btc_registrations: username = entry if username != (check_username + "." + namespace): continue profile_hash = btc_registrations[username]['value_hash'] owner_address = btc_registrations[username]['address'] print username print owner_address print '-' * 5 entry = migration_users.find_one({"username": check_username}) print entry['btc_address'] hex_privkey = aes_decrypt(entry['encrypted_privkey'], SECRET_KEY) nmc_address, btc_address = get_addresses_from_privkey(hex_privkey) print btc_address print nmc_address