Build a DIY Trezor One Hardware Wallet with STM32 Boards

Build a Trezor One DIY Hardware Wallet with STM32 Dev Boards (For Bitcoin, Ethereum, Cryptocurrency)

The Trezor One was the original open-source hardware wallet, launched in 2014. Because it has been open source from the start, it is still one of the best devices for learning how a real Bitcoin and Ethereum hardware wallet works under the hood. In this guide, I walk through three practical ways to build your own Trezor One using common STM32 development boards, OLED displays, buttons, wires, and printed cases.

Watch the video.

This is not a beginner soldering tutorial. It is aimed at people who are comfortable with basic electronics, Linux command-line work, Docker, firmware flashing, and security trade-offs. The goal is to build a cheap, open-source hardware wallet that can run Bitcoin and Ethereum, while also understanding the difference between test builds and production-locked devices.

Build your own hardware wallet

Kits, smartcard hats, cases and parts for SeedSigner, ShieldSigner, Specter DIY and Satochip builds, tested with the firmware shown in these videos and shipped from Canada.

Why Build a DIY Trezor One?

The Trezor One is older now, but it remains a great DIY option for several reasons:

  1. It can be built very cheaply from off-the-shelf parts.
  2. The firmware is open source.
  3. The build process teaches you how STM32-based hardware wallets work.
  4. You can experiment with non-production firmware before locking the device down.
  5. Once locked, it behaves like a retail Trezor One when using compatible hardware and official firmware.

The main lesson here is that a hardware wallet is not just “a chip with keys on it.” It involves bootloaders, signed firmware, display output, button input, USB detection, flash protection, DFU mode, secure startup checks, and user confirmation workflows. Building one yourself makes those parts much easier to understand.

Three Hardware and Software Examples

I break the build into three examples. Each example covers a different hardware layout and a different software approach. You can mix and match these ideas if you want.

Example 1: Solderless Waveshare Build

This is the best starting point. It uses a Waveshare Core405R-style STM32 development board, a larger OLED display, tactile buttons, jumper wires, and no soldering.

It is not small or elegant. In fact, it can look like a chunky bench prototype. But that is exactly why it is useful: if something goes wrong, you can erase the flash, rewire things, rebuild firmware, and try again without damaging anything permanent.

Waveshare board, OLED display, and tactile buttons for the solderless DIY Trezor build
Solderless Waveshare-style hardware layout

For the display, I recommend a 2.4-inch SPI OLED rather than the very small screen shown in some older development-kit documentation. A larger screen makes testing and daily use much easier. For buttons, simple tactile switches work well. You can trim unused legs, straighten the remaining pins, add Dupont connectors, and even put colored caps on them so you know which button is cancel and which is confirm.

The important wiring detail for USB detection is that PA9 needs to be connected to a voltage source. On the Waveshare board in this example, that can be done with jumpers: set power from USB, not an external 5V input, and connect PA9 to VBUS. If PA9 is not tied to a valid voltage line, the firmware may load but your computer will not detect the device as connected.

For DFU flashing, put the board into DFU mode using the switch or jumper arrangement on that specific board. Then you can flash it over USB with STM32CubeProgrammer.

Pin colour table used to keep button and display wiring consistent
Colour-coded pin mapping for the DIY build

I use a consistent wire-colour scheme across all examples so it is easier to follow what connects where. You do not need to copy my exact colours, but you should make your own clear table before wiring anything up. A hardware wallet with swapped buttons or display pins can be confusing to debug, especially when the screen shows an error or the device does not behave as expected.

Build Non-Production Firmware with Docker

For this first example, we build non-production firmware. This is important because non-production firmware does not permanently lock down the STM32 chip in the same way production firmware does. It leaves debugging and programming access available, which is exactly what you want while learning, testing, or experimenting.

The older MCU development-kit documentation may show an outdated build process. I do not use that here. Instead, I follow the modern Docker-based approach from Trezor’s official documentation.

You will need:

  1. A Linux environment, such as Ubuntu in WSL2 on Windows.
  2. Docker or Docker Desktop running in the background.
  3. STM32CubeProgrammer installed for your operating system.
  4. The Trezor firmware repository cloned from GitHub.
Trezor wiki showing the Docker-based build process
Official Docker build documentation

The key difference between test firmware and production firmware is the production setting. For this first build, we use:

export production=0

This tells the build system not to lock the bootloader or disable debugging access immediately after flashing. It is useful for development because you can still erase flash, connect debuggers, and recover from mistakes.

Then build only the legacy Trezor One target. This avoids building firmware for devices you do not need, such as newer Trezor models. You also want to build from a specific release tag rather than just “whatever is latest right now.” In this guide, I use the legacy 1.12.1 release.

After the build completes, you will have separate bootloader and firmware files inside the build output folder. Before flashing, they need to be combined into one file.

The repository includes a helper script called prepare.py. You copy the bootloader and firmware files into the combine folder, rename them as expected by the script, usually bl.bin and fw.bin, then run:

python3 prepare.py
Terminal running prepare.py to merge bootloader and firmware
Combining bootloader and firmware into one flashable file

This creates a combined binary that can be programmed onto the board.

Flash and Test the Non-Production Device

Flashing is done with STM32CubeProgrammer over USB in DFU mode.

  1. Put the board into DFU mode.
  2. Connect it to your computer.
  3. Open STM32CubeProgrammer.
  4. Select USB as the connection interface.
  5. Refresh and connect to the detected device.
  6. Do a full chip erase if you have used the board before or want a clean slate.
  7. Browse to the combined firmware file.
  8. Set the start address correctly, usually 0x08000000 for this type of STM32 flash layout.
  9. Start programming.

After flashing, the display may light up and show something like “hard fault detected” while the board is still in DFU mode. That is normal in this context. Unplug the device, switch it out of DFU/programming mode into normal operation, then plug it back in.

Open Trezor Suite. The device should be detected. You can test the buttons using a workflow that asks you to confirm or cancel. One button should cancel; the other should continue. If both behave correctly, your wiring and firmware are working.

DIY STM32 wallet connected to Trezor Suite
Testing the DIY device in Trezor Suite

This first build is not beautiful, but it is excellent as a learning platform. It lets you understand the full software stack: cloning the repository, building with Docker, combining bootloader and firmware, flashing over DFU, testing in Trezor Suite, and verifying button behaviour. If you mess something up, you can usually erase flash and start again because production locking has not been applied yet.

Compact Soldered Builds on WeAct or DIYMore Boards

The second hardware example is much smaller and more retail-like. It uses compact STM32 boards such as the WeAct Studio STM32 Mini Core Board or similar DIYMore-style boards. These builds require soldering, but they produce a much nicer form factor.

I like these boards for several reasons:

  1. They are small enough to feel close to a real hardware wallet.
  2. Some have USB-C.
  3. Some have a button that helps enter DFU mode without extra jumpers.
  4. Pin numbers on the board can make wiring much easier.
  5. They work well with both small and larger OLED displays, depending on the exact board and power behaviour.

The same basic firmware applies if your board uses compatible pin mappings. However, you still need to confirm that PA9 is connected to a voltage source for USB detection. On some boards this is done automatically; on others it must be wired manually. If PA9 is not tied to 3.3V or 5V as appropriate for the board, your computer may fail to detect the device even though the firmware is running.

For compact soldered builds, I recommend flexible wire rather than stiff breadboard jumper wire. Thin flexible wire bends better inside a case and survives repeated movement much more reliably. Stiff copper wires can snap if bent too many times, which is annoying when you are trying to fit a device into an enclosure.

When flashing these boards, the process is the same: enter DFU mode, connect with STM32CubeProgrammer, erase flash if desired, program the combined firmware, then exit DFU mode and test in Trezor Suite.

Once the hardware works correctly with non-production firmware, you can decide whether to lock it down for real use.

Flashing the Official Trezor Bootloader

If your board uses the same pin layout as a retail-compatible Trezor One build, the simplest way to make it production-safe is to flash the official Trezor bootloader directly from Trezor’s GitHub data repository.

This is not a firmware build. You are downloading an official bootloader binary and programming it onto your board in DFU mode. After that, the device behaves like a retail Trezor One that has just been reset or shipped with only the bootloader installed.

The steps are:

  1. Go to Trezor’s data repository on GitHub.
  2. Find the Trezor One bootloader files.
  3. Download the official bootloader binary you want to use.
  4. Put your DIY board into DFU mode.
  5. Open STM32CubeProgrammer and connect over USB.
  6. Erase flash if desired.
  7. Program the official bootloader file.
  8. Exit DFU mode and plug the device into Trezor Suite.

Trezor Suite should then prompt you to set up the device and install firmware. Because the official bootloader is present, Trezor Suite can install matching production firmware just like it would on a retail device.

This approach avoids building from source entirely. It is also convenient because Trezor’s builds are reproducible, meaning it is possible to verify that the distributed binary matches what was generated from the official repository.

Build Production Firmware From Source

If you prefer to build the production firmware yourself, the process is similar to the non-production build, with a few important changes.

The most important change is:

export production=1

Production firmware locks down the STM32 chip. It disables DFU/debugger access and makes the device behave like a retail Trezor One. Once this is flashed, you should not expect to easily connect programming tools or debuggers afterward.

You also need to build from the exact release tag that matches the official bootloader/firmware release. This matters because production firmware checks the bootloader hash at startup. If the bootloader does not match an expected official release, the firmware will refuse to start.

So the workflow is:

  1. Check out the correct official release tag in your local repository.
  2. Set production=1.
  3. Build the legacy Trezor One target.
  4. Locate the built bootloader file.
  5. Compare its SHA-256 hash against the official bootloader binary.
  6. If they match, you know your build is reproducible and compatible with the expected production firmware.
Comparing official downloaded bootloader with locally built bootloader
Verifying that the built bootloader matches the official release

This hash check is critical. Do not skip it if you are building your own production bootloader. A mismatched or modified bootloader can prevent the firmware from starting, and once production locking is applied, recovery options become much harder.

After flashing production firmware, DFU mode should no longer be available in the normal way. If you try to enter DFU by holding a boot button, bridging pins, or using STM32CubeProgrammer, it may simply boot normally instead. An ST-Link debugger may detect the hardware but fail to connect to the chip.

This protection is useful and should definitely be enabled if you plan to store meaningful funds on a DIY Trezor. That said, it is not the same level of security as a Java Card or dedicated secure element. The STM32 is still a general-purpose microcontroller. Over the years, there have been attacks that trick chips into disabling protection features through power-glitching techniques during startup. So production locking is strong for normal users, but it is not magic.

Example 3: DevEBox / STM32_Mini Build With Built-In Buttons

The third hardware example uses another no-solder option with a better form factor than the first Waveshare build. It uses an STM32 Mini-style board from DevEBox, specifically version V31. Earlier versions may use a different MCU and will not work for Trezor firmware.

This board has built-in buttons that can be reused as the two Trezor input buttons. That makes assembly simpler because you do not need external tactile switches for the main controls. You still attach an OLED display, but with right-angle pin headers or 3D-printed connectors, it can sit neatly in a case without bulky extra buttons.

The software side is where this example gets more interesting: the board uses different GPIO pins for buttons and display control signals than the stock Trezor One layout expects. So we need to modify the legacy firmware source before building.

Modify Firmware for Custom IO Pins

For custom boards, you will edit files inside the legacy Trezor One source tree. The main files involved are:

  1. setup.c
  2. oled.c
  3. buttons.h

These files define how the device initialises GPIO pins, where it expects button inputs to be, and which pins control the OLED display.

For buttons, you need to change the GPIO port and pin numbers in both the header file and the setup code. If you only change one place, the build may compile but the buttons will not behave correctly. They might appear held down all the time, or they may not respond at all.

For the OLED display, you may need to remap control pins such as CS and DC so that the display connects from a single row of header pins instead of using pins scattered across multiple rows. This is especially useful if you want the screen to plug in at 90 degrees with right-angle headers or small printed connectors.

Pinout table open alongside buttons.h, oled.c, and setup.c
Editing firmware source files for custom IO pins

After editing these files, you need to build the modified repository. Because local builds are no longer officially supported in the same way, the practical method is to commit your changes locally and point Docker at that local repository.

This sounds more complicated than it is:

  1. Use git config to set placeholder user information if Git asks for it.
  2. Stage only the files you changed.
  3. Commit them with a simple message such as “Remap IO for STM32_Mini.”
  4. Copy the commit hash.
  5. Run the Docker build command using that local commit and point repository to your local folder, ending with .git/.

Docker will clone your modified local repository into the build environment and compile from there. Once the build finishes, run prepare.py again to combine bootloader and firmware.

Terminal showing local git commit and Docker build for custom IO firmware
Committing local changes and building custom firmware

Then flash the combined file using STM32CubeProgrammer in DFU mode, exit DFU mode, plug the device into Trezor Suite, and test both buttons. One should cancel; the other should confirm. If they work correctly, your custom IO mapping is correct.

Odd USB Behaviour on Some STM32_Mini Boards

One quirk I noticed with the specific STM32_Mini V31 board in this example is unusual USB detection behaviour. On most of my builds, PA9 had to be connected to a voltage rail for the computer to detect the device. On this particular board, it seemed to work without that explicit connection.

However, there was another issue: if you plug the USB connector all the way in too quickly, Windows may fail to identify the device properly. The data pins appear to become available only after the board has powered up and started its firmware. If the computer checks before the data lines are ready, it may assume nothing is connected.

The workaround is simple: insert the USB plug partway until power is applied, wait a moment for the board to start, then push the connector fully in so the data pins connect. After that, Trezor Suite detects the device normally.

This may be specific to my particular board revision or wiring, but it is worth knowing if your DIY build powers on yet refuses to appear reliably in USB devices.

Creating Signed Production Bootloader and Firmware for Custom Boards

If you modify hardware pin mappings, button behaviour, display control pins, or anything else that changes the firmware, you cannot simply use Trezor’s official signed firmware and expect it to work with your modified code. You would need to build your own signed production bootloader and firmware using your own signing keys.

That process is more involved than flashing an official binary. It requires:

  1. Generating a hardware wallet or key that can sign Bitcoin messages for firmware signing.
  2. Putting the appropriate public keys into the bootloader.
  3. Building the bootloader.
  4. Taking the bootloader hash and embedding it into the firmware build.
  5. Rebuilding everything correctly.
  6. Testing with the bootloader QA function before flashing production.

This is beyond what I can fully cover in one article, but the important point is this: if you want a custom board to have signed, production-locked firmware, you need your own signing process and careful verification of every hash. Do not mix official signatures with modified code expecting it to work.

Which Build Should You Start With?

If you are new to DIY hardware wallets, start with the solderless Waveshare-style build using non-production firmware. It is larger and less polished, but it gives you a safe learning environment where mistakes can be recovered by erasing flash and reflashing.

Once you understand:

  1. how Docker builds work,
  2. how bootloader and firmware files combine,
  3. how DFU flashing works,
  4. how PA9 affects USB detection,
  5. how buttons map to cancel/confirm actions,

then move on to compact soldered boards if you want a better form factor. After that, you can decide whether to flash the official bootloader for a retail-like experience or build production firmware from source.

If you want a larger display and simpler assembly with built-in buttons, the DevEBox-style board is attractive, but it requires modifying firmware source files because the IO pins are different. That makes it more advanced, but also a great way to understand how deeply hardware layout affects firmware behaviour.

Final Thoughts

Building your own Trezor One is one of the best ways to understand what a real open-source hardware wallet does before you use it with significant funds. It teaches you bootloaders, signed firmware, USB detection, DFU mode, GPIO configuration, display wiring, button mapping, and production locking.

The most important security lesson is this: test first with non-production firmware. Verify that every button works the way you expect. Confirm that Trezor Suite detects the device correctly. Only then should you flash official or production-locked firmware if you plan to store meaningful assets on the device.

A DIY hardware wallet can be cheap, educational, and genuinely useful when built carefully. But it is also a security-critical device, so do not rush the verification steps. Build it, test it, understand it, and only then trust it with your keys.

Full video transcript

Auto-generated from the video and lightly corrected; timestamps open that moment on YouTube.

Intro 0:00

The Trezor One is the original hardware wallet launching all the way back in 2014. It's also been fully open source from the very beginning. So in this video, I'll just be running through how to make your own Trezor One using readily available off-the-shelf hardware. I'll be looking at a few different hardware configurations, basically one that reproduces the stock unit as well as one that improves it and adds things like a larger display, USB-C connectors, all while still being able to run on the stock firmware. While the Trezor One is certainly an older device now, it is still a great DIY option. It can be made extremely cheaply, and the process of building one will also help you better understand some of the hardware and security features that are running under the hood for pretty much all STM32-based hardware devices, so things like Trezor, KeepKey, Foundation Passport, Cold Cards, and so on. So, let's get into it. And if you haven't already done so, hit subscribe, that way you can stay in the loop for content I make to help you find your way in the crazy and often hostile environment that is cryptocurrency. So I'm going to break this video up into three parts, which will actually cover different options on both the hardware and the software side at each step.

Overview of The Three Hardware/Software Examples 0:54

And you'll actually be able to use all of these different steps interchangeably if you'd like. So firstly, on the hardware side, we'll be looking at the standard Trezor 1 development board that is on the MCU dev GitHub page. That is one that has no soldering required and nothing much has changed there. And for that first example, on the software side, I'll be looking at how to use the modern Docker-based build approach to build non-production firmware. so this won't lock your hardware down at all and allow you to still use it for other projects if you like. So good for experimentation or development. So for the second part on the hardware side I'll be looking at some hardware options that give you a much nicer form factor though there is a little bit of soldering involved and on the software side I'll be running through what you need to do to lock your DIY hardware down so it is safe to use either through building the production firmware or through actually just flashing the official stock Trezor firmware on to your diy device and then finally on the hardware side i'll be looking at another nose solder option something has a bit of a better form factor than the Waveshare development board and on the software side i'll just be running through what you need to do to modify and build the firmware to suit a device that uses different pins for the input and output functions for things like the button and the screen as well as showing you what you need to change if you want to have your own signed firmware releases that you use on this customized board all right so let's get cracking

Example 1 – Hardware Assembly Waveshare Core405R + Waveshare 2.42 Inch OLED (Solderless) 2:13

with the first example so on the hardware front this first one's mostly going to follow the trezor one dev kit here that uses the Waveshare core 405r board though one difference here is we're not actually going to worry about using the st link adapter so we don't need one of those rather than use the little display there which is shown i'm actually going to suggest you use this one here that's also on the Waveshare store which is 2.4 inches in terms of the buttons i'm just going to use some of these and the nice thing about these ones is we can also just cut two of the legs off we don't need we can straighten the legs out that are there and just stick dupont connectors straight onto them and we can also just put colored caps onto the buttons we're not going to worry about the breadboard the usb cable comes with it and in terms of all the wires the screen itself actually comes with some cables with a socket on one end and the dupont connectors on the other and we'll just use four standard bits of wire to connect these buttons in so let's put this together so for the sake of consistency i'll actually be using these colors for all of the wires in these examples that i show you so basically all of the pins here are named so what you'll have to do is work out which pin goes to here and work out where it corresponds on the underside of the board which is where we'll connect everything so i'll just wire that up now okay so we've just connected all of our wires in so let's flip the board over and look at the jumpers so for this board this is probably how it will come from the factory and we just need to change a few things firstly we want to change the power to come from the usb port not an external five volt input basically we can remove these two jumpers up here but we do need to put this jumper here to connect pin pa9 to vbus otherwise our computer won't detect the device when we plug it in and to flash it using DFU mode we're actually going to flick this switch here into the up position so then we can actually connect it and flash it just using a usb port so there we go and basically what we can do now if we like is we can actually connect our buttons and our screen so this is just our hardware assembled on the bench let's move on to the software and this is

Example 1 – Software Build via Docker, Flash with STM32CubeProgrammer 4:17

the place where we are going to depart completely from the mcu dev page because the build process listed here is very out of date so we won't be using that we will instead be following the official documentation and the process on how to build the trezor one firmware that uses docker so for this example i'll just be using the windows subsystem for linux plus docker desktop the The process for installing and setting that up is actually covered in my Building Crux from Source video over here, and it's exactly the same, so I won't go through it again. But the important thing to say is because Docker is gonna be doing all of the heavy lifting, this process will be pretty much the same on any modern Linux platform, Mac OS or Windows through Windows Subsystem for Linux. The other piece of software we are going to use is the STM32Cube Programmer. And basically you can just download that from the STMicroelectronics website for whatever operating system you happen to be on, and just install it with the default, it'll work fine. Okay, so once we have Linux or whatever Linux environment we're using, Docker or Docker Desktop and STM32Cube Programmer installed, we are ready to go. Docker just runs in the background, so we'll just minimize that and we'll use STM32Cube Programmer later. So basically then we just head over to the official Trezor wiki and we are gonna follow a modified version of this process for building with Docker. So first thing we're gonna do is just clone the GitHub repository for the Trezor firmware. So basically I'll just paste that command in there and just hit enter. And that'll just take a minute to download all the firmware. So once that's done, we'll just switch into the GitHub repository we just downloaded. And this is where we're gonna do something different to what is in the documentation here. So the first thing we are gonna do is run this command called export production equals zero. And the reason we're doing that is because the first thing I wanna show you is how to build non-production firmware that won't immediately lock the bootloader and disable all of the debugging priori running ports on your board as soon as you upload it and this is pretty much equivalent to the old export memory underscore protect command that you'll see in older guides like the mcu dev guide and so on so anyway so we will say enter and look while we could just use this command here and build for every model of trezor just to speed things up we'll build only for the trezor one so we'll say models one and we'll also skip core because that's because we're not interested in the Trezor Safe 3, Trezor T or anything like that. And basically then we just need to put in the tag on GitHub that we want to build. So we'll go over to the Trezor One firmware page or we'll go to the releases page, we'll go to tags and we'll find the latest legacy release. In this case, that is legacy 1.12.1. So we'll just copy that and we'll paste that in there. And then we just hit enter. And there we go, the build is complete. And again, just one thing to double check is making sure that this stage, it was building with production equals zero. And if we go into Windows Explorer and go into the Linux section and into the folders for our WSL image, in this instance, I'm using Ubuntu 24.04, go into the home folder, there's the user that I created when I set up the WSL instance, and there is the Trezor firmware folder. So basically now there is a new folder in there called build, and basically this is all of the firmware we just built. So for example, if we go into legacy, we can see that we have the firmware there and the bootloader there. So that is great. But before we can flash this onto our device, we actually need to combine the file from here and here. And basically where they are going to go is we go back up a folder level. If we go back up a few folder levels, we wanna go into the folder called legacy in the Trezor firmware repository, go into bootloader, and there's a folder in there called combine. and we need this script here called prepare.py. And basically we're gonna put the files in this folder here along with prepare.py. We can just manually like copy and paste them and we'll just rename them to be bl.bin and fw.bin because that's what the script is expecting. And now we'll go back here into our terminal. We'll go cd legacy, we'll go cd bootloader, cd combine, combine and if I just type in ls you'll see we're in the folder with all of those files and we'll just type in python3 prepare.py and hit enter and basically it has now combined the bootloader and the firmware into one file and if I just hit refresh in windows explorer you'll see that is the file there and this is what we're going to flash to our hardware so let's do that so now

Example 1 – Flashing Firmware and Testing 8:50

that's built we just come back over here to our board and we're ready to actually plug that in and we should hear it get detected by windows and in STM32Cube program we'll just select USB and I'll just hit refresh there and you'll see it's actually detected this board here so now I'll just say connect and over here on this tab here this is where we erase and program the board and look if you've used this board for other things this is a good spot just to do a full chip erase just to completely wipe the flash on there because occasionally you can have a situation where that will cause problems all right so we've fully wiped that so now what we'll do is we'll just navigate to that combined file we just made and there is the combined file right there so I'll just double click on that that start address is not already populated we'll just set it to match this one here we can leave all these other things as they are and we can just say start programming basically now it's just going to upload it onto this board there we go so that is done and if we've connected to the screen correctly this should light up as soon as that has finished uploading basically but it will say Hard Fault Detected that's normal so we'll just unplug this we'll switch this switch here to take it off DFU mode so off programming mode and just into normal operation mode and over here we'll actually open up trezor suite so basically now when i plug this device in there we go so when i plug that device in it'll sit there show us the firmware checksum and then it starts up and then once we get to this screen it should get detected by trezor suite so there we go so we can say yes set up my trezor and we can test that our buttons work by using the recover wallet workflow we'll just use standard essentially this will ask us to cancel or confirm so if i have these buttons wired up correctly the red one should cancel that workflow yep and if i just do it again the green button should start it which it does so that's great so basically that tells us that everything we have here is correct and works and look I'll just put this in a case we don't short everything out when we're trying to use it there we go first DIY option certainly on the chunky side you could definitely make it a little bit smaller if you tried but you know depending on how you use your Trezor just sitting it on your desk that might be just fine and even with the specific board that I used in the hardware side of this first example isn't something you want, I'll suggest that this is the starting point you should have for all of the DIY treasures that you want to build, because it'll get you familiar with the software stack, how everything builds, and programming your board in such a way that if you mess it up, you can always erase the flash and try again. So with that out of the way, let's look at the second option. So that's some hardware that is a nicer form factor, it'll need some soldering, and some software that locks the device down. So while this first example was like comically large and not running production-safe

Example 2 – Hardware WeAct STM32 Mini Core STM32F405RGT6 & DIYMore STM32F407VGT6 11:34

firmware. The next ones we're going to look at are two different options, basically for one that is quite small, really comparable to a retail Trezor 1, and one that also has a much larger screen, same size as this, but is in a much thinner package. And they'll both be running the same production firmware that is on a retail Trezor. So we'll start off with the little one. So basically the board we're going to be using to put in here is this little Wii Act Studio STM32 core board. When you buy it, this is what you get, and it's actually a great little board in that it is very small. You can see, again, it's about a similar footprint to a retail Trezor one. It's nice and thin and doesn't have a bunch of extra peripherals that we don't need. It also has a nice USB-C connector on there, and the really nice thing about this one is it actually has a button that you can hold down to put it into DFU mode rather than having to use set jumpers, bridge pins, or anything else like that. So this is the board that we'll use. And the final thing that I really love about this board in terms of DIY is that it actually has the pin numbers on both sides of the boards. I've actually got one here that I soldered up earlier. Basically what I've done is use the same color format scheme that we used in the first example in terms of the wires and just put it into the corresponding pins exactly the same as in the first example. And I've actually just soldered two little push buttons in here and they're sharing a common ground pin. So basically we'll just flash that with the firmware that we just built earlier just to make sure that everything is working. So the one very important difference with this board is I've also had to wire pin A9 to a 5 volt line or a 3.31 would work just fine. On the development board one we had earlier this was done using a pin header but if you don't have this connection connecting A9 to a voltage source the firmware will load up but your computer will not detect that the Trezor is connected. And actually I'll just quickly mention so this board here is the same one that is used in the low cost Trezor 1 dev kit. Basically it's this one here. The nice thing about it is it plays nicely with these big displays. Some of the other boards I have don't always reliably turn on when you power them on with these big displays and the other thing is really nice about this one particularly when using it with a big display is that the holes for the screen and the PCB actually line up closely though one important thing to note is I've also hooked up the A9 pin over here on the board because that was actually not mentioned in the low-cost travel guide and I forgot to mention it for this one but for this board here to get into DFU mode basically you need to bridge these two pins up here on the top corner where it says boot one and you need to connect boot zero to a 3.3 volt line and basically when you have it connected like this and you power it up it will go into DFU mode and once you flash it you can remove the wire from the boot zero pin and then move this header can basically connect boot zero to ground in this case moving that header has done that and then I can plug that in and you'll see it powers up and the last thing I'll point out actually in terms of soldering these together is that both of these have been done using these sort of flexible wires. So basically this is just a sort of standard 30 AWG flexible cables that you get off Amazon or AliExpress or whatever. If you try and just use these sort of copper wires that are used for breadboard, you're gonna actually probably have a bad time because this wire actually, if you bend it backwards and forwards too many times, will just snap, nevermind the fact that this takes up a lot of space. So these little flexible wires are the way to go. So to program this with my test firmware that I built before, what I'm gonna do is hold down the B0 button and just plug it in. And we'll put that over here. So just like before we hit refresh and we can see it has detected our board and we'll just say connect. And I actually still have this up from the previous board that I did, all the IO on this one is the same as a retail Trezor. So I'll just erase the flash on here as well, just for good measure. There we go. And I will just program that with my combined firmware from before. And there we go. So we can actually see that has lit up and it's actually gonna say Hard Fault Detected just cause we're still in DFU mode. So we'll just unplug that. We'll bring up Trezor Suite and now we'll plug it back in. And there we go. That is loading up. So it should show up in Trezor Suite in a sec. There we go. And again, we can just test our buttons, same as last time. So one will be cancel and one will be continue. And there we go. So we now have our Trezor running on this little board here. So we've verified that everything is correct on the hardware and the software for this one here.

Example 2 – Software, Downloading Official Bootloader Binary from Trezor 16:47

So if we're happy that we've sold this up and this board is never gonna be anything other than a Trezor, we can move to flash the production firmware onto it. There are two ways that we can get the software to make it production safe. The first and the simplest mode is actually just to download the official Trezor bootloader from their GitHub. So we can head over to Trezor's GitHub page and go to this repository called data. And basically this is the data for various Trezor products. So we can actually click on bootloader. We can say we want a Trezor one bootloader and we can just download the latest version of the bootloader for the Trezor one, just as a file. And we can literally then just connect our little Trezor board holding down boot zero on this one. We will just refresh and connect to it. We'll full chip, we'll raise the flash. There we go. And I'm gonna just browse to the file I downloaded. There's the official bootloader, say open and then just say start programming. And there we go, we can actually see now that flashed almost instantly because the bootloader is tiny and we're now running the official Trezor bootloader. And basically what we can see here on the screen is just like a retail Trezor, it's actually telling us to go to trezor.io slash start, which will direct us to download Trezor Suite. So basically this board is now in the condition that a retail Trezor one comes in, where it's running a bootloader only, but having no firmware. So if I open up Trezor Suite, basically it prompts me to do the device security check. I'm just gonna say, set up my Trezor. And the first step is the firmware installation. So because I'm running the official bootloader, I can just click install firmware and Trezor Suite will install the firmware for me, just like a retail device. And there we go. We're running the official firmware and we can just set this up just like any normal retail Trezor one. And the important thing to say here, if you're really confident that the board you're using is compatible with the stock firmware, so it uses all the same output pins and so on, you can just flash this firmware without having to build anything from source at all.

Example 2 – Building Production firmware from Source 18:54

So that's how I do it official bootloader binary from Trezor and the great thing is that Trezor actually has reproducible builds which means that it's easy to verify that the binary that Trezor are distributing the one we just flashed does match what was generated with the repository. That said if you would prefer to build the bootloader from source the process for that is pretty much the same as what we had in the first step but with a few important changes. So you might recall back at the beginning we were setting production equals zero to make sure we didn't lock down our bootloader in this case we want to actually go back and change export production equals one that will make sure that we have locked down our firmware the second thing we want to do is make sure that our repository on our pc actually matches the repository that was used to build the production firmware so what we're going to do is say git checkout and if we go back to the trezor github page previously we were building from this one here but in this instance we actually want to build off the tag for the bootloader release so we'll just copy that one there and we want to make sure that first we switch our repository to be that and then finally if we go back to the command we had before rather than build from this tag here we want to make sure we're building from this tag here which is the same one that we just checked on the website the only change there is it just changes to bl 12 1.12.1 and then we'll hit enter oh that's interesting so our models one argument is not actually supported for that one so we'll just get rid of that and run it again all right so that build is complete and the bootloader.bin file has put itself in there and if we just compare these two files so the one we just built versus the official one that we downloaded we can see that their sha 256 sums are identical which means that we have correctly built our production bootloader and can flash that onto our hardware and the important thing i'll mention here is that the checksum of your bootloader file must match one of the official releases basically the official firmware for the trezor devices will check some the boot loader part of the firmware itself when it starts up if it doesn't recognize that the hash of the bootloader matches an official release the firmware will refuse to start so if you are planning to build your own production bootloader from scratch just take the time to make sure that this checksum matches the official release that you are expecting and unlike things like the jade or

Notes and Demo of Production Firmware 21:13

the Satochip card that i covered in previous videos uh with the trezors if you are running the stock firmware it will automatically enable all of the security features on the chip lock it down and disable any of the programming ports on that board so basically now if i were to unplug this and hold down boot zero and plug it back in you'll see that it actually still boots into the normal mode of operating so i'll just do that again just to be sure that i didn't mess it up so that's just booting as per normal so DFU mode is no longer available no matter what i do in stm32 cube programmer i can't connect to it and this hasn't just disabled DFU mode even if i connect to it with an st link v2 and try and get online with it i can detect my st link device but i won't be able to connect simply put this chip will not talk to any debugger or programming tool anymore. And it's important to say that while the protection on these chips is very good and generally prevents normal people from being able to access them, that is not the same level of security that you get in something like a Java card or a special secure element or something like that. There's still a general purpose MCU and the things you've read about over the years where people have extracted keys from Trezor devices is precisely, so essentially tricking the chip into turning these protection features off through glitching it when you are powering it up. And again, this isn't to say the protection isn't useful. It is still very useful and you should definitely turn it on if you are planning to store funds on these DIY Trezors. So let's put these in the cases. So there you go. So these are our two devices from Step 2. They're much better than this one, particularly when you look at the thickness of them. They're much better and they're even, with a small one, in the same sort of ballpark as a retail device. So it is a little bit thicker. Still they're both very nice particularly this one with a nice 2.4 inch display. You know this is definitely my preferred way to use a Trezor 1. So for this final example

Example 3 – DevEBox STM32_Mini V31 STM32F405RGT6 (With Integrated Buttons) 23:15

on the hardware side we're going to be looking at another no solder option though this one actually I think has a better form factor, simpler build and lower cost than the one we looked at at the very start but on the software side we're actually going to modify some things to make use of some of the buttons that are built in to the development board for this one. So this is the board that I'll we're using here basically it's called an STM32 mini and it's by the DevEBox I couldn't actually find a schematic for this but the key thing here is this is a version 31 of the board in that there are earlier versions that have a different MCU on there that will not work for Trezor firmware and basically you can see on this one here we actually have four buttons and we can basically make use of these last two very easily to be our two input buttons on the Trezor unlike our previous example we don't want to go flashing production firmware straight onto this right now so the first thing we'll do is rebuild the firmware using just the main github repo and set production off so we'll just say export production zero we'll set github back to the main repository and we'll just leave it there for the moment so basically for this board we're going to modify the software so that it can use these two buttons here because they're really easy and we're also going to change the connectors for the screen in that by default it's going to be using them from both sides of this header pin row so this row and this row whereas what i want to do is actually have something that can come out of a single row which means we can just come out at 90 degrees very easily using one of these sort of 3d printed covers they can just bend at 90 degrees and sit almost flush and we can do the same on the other end and have a 2.4 inch screen that will sit down across the board like that and because most of these 2.4 inch displays don't actually come with the pins soldered on i'll actually be pulling the Waveshare 2.4 inch screen out of this big one earlier and reusing it down here because it already has the pin header on there there we go so that is now hooked on there quite nicely essentially what we can do then is have a case that we're going to use where that is going to sit in there and this screen can actually tuck its wires and stuff in just in there like that and basically the lid will go on top and since we're using the built-in buttons that is all of the hardware assembly we need to do for now so let's look at the software side okay so once we are here we are just going to need to edit some

Example 3 – Modifying & Building Software for Custom IO 25:24

files now you can use whatever text editor you like i'm just going to use pycharm okay so basically we are just going to navigate into legacy because that's where all the trezor one stuff is and we're going to edit a couple of files so we're going to need to edit setup.c we're going to need to edit oled.c we're going to need to edit buttons.h so basically buttons.h tells it which gpio ports that we are using so you'll see here that we are on gpio port c using button gpio 2 for yes and 5 for no and that basically corresponds to this key that i was using earlier now fortunately for us for the yes pin basically we just set that to be gpio 1 so we and we set the no pin to be gpio 13 and we don't actually need to hit save because pycharm does it automatically now if you just stop here and try and run it, it won't actually work. So we also need to go into setup.c and change the port configuration for what our GPIO buttons will be. So we need to change the numbers here as well to be 1 and 13. Otherwise, it won't detect our buttons properly and we'll just think they're held down all the time. So that is the change we make for our buttons. For the screen, it's pretty much the same. We just go into OLED.c and for this particular board, we're going to leave the DC on port B but we're going to change it from PB0 to be PB11 and we'll just change the comment there so that it's correct as well. For the sake of simplicity we'll just leave the CS on port A but we'll change it to port 3 not port 4. So basically once we've made those two little changes all of the pins are in a nice neat row and just like before we need to come over here and change the GPIO as well. So basically we had GPIO 4 on port A that we're going to change from 423. And then for port B, we're going to change GPIO 0 to GPIO 11. And there we go. So we've made the change in all of the files that we need. Now, what we have to do next is a little bit counterintuitive and is basically necessary because of the way that Docker does a build. So essentially, we are going to commit some changes to a local GitHub repository just on our computer. And then we're going to point the Docker build back to that. It sounds a bit messy, but it's actually quite straightforward and it's really the best way to do it now that local builds are no longer officially supported by Trezor. So basically what we're going to do here is if we just type in say git commit you'll see it will ask us for some information about who we are so we can actually look and we can just put in placeholder information like we don't need to put in any sort of real information because we're not pushing this to a real github repository so we can just copy and paste the examples. And now if I type in git commit, it will show me the files that I just modified. So what I'm gonna do now is say git add, and then just add those three files. Just copy and paste. And if you've gone modifying other files and things, just leave them alone. We only are worried about these three. And so what we're gonna do now is we're gonna say git commit and we can type in any description at all. Cause again, this is just for our PC. And so here I will just type in remap IO for SEM32 mini. You could write anything. Then I'll hit control X and I'll say save, yes, hit enter. And we can see now it's done that. All right, so that has basically just pushed the changes to the local repository that we have on here. And that's all we need to do. So now, just cause I'm feeling paranoid and don't wanna accidentally lock my board, I'll just export production zero again. And what we're gonna do is we're gonna use a modified version of the command we ran before. So we're still gonna say build docker.sh. We're gonna skip core, so we don't need that. So rather than just build a release like we were before, we're actually gonna use this hash here for the thing that we just committed to our local system. So I've just copied this from there and pasted it there. That's gonna include the changes we just made. Now I put space, and now I need to point docker back to this local folder with our repository in there. So essentially what I'll say is repository, actually I'll just cancel that. Actually I'll just type in pwd and that'll show the working folder just in case you've done this somewhere else on your system other than your home directory. So if I just bring this command back and hit space, I'm basically gonna copy this and paste it there and just add dot git and then a slash at the end and hit enter. And basically what it's gonna do now is it is going to, so it's going to create a new environment and you'll see it's actually cloning from here. You can see it's actually cloned the modified repository that we just made from our local PC into the Docker instance and then it's going to build the code we want from there. Okay, and that is done. So basically now we can just do the same sort of process that we did before. Where is it? Python three, oh, prepare, prepare.py And there we go. So now if I refresh that folder, we have our combined firmware that we have just built. So flashing that is the same as all the other ones we've done before. So we'll just bring STM32Cube Programmer back up. I've got my board here and I've shorted the boot zero pin to 3.3 volts. That'll get this into DFU mode when we power it up. So let's just do that. So over here in STM32Cube program, also USB. Yep, there we go, it's found it, connect. Go into download, and we'll just full chip arrays just for good measure. There we go. And I'll just hit browse, and just make sure we're actually downloading the right thing, and that is not. So let's just go back to Trezor firmware. We'll go into legacy, bootloader, combine, and that combine.bin is the one we want, So the most recent timestamp, I just built it. So let's put that one on and say, start programming. Here we go, download complete. Oh, there we go. And you can see that's lit up straight away, which tells us that we've not only connected this correctly, but the software changes we made worked. Hard fault detected, that's normal. So look, I'll just unplug this and I'll just take it out of DFU mode and we'll get Trezor suite back up. Okay, so that has worked. So I'll say, yes, set up my Trezor and we'll just check the buttons are the right way around. I expect this button to be left and this one to be right, so I'll say cancel. Yep, that worked. And standard recovery, and that confirms. Yep, so that does what we want. Great, so this is working on the hardware front, so we'll just put it in our little case here, just so I don't accidentally short it out on everything else on my desk, and there we go.

Note on Odd USB Behavior on the STM32_Mini V31 32:52

Now, if you're paying very close attention, you would have just noticed that I didn't actually have to wire the A9 GPIO pin to a voltage rail to have this board be detected at all, which is unusual because for all the others, I had to do that or set a jumper. And the other thing that's a bit peculiar about this board is I noticed that even when I connected it to the computer with no firmware on there running, Windows actually attempted to identify it as a USB device and then failed to connect. Basically, the issue here is the data pins on this USB port are wired funny. So essentially what happens is if the device isn't ready to answer the computer straight away, the computer will just assume there's nothing there so we actually need to plug in the port until it powers up but the way these pins are wired the data pins aren't actually connected yet so once it's finished this startup here if i plug that the rest of the way in it will actually get detected by trezor suite no problem at all whereas if i just unplug it and plug it straight in straight away basically it will never get detected and we'll see it in device manager in windows as being incorrectly detected so a bit of a weird quibble and the only thing i'm not clear about is whether this is an issue with the specific board i have or whether it's an issue that all of these boards have and so yeah in terms of the size you know it is bigger than the previous one that i made both in terms of its size the length is about the same and it is a little bit thicker though not hugely so definitely much smaller than this monstrosity but you know this i think the size is certainly made up for by having a larger display and if you are interested in doing this one on an extreme budget you can also do it with a much smaller screen like this one here and basically have it work like that but again personally i'm not a huge fan of these tiny displays if you can have a big device might as well a big screen for an extra few bucks

Notes on creating your own Signed Production Bootloader and Firmware 34:35

and the last thing i'll mention is that this process that i've just showed you for being able to build a customized version of the repository is the same process you will need to follow if you want to build your own firmware that has all of the protections of the production firmware but that is signed by your signing keys not the official signing keys from trezor and basically if you try to modify the hardware in any way change the io or anything else like that and still want the benefits of signed firmware you will need to sign that yourself and basically that process is quite involved i'll actually put instructions for that on my github but essentially you'll have to go through generate a hardware wallet that will sign bitcoin messages to sign the firmware you'll have to put the public keys for that into the bootloader you'll have to basically build the bootloader take the hash from the bootloader put it into the firmware and then build it all again and then finally you know make sure once you've got it working with the build loader qa function you'll need to then flash that onto your device and give it a go with production so again it's certainly a bit beyond the scope i think of what i can usefully share in this video, but I'll include all of that on my GitHub repo for Trezor DIY. So there you go.

Conclusion 35:48

I really enjoyed the deep dive into doing this DIY stuff for the Trezor One, and I think it's fantastic, again, just to be able to build the device that pretty much started it all in terms of hardware wallets and has been committed to open source every step of the way. In terms of assembly and complexity, you know, it may seem a bit daunting, but really, it's actually not that bad in terms of getting your head around it, putting it together, and having a great functioning and secure device that gives you all of the benefits of a stock retail Trezor. Fantastic option. I've got a lot more information about different screens, development boards, compatibility issues you might run into along the way, and so on. And more stuff that I could realistically cover in this video is already very long. So I'll be putting all of that stuff in a GitHub repository for Trezor DIY. So if you're looking for information about which hardware to buy, including hardware options that I didn't cover in this video, my suggestion would be that you just head over to that GitHub and check it out. Otherwise, if you have any questions or if you've had experiences building your own Trezor, either from scratch or using development boards, you know, definitely let me know. I'd love to hear about it. Leave a reply in the comments. I do my best to answer everyone. Other than that, stay safe. Thanks for watching. I hope that was helpful. Hit like if you think that other people would find this video useful and hit subscribe if you'd like to be kept in the loop about future content I make that helps people stay safe in the crypto space and to recover if they get into trouble. If you have any questions about this video or a topic that you'd like me to cover just leave a reply

Related guides

Build your own hardware wallet

Kits, smartcard hats, cases and parts for SeedSigner, ShieldSigner, Specter DIY and Satochip builds, tested with the firmware shown in these videos and shipped from Canada.

Found this useful?

These guides are free and ad-free. You can support them by sharing them, subscribing on YouTube, or sending a tip.

Stuck on this?

Book a one-hour session and I’ll walk you through it, or ask about a trusted recovery.

Recovery guides

More guides