micro-bitcoin / uBitcoin

Bitcoin library for microcontrollers. Supports Arduino, mbed, bare metal.
https://micro-bitcoin.github.io/
MIT License
166 stars 34 forks source link

Which arduino run this? #5

Closed he3117 closed 4 years ago

he3117 commented 4 years ago

On which arduino can run this library? At the main page its said this library is for arduino but its seems the compiled code is not fit int to the ram of arduino and complier complain about array size is too big. Can we use https://github.com/arduino-bitcoin/arduino-bitcoin or that projects is dead?

stepansnigirev commented 4 years ago

This library is made to work with Arduino IDE, but 8-bit Arduino microcontrollers are not powerful enough. It will certainly work on ESP32 and other 32-bit microcontrollers, but not on original 8-bit Arduino.

What are you planning to build? Maybe I can recommend hardware and libraries that would fit your needs.

he3117 commented 4 years ago

I'm trying to build a simple hardware wallet to sign BTC transactions. I have few Ideas about the security model to store seed data on SD card that I like to try.

stepansnigirev commented 4 years ago

So there are many options for 32-bit microcontrollers with Arduino IDE support:

  1. ESP32: the cheapest and very powerful, plenty of devboards available, for example m5stack. But they have wifi and bluetooth capabilities and corresponding proprietary code running next to your firmware - so you probably don't want to use it.
  2. RiscV based devices like M5StickV or Maix series from Seeed - they also released a new Maix Cube recently that looks very interesting. Super powerful
  3. Adafruit M4 series like this one - they also have plenty of extension boards (feather wings) so it's pretty easy to buy everything you need from them and just plug it together
  4. STM32 based boards supported by stm32duino, not sure about blue pill and black pill - they might have not enough RAM and Flash. But other boards should work.

If Arduino IDE is not a requirement, you can also look into Micropython - most of the mentioned boards support micropython in some way. We have a micropython build that includes all bitcoin-related stuff here: https://diybitcoinhardware.com/f469-disco/ Personally I find working with MicroPython very enjoyable.

Regarding the libraries, micro-bitcoin should work fine on all of them, you can also look into libwally from Blockstream and secp256k1 from Bitcoin Core. They are battle-tested and actively maintained libraries, and can be made to work with Arduino IDE.

I didn't work on micro-bitcoin for a while but plan to get back to it soon.

Please let me know if something doesn't work or you have further questions :)

he3117 commented 4 years ago

Thank you for your complete explanation. I decided to use 2 rotary encoders for inputs instead of simple buttons so I think m5stack is not suitable for my design. I ordered ESP-WROOM-32 I think this should be able to run uBitcoin codes. Basically I'm thinking about a new security model to allow me to store secure data on unsecure device like SD card. I have a background in c++ programming but I'm new in hardware space. Current hardware wallets are good against online hackers but it seems they can be vulnerable to hardware hacking. I hope to find a simple way to prevent hardware attacks.

stepansnigirev commented 4 years ago

Sounds interesting! Keep me posted :) I would also like to add your project to this list if you would open-source it.

he3117 commented 4 years ago

Sure I'd like to help. While I'm waiting for my hardware parts to arrive(because of coronavirus it may take a while) I like to know your opinion about my approach I will open a new topic.