xtruan / FlipBIP

BIP32/39/44 crypto wallet for Flipper Zero
MIT License
139 stars 12 forks source link

Crypto Wallet Crashes Flipper (out of memory) #27

Closed YerkydaMob closed 5 months ago

YerkydaMob commented 10 months ago

Flipbip is the only application on my flipper that constantly crashes. It works sometimes, but crashes regularly. Any suggestions? Can I utilize the flipper crypto wallet to send crypto assets directly to it?

xtruan commented 10 months ago

This is a known issue. Unfortunately, the crypto libraries make this one of the largest apps that is available for the Flipper. I've seen crashes on all the major custom firmwares, though it seems to crash less on XFW.

The app does not support sending and receiving directly on the device.

YerkydaMob commented 10 months ago

I appreciate your reply, will there ever be code written for a good crypto cold wallet app? What do you think?

YerkydaMob commented 10 months ago

I'm about to buy rogue master super and I'm very excited to learn new things for the flipper.

xtruan commented 10 months ago

I think it's possible. The code I'm using is all based on the original Trezor wallet code, and that already includes all the needed logic. It would need to be adapted to talk to the Flipper USB interface, but I imagine that's possible. The limitation as far as I'm aware is memory. The code is just too big to run with all those features baked in. There may be a way around that in the future, development in the Flipper world moves pretty fast.

Also legit, RM is a stand up dude!

YerkydaMob commented 10 months ago

I had started writing this code for an AI assistant to utilize in the flipper. But it's a work in progress. I tried to get CHATGPT to write me code for a crypto hardware wallet, but it told me I'd need a micro controller and other things...

AI Assistant

Import necessary libraries

import speech_recognition as sr import pyttsx3

Initialize speech recognition and text-to-speech engines

recognizer = sr.Recognizer() engine = pyttsx3.init()

Function to listen to user's voice command

def listen(): with sr.Microphone() as source: print("Please speak your command...") recognizer.adjust_for_ambient_noise(source) # Adjust for ambient noise audio = recognizer.listen(source)

try:
    print("Recognizing command...")
    command = recognizer.recognize_google(audio)  # Use Google's speech recognition
    print(f"User command: {command}")
    return command.lower()
except sr.UnknownValueError:
    print("Sorry, I couldn't understand your command.")
    return ""
except sr.RequestError:
    print("Failed to reach the Google API.")
    return ""

Function to speak out the assistant's response

def speak(text): engine.say(text) engine.runAndWait()

Main loop to interact with the user

while True: user_command = listen() # Listen to the user's command

# Implement your AI assistant's logic here based on user commands
if "hello" in user_command:
    speak("Hello! How can I assist you today?")
elif "what's the time" in user_command:
    # Implement time retrieval logic
    speak("The current time is...")
elif "goodbye" in user_command:
    speak("Goodbye!")
    break  # Exit the loop

End of the rubber ducky script

YerkydaMob commented 10 months ago

Also would this work?

DELAY 2000 REM Rubber Ducky script for capturing any rolling code signal via sub-GHz with Flipper Zero

REM Activate Flipper Zero as a HID device DELAY 1000 GUI r DELAY 500 STRING devmgmt.msc ENTER DELAY 2000 ALT A DELAY 500 STRING Flipper Zero DELAY 500 ALT E DELAY 500 STRING HID Keyboard Device ENTER DELAY 1000 ALT F4 DELAY 1000

REM Start capturing rolling code signals via sub-GHz DELAY 2000 STRING python3 /path/to/rolling_code_capture.py ENTER DELAY 2000

REM Continuously capture and log rolling code signals REM ( import subprocess import time

def capture_rolling_code_signals(): while True: try:

Use Flipper Zero's sub-GHz module to capture rolling code signals

        result = subprocess.run(["flipper-zero", "capture", "rolling_code"], capture_output=True, text=True, timeout=10)

        # Process the captured rolling code signal
        signal = result.stdout.strip()
        print(f"Captured rolling code signal: {signal}")

        # Do something with the captured signal (e.g., save to file, analyze, etc.)
        # (Insert your custom code here)

        time.sleep(1)  # Delay between captures
    except subprocess.TimeoutExpired:
        print("Timeout occurred while capturing. Exiting...")
        break
    except Exception as e:
        print(f"Error occurred: {str(e)}")
        break

Start capturing rolling code signals

capture_rolling_code_signals()

REM Mission accomplished! STRING echo "Rolling code signals successfully captured. ENTER

xtruan commented 10 months ago

I'm not sure. Your best bet is to get set up with a development environment from a Flipper firmware repo and try some things out. And then reach out with any questions on the various Flipper Discords!

YerkydaMob commented 10 months ago

I appreciate your help, thanks so much.

dogtopus commented 1 month ago

This is a known issue. Unfortunately, the crypto libraries make this one of the largest apps that is available for the Flipper.

One suggestion: You can break the crypto routines into bits and pieces as separate DLLs/plugins and load them dynamically only upon request via a wrapper or something. This is what the official NFC card decoder uses to combat bloat. If it's unlikely that all algorithms are needed at once this could drastically cut the memory usage by code.