Search code examples
nearprotocol

How to get the NEAR public key from the ledger device?


I have a near account with the key that is not on the ledger, and a ledger device with near app.

I want to add the key from the ledger to my near account. For that I need to know the public key associated with (some path on) the ledger. How can I get such public key?


Solution

  • If you want to generate the keys you can do it with the near-cli tool and call the command:

    near generate-key key --useLedgerKey="44'/397'/0'/0'/1'"
    near generate-key key --useLedgerKey="44'/397'/0'/0'/2'"
    

    You can find more in the docs: https://docs.near.org/docs/development/near-cli