-
Notifications
You must be signed in to change notification settings - Fork 1
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
Agree on a sketch of the overall wallet architecture #7
Comments
Rough (and incomplete, hence not put into the top post) sketches from a meeting with Daira-Emma and Kris: Current light client wallet architecture: flowchart
zcashdConsensus
zcashdConsensus -- Chain tip change --> lightwalletd
zcashdConsensus -- New blocks --> lightwalletd
subgraph Indexer
zcashdDb
lightwalletd
end
zcashdConsensus <-- Stuff --> zcashdDb
zcashdDb<-- UpdateChainTip --> lightwalletd
zcashdDb<-- GetUTXOs --> lightwalletd
zcashdDb<-- GetTransaction --> lightwalletd
subgraph Mobile wallet app
Scanner
Wallet
end
Wallet -- Register UFVK --> Scanner
Wallet -- (LC) [nf], ScanRange --> Scanner
lightwalletd <-- UpdateChainTip --> Wallet
lightwalletd <-- GetUTXOs --> Wallet
lightwalletd <-- GetTransaction --> Wallet
Scanner <-- CompactBlockRange --> lightwalletd
Scanner -- ScannedBlock --> Wallet
Sketch of possible desired architecture: flowchart
FullValidator
Indexer
Scanner
Wallet
FullValidator -- Chain tip change --> Indexer
FullValidator -- New blocks --> Indexer
Wallet -- Register UFVK --> Scanner
Wallet -- (LC) [nf], ScanRange --> Scanner
Scanner <-- (Compact)BlockRange --> Indexer
Scanner -- ScannedBlock --> Wallet
LC: Light Client |
Should the Scanner obtain the blocks from the Indexer, or direct from Zebra's database? (Assuming the scanner is running on the same machine as Zebra.) I assume that t-address balances and transactions will be obtained by querying the Indexer? ETA: Also, in the diagram above, is it the Indexer's job to index transparent addresses and transactions (e.g. for the block explorer use case)? I think it's worth being pedantically explicit about the functionality of each component to ensure that we don't have differing understandings/expectations. |
Temporary diagram for discussion flowchart
subgraph Zcash_P2P_Network
Other_nodes
end
Other_nodes -- chain state --> FullValidator
subgraph Zebra
FullValidator
Indexer
TxBroadcaster
subgraph State
NonFinalizedState
FinalizedState
end
FullValidator -- Chain tip change --> NonFinalizedState;
FullValidator -- New blocks --> NonFinalizedState;
FullValidator -- Finalized blocks --> FinalizedState
State -- transparent TX info --> Indexer
end
State -- Read Zebra State --> Scanner
Wallet -- T-addrs query --> Indexer
Indexer --T-addrs state --> Wallet
Wallet -- New transaction --> TxBroadcaster
TxBroadcaster -- New Transaction --> Other_nodes
Indexer --> BlockExplorer
subgraph CLI_Wallet
Scanner
Wallet -- Register viewing key --> Scanner
Scanner -- Shielded TX scan results --> Wallet
end
|
Are we settled on this design for the wallet architecture? What else is required in order to close out this issue? |
Although risky in terms of scope creep, I think that a general purpose approach would be much more helpful in terms of requirement elicitation. Many kind of users, either they are individuals, DAOs, Protocols or other Organizations (like CEXs, Asset Custodians, Banks, etc) need to make use of a Zcash Wallet and currently their needs are not met by our tooling. It's better to think of that beforehand. This is a layered approach where different application domains can be added horizontally as needed. The CLI can be the first one, but others come to mind. Principles:
flowchart
subgraph Zcash_P2P_Network
Other_nodes
end
Other_nodes -- chain state --> FullValidator
subgraph Zebra
FullValidator
Indexer
TxBroadcaster
subgraph State
NonFinalizedState
FinalizedState
end
FullValidator -- Chain tip change --> NonFinalizedState;
FullValidator -- New blocks --> NonFinalizedState;
FullValidator -- Finalized blocks --> FinalizedState
State -- transparent TX info --> Indexer
end
State -- Read Zebra State --> Scanner
Wallet -- T-addrs query --> Indexer
Indexer --T-addrs state --> Wallet
Wallet -- New transaction --> TxBroadcaster
TxBroadcaster -- New Transaction --> Other_nodes
Indexer --> BlockExplorer
subgraph Data Transformation Layer
CLI_API <--> CoreTransformationLogic
ZcashSnapAPI <--> CoreTransformationLogic
B2B_API <--> CoreTransformationLogic
CoreTransformationLogic
end
CoreTransformationLogic -- works with native types --> Wallet
subgraph Wallet CLI
CLIClientLogic -- mediates formats and lifecycle --> CLI_API
end
subgraph Zcash Metamask Snap
BackendLogic <--> ZcashSnapAPI
end
subgraph Zcash Avax Bridge
ZavaxDataLayer <--> B2B_API
end
subgraph Zcash CEX Infrastructure
CEX_Backend <--> B2B_API
end
subgraph Wallet Backend
Scanner
Wallet -- Register viewing key --> Scanner
Scanner -- Shielded TX scan results --> Wallet
end
|
@pacu that is compatible with the sketch we have in this issue, but you should open a separate issue for discussing it. |
Apologies in advance, if this question is naive or out-of-scope. Should we explicitly consider an API that offers guidance to mobile developers in this discussion? It's not explicit in the title of this issue that we're focused on CLI-only wallets, and it seems like explicit consideration of other interface cases, even if there's no requirement to implement (or it's already implemented) might be useful in this context. I am specifically thinking about APIs that encourage non-CLI developers (e.g. mobile) to prefer QR code representations of addresses (or payment requests etc.) over strings. |
Updated temporary diagram based on recent discussions (see note at the end about the block explorer use case): flowchart
subgraph Zcash_P2P_Network
Other_nodes
end
Other_nodes -- chain state --> FullValidator
subgraph Zebra
FullValidator
TxBroadcaster
RpcServer
subgraph State
NonFinalizedState
FinalizedState
end
FullValidator -- Chain tip change --> NonFinalizedState;
FullValidator -- New blocks --> NonFinalizedState;
FullValidator -- Finalized blocks --> FinalizedState
end
State -- transparent TX and nullifier info --> Indexer
subgraph Zebroid
Indexer
IndexerRpcServer
end
ReadStateService --> Scanner
RemoteReadStateService --> Scanner
State --> ReadStateService --> Wallet
IndexerRpcServer --T-addrs state --> RemoteReadStateService --> Wallet
Wallet -- New transaction --> TxBroadcaster
TxBroadcaster -- New Transaction --> Other_nodes
FullValidator --> RpcServer
Indexer --> IndexerRpcServer --> BlockExplorer
RpcServer -- NonFinalizedState via getblock method --> Indexer
subgraph CLI_Wallet
Scanner["Scanner<br>(zcash_client_backend)"]
ReadStateService["ReadStateService<br>(zebra-state)"]
RemoteReadStateService["RemoteReadStateService<br>(zebra-state)"]
Wallet -- Register viewing key --> Scanner
Scanner -- Shielded TX scan results --> Wallet
WalletRpcServer --> Wallet
end
WalletRpcServer --> Client
The indexer RPC server is shown supporting the block explorer use case here as we've discussed moving some of the RPC methods currently supported in Zebra to the indexer RPC server so that Zebra cannot be called directly with those queries. |
We just discussed this in the Zcashd Deprecation Collaboration meeting. I'll try to update the figure later but here are the gist of it while it's fresh in my mind. Current zcash_client_backend-backed lightwallets work like this (where "->" is function calls inside process, and "-->" is across processes):
The proposal is to first support this:
And then eventually (but not required for zcashd deprecation) we could migrate to:
Please confirm if this is accurate. |
Annotated diagram based on discussions during the Arborist call on 19 Sept 2024. |
I've opened an issue in the Zaino repo (here zingolabs/zaino#69) to finalise the red "gRPC" in the diagram above. I believe there are currently a couple differing ideas regarding this so have put forward an initial option there. |
No description provided.
The text was updated successfully, but these errors were encountered: