monero-ecosystem / monero-python

A comprehensive Python module for handling Monero cryptocurrency
BSD 3-Clause "New" or "Revised" License
246 stars 80 forks source link

Command Line Wallet Backend #87

Closed jeffro256 closed 3 years ago

jeffro256 commented 3 years ago

I think it would be cool if we had a backend that uses the monero-wallet-cli command to interact with a wallet. The backend could take a path/alias/command to the monero-wallet-cli executable and a path to a wallet file. Then we would be able to write something like this:

from monero.wallet import Wallet
from monero.backends.cli.wallet import CLIWallet

wallet = Wallet(CLIWallet(wallet_path='~/Documents/mywallet', exe='/usr/local/bin/monero-wallet-cli'))

# normal wallet commands

I could start working on it if you think its a good idea. The advantage of this is that you don't have to have a wallet server running on your computer.

emesik commented 3 years ago

Been there, done that. Talking to monero-wallet-cli via pipes is a mess of lags and parsing problems. Definitely, I don't recommend.

Is that a general idea, or there's an objective you want to achieve?

jeffro256 commented 3 years ago

Even though it is a complete mess, I've personally had need to do that before. A project I'm currently working on communicates with monero-wallet-cli on a user's computer to grab its one-time outputs and then searches the blockchain for txs which use those outputs as decoys.

I wish there was a --json option or something similar to get some standardized, easily parse-able output from monero-wallet-cli

jeffro256 commented 3 years ago

I guess I'll close this for right now because it isn't THAT important.

emesik commented 3 years ago

BTW, I've just realized I have similar project in my github. Just in case you wanted to check alternative implementation: https://github.com/emesik/monerowalletpool/blob/master/monerowalletpool/__init__.py However, I don't recommend using it.

jeffro256 commented 3 years ago

That is some good code, but yeah it looks like more trouble than it's worth.