def create_wallet(self): """ Launch wasabi, generate wallet and select it. """ self.clear() if advanced.interpreter.is_wasabi_running(): raise MyExceptions.AlreadyRunning( 'Wasabi is currently running, shut it down ' + 'and launch spawn.py again') wallets_path = self.wasabi_path + 'Wallets' ## Copies the placeholder.json wallet file into the Wasabi's wallets ## folder, needed to start the daemon the first time. if 'placeholder.json' not in listdir(wallets_path): copy('advanced/placeholder.json', wallets_path) self.wassabee = advanced.interpreter.launch_wasabi( 'placeholder', self.launch_path) if not self.wassabee: raise MyException.FailedLaunch('Wasabi has not started') wallet = advanced.interpreter.generate_wallet(self.RpcUser, self.RpcPassword, self.pwd) self.clear() print('Recovery words:\n{}'.format(wallet) + '\n\nThey are encrypted by Wasabi in the ' 'spawned.json wallet file' '\nBackup either the words list or the wallet file!') advanced.interpreter.select_wallet(self.RpcUser, self.RpcPassword) return
def create_wallet(self): """ Launch wasabi, generate wallet and select it. """ self.clear() if advanced.interpreter.is_wasabi_running(self.RpcUser, self.RpcPassword): raise MyExceptions.AlreadyRunning( 'Wasabi is currently running, shut it down ' + 'and launch spawn.py again' ) self.wassabee = advanced.interpreter.launch_wasabi( self.RpcUser, self.RpcPassword, self.wasabi_path, launch_path = self.launch_path, ) wallet = advanced.interpreter.generate_wallet(self.RpcUser, self.RpcPassword, self.pwd) self.clear() print('Recovery words:\n{}'.format(wallet) + '\n\nThey are encrypted by Wasabi in the ' 'spawned.json wallet file' '\nBackup either the words list or the wallet file!' ) self.choose_wallet() return
def __init__(self, settings): """ Initialize the Handler with the settings and check script status looking for spawned.json in Wasabi directory. """ self.wasabi_path = str(Path.home())+'/.walletwasabi/client/' try: self.launch_path = settings['launch_path'] self.auto_generate = settings['auto_generate'] self.auto_backup = settings['auto_backup'] self.RpcUser = settings['JsonRpcUser'] self.RpcPassword = settings['JsonRpcPassword'] self.observer = settings['observer'] self.num_addresses = settings['num_addresses'] self.destination = settings['destination'] except(KeyError): raise KeyError( 'settings.py is messed up, check the settings are ' + 'okay or download the repository again\n' ) self.check_settings() try: with open(self.wasabi_path+'Config.json') as config: lines = config.readlines() except FileNotFoundError: raise FileNotFoundError( '"Config.json" file is missing, if this ' + 'is the first Wasabi run, you have to ' + 'launch it manually.\n This operation has ' + 'to be done just once as long as ".walletwasabi" ' + 'folder is not removed' ) for line in lines: if '"JsonRpcServerEnabled": true' in line: rpc_enabled = True break elif '"JsonRpcServerEnabled": false' in line: rpc_enabled = False break if not rpc_enabled: raise MyExceptions.RpcDisabled( 'RPC server is not enabled, turn it on ' + 'changing "JsonRpcServerEnabled" to true in the ' + 'Wasabi config.json file' ) # If spawned wallet already there we can skip all the wallet # and password creation if 'spawned.json' in listdir(self.wasabi_path+'Wallets'): self.status = 'mixing' else: self.status = 'first_run' if advanced.interpreter.is_wasabi_running(self.RpcUser, self.RpcPassword): raise MyExceptions.AlreadyRunning( 'Wasabi is currently running, shut it down ' + 'and launch spawn.py again' )
def start_mixing(self): """ Launch Wasabi daemon with spawned wallet and select it. """ self.clear() # Wasabi should never be running at this point # but better safe than sorry if advanced.interpreter.is_wasabi_running(): raise MyExceptions.AlreadyRunning( 'Wasabi is currently running, shut it down ' + 'and launch spawn.py again') self.wassabee = advanced.interpreter.launch_wasabi('spawned', self.launch_path, self.destination, pwd=self.pwd) if not self.wassabee: raise MyException.FailedLaunch('Wasabi has not started') advanced.interpreter.select_wallet(self.RpcUser, self.RpcPassword) del self.pwd return