commit 50305e1f57bca1f499430a3069d189e2f619e669
parent cd4afb89ea38176541abeddec8fa814734acb967
Author: thomasv <thomasv@gitorious>
Date: Sat, 2 Feb 2013 11:46:02 +0100
menu option to show private key
Diffstat:
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/lib/gui_qt.py b/lib/gui_qt.py
@@ -1088,6 +1088,7 @@ class ElectrumWindow(QMainWindow):
menu.addAction(_("Request amount"), lambda: self.edit_amount())
menu.addAction(_("View QR"), lambda: ElectrumWindow.show_qrcode(_("Address"),"bitcoin:"+addr) )
menu.addAction(_("Edit label"), lambda: self.edit_label(True))
+ menu.addAction(_("Private key"), lambda: self.view_private_key(addr))
menu.addAction(_("Sign message"), lambda: self.sign_message(addr))
if addr in self.wallet.imported_keys:
menu.addAction(_("Remove from wallet"), lambda: self.delete_imported_key(addr))
@@ -1262,7 +1263,7 @@ class ElectrumWindow(QMainWindow):
def create_wall_tab(self):
from qt_console import Console
self.console = console = Console()
- console.updateNamespace({'wallet' : self.wallet, 'interface' : self.wallet.interface})
+ console.updateNamespace({'wallet' : self.wallet, 'interface' : self.wallet.interface, 'gui':self})
return console
@@ -1444,6 +1445,24 @@ class ElectrumWindow(QMainWindow):
d.setLayout(vbox)
d.exec_()
+ def view_private_key(self,address):
+ if not address: return
+ if self.wallet.use_encryption:
+ password = self.password_dialog()
+ if not password:
+ return
+ else:
+ password = None
+
+ try:
+ pk = self.wallet.get_private_key_base58(address, password)
+ except BaseException, e:
+ self.show_message(str(e))
+ return
+
+ QMessageBox.information(self, _('Private key'), 'Address'+ ': ' + address + '\n\n' + _('Private key') + ': ' + pk, _('OK'))
+
+
def sign_message(self,address):
if not address: return
d = QDialog(self)
diff --git a/lib/wallet.py b/lib/wallet.py
@@ -147,7 +147,6 @@ class Wallet:
# encrypt
self.seed = self.pw_encode( seed, password )
-
def init_mpk(self,seed):
# public key
curve = SECP256k1