def do_create(self, arguments):
item = get_arg(arguments)
if item and item == 'wallet':
path = get_arg(arguments, 1)
if path:
if os.path.exists(path):
print("File already exists")
return
passwd1 = prompt("[Password 1]> ", is_password=True)
passwd2 = prompt("[Password 2]> ", is_password=True)
if passwd1 != passwd2 or len(passwd1) < 10:
print("please provide matching passwords that are at least 10 characters long")
return
try:
self.Wallet = UserWallet.Create(path=path, password=passwd1)
contract = self.Wallet.GetDefaultContract()
key = self.Wallet.GetKey(contract.PublicKeyHash)
print("Wallet %s " % json.dumps(self.Wallet.ToJson(), indent=4))
print("pubkey %s " % key.PublicKey.encode_point(True))
except Exception as e:
print("Exception creating wallet: %s " % e)
self.Wallet = None
if os.path.isfile(path):
try:
os.remove(path)
except Exception as e:
print("Could not remove {}: {}".format(path, e))
return
self._walletdb_loop = task.LoopingCall(self.Wallet.ProcessBlocks)
self._walletdb_loop.start(1)
else:
print("Please specify a path")
评论列表
文章目录