4

I am trying to use RPC to perform such actions as:

  1. Check balance and make transfers using selected wallet

  2. The needed wallet should be unlocked just before any tranfer and locked immediately after

monero-wallet-rpc (with --wallet-dir option) can do the first part, but I have some problems with the second.

When I start monero-wallet-rpc, no wallet is loaded and I should manually do that using "open_wallet" function with filename and password parameters. After that, I can request balance ("getbalance") or transfer ("transfer") funds, none of them needs password anymore. I tried to close wallet using "stop_wallet" command to "lock" the wallet, but it stops the entire monero-wallet-rpc daemon (so I can't anymore open wallets without restarting monero-wallet-rpc).

The only solution that I found to solve the problem is to use "open_wallet" on some temporary wallet, so that it replaces the "battle" one, but I am not sure, that "battle" wallet is fully closed and the whole solution doesn't seem to be correct.

What else can I do to achieve listed requirements? May be there are some other tools (or options) that can be used?

3 Answers 3

2

Recent monero code has a close_wallet RPC, as seen in https://github.com/monero-project/monero/pull/4007.

This call will close the currently opened wallet, if any, if you've started monero-wallet-rpc with --wallet-dir.

0

Currently, using a dummy/empty/temp wallet as you described is the only option via the wallet RPC. Furthermore, open_wallet does indeed close any previously opened wallet.

0

As @user36303 mentioned, in version 0.13.0.x a "close_wallet" command appeared. So it is now possible to open wallet with "open_wallet" command, sync it with "refresh" command (it can take some time), store updated state with "store", perform activities and close with "close_wallet".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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