Ganache-cli mnemonic flag

Hello,

I have been trying to create a local blockchain with the help of ganache-cli. For this I have already my mnemonic phrase, which I want to use for creating my wallets (Lets imagine I am using the following mnemonic: horn hammer original lemon chapter weird gun pond fortune blush cupboard cat).
So when I execute the following command:

npx ganache-cli --deterministic --mnemonic "horn hammer original lemon chapter weird gun pond fortune blush cupboard cat"

I get my wallets, which dont correspond with the wallets i had previously for this mnemonic phrase. I get the following in the ganache-cli result:

HD Wallet
==================
Mnemonic:      horn
Base HD Path:  m/44'/60'/0'/0/{account_index}

Apparently it registers only horn as the phrase. Can anybody help me and tell me how i have to write the input for the mnemonic flag so that I can let ganache-cli recognize the whole mnemonic phrase?

1 Like

Hi @Krylli96,

You only need to specify --mnemonic

From: https://github.com/trufflesuite/ganache-cli

  • -m or --mnemonic : Use a bip39 mnemonic phrase for generating a PRNG seed, which is in turn used for hierarchical deterministic (HD) account generation.
  • -d or --deterministic : Generate deterministic addresses based on a pre-defined mnemonic.

When I run it (ganache-cli is one of the only things I have installed globally) it shows multiple addresses.

If you have issues with other wallets, then check that they are using the same derivation path m/44'/60'/0'/0/

ganache-cli

$ ganache-cli --mnemonic "horn hammer original lemon chapter weird gun pond fortune blush cupboard cat"
Ganache CLI v6.12.1 (ganache-core: 2.13.1)

Available Accounts
==================
(0) 0x5fe9dD4c80ab7742B62Fb40CE1fBE37D226645A1 (100 ETH)
(1) 0xfB3Ce1611272f443B406BcE2e2dd1eEA85Ad340E (100 ETH)
(2) 0x72A4Bbe493FC0A724460C9940eE6FAE5f9209D61 (100 ETH)
(3) 0x52CF8bDea5BAd21DFE627Bef7a5efc4558665884 (100 ETH)
(4) 0x7005eae3556cba0A81c2bf486d98a1a033CEa180 (100 ETH)
(5) 0x807dC7A1dDC10350E8197607e267650369ed5033 (100 ETH)
(6) 0x8a0d5408cCCe5F6d7496515C960Aa6D83c352651 (100 ETH)
(7) 0x2C84990BbF49D95d9c826D061aDd2b538ffFda1B (100 ETH)
(8) 0xAF508a3EC6A80c6f6Bd916e346ECc0b6937B60bB (100 ETH)
(9) 0x388Ef493FaD03e3C73844Be82317017dEfdf6899 (100 ETH)

Private Keys
==================
(0) 0xb2c488b68a775c823263a436bbb8876c4ba64c4b21a0713c5fede5ad369ef89b
(1) 0x5202280f7887b8962a7351b037eb76392fd6dec3d979a6312933a160271fb266
(2) 0xfc69e6be7682c78b985bddc4d35c149313c03f122529e76d1666397533f1a480
(3) 0xb9010af24dc60e6566cf34beda73be9e706d49e18e13916fb6d475cea432118b
(4) 0xb04ebd6ac8c8fd8331d818128f9506816db26f80bf0dc992a8db987fb25fef8c
(5) 0x0a7f2d5ab35209dd138933297a411a93226284980fa541d36376eff313b4c428
(6) 0xbf177ef6f776c127fd172f236e82fcc5911ef055f551c5f6ac3b0c33a100c509
(7) 0x0591fa96aefe23911faba79f3cc699c9d104dfa49097b81ef2560cccc7775fb3
(8) 0xa72626308bbe1c4ea491b1f4a861636b008b25d743deb912f70b2ff9678cf97e
(9) 0x357304b1e6db5691b6102341f28c676905535d1c17cc64ef4d591c009776d742

HD Wallet
==================
Mnemonic:      horn hammer original lemon chapter weird gun pond fortune blush cupboard cat
Base HD Path:  m/44'/60'/0'/0/{account_index}

Gas Price
==================
20000000000

Gas Limit
==================
6721975

Call Gas Limit
==================
9007199254740991

Listening on 127.0.0.1:8545
1 Like

Thank you very much or the quick answer :slight_smile:
Apparently it was also the npx that i put at the beginning, which messed up the process.
Now its working!

1 Like

Hi @Krylli96,

I was also able to get it to work using:

$ npx ganache-cli --mnemonic "horn hammer original lemon chapter weird gun pond fortune blush cupboard cat"

These days I tend to only have ganache-cli installed globally, see: Installing packages locally rather than globally (npx).

1 Like