def main(password, private_key_seed, date_string, key_label, output_dir): private_key_bin = sha3("".join(seed for seed in private_key_seed).encode("UTF-8")) password = password.encode("UTF-8") key = make_keystore_json_patched(private_key_bin, password) key["address"] = encode_hex(privatekey_to_address(private_key_bin)) filename = "UTC--{date}--{label}".format( date=date_string, label=key_label if key_label else key["address"] ) filepath = os.path.abspath(os.path.join(os.path.abspath(output_dir), filename)) with open(filepath, "w") as f: json.dump(key, f, cls=BytesJSONEncoder) print("0x{}".format(key["address"]))
def main(password, private_key_seed, date_string, key_label, output_dir): private_key_bin = sha3("".join(seed for seed in private_key_seed).encode("UTF-8")) password = password.encode("UTF-8") key = make_keystore_json_patched(private_key_bin, password) key['address'] = encode_hex(privatekey_to_address(private_key_bin)) filename = "UTC--{date}--{label}".format( date=date_string, label=key_label if key_label else key['address'], ) filepath = os.path.abspath(os.path.join(os.path.abspath(output_dir), filename)) with open(filepath, "w") as f: json.dump(key, f, cls=BytesJSONEncoder) print("0x{}".format(key['address']))
def privatekey_to_address(private_key_bin): return sha3( PrivateKey(private_key_bin).public_key.format( compressed=False)[1:])[12:]
def privatekey_to_address(private_key_bin): return sha3(PrivateKey(private_key_bin).public_key.format(compressed=False)[1:])[12:]