Context for question: With the latest security breaches around modern CPU's (Spectre / Meltdown) I was wondering if we could generate ECDSA keypairs on cheap, small and/or simple air gapped (micro)processors.

I have found GitHub repository Bitduino attempting to make an Arduino (an 8-bit microprocessor) create a bitcoin address, but in fact it simply leverages a connected computer that creates the actual keypair with Python. The Arduino merely creates the (possibly true cryptographic) random bytes.

I also found GitHub repository micro-ecc implementing ECC for 8-bit microprocessors, which looks very promising.

Then I guess additionally all that is needed to generate a keypair, are some hashing algorithms; RIPEMD-160 and SHA-256. And then simply use Base58 encoding, which can be found as C-code in the actual Bitcoin client implementation (so it could be used for a microprocessor).

So to sum it up, my question comes down to: would putting these parts together enable the generation of ecdsa / bitcoin keypairs on a microprocessor, or am I missing something?

If let's say it's not possible simply because of memory limitations, what amount of memory would make it possible? Or if the 16MHz of an Arduino (for example) would be too slow, would an ESP8266 do, or an STM32F4? Or a Raspberry Pi?

Personal context: I would very much like to create a full implementation of exactly this entire process. Starting with a press of a button (on an embedded device) which will result in a string containing base58 encoded private and public keys, while using strong true cryptographic random values. I'm just trying to prevent unnecessary work targeting a platform that cannot ever make something like this work.

I would be happy to write it in 'cutting-edge' Rust on a 64-core machine, but I also realise that would set the threshold so high, the 'average' user couldn't reproduce it. (Also it wouldn't solve my main issue with modern-day CPU vulnerabilities.) Whereas if the end result would be an Arduino library you can simply download using Arduino's board manager, flash the example and it spits out keypairs, that would suddenly make it accessible for a (very) large audience.

I know hardware wallets exists, I am much more interested in creating something like this myself for learning purposes. Also, if the resulting software can be used by other people on very inexpensive and easy to come by hardware, that would be a plus.

  • 1
    They're Turing-complete after all. I guess the only question would be whether they have enough memory. May 4, 2018 at 14:40
  • 1
    As someone who has implemented an ECDSA library, and worked a lot with 8-bit microcontrollers, I see no reason why you couldn't do ECDSA stuff on an 8-bit microcontroller. I don't think you'll need very much RAM but you will need a lot of code space so I'd start with something like an ATmega2560. However, I think a 32-bit microcontroller would be way more appropriate. The Trezor uses an STM32. Have you seen the ST Nucleo boards? They are pretty decent and cheap. And you know hardware wallets already exist, right? May 4, 2018 at 23:06


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.