linera-protocol icon indicating copy to clipboard operation
linera-protocol copied to clipboard

Support multi-account chains in the node service (and the fungible demo)

Open ma2bd opened this issue 1 year ago • 2 comments

The file examples/fungible/README.md ends with two URLs. If one opens them both, it is possible to transfer from the first account to the second one but not backward. This is likely because the "node service" wants to use the same (first) signing key for both actions.

Incidentally, the error message in the UI is not great.

ma2bd avatar Apr 10 '24 00:04 ma2bd

Currently the wallet associates each chain with a unique optional key pair, and the ChainClient is initialized with only that. ChainClient::rotate_key_pair would add another entry to known_key_pairs, but it isn't exposed via the CLI or node service, so each ChainClient currently has at most one key pair.

We should decide:

  • Do we want to keep the key pair assignment in the wallet? Or should the wallet just contain a separate collection of key pairs, that we search for a matching entry when needed?
  • Should a ChainClient have key pairs at all, or should it be passed in to all the functions?
  • If it does have key pairs, should it have many or just one?

Currently the node service has one ChainClient for each chain. If we make each ChainClient have only one key pair, it may need to instantiate multiple ChainClients for each chain where we have multiple key pairs.

afck avatar Apr 11 '24 10:04 afck

As discussed, it might be best to split ChainClient into two parts: The ChainClient itself will not have any key pairs, or methods that basically just put together an Operation and pass it to the execute_* functions.

An OwnedChainClient (name TBD) will contain a ChainClient and a key pair, and have these convenience methods.

afck avatar Apr 15 '24 16:04 afck