ElrondNodeController { @RequestMapping(path = "/node/shardofaddress", method = RequestMethod.GET) public @ResponseBody ResponseObject shardOfAddress( HttpServletResponse response, @RequestParam() String address) { logger.traceEntry("params: {}", address); try { ShardingService shardingService = AppServiceProvider.getShardingService(); byte[] publicKeyBytes = Util.hexStringToByteArray(address); return logger.traceExit(new ResponseObject(true, "", shardingService.getShard(publicKeyBytes).getIndex())); } catch (Exception ex){ logger.throwing(ex); return logger.traceExit(new ResponseObject(false, ex.getMessage(), null)); } }  @RequestMapping(path = "/node/stop", method = RequestMethod.GET) @ResponseBody boolean stopNode(HttpServletResponse response); @RequestMapping(path = "/node/appstatus", method = RequestMethod.GET) @ResponseBody boolean nodeAppStatus(
            HttpServletResponse response); @RequestMapping(path = "/node/status", method = RequestMethod.GET) @ResponseBody boolean nodeStatus(HttpServletResponse response); @RequestMapping(path = "/node/start", method = RequestMethod.GET) @ResponseBody boolean startNode(
            HttpServletResponse response,
            @RequestParam(defaultValue = "elrond-node-1") String nodeName,
            @RequestParam(defaultValue = "4001") Integer port,
            @RequestParam(defaultValue = "4000", required = false) Integer masterPeerPort,
            @RequestParam(defaultValue = "127.0.0.1", required = false) String masterPeerIpAddress,
            @RequestParam(defaultValue = "00e15fc71adc4832c56c4e6a8b50a9503a4ede9485c4efbc585def0c657d93066a", required = true) String privateKey,
            @RequestParam(defaultValue = "21000000", required = false) String mintValue,
            @RequestParam(defaultValue = "START_FROM_SCRATCH", required = true) BootstrapType bootstrapType//,
            //@RequestParam(defaultValue = "elrond-node-1", required = false) String blockchainPath,
            //@RequestParam(defaultValue = "elrond-node-1", required = false) String blockchainRestorePath

    ); @RequestMapping(path = "/node/send", method = RequestMethod.GET) @ResponseBody ResponseObject send(
            HttpServletResponse response,
            @RequestParam  String address,
            @RequestParam(defaultValue = "1") BigInteger value); @RequestMapping(path = "/node/receipt", method = RequestMethod.GET) @ResponseBody ResponseObject getReceipt(
            HttpServletResponse response,
            @RequestParam() String transactionHash); @RequestMapping(path = "/node/balance", method = RequestMethod.GET) @ResponseBody ResponseObject getBalance(
            HttpServletResponse response,
            @RequestParam() String address); @RequestMapping(path = "/node/sendMultipleTransactions", method = RequestMethod.GET) @ResponseBody ResponseObject sendMultipleTransactions(
            HttpServletResponse response,
            @RequestParam String address,
            @RequestParam(defaultValue = "1") BigInteger value,
            @RequestParam(defaultValue = "1") Integer nrTransactions); @RequestMapping(path = "/node/sendMultipleTransactionsToAllShards", method = RequestMethod.GET) @ResponseBody ResponseObject sendMultipleTransactionsToAllShards(
            HttpServletResponse response,
            @RequestParam(defaultValue = "1") BigInteger value,
            @RequestParam(defaultValue = "1") Integer nrTransactions); @RequestMapping(path = "/node/getStats", method = RequestMethod.GET) @ResponseBody ResponseObject getStats(
            HttpServletResponse response); @RequestMapping(path = "/node/ping", method = RequestMethod.GET) @ResponseBody ResponseObject ping(
            HttpServletResponse response,
            @RequestParam() String ipAddress,
            @RequestParam() int port
    ); @RequestMapping(path = "/node/checkfreeport", method = RequestMethod.GET) @ResponseBody ResponseObject checkFreePort(
            HttpServletResponse response,
            @RequestParam() String ipAddress,
            @RequestParam() int port
    ); @RequestMapping(path = "/node/generatepublickeyandprivateKey", method = RequestMethod.GET) @ResponseBody ResponseObject generatePublicKeyAndPrivateKey(
            HttpServletResponse response,
            @RequestParam() String privateKey); @RequestMapping(path = "/node/shardofaddress", method = RequestMethod.GET) @ResponseBody ResponseObject shardOfAddress(
            HttpServletResponse response,
            @RequestParam() String address); @RequestMapping(path = "/node/gettransactionfromhash", method = RequestMethod.GET) @ResponseBody ResponseObject getTransactionFromHash(
            HttpServletResponse response,
            @RequestParam() String transactionHash); @RequestMapping(path = "/node/getblockfromhash", method = RequestMethod.GET) @ResponseBody ResponseObject getBlockFromHash(
            HttpServletResponse response,
            @RequestParam() String blockHash); @RequestMapping(path = "/node/getNextPrivateKey", method = RequestMethod.GET) @ResponseBody ResponseObject getNextPrivateKey(HttpServletRequest request, HttpServletResponse response); @RequestMapping(path = "/node/getprivatepublickeyshard", method = RequestMethod.GET) @ResponseBody ResponseObject getPrivatePublicKeyShard(
            HttpServletResponse response); @RequestMapping(path = "/node/exit", method = RequestMethod.GET) @ResponseBody void nodeExit(
            HttpServletResponse response);  }
@Test public void testShardAllocation(){ ElrondNodeController elrondNodeController = new ElrondNodeController(); TestCase.assertEquals(false, elrondNodeController.shardOfAddress(null, null).isSuccess()); TestCase.assertEquals(false, elrondNodeController.shardOfAddress(null, "").isSuccess()); TestCase.assertEquals(0, elrondNodeController.shardOfAddress(null, "0302fa311fac6aa56c1a5b08e6c9bcea32fc1939cbef5010c2ab853afb5563976c").getPayload()); TestCase.assertEquals(1, elrondNodeController.shardOfAddress(null, "0302fa311fac6aa56c1a5b08e6c9bcea32fc1939cbef5010c2ab853afb5563976d").getPayload()); System.out.println("Shard: " + elrondNodeController.shardOfAddress(null, "0302fa311fac6aa56c1a5b08e6c9bcea32fc1939cbef5010c2ab853afb5563976c")); }