gnolang / gno

Gno: An interpreted, stack-based Go virtual machine to build succinct and composable apps + gno.land: a blockchain for timeless code and fair open-source.
https://gno.land/
Other
898 stars 376 forks source link

develop and integrate a cgo-free hid library for ledger support #3051

Open thehowl opened 3 weeks ago

thehowl commented 3 weeks ago

This is unlikely to be officially tackled by the core team, but can be a fun pet project for anyone who's interested.

Currently, we use https://github.com/zondax/hid indirectly, to support ledger in gnokey:

$ go mod why github.com/zondax/hid
# github.com/zondax/hid
github.com/gnolang/gno/tm2/pkg/crypto/internal/ledger
github.com/cosmos/ledger-cosmos-go
github.com/zondax/ledger-go
github.com/zondax/hid

There is an existing attempt, started by zserge, to make a non-cgo hid driver. However, it only works on linux.

For inclusion in gno, there should be a hid library, possibly mimicking zondax/hid's API, which doesn't use cgo and instead uses build tags and pure go functions. Then, we can adapt the existing ledger libraries so that they use the new API.

Avoiding cgo simplifies our (cross-)compilation processes and allows to create entirely static binaries.

Related: #2928

clockworkgr commented 3 weeks ago

@thehowl came across this as well: https://github.com/rafaelmartins/usbhid which claims linux/win/mac