ADR 002: Importing/exporting mnemonic keys from Cosmos

Status

CategoryStatus

Authors

Andrew Nikitn, Ankur Banerjee

ADR Stage

ACCEPTED

Implementation Status

Implemented

Start Date

2021-09-23

Summary

This ADR describes how cheqd/Cosmos account keys can be imported/exported into identity wallet applications built on Evernym VDR Tools SDK.

Context

Client SDK applications such as Evernym VDR Tools need to work with cheqd accounts in identity wallets to be able to interact with the cheqd network ledger.

For example, an identity wallet application or backend application would need to pay network transaction fees for writing cheqd DIDs to the ledger. This may also need to be extended in the future to support peer-to-peer payments for credential exchange.

Assumptions / Considerations

Cosmos SDK uses known algorithms for deriving private keys from mnemonics. This can be replicated using standard crypto libraries to carry out the same steps as in Cosmos SDK:

rounds of iteration :    2048
length              :    64
algorithm           :    sha512
salt                :    "mnemonic" + passphrase

The mnemonic above is assumed to be a pre-existing one cheqd/Cosmos CLI. The "passphrase" above is user-defined, and defaults to blank if not defined.

Decision

Mnemonic import/export can be achieved using pre-existing BIP39 packages and Cosmos SDK's Rust library cosmrs.

Using these pre-existing libraries, cheqd accounts can be recovered using the standard BIP44 HDPath for Cosmos SDK chains described below:

"m/44'/118'/0'/0/0"

Consequences

Functionality will be added to VDR Tools SDK to import/export cheqd accounts using mnemonics paired with the --recover flag as done with Cosmos wallets.

Backwards Compatibility

Not applicable, since this is an entirely new feature in VDR Tools SDK for integration with the new blockchain framework.

Positive

  • Adding/recovering cheqd accounts in VDR Tools SDK will follow a similar, familiar process that users have for Cosmos wallets.

Negative

N/A

Neutral

N/A

References

Last updated