for addrvalue in wallet.unspent.values(): if addr == addrvalue["address"]: balance += addrvalue["value"] used = " used" if balance > 0.0 else "empty" balance_depth += balance wip_privkey = ( btc.encode_privkey(privkey, "wif_compressed", get_p2pk_vbyte()) if options.showprivkey else "" ) cus_print(" " * 13 + "%-35s%s %.8f btc %s" % (addr, used, balance / 1e8, wip_privkey)) total_balance += balance_depth print("for mixdepth=%d balance=%.8fbtc" % (m, balance_depth / 1e8)) print("total balance = %.8fbtc" % (total_balance / 1e8)) elif method == "generate" or method == "recover": if method == "generate": seed = btc.sha256(os.urandom(64))[:32] words = mn_encode(seed) print("Write down this wallet recovery seed\n\n" + " ".join(words) + "\n") elif method == "recover": words = raw_input("Input 12 word recovery seed: ") words = words.split() # default for split is 1 or more whitespace chars if len(words) != 12: print("ERROR: Recovery seed phrase must be exactly 12 words.") sys.exit(0) seed = mn_decode(words) print(seed) password = getpass.getpass("Enter wallet encryption passphrase: ") password2 = getpass.getpass("Reenter wallet encryption passphrase: ") if password != password2: print("ERROR. Passwords did not match") sys.exit(0) password_key = btc.bin_dbl_sha256(password)
raise ValueError("invalid default answer: '%s'" % default) while True: sys.stdout.write(question + prompt) choice = raw_input().lower() if default is not None and choice == '': return valid[default] elif choice in valid: return valid[choice] else: sys.stdout.write("Please respond with 'yes' or 'no' " "(or 'y' or 'n').\n") if method == 'generate': seed = btc.sha256(os.urandom(64))[:32] words = mn_encode(seed) print('Write down this wallet recovery seed\n\n' + ' '.join(words) + '\n') elif method == 'recover': words = raw_input('Input 12 word recovery seed: ') words = words.split( ) # default for split is 1 or more whitespace chars if len(words) != 12: print('ERROR: Recovery seed phrase must be exactly 12 words.') sys.exit(0) seed = mn_decode(words) print(seed) password = getpass.getpass('Enter wallet encryption passphrase: ') password2 = getpass.getpass('Reenter wallet encryption passphrase: ') if password != password2: print('ERROR. Passwords did not match')