cryptoadvance / specter-diy

DIY airgapped hardware wallet that uses QR codes for communication with the host
MIT License
440 stars 73 forks source link

Use PSBTView - RAM efficient PSBT implementation #171

Closed stepansnigirev closed 2 years ago

stepansnigirev commented 2 years ago

This PR switches from in-memory PSBT implementation to PSBTView - an implementation that only loads currently processed scope from a trusted stream.

PSBT is loaded from the host to the SDRAM first. SDRAM is a separate chip present on the board and it is not mapped to the stack or heap of Micropython to avoid leaking secrets to external chip before user authentication. But as soon as the PIN code is verified we can consider SDRAM semi-trusted and use it for PSBT storage.

Handling 10-input transactions was already a problem on master. I tested 100 inputs transactions and signed them without any problems with this PR.

Also solves https://github.com/cryptoadvance/specter-diy/issues/170 - now after processing the SD card file you can display the corresponding response as a QR code.