Skip to content

Instantly share code, notes, and snippets.

View odudex's full-sized avatar

Odudex odudex

View GitHub Profile
@odudex
odudex / TR_Simple_Inheritance_Krux_Liana.md
Last active March 11, 2025 14:28
A Taproot Simple Inheritance example with Krux and Liana

Liana Simple Inheritance Taproot Miniscript Wallet with Krux

Overview

This guide details how to set up a Taproot miniscript wallet using:

  • Krux: For key creation, backup, and transaction signing.
  • Liana Wallet: For creating a “Simple Inheritance” wallet that uses the keys generated on Krux.

The process involves key management, backups, and data exchange via an SD card.

class Node:
"""
A simple tree node that only stores:
- text: The 'prefix' of the expression before an open parenthesis,
or the entire expression if no parentheses exist.
- children: Any sub-expressions contained within parentheses (split by commas at top level).
- level: An integer used to control indentation depth.
"""
def __init__(self, text, children=None, level=0):
END_OPERATORS = [
"pk_k",
"pk_h",
"older",
"after",
"sha256",
"hash256",
"ripemd160",
"hash160",
"multi",
class Node:
"""
A simple parse-tree node to represent Miniscript expressions.
"""
def __init__(self, node_type, children=None, value=None, level=0):
self.node_type = node_type # e.g. "AND", "OR", "PK", "OLDER"
self.children = children if children is not None else []
self.value = value # used by PK(...) or OLDER(...)
self.level = level # for indentation
@odudex
odudex / qr_templater.py
Last active December 23, 2024 17:47
Generate QR Code templates for manual transcription as SVG and PNG files
# The MIT License (MIT)
# Copyright (c) 2024-2024 Krux contributors
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@odudex
odudex / krux_decrypt.py
Last active December 23, 2024 10:01
Load and decrypt Krux encrypted mnemonics from JSON, QR codes, save them as .txt and load as .txt
# The MIT License (MIT)
# Copyright (c) 2021-2023 Krux contributors
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@odudex
odudex / Context on Tamper Detection Tool.md
Created November 12, 2024 19:01
Context on Krux Tamper Detection Tool

After a user reported that the settings on their Krux device changed unexpectedly, and with the disclosure of threads like "Dark Skippy" I decided to invest time in protecting Krux from tampering.

My first objective was to investigate if it was possible to implement some type of tamper protection for Krux K210-based boards, such as secure boot. The K210 specifications mention firmware encryption and One-Time Programmable (OTP) memory, which could make secure boot viable, but there was no documentation on how to implement it.

The lack of documentation didn't stop us from exploring K210 features before, so I started a quick investigation.

My first finding was that I was not the first to explore these poorly documented characteristics of the K210. Wladimir van der Laan, while still the lead Bitcoin Core maintainer, conducted a deep investigation into the K210, also trying to determine how to use the chip's OTP memory.

[Wladimir's OTP Layout Documentation](https://github.com/laanwj/

Krux Ethos

The purpose of this ethos is not to virtue signal, but to introduce newcomers to Krux's philosophy and provide a guiding reference for decision-making and the long-term mission for dedicated Krux users.

Mission

To implement ideas that make self-custody more powerful, accessible, and user-friendly.

Don't Trust

Do not trust developers’ intentions or competence. Krux is a DIY, use-at-your-own-risk project. We are committed to continuously improving security, but will not make claims or create marketing narratives about it.

Donations

@odudex
odudex / krux_flash_viewer.py
Created October 2, 2024 14:32
Render images from Krux flash dumps
import os
import tkinter as tk
from tkinter import filedialog
from PIL import Image, ImageTk
def create_image_from_file(filename, start_pos):
def maxv(number_of_bits):
return (2**number_of_bits) - 1
with open(filename, 'rb') as f:
@odudex
odudex / flash_map.py
Created September 30, 2024 15:53
Creates a map of used flash bocks for Krux
import flash
from . import Page, MENU_CONTINUE, DEFAULT_PADDING
from ..themes import theme, GREEN, LIGHT_PINK, PURPLE, BLUE, YELLOW
from ..krux_settings import t
from ..display import FONT_HEIGHT
from ..wdt import wdt
from ..firmware import FLASH_SIZE, SPIFFS_ADDR, FIRMWARE_SLOT_1, FIRMWARE_SLOT_2
FLASH_ROWS = 64
BLOCK_SIZE = 0x1000