Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_mnemonic(seed):
return ' '.join(mnemonic.mn_encode(seed))
elif cmd2 == 'history':
print "show the transaction history"
elif cmd2 == 'label':
print "assign a label to an item"
elif cmd2 == 'gui':
print "start the GUI"
elif cmd2 == 'mktx':
print "create a signed transaction. password protected"
print "syntax: mktx [label]"
elif cmd2 == 'seed':
print "show generation seed of your wallet. password protected."
elif cmd == 'seed':
import mnemonic
seed = wallet.pw_decode( wallet.seed, password)
print seed, '"'+' '.join(mnemonic.mn_encode(seed))+'"'
elif cmd == 'validateaddress':
addr = args[1]
print wallet.is_valid(addr)
elif cmd == 'balance':
try:
addrs = args[1:]
except:
pass
if addrs == []:
c, u = wallet.get_balance()
if u:
print c*1e-8, u*1e-8
else:
print c*1e-8
return
else:
password = None
try:
seed = wallet.pw_decode(wallet.seed, password)
except:
QMessageBox.warning(parent, _('Error'),
_('Incorrect Password'), _('OK'))
return
dialog = QDialog(None)
dialog.setModal(1)
dialog.setWindowTitle(_("Seed"))
brainwallet = ' '.join(mnemonic.mn_encode(seed))
msg = _('<p>"%s"</p>'
"<p>If you memorise or write down these 12 words, you will always be able to recover your wallet.</p>"
"<p>This is called a 'BrainWallet'. The order of words is important. Case does not matter (capitals or lowercase).</p>") % brainwallet
main_text = QLabel(msg)
main_text.setWordWrap(True)
logo = QLabel()
logo.setPixmap(QPixmap(":icons/seed.png").scaledToWidth(56))
if parent:
app = parent.app
else:
app = QApplication
copy_function = lambda: app.clipboard().setText(brainwallet)
# Count number of hex digits for informational purposes
if len(hex_seed) != len(seed):
hex_digit_count = 0
for h in seed:
if '0' <= h <= '9' or 'a' <= h <= 'f':
hex_digit_count += 1
warn('info: {} out of {} characters in decrypted seed are lowercase hex digits'
.format(hex_digit_count, len(seed)))
if len(hex_seed) < 8:
warn('length of valid hex-encoded digits is less than 8, giving up')
return seed, None
else:
if len(hex_seed) % 8 != 0:
warn('length of hex-encoded digits is not divisible by 8, some digits will not be included in the mnemonic')
return seed, ' '.join(mnemonic.mn_encode(hex_seed))