Is it possible to use bip39 mnemonic used in btc/eth etc and generate monero keys ?
If not possible is it possible to generate a monero compatible mnemonic deterministically from bip39 mnemonics ?
There is an option called --generate-from-spend-key
in the monero-wallet-cli
program to generate a wallet from a private spend key.
To avoid having to rely on tools via web sites which may not be around in the future, you can use the following Linux/MacOS command to generate a Monero private spend key from your BIP39 Mnemonic:
echo "ibase=16;obase=10;"`read line && echo $line | shasum -a 256 \
| tr '[:lower:]' '[:upper:]' | awk {'print $1'}`" % \
1000000000000000000000000000000014DEF9DEA2F79CD65812631A5CF5D3ED" | bc
What this does is take your BIP39 mnemonic (or other suitable key with sufficient entropy), and produce a SHA-256 hash from it (SHA-256 hashes are suitably uniformly distributed). Monero private keys must be lower than 2^252+27742317777372353535851937790883648493
(which is 1000000000000000000000000000000014DEF9DEA2F79CD65812631A5CF5D3ED
in hex), and so the command reduces it accordingly. This is equivalent to the Monero sc_reduce32()
function.
Beware that input to this command is case sensitive, in order to allow it to be used with any kind of source input.
The short answer is yes. Here is a short and sweet complete working example that was posted almost two years ago. Also look at adjacent examples for compting ETH, ZEC, and DASH using BIPs 32/39/44.
The issue is how to do it in an way so that the restoration process is interoperable between different wallet types. For example, we will shortly see if Monero is interoperable between a Trezor Model T and a LedgerWallet Nano S. Take a look at the bounty offered at https://monero.stackexchange.com/questions?sort=featured.
For example, ETH hardware wallet BIP 32 paths are not the same for Trezor and LedgerWallet hardware devices. This impacts recovery interoperability in heterogeneous wallet environments. Pretending and extending is not ultimately good for hardware wallet consumers.