Is it possible to recover all your xmr funds from providing only your private spend key?
That depends on whether the private spend key is deterministic or not.
First, a bit of history. In Monero's early days (before 24 (and later on 25) word mnemonic seeds), Monero's private spend key was non-deterministic. In other words, the private spend key and private view key were both independently and randomly generated. As a result, losing access to either of those would result in you not being able to retrieve your funds (note that the
.keys wallet file would still contain all your keys). Nowadays, however, the private spend key is deterministic and the private view key is derived from the private spend key by hashing the private spend key with Keccak-256 (hash_to_scalar). Subsequently, the private view key is reduced modulo l (sc_reduce32).
Or do you need the private view key too?
Thus, in sum, you need the private view key too if the private spend key is non-deterministic. If, however, the private spend key is deterministic, you can simply derive it.
And how can this be done in the cli if you only had the private spend key?
For "spend" wallets, the CLI will currently only accept full key pairs, i.e., it requires both the private view key and the private spend key in addition to the public address. Thus, the CLI will not derive the private key for you if your spend key is deterministic.
Fortunately, there are tools out there to derive the private view key from a deterministic private spend key. You can, for instance, use this tool from luigi1111 (a Monero core-team member). It is used as follows (in case of merely possessing the deterministic private spend key):
You can either browse to this link or download the ZIP file from here (in case you want to use it locally and/or offline).
Enter your deterministic private spend key in box
2. Hexadecimal Seed:
Gen 3. & 4.
You can now take the private spend key from box
2. Hexadecimal Seed:, the private view key from box
4. Private View Key:, and the public address from box
7. Public Address:. Subsequently, you can proceed to restore / recreate the wallet
--restore-from-keys <arg> flag from the CLI. This is done as follows:
Go to the folder
monero-wallet-cli is located and make sure your cursor isn't located on any of the files. Subsequently do SHIFT + right click and it will give you an option to "Open command window here". Note that, if you're using Windows 10, it'll, most likely, give you an option to open the Powershell. Lastly, type the following command:
monero-wallet-cli.exe --generate-from-keys <new-wallet-name>
If that doesn't work in the Powershell, type:
.\monero-wallet-cli.exe --generate-from-keys <new-wallet-name>
If that doesn't work either in the Powershell, type:
./monero-wallet-cli.exe --generate-from-keys <new-wallet-name>
Linux and Mac OS X:
Open a new terminal from the same directory as
monero-wallet-cli and subsequently type:
./monero-wallet-cli --generate-from-keys <new-wallet-name>
In the GUI you can simply select
Restore a wallet from keys or mnemonic seed on the second page of the wizard (first page is language selection). If you currently have a wallet open, you ought to go to the
Settings page and press
Close wallet first.
To end, a few notes:
In general, when restoring a wallet, one has to add a
Restore height. It's relevance can be found here: What is the relevance of the restore height?
You can currently still generate a non-deterministic private spend key (using the CLI) with the
A relevant SE question for visibility: Can you sweep a wallet if you only have the private spend key?
Luigi111's tool also has a great informational part (at the bottom under
How Cryptonote Addresses Are Created).