electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 4d3159a74a78b4c972ced4d3a997d203bad4c825
parent 89d6971b8c1ec474f58b08a642e2855be48f120b
Author: ThomasV <thomasv@gitorious>
Date:   Sat,  5 Nov 2011 15:06:43 +0100

use 'seed' instead of 'passphrase'

Diffstat:
Mclient/electrum | 26+++++++++++++-------------
Mclient/gui.py | 24++++++++++++------------
2 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/client/electrum b/client/electrum @@ -171,7 +171,7 @@ oid_secp256k1 = (1,3,132,0,10) SECP256k1 = ecdsa.curves.Curve("SECP256k1", curve_secp256k1, generator_secp256k1, oid_secp256k1 ) -no_wallet_message = "Wallet file not found.\nPlease provide a passphrase and a password. The passphrase will be used as a seed to generate Bitcoin addresses. It should be long and random, and nobody should be able to guess it. Memorize it, or write it down and keep it in a vault. The password will be used to encrypt your local wallet file. You will need to enter your password everytime you use your wallet. If you lose your password, you can still recover your wallet with the passphrase." +no_wallet_message = "Wallet file not found.\nPlease provide a seed and a password. The seed will be to generate Bitcoin addresses. It should be long and random, and nobody should be able to guess it. Memorize it, or write it down and keep it in a vault. The password will be used to encrypt your local wallet file. You will need to enter your password everytime you use your wallet. If you lose your password, you can still recover your wallet with the seed." def filter(s): out = re.sub('( [^\n]*|)\n','',s) @@ -229,7 +229,7 @@ class Wallet: # saved fields self.use_encryption = False self.addresses = [] - self.passphrase = '' # encrypted + self.seed = '' # encrypted self.private_keys = repr([]) # encrypted self.change_addresses = [] # index of addresses used as change self.status = {} # current status of addresses @@ -256,9 +256,9 @@ class Wallet: return ADDRESS_RE.match(addr) def create_new_address(self, for_change, password): - passphrase = self.pw_decode( self.passphrase, password) + seed = self.pw_decode( self.seed, password) i = len( self.addresses ) - len(self.change_addresses) if not for_change else len(self.change_addresses) - seed = Hash( "%d:%d:"%(i,for_change) + passphrase ) + seed = Hash( "%d:%d:"%(i,for_change) + seed ) order = generator_secp256k1.order() secexp = ecdsa.util.randrange_from_seed__trytryagain( seed, order ) secret = SecretToASecret( ('%064x' % secexp).decode('hex') ) @@ -279,7 +279,7 @@ class Wallet: return address def recover(self, password): - passphrase = self.pw_decode( self.passphrase, password) + seed = self.pw_decode( self.seed, password) # todo: recover receiving addresses from tx num_gap = 0 while True: @@ -316,7 +316,7 @@ class Wallet: def save(self): s = repr( (self.use_encryption, self.fee, self.host, self.blocks, - self.passphrase, self.addresses, self.private_keys, + self.seed, self.addresses, self.private_keys, self.change_addresses, self.status, self.history, self.labels, self.addressbook) ) f = open(wallet_path,"w") @@ -332,7 +332,7 @@ class Wallet: return False try: (self.use_encryption, self.fee, self.host, self.blocks, - self.passphrase, self.addresses, self.private_keys, + self.seed, self.addresses, self.private_keys, self.change_addresses, self.status, self.history, self.labels, self.addressbook) = ast.literal_eval( data ) except: @@ -590,9 +590,9 @@ if __name__ == '__main__': if not wallet.read(): print no_wallet_message - passphrase = raw_input("Enter passphrase: ") - if len(passphrase)<20: - print "Passphrase too short. Please at least 20 characters" + seed = raw_input("Enter seed: ") + if len(seed)<20: + print "Seed too short. Please at least 20 characters" exit(1) if has_encryption: password = getpass.getpass("Password (hit return if you do not wish to encrypt your wallet):") @@ -605,7 +605,7 @@ if __name__ == '__main__': password = None print "in order to use wallet encryption, please install pycrypto (sudo easy_install pycrypto)" - wallet.passphrase = wallet.pw_encode( passphrase, password) + wallet.seed = wallet.pw_encode( seed, password) print "server name and port number (default: ecdsa.org:50000)" host = raw_input("server:") @@ -702,7 +702,7 @@ if __name__ == '__main__': elif cmd == 'password': try: - passphrase = wallet.pw_decode( wallet.passphrase, password) + seed = wallet.pw_decode( wallet.seed, password) private_keys = ast.literal_eval( wallet.pw_decode( wallet.private_keys, password) ) except: print "sorry" @@ -710,7 +710,7 @@ if __name__ == '__main__': new_password = getpass.getpass('New password:') if new_password == getpass.getpass('Confirm new password:'): wallet.use_encryption = (new_password != '') - wallet.passphrase = wallet.pw_encode( passphrase, new_password) + wallet.seed = wallet.pw_encode( seed, new_password) wallet.private_keys = wallet.pw_encode( repr( private_keys ), new_password) wallet.save() else: diff --git a/client/gui.py b/client/gui.py @@ -39,16 +39,16 @@ def numbify(entry, is_int = False): def init_wallet(wallet): if not wallet.read(): - passphrase = None - while not passphrase: + seed = None + while not seed: dialog = gtk.MessageDialog( parent = None, flags = gtk.DIALOG_MODAL, buttons = gtk.BUTTONS_OK_CANCEL, - message_format = "Wallet not found. Please enter a passphrase to create or recover your wallet. Minimum length: 20 characters" ) + message_format = "Wallet not found. Please enter a seed to create or recover your wallet. Minimum length: 20 characters" ) p_box = gtk.HBox() - p_label = gtk.Label('Passphrase:') + p_label = gtk.Label('Seed:') p_label.show() p_box.pack_start(p_label) p_entry = gtk.Entry() @@ -59,17 +59,17 @@ def init_wallet(wallet): dialog.show() r = dialog.run() - passphrase = p_entry.get_text() + seed = p_entry.get_text() dialog.destroy() if r==gtk.RESPONSE_CANCEL: exit(1) - if len(passphrase) < 20: - print len(passphrase) - passphrase = None + if len(seed) < 20: + print len(seed) + seed = None # disable password during recovery # change_password_dialog(None, wallet) - wallet.passphrase = passphrase + wallet.seed = seed run_settings_dialog( None, wallet, True) @@ -110,7 +110,7 @@ def settings_dialog(wallet, is_recover): gap_entry.connect('changed', numbify, True) gap_entry.show() gap.pack_start(gap_entry,False,False, 10) - add_help_button(gap, 'The maximum gap that is allowed between unused addresses in your wallet. During wallet recovery, this parameter is used to decide when to stop the recovery process. If you increase this value, you will need to remember it in order to be able to recover your wallet from passphrase.') + add_help_button(gap, 'The maximum gap that is allowed between unused addresses in your wallet. During wallet recovery, this parameter is used to decide when to stop the recovery process. If you increase this value, you will need to remember it in order to be able to recover your wallet from seed.') gap.show() host = gtk.HBox() @@ -227,7 +227,7 @@ def change_password_dialog(button, wallet, icon): return try: - passphrase = wallet.pw_decode( wallet.passphrase, password) + seed = wallet.pw_decode( wallet.seed, password) private_keys = ast.literal_eval( wallet.pw_decode( wallet.private_keys, password) ) except: show_message("Incorrect password") @@ -238,7 +238,7 @@ def change_password_dialog(button, wallet, icon): return wallet.use_encryption = (new_password != '') - wallet.passphrase = wallet.pw_encode( passphrase, new_password) + wallet.seed = wallet.pw_encode( seed, new_password) wallet.private_keys = wallet.pw_encode( repr( private_keys ), new_password) wallet.save()