linera-io / linera-protocol

Main repository for the Linera protocol
Apache License 2.0
703 stars 137 forks source link

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

Open ma2bd opened 6 months ago

ma2bd commented 6 months ago

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.

afck commented 6 months ago

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:

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 commented 5 months ago

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.