vacuumlabs / adalite

A lightweight web wallet for Cardano cryptocurrency with Trezor, Ledger and BitBox02 support. Please note that the only valid domain for our wallet is adalite.io
https://adalite.io
235 stars 49 forks source link

Feat: integration of new bitbox API #1415

Closed shonsirsha closed 4 months ago

shonsirsha commented 5 months ago

Addresses issue: #1406

refi93 commented 5 months ago

Thanks @shonsirsha, we will look into that

btw, I got a question for bitbox02 devs, if you are in touch with them - will bitbox firmware support vote delegation certificates? Shortly (not sure when exactly, no exact times available, AFAIK) after the upcoming hardfork, in order to be able to withdraw rewards, wallets will need to delegate their vote at least to an "always abstrain" DRep - more info here:

https://github.com/cardano-foundation/CIPs/tree/master/CIP-1694#incentives-for-ada-holders-to-delegate-voting-stake https://docs.intersectmbo.org/cardano/cardano-upgrades/hard-forks/chang-timeline-and-dependencies

Relevant fields in the transaction body: https://github.com/IntersectMBO/cardano-ledger/blob/cf05d70ea4e8eae4ce2ad349ed17850c0c8204d1/eras/conway/test-suite/cddl-files/conway.cddl#L277 https://github.com/IntersectMBO/cardano-ledger/blob/cf05d70ea4e8eae4ce2ad349ed17850c0c8204d1/eras/conway/test-suite/cddl-files/conway.cddl#L303

We didn't update Adalite yet, but will do so in the upcoming weeks

benma commented 5 months ago

Hi @refi93, BitBox firmware dev here. If it is required to withdraw staking funds, we will support it. Any suggestions for how to test such a change before it is live?

Would you potentially be interested in helping us to add support in the BitBox02 firmware? It could be more efficient as you will be more familiar with the details. There is a simulator for easy testing.

Protobuf certificate definitions:

https://github.com/BitBoxSwiss/bitbox02-firmware/blob/6446fcf2016fbb4a38384a677fe1aa7c08560195/messages/cardano.proto#L89

Certificate verification code:

https://github.com/BitBoxSwiss/bitbox02-firmware/blob/6446fcf2016fbb4a38384a677fe1aa7c08560195/src/rust/bitbox02-rust/src/hww/api/cardano/sign_transaction/certificates.rs#L31

called from the main transaction verification/processing function:

https://github.com/BitBoxSwiss/bitbox02-firmware/blob/6446fcf2016fbb4a38384a677fe1aa7c08560195/src/rust/bitbox02-rust/src/hww/api/cardano/sign_transaction.rs#L172

refi93 commented 5 months ago

@benma For the sake of inspiration/test vectors I'd recommend checking the ledger JS library integration tests which include also transactions with vote delegations and other new kinds of certificates: https://github.com/vacuumlabs/ledgerjs-cardano-shelley/blob/9c643c406ed200e44b56e8349ec2ac3c53b670de/test/integration/__fixtures__/signTx.ts#L758

here's Ledger's cardano app source code: https://github.com/LedgerHQ/app-cardano/blob/605d7095d9d40cc04b18cb398a163d50e0215afd/src/signTx.c#L1101

additionally, here's trezor firmware PR adding conway functionality: https://github.com/trezor/trezor-firmware/pull/3496/files

regarding possible assistance with development, we'll discuss internally and get back to you in the upcoming 1-2 days 👍