Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cold wallet functionality #15

Closed
MrStahlfelge opened this issue Jul 28, 2021 · 4 comments
Closed

Cold wallet functionality #15

MrStahlfelge opened this issue Jul 28, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@MrStahlfelge
Copy link
Member

MrStahlfelge commented Jul 28, 2021

Currently, the Android wallet can already be used as a cold wallet:

  • Use a fresh (factory reset) Android device and don't set up any Wifi connections
  • Use flight mode and don't insert a SIM card
  • Install the Android app by sideload
  • generate your wallet
  • Done - you have a cold wallet

This works, but the experience is subpar because the app tries to connect to the network and shows zero balance. The UI could be improved: There could be a setting that switches to "Cold wallet" mode. In this mode, there is no attempt to retrieve information and the wallet list will not show any balances any more. Additionally, in this mode, a big warning can be shown when a network connection is detected.

These UI improvements can be done without problems, however, as soon as you want to access your funds, you need to connect and the wallet goes from cold to hot. In theorey, that is not necessary: A second - connected - device with only the public address could prepare the unsigned transaction, this transaction can be transferred to the cold wallet device by QR code, the transaction is then signed and transferred back by QR code and the cold wallet never needs to connect to the internet.
Discussion with @aslesarenko : https://discord.com/channels/668903786361651200/669207683869573142/869136961904996382
A POC should be implemented to see if this is viable to add to the app and have a ledger alternative for people owning a second, not needed Android device.

In most of the cases full context data is not required, but in any case each input box requires proof (aka signature) to be generated, which is done by this method https://github.com/ScorexFoundation/sigmastate-interpreter/blob/de6220fefd5738ea7984ebb18e088d0da9f58f3c/sigmastate/src/main/scala/sigmastate/interpreter/ProverInterpreter.scala#L117
It is possible to implement optimised serialization/deserialization of the Context data storing only necessary data. Each ErgoTree can be analysed on which context data is actually used in the contract and only those data need to be serialized and passed to the Cold Wallet.
In most of the cases the context data set is actually small, so the implementation can be generic (but may be quite involved).
The first PoC version can support P2PK addresses only, in which case context data in not needed, and some dummy Context can be created in Cold Wallet App, to be passed in prove method above.

Open questions:

  • Inboxes need to be serialized, sent to the cold wallet, and validated to show the user what is withdrawn
  • How to determine which key is needed to sign? Easy for p2pk addresses, but for general scripts it is not apparent
@MrStahlfelge MrStahlfelge added the enhancement New feature or request label Jul 28, 2021
@aslesarenko
Copy link
Member

I think it may be easier to have a separate Ergo Cold Wallet app which perform all the security checks when started and stops (with clear message) when there are issues.
Its interface have special purpose and can be (and probably should be) completely different form Hot wallet.
This new app can share most of the non-UI components, so it can be just separate App module in the same project repository.

@MrStahlfelge
Copy link
Member Author

I think it may be easier to have a separate Ergo Cold Wallet app which perform all the security checks when started and stops (with clear message) when there are issues.
Its interface have special purpose and can be (and probably should be) completely different form Hot wallet.
This new app can share most of the non-UI components, so it can be just separate App module in the same project repository.

Yes, we could add a second flavor dimension for this. Upside is that it is more clear for users that are aware of this second app. But there are also some downsides of this approach.

  • We have to maintain and publish two apps
  • I see a onboarding problem for people not aware of the app: It makes not much sense to publish the app to Google Play, but we are not allowed to link to or advertise APKs that are not on Play from the app that is published there. So people only using the app won't know about the cold wallet functionality.

The second problem can be faced by just doing both: Having the main app doing both and also publishing a dedicated cold wallet apk

@MrStahlfelge
Copy link
Member Author

Almost finished. Left to do is handling chunked QR codes (when data exceeds 2900 bytes) and waiting for ergoplatform/ergo-appkit#107 deployment

@MrStahlfelge
Copy link
Member Author

Functionality is done. For the dedicated cold wallet APK issue #49 was made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants