<p><strong>Context for question</strong>: 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.</p>

<p>I have found GitHub repository <a href="https://github.com/jujugoboom/Bitduino" rel="nofollow noreferrer">Bitduino</a> 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.</p>

<p>I also found GitHub repository <a href="https://github.com/kmackay/micro-ecc" rel="nofollow noreferrer">micro-ecc</a> implementing ECC for 8-bit microprocessors, which looks very promising.</p>

<p>Then I guess additionally all that is needed to generate a keypair, are some hashing algorithms; <a href="https://github.com/wolfSSL/wolfssl/blob/master/wolfcrypt/src/ripemd.c" rel="nofollow noreferrer">RIPEMD-160</a> and <a href="https://github.com/Cathedrow/Cryptosuite" rel="nofollow noreferrer">SHA-256</a>.
And then simply use Base58 encoding, which can be found as C-code in the actual <a href="https://github.com/bitcoin/bitcoin/blob/master/src/base58.h" rel="nofollow noreferrer">Bitcoin client implementation</a> (so it could be used for a microprocessor).</p>

<p>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?</p>

<p>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 <a href="https://www.adafruit.com/product/2471" rel="nofollow noreferrer">ESP8266</a> do, or an <a href="https://www.adafruit.com/product/3514" rel="nofollow noreferrer">STM32F4</a>? Or a <a href="https://www.raspberrypi.org/products/" rel="nofollow noreferrer">Raspberry Pi</a>?</p>

<p><strong>Personal context</strong>: 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.</p>

<p>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.</p>

<p>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.</p>

CC BY-SA 4.0
2018-05-04T14:40:43.187Z
They're Turing-complete after all.  I guess the only question would be whether they have enough memory.
Nate Eldredge
CC BY-SA 4.0
2018-05-04T23:06:23.167Z
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?
David Grayson
<cryptography><address-generation><ecdsa>
Would it be possible for an 8-bit microprocessor to create a bitcoin keypair?
Mr Jones
# Would it be possible for an 8-bit microprocessor to create a bitcoin keypair?

(Asked by: username_0 on 2018-05-04)

**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](https://github.com/jujugoboom/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](https://github.com/kmackay/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](https://github.com/wolfSSL/wolfssl/blob/master/wolfcrypt/src/ripemd.c) and [SHA-256](https://github.com/Cathedrow/Cryptosuite).
And then simply use Base58 encoding, which can be found as C-code in the actual [Bitcoin client implementation](https://github.com/bitcoin/bitcoin/blob/master/src/base58.h) (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](https://www.adafruit.com/product/2471) do, or an [STM32F4](https://www.adafruit.com/product/3514)? Or a [Raspberry Pi](https://www.raspberrypi.org/products/)?

**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.

**Tags:** cryptography, address-generation, ecdsa

> **Comments:**
> **username_1**: They're Turing-complete after all.  I guess the only question would be whether they have enough memory.  
> **username_2**: 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?  

---

## 0 answers

