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

Wallet integration #982

Open
9 of 14 tasks
vlopes11 opened this issue Oct 4, 2023 · 2 comments
Open
9 of 14 tasks

Wallet integration #982

vlopes11 opened this issue Oct 4, 2023 · 2 comments

Comments

@vlopes11
Copy link
Contributor

vlopes11 commented Oct 4, 2023

Tasks

Frontend

  • Create an example CLI application for sov-bank
  • Create an example Web application for sov-bank

Encoding Library

Metamask Snap

Sequencer

  • Implement an example sequencer for sov-bank

Summary

An integration interface that will receive transactions from various frontends and forward them to the sov-sequencer, so these can be received by the rollup.

image

Frontend

Can be any tool that invokes the TypeScript Sovereign Metamask Snap, including but not limited to browsers (natively) and CLI applications (probably through WASM modules).

Encoding Library

Will be responsible for receiving a human friendly transaction format, and encode it as Borsh. The Borsh encoded transaction will be the one included on-chain; hence, will be the signed transaction.

This library is expected to be implemented per rollup. As SDK, we should have some tooling that will generate automatically such library, per message. This means we might face challenges with enums discriminants. One example is if we are to encode the CallMessage of sov-bank: as per specification, Borsh will constrain us to 255 variants, that are probably enough. However, we need a fallback strategy in case more variants are required.

Metamask Snap

Will be responsible for signing transactions, provided a Metamask key seed. It means that any system that supports Metamask will also have the ability to sign transactions for the rollup.

Also, such library should support interacting with metamask via network socket so applications outside a browser context will be able to access the service. It means the library should potentially, on request, make available a network socket for CLI applications. Naturally, this socket would be critical - as it can sign transactions - and some security wards must be in place.

Sequencer

The sequencer will receive the signed transaction via RPC, and will broadcast them into the rollup.

It must be agnostic regarding the encoding strategy. For this task, we will use as input the signed transaction from the Metamask Snap, but we might as well take input from a HW wallet. With a payload as simple as (transaction, signature, public key), that would be trivial.

Note: public key might be optional here, as a transaction might either contain the public key, or a zero-knowledge proof that will take the signature and transaction as argument, and check the validity. This would unlock privacy-preserving transactions. However, if we assume that to be the case, we might want a trait that defines a transaction validity, such as fn(&self, signature: S) -> bool

@cemozerr
Copy link
Member

cemozerr commented Oct 4, 2023

Looks great. Excited to see the results!

@vlopes11
Copy link
Contributor Author

We will make RuntimeCall from demo-stf as WASM module to be consumed by the library, and expose it to typescript.

A next step is to make any DispatchInfo exportable this way, with a similar interface, that can be consumed by any Snap.

image

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

No branches or pull requests

2 participants