With cardano-cli address key-gen
, what is the difference between a normal key (obtained with --normal-key
) and an extended key (obtained with --extended-key
)?
1 Answer
I'll preface with the note that cardano-cli
is a legacy project from the Byron era prior to the restructuring of cardano-sl
into the modern infrastructure used today. You likely want to use the cardano-address if you can. The Adrestia repo keeps track of the official tools, libraries, and APIs as well as their support for the various eras.
To give a short explanation, the way key generation in Cardano works is as follows:
You create a Recovery or Seed Phrase. This is a deterministic seed that then derives your extended private key. This is the famous 24 word phrase that you store. It derives your xprv key but it does not represent it. This means if you do not have a seed phrase, you can not get one and you'll have to create a new wallet to get it.
You create the Extended Private Key. This is the root key from which all other keys are derived (including the extended public key). This key can either be created from scratch or derived from a seed phrase. If you want your key to be loadable into Daedalus/Yoroi without poking around in the internals and manually editing the SQLite database, you need to start from a seed phrase.
You derive Child Private Keys. These are various keys that serve specific purposes. Examples include the delegation(staking) keys, the various stake pool keys, and spending keys. As the protocol grows, there'll be more of these keys however as long as you have your extended private key or seed phrase, you'll be able to gain access to those with little to no action required.
You derive whatever else from the Child Private Keys. This is where you would derive addresses, stake pool certificates, etc. This is essentially all handled by the node itself and you don't really have to worry about much of this stuff unless you are doing something specific.
So in summary, the seed phrase is the "seed" that creates everything else (and is easy to store/remember), the extended key is your "master key", and the normal key (now called a spending key) derives from the extended key and lets you spend your funds.
Also note that the terminology differs a bit between eras. Byron used a rather different key system so you should generally avoid using it unless you absolutely have to. Icarus established the basis for modern key derivation in the Cardano ecosystem and Shelley has extended upon that (with staking related keys).
-
1The Adrestia repo README lists
cardano-wallet
among other tools so you seem to be implying thatcardano-cli
is deprecated and that I should usecardano-wallet
instead. I'm trying to mint some native tokens, which I know how to do withcardano-cli
. Is minting supported by newer tools likecardano-wallet
? A cursory inspection of thecardano-wallet
help reveals no minting functionality. Ifcardano-cli
is the only way to mint native tokens, then I'm missing the bridge between howcardano-cli
manages keys and addresses and how the newer tools (e.g. cardano-address) do it. Commented May 28, 2021 at 12:19 -
I'll report back after I do a bit of research first. From my understanding
cardano-cli
kinda supports Shelley and Mary. I think the development of native assets started oncardano-cli
and is still being ported over tocardano-wallet
. It is ultimately just metadata Tx whichcardano-wallet
supports. From what I can tell atm it looks like if you want to mint native assets withcardano-wallet
, you can do it but it's a manual process. The fields and validation seem to exist in the backend but there doesn't seem to be a cli interface other than the metadata interface exposed at the moment. Commented May 29, 2021 at 14:10