NODE ONLINE
EP 105
slp@node:/transmissions$ open --transmission SLP105
TRANSMISSION_DETAIL

TRANSMISSION SLP105

DIY Bitcoin Hardware Wallet and Multi Signature

with Justin Moon & Stepan Snigirev

DATE 3 September 2019
DURATION 01:06:05
GUEST Justin Moon

Justin Moon (BUIDL Bootcamp) and Stepan Snigirev (CTO Crypto Advance) rejoin me in this episode to talk about creating your own Bitcoin Hardware Wallet, and setting up Multi Signature with it. Justin and Stepan have been working on their respective projects relating to DIY Hardware Wallets, and multi signature. We talk about: • Why you would make your own HW Wallet • How much skill it takes and what the cost is • The security of such a set up • Compatibility with Bitcoin Core and standards • How to build trust in the software • How you can learn more and get involved DIY bitcoin hardware website: https://diybitcoinhardware.com

listener@future:/transcript$ decode --transmission SLP105
TRANSCRIPT_BUFFER DECODED

Hi, you're listening to the Stefan Livera podcast focused on Bitcoin and Austrian economics. Today, with episode one hundred and five, we're carrying on with the hardware wallet series. But first, let me introduce the sponsors of the podcast. Firstly, Kraken. Over my years in Bitcoin, I've been really impressed with the way Kraken operate, both for their incredible focus on security and also- Also for consistently acting ethically in the space under Jesse Powell's leadership, they're one of the longest standing Bitcoin exchanges, they're consistently rated the best, they offer some of the best liquidity available in the industry, and if you're a trader, you know that's what you need. They've got high trading volume, low fees, Kraken also offer twenty four seven support, and on the institutional and business solutions side, they're providing best in class accounting, reconciliation, reporting services for cryptocurrency hedge funds, asset managers, and fund administrators. Kraken also have an OTC desk For those higher touch, large block trades, Kraken offer five fiat currencies and also offer margin and futures trading. So to learn more and sign up, go to the Kraken link in the show notes. Next up, Unchained Capital. If you're looking for a product that allows you to easily set up a two of three keys multi-signature vault, these are the guys to look for. They, they can use Trezor or Ledger wallets. It's in a web wallet. It doesn't require a great deal of technical skill to set it up, but remember, you still may Maintain control with your two keys, helping you distribute that risk, and you can keep the keys stored in different locations. And so on the other side of that is you can also choose to enter into a Bitcoin collateralized loan, meaning you can get USD liquidity without selling your Bitcoins, meaning you don't trigger a capital gains event. So that might be more tax efficient for you. And while that loan is outstanding, that Bitcoin is then stored in a dedicated multi-signature address under what's called collaborative custody with Unchained. So Unchained would hold one of the keys, you would hold a second key, and Unchained's independent third party key agent would hold the third key. So to learn more and sign up, go to the Unchained Capital link in the show notes. Alright, so we are carrying on with the hardware wallet series. So basically, this is the final episode. My guests are actually both repeat guests. They are Justin Moon, he appeared on SLP thirty-six. He's a developer and Bitcoin educator. He's the guy running Bitl Bootcamp, Moon University, and also the upcoming Hodl Bootcamp. Stepan Snigirev, he is the CTO of Crypto Advance. He appeared on SLP eighty four when we were talking about quantum computing, and we were also talking about his work with Crypto Advance, working on new hardware wallets. These guys are both working on some really interesting stuff in terms of DIY hardware wallets and multi-signature, so I had to get them on to talk about it. So here is the interview. Stepan and Justin, welcome back to the show. Thanks.

Hey, how's it going?

Yeah, so look, I've, I've obviously had both you guys on the show in the past, so I think we don't need to do the intro stuff, but I hear you guys have a really cool story of how you two met. Do you wanna go into that? Justin, do you wanna start?

Yeah, let me, let me do that. So I, I, I got into Bitcoin a little over a year ago, and I dove in really hard, and I took

I went to a conference in Lisbon called Breaking Bitcoin, and I did the hackathon there. And, so it's like, you know, early in the morning, getting ready for the hackathon, and, there's all these people sitting around, and we're all programmers, so we're all introverted, sort of sitting, minding ourselves, and I just started walking around and meeting people, like, "What are you gonna work on?" And, you know, people were making a website or just kind of boring things, and then I walk up to this, Russian guy

And he's like, "I'm gonna build the first Lightning hardware wallet." And so I'm like, "Ooh, I'm, I'm working with you." and that's how we met. so we ended up actually building a Lightning hardware wallet. It's more like a Lightning button. Stefan, do you wanna describe what we-- He was the real mastermind of it, so do you wanna describe what we did?

Hi. Yeah. So also from, from my side, so, Breaking Bitcoin was also my first, Bitcoin conference.

And I spent like half a year writing my own Bitcoin library and going to Jimmy class and so on, and, this, conference wa- was, like, I was entering this completely different world at that moment. So I had to be prepared. So I decided, what can I do? What will I enjoy doing during this hackathon? And I put all my toys into the box, like NFC chips, GPS chips, and all the other stuff that I had. and I was just thinking, okay on my way there, I will figure out what exactly I want to build, but I definitely want to build some crazy Bitcoin hardware. And, probably a couple days before the conference, there was an announcement from the C-Lightning, team that they, have a very interesting modular structure such that they have a completely separate daemon that is, responsible for signing. And I thought, okay, what if we just replace this daemon with the hardware, then we will have- Have a Lightning hardware wallet, and it will be definitely something fun to do, and even if we will fail miserably, at least we will enjoy the time there. Yeah. So I was, si-sitting there and, kind of gathering people around me, and we ended up with the largest team in the hackathon, actually. it was really crazy two days, I think. It was two days in a row, like, fourteen people or so working on that. it was a lot of fun. yeah. But eventually at the end it wasn't even close to what we wanted, but it behaved very similarly to what it should do. So, eventually we got the first prize, even though we cheated a bit with the functionality of the thing.

No, that sounds great. I think, it was one of those things that then spurred on a lot of other ideas and collaboration.

One, one of the other interesting things there is that a bunch of the people from the team ended up going and working at hardware wallet companies, Shift Crypto in particular, the makers of BitBox. and I've been, you know, teaching people about, like, to, to make hardware wallets in my class, Taproot now has a company. So, I don't know, it was like a, it was, it was one of those really interesting experiences where, a bunch of peo- like some people come together and a lot happens in two days, and,

and we still are connected. Yeah, exactly. And I,

I think part of it is that the, that this topic, like Bitcoin hardware wallets, is just so interesting. Like hobbyist Bitcoin

and, you know, put the puzzle together is, is really, really interesting, and you, you learn a ton about how Bitcoin works and, how security works and, just different considerations. And how hardware works. Yeah, how hardware, how, how hardware works, how computers work, 'cause you, you know, you're just dealing with this little simple machine. And, and so that's sort of the, the genesis of why we wanted to jump on the show is like to share a little bit of that enthusiasm and hopefully get a bit of Hardware nodes, right? We have, you know, the Raspberry Bolt, Raspberry Blitz, a lot of these open, node, projects, which is great. I think it would be cool if we could have sort of at the same time some open hardware projects where you just get off-the-shelf pieces and construct them into a usable hardware wallet. So that's kind of the, the thesis here, that's what we're trying to kind of communicate.

Yeah, and by the way, it doesn't have to be on-only hardware wallets, it can be any kind of hardware Working a lot on this, point of sale terminals, for Lightning with this, small things and also there were projects like, candy machines and, yeah, electric scooters and things. So just, would be nice to put all this together and kinda get more and more people, experimenting with, hardware and Bitcoin.

Yeah, right. And I think as you mentioned the, the Lightning hardware at Bitcoin 2019 I think that was the one with, OpenNode, we're doing the hookup for that, and Ben, I think, helped with that, and then people could just pay with one sat and then play the little arcade game. So that was a pretty cool demonstration of real-world lightning here you go, and it was on these, these little pieces of hardware that Ben was making. So that was pretty cool. so look, I guess for the listeners who are thinking, "Oh, hang on, how do I like rolling my own hardware wallet? Why, why would I look into this? Like

Well, doesn't, have to be, cheaper? Like, it can be cheaper actually. So for example, one of the project that Ben is working, with us at the moment is like five bucks, hardware wallet. so none of the, of the shelf hardware wallets can cost five, five dollars. I don't know, even OpenDime is probably more expensive. and, also another thing is that, yeah, do it yourself hardware wallet Never be as secure as the off-the-shelf hardware wallets from Trezor, Ledger, and others, because, obviously it's do-it-yourself and you, are probably not, better than a huge security team of the large company. but if you add it into your multi-signature setup, the multi-signature is, additive, so, every new unit increases the security, it doesn't make the security worse. So even if you add the do-it-yourself thing, you- To actually improve it by, introducing a completely different security model into the system. So, it is like, very weird setup, with off-the-shelf components that, aren't, a target of the supply chain attacks, for example, and, if, even if someone will see this hardware wallet, they will probably not guess that it is a hardware wallet. It will be just a weird-looking box. Yeah. So, some security- Security, yeah, you can get some security from it.

And you can also get some pretty good air gaps, like, one of the big problems with current wallets is that almost everything uses the, you know, micro USB wire, and that's sort of, complicated and a lot of attacks are possible there. And so now we have like some, you know, cold card uses micro SD card, which is, better, but it's, you know, quite feasible to make a QR-based. Like Stepan and I have both made QR- QR code based airgapped like hardware wallets. And as far as I know, you can't really buy one of those right now, and so, so you can get some better features, like airgapping wise that you can't buy yet, which is, I think, really interesting.

Yeah, right. And on that topic of QR code, let's talk a little bit about that because as I understand from speaking with some of the, the hardware wallet manufacturers, one of the concerns shared was that it's difficult to- Transmit enough information inside a QR code because the difficulty is about how much you can encode into one QR. What, what are your views on that?

Well, basically we can use, QR codes in two directions. First one is we show the QR code with, let's say, unsigned transaction on the screen of the computer, and then it can be pretty large actually, because the computer screen is pretty large, and, in principle you can put a few, kilobytes, into the QR code. so it's, normally when we were experimenting with this, a standard transaction of, couple inputs and couple outputs, fits in a single, QR code, it's fine. if you are dealing with a larger, transactions or, or if you are using a crazy multi-signature setup where there are twenty cosigners, for example, then you may need to split it into, two or three QR codes, but, still it's like not twenty, it's just eight View, and in most cases it's just one. and, if you are using a cheapish camera that can't really scan this kind of, QR code, then yeah, the usability is pretty bad. But, there are pretty cheap industrial QR code scanners, so like, very similar to what you use in the mall, what you see in the malls, and they can scan, well, very large QR codes of a few kilobytes at least, so they can easily scan the, The QR code with the PSBT. And on the other side, when you're sending back signatures, you can, really get rid of all other data but the signature. So you basically need to, display only a few signatures, and then the QR code is pretty small. And, well, it depends on the screen, but I think that a few inch screen, can handle QR code like this. and, the phone camera can scan it. So, Justin, you worked with a smaller screen, right? So I'm That is four inches. Yeah, so,

so I, I've, I've been working on this little project called BitBoy, by the time the episode drops, I'll have tweeted out a bunch of stuff about it, but, so it's a little hardware wallet made on an M5 Stack, which is a really cute little, like forty dollar computer with a nice screen, a case, and three buttons. and there's some nice attachments you can get. So this att- the att- attachment I'm using is like a QW

Boy, and it also has a QR code scanner, bolted onto it in sort of a Frankenstein manner. so this screen has, is 320 pixels by like 240, I think. so it's like about an inch and a half across. And on this screen, I'm able to display a QR code of a sig- a single signature. So when I, display, when I finish signing, it just displays one QR code for every input that was signed. And this is sufficient, you have to sort of have a It's kind of small, but it does actually work, and this is like, very, you know, with a, with a bigger screen, it would obviously get a lot, get a lot better. And most, you know, most, transactions that everyone use is just, you know, one or just a couple signatures, so I don't think it's, it's too bad. The one tricky thing is that you do need sort of a s-more powerful microcontroller, to drive the screen to,

to be able to, to, The implementation isn't perfect, but you want, you want the QR code to show up quickly.

Yeah, because you're also using a MicroPython that is a little bit slower, yeah. so and, our Dojosef hardware wallet, uses the screen that is, four point something, inches, so was exactly the same as was used in first, iPhones. and there actually the QR code with, several inputs, can fit, fit perfectly because it is like, four hundred eighty By eight hundred pixels, resolution, so, large QR codes, can fit there. and scanning again is very efficient and easy because, if you, if you use an industrial, QR code scanner chip, so it, is a little bit more expensive than the cheapest camera, so like if you get a cheap camera, it is, a few bucks, and this QR code scanners, Well, can cost about forty, so probably, this is also a reason why we don't really see QR code, hardware wallets because it is somehow expensive. but, yeah, this scanners works really well, and another nice thing is that, it, they have a separate chip that, processes the images, and therefore you don't put all this code of, image recognition into your main code that is storing the secrets. So like you have We have a physical separation beca- be-between the parsing of the images and the user data and the main microcontroller that is controlling, security critical, peripherals like display and, the private keys.

Great. And so I guess while we're on this topic, let's talk a little bit around what parts would be needed, for the, let's say the user wants to do, you know, roll your own hardware wallet. So we mentioned here the QR reader, we mentioned the M5 or, or something similar. What other parts are needed? How difficult are they to get?

so for our hardware wallet, we are using a developer board from STMicroelectronics. So it's just a single developer board that you can buy from any electronics store, like Mouse or DigiKey or anything else, and it already includes, this screen, and the microcontroller. And then on top of that, you only need To add the QR code scanner and maybe an adapter, such that you can just plug them together without any soldering. So ideally, in principle, you can, just buy three parts, when they arrive, you just unpack them and put them together like a Lego style, and then, you just connect it to the computer to, upload the firmware there. And, in case of this board, the firmware upload works, as simple as just drag and drop of the file into the USB drive. Yeah. with the M5 stack, is it, it is a little bit different, so there, Justin, maybe you can say what you need for a BitBoy.

Yeah, so BitBoy is more like, like there's sort of a difference between-- I wanna make a distinction between some of the stuff Stepan is working on, it's, it's more like, a little-- it's, it's, it's more, it's like a real Bitcoin hardware wallet, mine's sort of like for the lulls, sort of. It's, it's But it's, the M5 Stack platform is really nice because they have all these amazing peripherals and stuff. So the, the M-- the actual, the, the main piece is like forty dollars. And, and by the way, you can go to diybitcoinhardware dot com, that's a little website we've set up for this to see all the little instruction lists, demos, everything we're gonna talk about, and also like a history of hardware wallets. We were just looking a little earlier on GitHub at the first ever hardware wallet, it was created like seven, eight years ago. Since then. So we're gonna have s-that stuff up on DIYBitcoinHardware dot com, I'm sure it'll be in the show notes. So the, M5 Stack's like forty bucks, the peripherals like another thirty, and then the QR code scanner's like twenty five. So for about the price of a, cold card, you know, it's about, it's little less than a cold card, but of course, it has a WiFi chip, so it's not-- this isn't ideal for like real use, but it's like a really fun thing to learn with, Jump in and, and learn quite a bit, whereas Stepan's is like a real thing that he's building a company around.

One call out, and you, you guys mentioned this earlier, is that this potentially does dramatically reduce your risk against a supply chain attack because theoretically it's It's like general purpose computing device, it's not as likely that somebody is going to try and insert some vulnerability or exploit, before it re- before it arrives at your door, right?

Yeah, mostly because, well, if you see, if you are, I don't know, a guy who is delivering DHL packages and you see a bag that is labeled as treasure and letter, you know that probably this device will be used to store bitcoins, so you have a large intent Incentive and you have every like, high probability of a successful, supply chain attack in this scenario. if you're delivering some random maker's stuff, you don't know if it will be a hardware wallet or maybe it will be just a, meteor station that will show the weather outside of the window. so like the probability that this hardware will be used for, Bitcoin is, way lower, yeah. So this way, supply chain attack is, well, much less probable.

One really cool thing about this hobbyist hardware wallet idea is that it would be feasible with some degree of, a little bit of technical sophistication, but not that much, and maybe, you know, in the next six months, not right now, it's still a little bit of a work in progress, but you get to a point where somebody could like set up a multi-sig Wallet with like a couple different, you know, building blocks that will, hopefully, we'll be able to, create, and nobody in the world would know this person owns Bitcoin, which is amazing. They just buy it off the shelf, and, you know, download the software over Tor, stuff like that, and, and they wouldn't leak the fact that they have any interest in Bitcoin to like really anybody. And that's sort of tough if you have to buy hardware, or, you know, hardware wallet from a, a manufacturer or a f- You know, maybe you could get someone else to buy it for you, but I think it's just like a cool sort of push-the-edge cypherpunk idea that, that you could do this and, and, and nobody would even know that you're even interested in the, the whole topic. And, on a kind of related note, is like, you know, if, if you ever got into a situation where, you know, Bitcoin became a huge target, like say there was a, a horrible terrorist attack or something, and Bitcoin became a political target, and, you know It's sort of like the blockstream satellite, right? it, like, hopefully we never need that, but it'd be great if we sort of have, sort of a, some of these devices in, in the background, so like in case something goes really wrong and we can't depend on hardware wallet companies, not for their own fault, but for some, you know, just for political reasons or something, it'd be really, really good if we had the ability to construct hardware wallets as a, you know, people could go and construct one, We're using just off-the-shelf stuff. So that's the, those are, it's, it's not exactly supply chain, but it is kind of supply chain, 'cause the risk of supply chain isn't just that it gets hacked and you lose your funds, it's like, what if the whole thing goes down? You know? Like, you know, there, there is a chance that something like that would happen, just like there's a chance that Bitcoin network, activity would get censored, at which point the satellite becomes really useful.

Right, yeah, so I would summarize that then as helping build resilience in Bitcoin's hardware network, let's say, if you will. and so while that said, I think the listener at this point, they might be thinking, "Well, hang on, most of the typical hardware wallets, they've got a secure element. Would this DIY wallet I make, would that just be more easily hackable? Is the idea that I would use multi-signature and have tamper-evident stickers so I know if it's been tampered with?" What's the consideration there?

Okay, so, there are a few secure elements that you can, buy and use, off the shelf, like, the one that, Coldcard is using and also others from Microchip. otherwise, yeah, in principle, the security of your do-it-yourself thing will be, lower. but, for example, in our hardware wallet, it's, the do-it-yourself, version that We are releasing soon, we just don't store the private key ever. So you just, every time you boot the device, you need to enter your recovery phrase. and then even if someone will get your hardware wallet, they can't really extract your private key because it's, it's never there. So it's, it's used only, when you use it, you enter it, you sign the transaction, and then it, deletes the private key. so like every time you can even- You can, use something like a disposable hardware wallet. So like you buy off-the-shelf components, you program it, you use it for a single signature, and then you crash it with a hammer or, burn it into the micro-in-the-micro wave, and then you know that every time you have a clean hardware and, like no one will ever get your private key.

let me jump in right there, that sort of gets to this like broader question of like, what is a hardware wallet anyways? Like when I first encountered a hardware wallet I'm like, okay, this is the thing I huddle, right? I get this, and I just protect it, right? but that's really not-- I think that's how a lot of people approach them, but that's really not the way you, you should probably, or usually use them, 'cause, hardware wallet firmware can get out of date, the device can fail, like, that's not a very, like physically not a very resilient piece of, of, device, right? You really want, your You know, many copies of it or in some sort of more, resilient, like a, in, in crypto steel or something, just so it can, you, you know, a fire doesn't take you out, you know, just like hodling one hardware wallet isn't a, a great, way to do it. And so like one of the, the hard, these sort of obvious things we're working on right now, that's how BitBoy works right now, is like, yeah, you, it's really great if it's more like a UI for your seed Signature. Like that's really what you want. You want to be able to turn your seed, your private key into addresses and signatures, with, while, exposing it, as little as possible to the, env- the environment around it. And so that's, that's kind of like, you know, the question, you know, other hardware wallets sort of generate the seed. You know, they, they use, they, they, they look for some source of randomness on the vi-device and generate the seed. And I don't think hobbyist hardware wallets will probably be the best at that, but I think one thing they will be really good at, given that they have like big screens and nice keyboards, is, facilitating like, sort of like provable generation of, s-nomynics and seeds from dice rolls, just like Coldcard does. And I think that's maybe, you know, if, if you just get some good casino dice, I think that's a really good way to get your randomness. you don't have to trust in all

You can just sort of throw it out and just roll your dice and enter them in. And so, you know, there, there you can get generation and, interaction with your seed, it's just not very good at storing it long term, but hey, you know, you could use, you just maybe, just store the seed in, steel form and, just, you know, introduce the hardware wallet when you wanna interact with it five years later.

also, side note, so first of all, i-ideally you want to add several sources of entropy, so you can, add, your dice rolls, plus you add environmental noise, for example, from the antenna or now input, and you also can add the true random number generator that is built in in most of the, of the chips nowadays, and then you, add all of them together, and, whenever you add random stuff to anything It becomes actually random, so even if one of them is random enough, then you are safe. and another nice thing about this Hobbit approach is that you can also make your own custom, tamper-proof, features. For example, you can program your hardware wallet such that if someone is moving it, and then, the hardware wallet wakes up and asks, for the PIN or whatever, and if, the guy doesn't enter the PIN in ten seconds, then Then it erases all the secrets, for example. or maybe, something else like an always-erotic and, really, sci-fi, anti-tempor, measures, like someone crossing the waist and, again, all the secrets are get erased. So, with this approach, you can experiment and go crazy, actually.

Great. And with the, the skill required to assemble these- Devices, you mentioned earlier that it's kind of like Lego style assembly, no soldering required, and also the powering of it as well. I, is it, is it presumably that you would do something like the cold card where you get a power bank and you plug it with a micro USB to charge or to power these devices?

So M5 Stack, as far as I know, has a built-in battery that lasts not for long, like for half an hour or so, but, basically there you have a battery that you can charge If you want. for our thing, you don't have a battery like built in, but you can just buy a battery like two thousand milliamp hours, or so and, plug it in. So, depends on your skills. So if you want to stay like really lego style without any soldering, then it might be a little bit tricky adding a, an external battery. But if you are okay with soldering, then, couple of- hours of work and then you have a full, phone form-factor hardware wallet that has both a QR, QR code scanner, the, battery and the charger, that, like the USB port that is only used for charging, it doesn't even have any data lines, so something like this. M5Tech is even easier, it is really built, like, already has a casing and, really easy to plug in.

I think in terms of the skills required, it's still like, it's, it's still a lot of, like, this is for tinkers, and if you don't want to tinker, like, stay away for like another six months. like, but if you like tinkering, which I think a lot of people in Bitcoin do, and a lot of, you know, a lot of people's interest drives them deeper, if, if that's sort of you and you wanna tinker around, then, then it is fun, and you'll have to Maybe you'll edit a little Python code or something, so it, it does take, like right now it is a little more hands on, but I think we're, we're, like hopefully we can get to the point where it's, it's basically as simple as updating your firmware on your Trezor or something, you know, you just plug, plug a couple things together, plug it in, run a command and, you know, click a button and get your firmware update, hopefully we can get to that point over the next six months, that's sort Yeah, sharing our progress a little prematurely, but, but hopefully, like, and part of the reason is we'd like to get some more, people to both test out and contribute to these devices, 'cause we've had like a blast playing around with them in the last year. So, so yeah, it's, it's still, it's still kind of difficult now if you're not a tinkerer, but I think in six months it could get a lot more eas- a lot easier.

Great. And, well, you mentioned earlier the just the firmware as well What sort of firmware will these devices have? What language would they be written in? And then what's the idea to keep them updated? So, you know, Bch thirty-two addresses, Schnorr, Taproot, all of that.

so I, I'm currently focusing more on C and C++, and embedded frameworks, so, Arduino, embedded, and, C style, so it is a little bit low level, language. but we are slowly moving towards, MicroPython and embedded Rust, and, yeah, we are With Justin on the, MicroPython, Bitcoin library. So, I wrote all the low-level C code, that is, basically providing some, efficient primitives for, elliptic curve, math and hashing. and he wrote, all the Python part for hardware wallet. So, it is way easier to program in MicroPython, I would say. but, unfortunately at the moment And sometimes you need to go deeper to the sea level, so sometimes you al-well, you always, find some problems where you-- that you can't solve with, MicroPython and you need to go, a little bit deeper. So in that sense, it's really great that we work together with Justin because, we can kind of, collaborate on both sides and, really make a big progress. So, the last, thing that we did like one month ago, right? Yeah. That's, that's my question for you. Yeah, and, you, you wrote really like everything so, from the, all the functionality that they had in C and C++, you wrote within this one month. That's crazy.

Yeah, so I think part of the goal here is like, it, it takes a lot of plumbing to get something that works at all. Like, you're just like plumbing and it's boring and you're like really low level trying to get C code to work, in, in, in, like under- But once that all works and you can sort of access the C cryptography or, like display driver code, all the low level stuff that's gotta be fast, and you can, you can just, you can start to just write normal Python code, which is like the most accessible programming language, and just pull in all this stuff that me and Stepan spent like a year building, or, you know, like in various forms, like we've been kind of working on it for a long time. And so, like, that's the idea is, I think, building on Top of this is gonna get really easy now that we've sort of put this, a lot of this, stuff underneath, all, all these sort of libraries. And an, another thing that-

Yeah. So like to prepare a toolbox, that people can use that a bunch of useful libraries, like for QR code display, for, addresses encoding and other things.

Yeah. So that, that's sort of the idea is like long term, I think it would be really good to have, you know, a couple of these firmwares in, in different

Implementation and not in the others. So in like a multi-sig, it's really nice if you, you can have stuff written in different languages. and so like C, C, C++ is one, MicroPython is another, Embedded Rust is a third. and the, the idea is these would just be like very simple, like all they do is sign Bitcoin transactions, deal with seeds and HD wallets, a couple things like that, and so, so very minimal, like no shitcoins, which is, you know, weighs down a lot of other hardware wallets. I felt like, well, what, how exactly does one of these big time hardware wallets like verify change addresses? It's actually quite difficult, even if you're a programmer, like, there's so much code in these, in these, that they've sort of produced. So the idea is, these, these, these things would be very auditable, so it's, it's not as-- hopefully, a lot less code. and, and another, another thing is like, it'd be great if we could have, you know, some different computing platforms. Like, currently Stepan is using STM thirty-two, and there's this like RISC-V or RISC-V, I never know how to say it, it's a little more kind of like an open-source, computing platform, and actually Vat-Vladimir Vandalan, the lead Bitcoin core maintainer, is, is one of, is on their like Rust steering committee, so he's like, there's a lot of interest in this computing platform, so like, it'd be cool to have, you know One, you know, a port on every language that targets sort of a different, platform, and you could just sort of pick these three together in a multi-sig, and it'd be really like a diverse setup, you know, you'd have like three different languages, three different platforms, that would be pretty, it'd be pretty interesting, I think. Yeah, that's fantastic.

And let's, let's now talk about the software aspect of it. So how would this hook up to the blockchain? How, how would I- Would I hook it into Electrum or how, how would that work?

Well, let me take this one. I, I've been working on this a lot lately. So, so yeah, I, I've been, largely trying to figure out how to do multi-sig in my personal life, you know, like I wanna, you know, graduate to multi-sig like a good Bitcoin adult, and still having trouble, having trouble with that to be honest. like, Electrum works, but it's not the easiest, and, I always have trouble Personal server like crashes, I'm not very good at like that sort of thing. So, so yeah, I've been trying to look into, how to write a UI for, for multisig using Bitcoin Core directly as a watch-only wallet. and so the idea there is like, you know, Bitcoin has all this wallet code, and usually you interact with it through the, Bitcoin QT, the GUI that they made, right? but the Bitcoin QT, wh-while, while it's very- Very secure and excellent and like audited by all of the Bitcoin core developers. It's written in C++, and it's sort of a, a, you know, very legacy code base, so it evolves slowly, and features generally show up there last. so you, you pay and use it for, you, you pay for the security with some usability. but you can also access the Bitcoin core wallet on the command line. And in Andrew Chow's episode, he was telling about how he used to, he, he still uses it on the command line. and a lot of Bitcoin But another way you can do it is something called RPC. RPC means remote procedure call. Usually a procedure call means you're like exercising a function in a programming language, like a sum function would take, you know, one, two, three, and then return six. So remote procedure call is like the same idea, but the person who-- the, the, the source of the information might be on a different machine, for example. That would be your hardware node, right? So you'd have a hardware node in your network that's running Bitcoin Core, and you can do this RPC thing to, Response back. So that's what, if you heard of RPC, that's what it means, remote procedure call. It's like a procedure, but it's remote, somewhere else. And, so the idea is, this is another way you can access Bitcoin Core. And so like, if we can, so I made this project called Junction, which uses RPC to, create a watch-only wallet for a multi-sig. and so the way, the way it works is you set it up, it creates one of these watch-only wallets. Watch-only means it doesn't

Connected machine, has no private keys, so if it gets hacked, it's not a problem, 'cause it has no private keys. The worst you can leak is your privacy. so you create this watch-only wallet, and then we use this HWI project created by Andrew Chow, described in the previous episode with him, and there's a command so that allows you to get the xpubs, the public keys, on each one of your hardware devices. And so you plug in each hardware wallet, you extract a public key, which is needed to construct a multisig script. able to use something called the descriptor language, which Andrew Chow also, mentioned, which allows you to, export a huge range of addresses from my little junction thing into Bitcoin Core's wallet. so that means it'll, it'll watch these addresses for incoming funds. and this is really powerful because, like, it's-- you're, you're able to e-export huge amounts of, of addresses very quickly, very easily, and, and lastly, you do this wallet create funded PSBT, Andrew also- Also talked about this, you provide the outputs you want, the address and the amount, and Bitcoin Core actually chooses the input. So you, Bitcoin Core has a sophisticated coin selection algorithm which it uses here, and then you once again use HWI to sign this PSBT, partially signed Bitcoin transaction, and broadcast it to the network. So it's really cool, it's like this minimal UI that allows you to interact with hardware wallets, and use Bitcoin Core full node, for all the blockchain stuff. So, and the co-- the best thing about this is, Hundred lines of Python code, it really speaks to all the work that's been done by the Bitcoin core developers with the descriptor language, with these, PSBT, with HWI, so I think, I think this really, like, we're, we're really close to being able to have hardware wallets UIs that plug in directly with Bitcoin Core, just because a few years of work in, into, into making this easy, is sort of like culminating now. So that's the idea is, we could have like, You know, we just add a QR code scanner for these hobbyist hardware wallets, and then all of a sudden, boom, since we all use a, a standard PSBT format, now we're able to pass around this thing, over the serial port for a Trezor, and then it goes over a QR code to Stepan's Specter, his, his project, and it goes over a QR code to my little, BitBoy. So that's the idea, is, is, you know, we're, we're moving towards that. But I think we're layer of the wallet, which allow sort of application developers like me to come in and, expose that to the user. Got it.

And so as, you know, from my own fooling around with Bitcoin Core, I see when you, when you go into your Bitcoin folder and you open the, you know, you do nano, bitcoin dot conf, oh, there you go, and you open up the conf file, right? And then there's an option you can set there like RPC user equals and RPC password equals, right? And then that's where you would set Presumably on the, or on your software, Justin, the Junction software, or is it actually in the hardware wallet where you're giving it, okay, here is my RPC username and password that I previously put into my Bitcoin Core conf file?

great question. It, it is all, it is all in the like this, this, duct tape Junction layer. All, all the sort of permission, RPC username and password would be stored by this like UI, and none of that will be known by the, by the hardware The hardware wallet, the hardware wallet just, the hardware wallet's really stupid. Like, that's the whole idea of a hardware wallet. It just knows as little as possible. It, it, it, it, it can only see the outside world through a tiny little hole, you know? It, it can only, it can only like, respond to very simple messages. so it doesn't know anything like that. It just says, "Hey, if, if it gets a, you know, a, a request over a QR code, it knows how to respond

Taproot will give the hardware wallet everything it needs to do its job, and, so the, the hardware wallet only needs to deal with this one format. Gotcha. And so

I guess the other question that a listener is probably thinking, well, what about this idea of building trust in the firmware and the software, right? So the idea is eyes on the code, and people say, well, Bitcoin Core has the most eyes on the code. How do we build trust in the firmware and the software needed for these projects?

I think a big thing on the UI front is that it, it's just very little code actually, it's all Bitcoin Core, like that's the cool thing for the Junction project and the projects like it, like Stepan's working on a similar project for his Specter wallet, and I know a couple companies, like there's gonna be a number of these coming out. the cool thing is that all the work is done by Bitcoin Core, which is awesome, like, don't do any crypto in your wallet, like outsource as much of that to like the, the Bitcoin engine, And then for the, the, the hardware wallets, I mean, absolutely, this is gonna be a, time will, time will tell whether these things are actually secure over the long run, whether they get hacked a lot or whether they're, you know, whether trust builds. So it's, it's more of an experiment on that front, but I think that's probably more acceptable in, you know, multi-sig situations where loss of one key that's different, it's, it's subject to a very different security model, that's actually acceptable and maybe good in some cases.

About, the firmware part. if there will be more contributors that are like, people tinkerers that experimenting with this firmware, then there will be more people that look at the code, because, it's not enough just to open source your firmware, because, for example, look at Ledger, they open source the firmware and there was still a bug that was lying there, for years just because people aren't building on top of that, it just they can, read The code, but they aren't using it. And, what we are trying to, do is actually to provide a toolbox that, allow people to build on top of. So if pe-people are building on top of the libraries and the toolbox that we have, they will find bugs easier, just because it is commonly used, like, similar to, Bitcoin Core and LibVOL and other libraries that are popular in the community at the moment. and, also white, treasure crypto libraries or, Actually, also pretty good, because, it is used by all the clones of Trezor, for example.

So the secret to getting someone to audit your code is have people build stuff on top of it, hey? Yes, yeah,

for sure. That's the idea. Easier said than done, I think, but we'll see. So

just help me compare this, right? So in most listeners will need to compare this back against something that already exists, right? Now, if you're going-- So commercially, there's obviously, there's Unchain Capital. So, of, disclosure Also Casa, who are doing this as like a, as a product that you can have. But if you were doing this on your own, users most probably they're using something like Electrum, and they're using Electrum with like either Electrum Personal Server, Electrum X, or Electrum Rust Server. And so the flow there would be something like, use the web wallet, plug in, or not the web wallet, the Electrum Wizard, and go multi sig, hardware wallet, blah, blah, two of three, whatever. What would be the main difference then in the flow? Of using Junction and or Specter Desktop versus, say, Electrum MultiSig.

well, go ahead. You just, run your Bitcoin Core and then hopefully just run the app that can talk to your Bitcoin Core and just go on.

Yeah, I mean, I, I think that's just the way it's going to move. Like, I expect a lot of these, companies, like, I, I expect Casa and Unchained are also moving in this direction, right? Like, I'm sure Casa wants their, Casa node to talk to Keybase. Master, right? I'm sure that's coming soon. I'm sure the same is true with Unchained. Like, I just think this is the direction it's gonna go. you know, all of these, these companies that really help secure one of your keys and help provide both software and, customer service to like make sure you don't screw up, they're, they're gonna all move to helping you talk to your own node as well. So I think the whole, the whole group is just gonna move in this direction. And, and yeah, that's

Yeah, I think that's just the way, like talking directly to nodes instead of, like, I mean, lo- like largely, this kind of Electrum, it's like Electrum is just such a good wallet that was built for a long time, it just made more sense to build like an interface layer in between, than to try to build a whole new wallet going directly to Bitcoin Core two, three years ago when Electrum personal servers were, created. But I think now we're getting to the point where you can build UIs that go directly to Bitcoin Core,

I think the main reason is that, Bitcoin Core is really moving in that direction and, making it easier to, use it as a watch-only wallet, because even at the moment, if you compare the, current, Bitcoin Core release, I think it is eighteen point one, versus the master branch, you will see the significant differences. So the master branch that is like not released yet, is way faster in, parsing and scanning All this, watch descriptors and, watch-only addresses and so on. so, there was a lot of work done by Bitcoin Core, guys to actually, add support of external signers, let's say.

Great. And I think it might also be good to get a point of view from a more of a development point of view around Okay, so there's a famous XKCD doc, on this topic, and it's like there are fourteen different standards for doing something, and then someone says, "Oh, I know, I'll make one standard to rule them all," and then the next panel is something like, "Oh, there are now fifteen standards for doing this, yeah." So same thing with, multi-signature, right? So as I understand, there are different ways to achieve it. There are, you know, and al-fun-fundamentally, you still have to know, and this

Well, okay, it's fine, it's all well and good for this wallet to know, but what if that wallet goes defunct, out of business or whatever, the user still has to have the, derivation path and ideally the redeem scripts, right? And so in this case, if the user is rolling their own, they still need to make sure they've got I guess the key pieces they would need, right? So in this case, it's probably the xPub's of those, say, say you're doing a two of three, you would need the xPub's for those three wallets, you would need the redeem script as well. So can you comment a little bit on how, how does that kind of come together?

So the descriptors in Bitcoin Core, should work as a universal description of the wallet. So ideally, you should back up only this piece of information. it includes, both the xPub's and also the order of the, of the wallets and also the, way how to construct the redeem scripts. so, at the moment, Bitcoin Core supports, only like single key and, multi-signature Descriptors and as far as I know, they want to include miniscripts there, and then we will be able to construct, very, interesting wallets that, for example, include the time works and other things like this, and they will all be, displayed and configured by this descriptor language. so I think that then the only thing that you will need to, to store together with your wallets like, like a backup, is this descriptor, so a single text file that, has a, all the information necessary to find your bitcoins afterwards if you screw up, if you, lose your node or whatever.

Justin, did you have anything to add on that or you

mostly agreed there? Yeah, no, I, I, I agree. It's, I think both of these, it's like the, the, the hobbyist wallet and the, the sort of like, new RPC multisig UI thing, the two sort of things we've been discussing here Reusing whatever the standard is. So like, these hobbyist wallets just use the, the seed, the mnemonic seed, not trying to innovate there, just like reuse that, UI, make, make a nice way to interact with it. So I don't think it's a problem there. And with like the kind of multi-sig wallet setup, outsource everything to Bitcoin Core, and I think that's, it's like one less standard. Every-- all the important stuff is happening in Bitcoin Core. So, yeah, I've, I view it as the other So that, you know, you get the standard setup.

And because it is, first our reference implementation, and also, I would say that if there are fourteen standards and then someone invents the fifteenth standard that goes into, goes into the BEP, then we have this standard and fourteen others.

No, that's a, that's a great point, guys. Agreed. So then from an estate planning, backup, recovery point of view, as you're saying, then it's mainly keeping the- The output descriptors, and obviously the private key each is held on each of the, say, the three different devices, so that would be the main thing you have to worry about there. So what about some of the other ideas? So things like ongoing support, is there gonna be like a chat channel for people to all support each other? What's, what's, what's your view there?

You mean on making this, do-it-yourself hardware wallets? okay, so, that's why we, decided to, put online this, website, DIYBitcoinHardware dot com, where we hope to put, also the, links to the Telegram and make a Telegram group where people can actually ask and get help with assembling this and,

if people don't want to go to, open an issue on GitHub, for example, they can, they can just, text there, but we didn't really set up, set it up yet. So So, hopefully we will do it, soon after the podcast and, and put the link in the, in there.

Great. And also, I guess the other one that people might have a concern about, and I suppose if they're more of a tinkerer or a builder, they, they're not as concerned with this, but they might be wary of using it if they think, "Oh, maybe this project might fall into disrepute and, or it might just, just go stale." You know what I mean? What's the hope there? Is the hope there that it'll just be continually built on, and then once, once there's additional use, then there'll be-- it'll be seen more like a community project to keep updated?

so from, our side, I can say that, we are building the- This, wallet and the desktop app, to use by ourselves. So we are just building tools for ourselves, and we desperately need something like this. This, and this is why we started all this. so, as- far as we are in Bitcoin and we keep using it, we will continue, working on it and adding new features. so, for me it is especially important because I'm now part of the hardware company, so, it will stop probably only if I die. Hopefully it won't ever happen. And, even then, if we have enough contributors and, we rise enough, kind of interest in the community, then the progress will continue. and Justin is planning to start the, course on hardware wallets with MicroPython, so hopefully there will be more and more developers that are building, on top of this, toolbox and, starting tinkering. so I think that, to make sure that the project will survive and evolve, we really need people to start working on that. and we'll try our best to get more people on board.

Yeah, I would say Be skeptical of us, you know, like, if you're listening to the podcast, assumes Stefan and I are overpromising and we're full of crap, you know? Like, you know, and that's good. And, and, but, you know, hop in and if you wanna play around with this stuff, you know, put some test net coins on it. Put a little, you know, tiny bit of money real Bitcoin if you, if you're reckless, but, you know, don't go and, you know, maybe redo your entire cold storage the first week

Anything, right? You don't wanna go buy a new trezor and then just stick your entire net worth on there, you know, the first time. You wanna practice with it, and that's, I think that's a big thing, you know, it's, it'd be good to see more of. It's just, you know, or it's just a good idea just to, to practice with these things, explore them, use it on testnet all the time, and over time you get more and more sophisticated, and then you

can make that Possibility, and you can't outsource that. You need to actually develop the sophistication yourself, and I think that's one of the, the big value propositions of playing around with these hobbyist hardware wallets is it helps you develop that sophistication so you can make good decisions yourself.

Fantastic. And, Justin, maybe you just also wanna comment on, are there any upstream dependencies or anything that has to get merged into Bitcoin Core before this is easy for noobs to use, right? So we were talking about HWI earlier, but you were also mentioning that you could just do this from, from Can you comment on that?

Yeah, so, I mean, just with my little Junction project, like there are a number of like little annoying things that, like, like it, it'll, it'll contin- so, so it works now, it'll continue to improve, but like, one, one of the trickiest things is that, you know, this HWI project, which is a brilliant interface for, like, these different vendors, sort of like a standard way to access these different vendors who behind the scenes all work very differently, Like there are some things that you just can't do. You can't say, "Hey, Trezor, show this multisig, address on the screen." you really want that, because if you're gonna, s-s, receive, if you're gonna redo your cold storage, receive a bunch of coins on a new address, you really, really wanna be sure you actually control that address. The idea is that the hardware wallet should be like the trusted UI, right? The desktop might be malware. The hardware wallet is like the trusted UI. This is the one machines agree, I'll, I'll sort of believe them, but I really wanna have this one, hardware wallet UI that I can trust. And there's no way to just say, "Hey, show this multisig address." and so that's, that's one of the difficulties of making a standard interface layer, it's, we haven't figured out how to make this work on all three devices. another tricky thing is that it doesn't detect change, change address, ch-change addresses. and that's just a dis- decision on based thing like HWI, it's always, it always lacks a little bit in functionality, right? Like these two are good examples, but the benefit is that you get the standard thing that everyone can plug and play with. But hopefully, doing some of this hobbyist stuff like this Junction and this Junction UI, we can help sort of drive a little bit of the, you know, give the, some of these Bitcoin core maintainers some feedback about what the, you know, use cases would be helpful and can help, help to sort of give some feedback and drive the development process Forward there a little bit, based on user, user input.

Excellent. Yeah. So that sounds great. Stepan, did you wanna just give us a quick update? What's happening? What's the latest with Crypto Advance?

Yeah. So, We decided to, actually publish the code of our, let's say, functional prototype, that is why we are also, releasing this do-it-yourself hardware wallet and the desktop app that is talking to Bitcoin Core, because, well, who knows what community will find useful and interesting and, whatnot, so we decided to, release it at the moment, even though it isn't perfectly secure, like it isn't secure at all, because- It is a functional prototype, this means that it is, it can sign, it can display things, it can add new co-signers and display multi-signature addresses and, things like that, but, it is, it didn't go through the security audit yet. It is like a little bit of spaghetti code everywhere and so on, but at least this is something that, already lets people to feel the interface and capabilities of the wallet that potentially can be made. and also we are using the same prototype to experiment with new features like CoinJoin, Lightning Network, and, other, additions to the protocol. and yeah, we also want to give a tool for other developers to try it out and to see how we can improve and how are the software, parts of the, or let's say Bitcoin Core or Electrum or other wallets can improve. And so that is the current status. So we decided to focus on this do-it-yourself approach for now, and, get the community feedback and then from there continue, working on both the, consumer hardware wallet like a Series One and, enterprise solution and other things like, in parallel with that. So, we hope to get some feedback from this do-it-yourself project to align ourselves for the future. So, a little bit selfish, but, hopefully

Yeah, I think that will. Justin, do you wanna just give us a quick update what you're doing with Biddle Bootcamp and some of your projects?

Yeah, so I've been teaching Biddle Bootcamp for like ten months now. So one of the things we do is we build a couple hardware wallets, build some software wallets. So if you're interested in that, Please join, it's a, it's a, it's a good group. And, I, I made like a Mooniversity class, it was called, it's like a learn to code class where everything's about Bitcoin. so if like you're interested in coding, you can check that out. interested in learning to code. So it's the idea is like leverage people's interest in Bitcoin to help them learn to program, 'cause that's a very useful skill. And the idea is eventually I'd turn that into kind of like a subscription, more, more subscription site where it's just like a, kind of a, all kinds of little examples of stuff you could do Bitcoin programming-wise, if you wanna learn how addresses work, if you wanna learn to build a block explorer, there's all these little projects that you'd do. So I'm, I'm sort of like slowly rolling that out. And, yeah Hopefully that'll happen. Fantastic. So

look, let's, just talk about where, if the listeners now they wanna find more, find out more about Junction or about Specter Desktop and about this project, where should they go to find

the info? So the, let me just get this, diybitcoinhardware dot com. That'll sort of have everything from these. if you wanna see the Crypto Advance stuff, go to github dot com slash crypto advance. They have the two, projects posted. Just recently posted, so check those out, like really impressive looking, and, yeah, Junction is just GitHub dot com ju-uh Justin Moon slash, Junction, that'll probably be on the, yeah, you, you can find that. So, so yeah, I think most of it is just on that Bitcoin, DIYBitcoinHardwareWallet dot com, we'll try to put all that stuff there. so if you wanna dive down the rabbit hole of playing with Bitcoin hardware, learning how private keys work, and sort of like, And Stefan

and I. We'll put all the links in the show notes for the listeners, you guys can go and click around and have a read on the material there. So look, thank you very much again, Justin and Stefan, for joining me today.

Thanks for having us, it was a lot of fun again.

Yeah, my pleasure. It's, I, I just have to mention that we have a person in Texas, we have a person in Australia, and a person in Moscow. So One of us is very tired right now,

in the middle of the night. Let the lesser, lesser guess who that was. It's crazy though, it's crazy how this works.

Thanks, guys.

Take it easy.

So if you're interested to get reckless and learn and play around with DIY hardware and multisig, make sure you check out the links in the show notes. That brings the hardware wallet series to a close. I hope you got a lot of value out of this and that this becomes a nice resource to refer people to. So some notes for a newbie listener, just summing things up. So if you've gotten through this whole series, congratulations, this is some pretty technical material. If you're still stuck leaving your coins on the Bitcoin exchange, I highly recommend you to get A hardware wallet and get off the exchange, right? So if you're stuck in, quote unquote, analysis paralysis and don't know which hardware wallet to go with, I will just pick one. I'll recommend the Coldcard. Go to coinkite dot com and use the code levera to get five percent off. I truly believe it's the best overall blend at the time of recording this in late August twenty nineteen. Having the potential for a completely airgapped setup and SD card airgapping for PSBT transactions are some great features. Now, if you're more of an in- Intermediate or advanced listener, make sure you consider the different products mentioned as part of this series and use that to inform your decision and your knowledge in how you guide your newbie friends. So one tip that I've found is don't expect people to go from zero to one hundred, try to give them just the next incremental step, the next progressive step of, okay, you're on the exchange, get a hardware wallet. Okay, you've got a hardware wallet, learn to run a node, that kind of thing. I've found that to be helpful. Just remember, show notes and transcripts are on my website stephanlivera dot com. If you like the show, make sure you tell your friends and family about it. There is also a Patreon for donations. I've also recently set up a BTC Pay server on my website for Bitcoin donations, that's best thirty-two cent only, and I'm also looking into Libra Patreon as well, Libra Patron as well, but just having a bit of trouble with the email server config, but anyway, I'll get around to that. That's it from me, guys. Thank you for