I have an encrypted private key that I created using NEON. I need access to my private key. There doesn't seem to be any option to export the private key, or at least convert this into a keystore file. Am I missing something?
On a side note, is there any other way (a tool) to decrypt the encrypted key into a raw private key?
For another tool, you could use neo-python to import your NEP-2 encrypted private key, and export it in WIF format with export wif {address} if you want that. If by raw private key you mean the 32 raw bytes that make up your private key, you'll need to decide in what representation you want to get them out (32 int values?). In neo-python, the private key is stored in KeyPair.PrivateKey, and you could access that after importing: https://github.com/CityOfZion/neo-python/blob/master/neo/Wallets/KeyPair.py#L46
Unfortunately the term private key is used mostly for referring to the unencrypted wif formatted key (len: 52), not what technically is the private key (len:32). As what @metachris said, start neo-python, open or create a wallet, and import your current encrypted wif (len:58) using import nep2 <insert key here>. Then run the export command he described.
Yes, I meant the WIF key. Thanks for the info.
However, it would still be nice if NEON supported this somewhere in the UI. Any plans to add this feature? I'm sure it's not much work I'd imagine.
Adding it should indeed not be much work. I think it will come down to the question if it fits the purpose of the wallet. Right now exporting the wallet keys makes it somewhat 'safe' for it's users because it's always in encrypted form. I guess it comes down to what @snowypowers as the maintainer thinks of it.
If it's just a 1 time thing and you do not want to setup any development environment you could do the following.
{} at the bottom left of that window to make it slightly easier to read.s.getWIFFromPrivateKey. There should be only 2 hits, and it's the second hit. Put a breakpoint on the line below it by clicking the line number on the left of that line such that it turns blue (see screenshot)Return value: <a long string>. That's your unencrypted private key.If you already have a development environment I'd would do the following:
node_modules/neon-js/ and put a console.log/print statement before this line: https://github.com/CityOfZion/neon-js/blob/master/src/wallet/nep2.js#L89I am not the maintainer of neon-wallet. Just neon-js :)
The tech is definitely there, just a matter of presenting it properly so it does not pop up unintentionally. I would say its not high on priority list.
https://github.com/snowypowers/ansy works for your needs :)
@ixje thanks for that, worked fine!
Still would be nice to leave this open and to implement some way to get the PK/WIF in NEON UI.
You're welcome. Glad it solved your short term needs.
Adding it should indeed not be much work. I think it will come down to the question if it fits the purpose of the wallet. Right now exporting the wallet keys makes it somewhat 'safe' for it's users because it's always in encrypted form. I guess it comes down to what @snowypowers as the maintainer thinks of it.
If it's just a 1 time thing and you do not want to setup any development environment you could do the following.
- start neon wallet
- In the "View" menu choose "Toggle developer tools".
- in the new 'window' that shows up select "bundle.js" to show the source code. For ease of use press the
{}at the bottom left of that window to make it slightly easier to read.- press cmd+f or ctrl+f and search for
s.getWIFFromPrivateKey. There should be only 2 hits, and it's the second hit. Put a breakpoint on the line below it by clicking the line number on the left of that line such that it turns blue (see screenshot)- in the GUI use the "Login with an encrypted key" menu and wait until the breakpoint hits.
- now look at the right side and you'll see
Return value: <a long string>.That's your unencrypted private key.If you already have a development environment I'd would do the following:
- go into
node_modules/neon-js/and put a console.log/print statement before this line: https://github.com/CityOfZion/neon-js/blob/master/src/wallet/nep2.js#L89
there is only one hit for s.getWIFFromPrivateKey for me.
I'm also trying to export my private key because I erroneously sent ONT to my NEON wallet and it isn't supported anymore, even though I can see it on the block explorer.
The "workaround" comment was made years ago. It could very well be that in the latest version there is now only one call to that function. Perhaps try what you see on the first hit
Most helpful comment
For another tool, you could use neo-python to import your NEP-2 encrypted private key, and export it in WIF format with
export wif {address}if you want that. If by raw private key you mean the 32 raw bytes that make up your private key, you'll need to decide in what representation you want to get them out (32 int values?). In neo-python, the private key is stored inKeyPair.PrivateKey, and you could access that after importing: https://github.com/CityOfZion/neo-python/blob/master/neo/Wallets/KeyPair.py#L46