0

I building wallet software for monero and I'm running into issues of creating wallets from monero private keys. I'm trying to import a private key as a wallet via monero-wallet-cli command, but the command is interactive. Is there a non-interactive mode setting for the cli command? I tried monero-rpc but that doesn't let you import private keys to create a new wallet.

  • monero private spend keys stored in mysql database as plain text
  • php script that reads the db and runs the monero-wallet-cli command to creat a wallet
  • Can you elaborate on what you are trying to achieve please? If you have created a wallet, you would have the private keys in a file. Thus you would use the wallet RPC open method on the wallet file (which contains the keys). – jtgrassie Oct 18 '18 at 18:05
  • i have a list of private keys that i want to make a wallet for. – Patoshi パトシ Oct 19 '18 at 13:22
  • How are they stored though? And what format? – jtgrassie Oct 19 '18 at 13:24
  • in plain text. its just the private spend key. – Patoshi パトシ Oct 19 '18 at 13:25
  • So a file on disk with hex encoded keys? You commented below MySQL. Please give as much detail as possible instead of drip feeding the question. – jtgrassie Oct 19 '18 at 13:30
3

Looks like you can't provide all arguments in the command, but you can pass them via stdin, and "simulate" the interactive process.

If you use ./monero-wallet-cli --generate-from-spend-key walletName The cli will ask you for the following arguments in this order:

  • private-spend-key
  • wallet-password (twice)
  • seed-language
  • blockchain-height-to-restore-from

You can create a file will all these arguments, each on a new line and tell the cli to read input from this file:

$ cat commands 
8106ca36c4206caba03b463e42ba7bf87fd212789c719fd180666d0d9bec230b
myPassword
myPassword
1
0

Create wallet:

./monero-wallet-cli --generate-from-spend-key walletName < commands
  • what if these private keys are in a mysql database? – Patoshi パトシ Oct 19 '18 at 13:23
  • 1
    You mentioned that a php script reads from the db, so perhaps you should consider run this shell command from the php script. I can't tell you how exactly because I have little knowledge in php, and I also think this is out of the scope of this discussion. – Jona Oct 19 '18 at 14:21

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.