bitcoind-walletunlock.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/usr/bin/env python3
  2. #
  3. # mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution
  4. # Copyright (C) 2013 by philemon <mmgen-py@yandex.com>
  5. #
  6. # This program is free software: you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation, either version 3 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. """
  19. bitcoind-walletunlock.py: Unlock a Bitcoin wallet securely
  20. """
  21. import sys,getpass
  22. from mmgen.common import *
  23. opts_data = {
  24. 'prog_name': sys.argv[0].split('/')[-1],
  25. 'desc': "Unlock a Bitcoin wallet securely",
  26. 'usage': "[opts]",
  27. 'options': """
  28. -h, --help Print this help message
  29. -e, --echo-passphrase Print passphrase to screen when typing it
  30. --, --testnet Use testnet instead of mainnet
  31. """
  32. }
  33. cmd_args = opts.init(opts_data)
  34. password = (getpass.getpass,raw_input)[bool(opt.echo_passphrase)]('Enter passphrase: ')
  35. bitcoin_connection().walletpassphrase(password, 9999); msg('OK')