From aadb9e2a3330da8cd14874f17d208956fc9e3843 Mon Sep 17 00:00:00 2001 From: uname0x96 Date: Mon, 22 Jan 2024 11:18:44 +0700 Subject: [PATCH 1/2] convert entropy to mnemonic --- README.md | 8 ++++- convert/convert_entropy_to_mnemonic.py | 44 ++++++++++++++++++++++++++ convert/requirements.txt | 1 + 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 convert/convert_entropy_to_mnemonic.py create mode 100644 convert/requirements.txt diff --git a/README.md b/README.md index 85f4849..f8c13ab 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,13 @@ Owshen is an innovative privacy platform developed for EVM-based blockchains. Ow ``` ./Owshen_v0.1.3_x86_64.AppImage wallet ``` -7. If you have problems running the wallet, let's discuss in our Discord server: https://discord.gg/owshen +7. if you've forgotten to save your mnemonic but have the entropy file, you can convert your entropy to a mnemonic + ``` + cd convert + pip install -r requirements.txt + python convert_entropy_to_mnemonic.py --entropy-json /path/to/your/.owshen-wallet.json + ``` +8. If you have problems running the wallet, let's discuss in our Discord server: https://discord.gg/owshen Happy diving! :swimmer: diff --git a/convert/convert_entropy_to_mnemonic.py b/convert/convert_entropy_to_mnemonic.py new file mode 100644 index 0000000..b5cddf2 --- /dev/null +++ b/convert/convert_entropy_to_mnemonic.py @@ -0,0 +1,44 @@ +import argparse +import json +from mnemonic import Mnemonic + +def entropy_to_mnemonic(entropy): + mnemonic = Mnemonic("english") + mnemonic_phrase = mnemonic.to_mnemonic(bytes(entropy)) + return mnemonic_phrase + +def main(): + # Create an argument parser + parser = argparse.ArgumentParser(description="Convert entropy to mnemonic phrase") + + # Add the --entropy-json argument + parser.add_argument("--entropy-json", required=True, help="Path to the JSON file containing entropy") + + # Parse the command-line arguments + args = parser.parse_args() + + # Read JSON data from file + try: + with open(args.entropy_json, "r") as file: + json_data = json.load(file) + except FileNotFoundError: + print(f"Error: File '{args.entropy_json}' not found.") + return + except json.JSONDecodeError: + print(f"Error: Invalid JSON format in file '{args.entropy_json}'.") + return + + # Extract entropy from the JSON + entropy = json_data["entropy"]["value"] + + # Convert the array of integers to a bytes object + entropy_bytes = bytes(entropy) + + # Convert entropy to mnemonic + mnemonic_phrase = entropy_to_mnemonic(entropy_bytes) + + # Print the mnemonic phrase + print("Mnemonic Phrase:", mnemonic_phrase) + +if __name__ == "__main__": + main() diff --git a/convert/requirements.txt b/convert/requirements.txt new file mode 100644 index 0000000..f4e340a --- /dev/null +++ b/convert/requirements.txt @@ -0,0 +1 @@ +mnemonic==0.21 \ No newline at end of file From 7f88f2cdefbeda23414c635abbbf1eeccbcc59e3 Mon Sep 17 00:00:00 2001 From: uname0x96 Date: Mon, 22 Jan 2024 13:40:09 +0700 Subject: [PATCH 2/2] add --- .owshen-wallet.json | 1 + README.md | 1 + 2 files changed, 2 insertions(+) create mode 100644 .owshen-wallet.json diff --git a/.owshen-wallet.json b/.owshen-wallet.json new file mode 100644 index 0000000..08c7be4 --- /dev/null +++ b/.owshen-wallet.json @@ -0,0 +1 @@ +{"entropy":{"value":[112,156,131,183,172,162,169,216,53,166,227,148,139,216,113,139]},"token_contracts":[]} \ No newline at end of file diff --git a/README.md b/README.md index f8c13ab..cd4fb01 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ Owshen is an innovative privacy platform developed for EVM-based blockchains. Ow 1. Get yourself a GNU/Linux machine. (Ubuntu +22.04 preferred) 2. Install `libfuse2`, `nodejs` and `snarkjs`: ```bash + sudo add-apt-repository universe sudo apt install fuse libfuse2 nodejs -y sudo npm install -g snarkjs ```