class GenesisImporter {

    List<Map.Entry<String, Long>> loadGenesisAccounts() {
        final String path = blockchainConfig.getChain().getGenesisLocation();
        log.debug("Genesis accounts json resource path = " + path);

        final Queue<Map.Entry<String, Long>> sortedEntries =
            new PriorityQueue<>((o1, o2) -> Long.compare(o2.getValue(), o1.getValue()));
        try (
            final InputStream is = ClassLoader.getSystemResourceAsStream(path);
            final JsonParser jsonParser = jsonFactory.createParser(is)
        ) {
            boolean isBalancesProcessingStarted = false;
            while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
                final JsonToken currentToken = jsonParser.getCurrentToken();
                final String currentName = jsonParser.getCurrentName();
                if ((currentToken == JsonToken.FIELD_NAME) && (BALANCES_JSON_FIELD_NAME.equals(currentName))) {
                    jsonParser.nextToken();
                    isBalancesProcessingStarted = true;
                } else if (isBalancesProcessingStarted) {
                    jsonParser.nextToken();
                    sortedEntries.add(Map.entry(currentName, jsonParser.getLongValue()));
                }
            }
        } catch (IOException e) {
            throw new RuntimeException("Failed to load genesis accounts", e);
        }

        final int balanceNumber = sortedEntries.size();
        validateBalanceNumber(balanceNumber);

        return sortedEntries.stream()
            .skip(1) //skip first account to collect only genesis accounts
            .collect(Collectors.toList());
    }

    @Inject public  GenesisImporter(
        BlockchainConfig blockchainConfig,
        BlockchainConfigUpdater blockchainConfigUpdater,
        DatabaseManager databaseManager,
        AplAppStatus aplAppStatus,
        GenesisImporterProducer genesisImporterProducer,
        AccountGuaranteedBalanceTable accountGuaranteedBalanceTable,
        AccountTable accountTable,
        ApplicationJsonFactory jsonFactory,
        PropertiesHolder propertiesHolder,
        AccountService accountService,
        AccountPublicKeyService accountPublicKeyService
    );

}