def METHOD_NAME(numnodes, printnodes):
	os.system('killall lzilliqa')
	if os.path.exists(LOCAL_RUN_FOLDER) != True:
		# shutil.rmtree(LOCAL_RUN_FOLDER)
		os.makedirs(LOCAL_RUN_FOLDER)
	for x in range(0, numnodes):
		testsubdir = LOCAL_RUN_FOLDER + 'node_' + str(x+1).zfill(4)
		if os.path.exists(testsubdir) != True :
			os.makedirs(testsubdir)
		shutil.copyfile('./tests/Zilliqa/zilliqa', testsubdir + '/lzilliqa')
		st = os.stat(testsubdir + '/lzilliqa')
		os.chmod(testsubdir + '/lzilliqa', st.st_mode | stat.S_IEXEC)
	if printnodes:
		testfolders_list = get_immediate_subdirectories(LOCAL_RUN_FOLDER)
		count = len(testfolders_list)
		for x in range(0, count):
			print ('[Node ' + str(x + 1).ljust(3) + '] [Port ' + str(NODE_LISTEN_PORT + x) + '] ' + LOCAL_RUN_FOLDER + testfolders_list[x])
	keypairs = []
	# Generate keypairs (sort by public key)
	for x in range(0, count):
		process = Popen(["./tests/Zilliqa/genkeypair"], stdout=PIPE, universal_newlines=True)
		(output, err) = process.communicate()
		exit_code = process.wait()
		keypairs.append(output.strip())
	keypairs.sort()
	patch_lookup_pubkey(LOCAL_FOLDER + "/constants_local.xml", keypairs, count)
	patch_seed_pubkey(LOCAL_FOLDER + "/constants_local.xml", keypairs, count)
	nodes = ET.Element("nodes")
	# Store sorted keys list in text file
	keys_file = open(LOCAL_RUN_FOLDER + 'keys.txt', "w")
	for x in range(0, count):
		keys_file.write(keypairs[x] + '\n')
		keypair = keypairs[x].split(" ")
		if (x < count):
			peer = ET.SubElement(nodes, "peer")
			ET.SubElement(peer, "pubk").text = keypair[0]
			ET.SubElement(peer, "ip").text = '127.0.0.1'
			ET.SubElement(peer, "port").text = str(NODE_LISTEN_PORT + x)
	keys_file.close()