This Python script generates a BIP-39 seed phrase using multiple sources of entropy, including:
- Audio: Captures audio from the microphone.
- Mouse movements: Tracks mouse activity during the recording process.
- Webcam video: Captures real-time video frames from the webcam.
The script combines these data sources to ensure a highly random and secure seed phrase generation. It also generates a QR code of the seed phrase and saves all related files (audio, video, QR code) for verification purposes.
-
Audio Entropy:
- Records 10 seconds of audio and uses raw data for entropy.
-
Mouse Entropy:
- Captures mouse movements during the recording period.
-
Webcam Entropy:
- Records video from the webcam to add additional randomness.
-
Seed Phrase Generation:
- Generates a BIP-39-compliant seed phrase.
-
QR Code Output:
- Saves the seed phrase as a QR code for easy storage.
-
Output Files:
- Audio:
recorded_entropy.wav
- Video:
webcam_mouse_output.avi
- QR Code:
seed_qr.png
- Audio:
Ensure you have Python 3.8 or later installed. Check your Python version with:
python3 --version
Install the necessary libraries using pip
:
pip install sounddevice numpy hashlib mnemonic qrcode opencv-python pynput scipy pillow
-
Clone the Repository:
git clone https://github.com/asyscom/seed-phrase-generator.git cd seed-phrase-generator
-
Create a Virtual Environment (Optional but Recommended):
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install Dependencies:
pip install -r requirements.txt
-
Run the script:
python3 happy3.py
-
During Execution:
- Move the mouse as instructed on-screen.
- Speak or make noise near the microphone.
- Stay in front of the webcam to add visual randomness.
-
Outputs:
recorded_entropy.wav
: The audio recording.webcam_mouse_output.avi
: The video recording with mouse movements.seed_qr.png
: A QR code of the generated seed phrase.
-
Seed Phrase:
- The seed phrase is printed in the terminal.
- Keep this phrase secure as it’s your key for recovery!
This script combines three levels of entropy to create the seed phrase:
-
Audio Entropy:
- Derived from raw audio data captured from the microphone.
- Adds randomness through ambient noise and voice inputs.
-
Mouse Entropy:
- Captures mouse movements during the recording.
- Random mouse movement increases entropy significantly.
-
Visual Entropy:
- Captures real-time frames from the webcam.
- Frame data adds a layer of visual randomness.
The combined entropy ensures robust randomness and security for the generated seed phrase.
-
Offline Execution:
- Run the script on an air-gapped (offline) computer to prevent data leaks.
-
Backup Securely:
- Store the generated files (audio, video, QR code) in secure, offline locations.
-
QR Code:
- Never share the QR code with untrusted parties.
-
Seed Phrase:
- The seed phrase is your recovery key. Treat it as highly confidential and secure.
-
OpenCV GUI Timer Error:
- You may see a
QObject::killTimer
warning while displaying the video. This is a known OpenCV issue and does not affect functionality.
- You may see a
-
Hardware Limitations:
- Ensure your microphone and webcam are functional before running the script.
If you’d like to contribute:
- Fork the repository.
- Create a branch for your feature:
git checkout -b new-feature
- Submit a pull request.
This project is licensed under the MIT License. See the LICENSE
file for more details.