diff --git a/bin/linux/MultiWallet_README.md b/bin/linux/MultiWallet_README.md new file mode 100644 index 000000000..c81adbc83 --- /dev/null +++ b/bin/linux/MultiWallet_README.md @@ -0,0 +1,23 @@ +FLO Core MultiWallet + +This executable file is used to run more than 1 wallet at a same time + +Usage: + + ./multiWallet -create [walletName] + creates a wallet under 'walletName' if specified + else creates wallet with name 'floxxxxxx' + + ./multiWallet [option] + executes the command in wallet 'walletName' + +commands: + + flo-qt - open FLO Core Wallet + flo-cli - run cli commands + flod - run FLO daemon + +for more info on each commands use option -help (or) -? +./flo-qt -? +./flo-cli -? +./flod -? diff --git a/bin/linux/multiWallet b/bin/linux/multiWallet new file mode 100755 index 000000000..b6c53f056 Binary files /dev/null and b/bin/linux/multiWallet differ diff --git a/bin/linux/multiWallet.py b/bin/linux/multiWallet.py new file mode 100644 index 000000000..674404458 --- /dev/null +++ b/bin/linux/multiWallet.py @@ -0,0 +1,81 @@ +import subprocess +import random +import sys +import os +import socket + + +def _start(): + + if(len(sys.argv)<2): + _help() + print('Error : too few parameters') + + elif(sys.argv[1] in ['-help','-?']): + _help() + + elif(sys.argv[1]=='-create'): + try: + foldername = sys.argv[2] + except: + rand = random.randint(1,999999) + foldername = 'flo'+str(rand) + print('Creating a new Wallet...') + try: + subprocess.call(['mkdir','-p',foldername]) + except Exception as e: + print('Wallet Creation Failed : '+str(e)) + exit(0) + print('Created wallet '+foldername) + print('To use wallet : '+sys.argv[0]+' '+foldername) + + elif(len(sys.argv)<3): + _help() + print('Error : too few parameters (command missing)') + + elif(sys.argv[2] in ['flo-qt','flo-cli','flod']): + + #use this for find ip n available port using socket instead of random port + localip=socket.gethostbyname(socket.gethostname()) + ''' + for p in range(0, 65535): + with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock: + if(!sock.connect_ex(('localhost', p))) + port = p + break; + ''' + #localip = '0.0.0.0' + port = str(random.randint(2000,10000)) + path=os.getcwd() + cmd = ['./'+sys.argv[2]] + ['-conf='+path+'/'+sys.argv[1]+'/flo.conf','-datadir='+sys.argv[1],'-bind='+localip+':'+port] + sys.argv[3:] + #print(cmd) + subprocess.run(cmd) + else: + _help() + print('Error : command '+sys.argv[2]+' not recognised') + +def _help(): + help_data=f""" +FLO Core MultiWallet + +Usage: + + {sys.argv[0]} -create [walletName] + creates a wallet under 'walletName' if specified + else creates wallet with name 'floxxxxxx' + + {sys.argv[0]} [option] + executes the command in wallet 'walletName' + +commands: + + flo-qt - open FLO Core Wallet + flo-cli - run cli commands + flod - run FLO daemon + +for more info on each commands use option -help (or) -? + +""" + print(help_data) + +_start() \ No newline at end of file