nxt.addons

## Class JPLSnapshot.JPLSnapshotAPI

- java.lang.Object
- - nxt.http.APIServlet.APIRequestHandler
  - - nxt.addons.JPLSnapshot.JPLSnapshotAPI

- Enclosing class:
    JPLSnapshot

      public static class JPLSnapshot.JPLSnapshotAPI
      extends APIServlet.APIRequestHandler

  The downloadJPLSnapshot API can be used to generate a genesis block JSON for a clone to satisfy the JPL 10% sharedrop requirement to existing Ignis holders.

  This utility takes a snapshot of account balances and public keys on the Ignis child chain as of the specified height, scales down the balance of each account proportionately so that the total of balances of sharedrop accounts is equal to 10% of the total of all balances, and merges this data with the supplied new genesis accounts and balances. (If the total of new genesis account balances is zero, the balance of sharedrop accounts is left unchanged.)

  Note that using a height more than 800 blocks in the past will normally require a blockchain rescan, which takes a few hours to complete. Do not interrupt this process.

  Request parameters

  - newGenesisAccounts - a JSON formatted file containing all new account public keys and balances to be included in the clone genesis block
  - height - the Ardor blockchain height at which to take the snapshot

  Response

  - A JSON formatted file, FXT.json, containing a mapping of public keys to their initial balances, for both new accounts and sharedrop accounts, which should be placed in the conf/data directory of the clone blockchain, renamed to the clone parent chain token.

  Input file format

  The input file should contain a mapping of public keys to their initial balances, for the accounts to which the remaining 90% of the tokens will be distributed, i.e. the non-sharedrop accounts. If an existing account is included here, it will receive the specified balance in addition to the sharedrop. If no input file is provided, or the total balance of new accounts in the input file is zero, no adjustment of existing account balances is done. Here is an example input file, which allocates 300M each to the accounts with passwords "0", "1" and "2", for a total of 900M to new accounts, resulting in 100M automatically allocated to existing Ignis holders:

       {
            "bf0ced0472d8ba3df9e21808e98e61b34404aad737e2bae1778cebc698b40f37": 30000000000000000,
            "39dc2e813bb45ff063a376e316b10cd0addd7306555ca0dd2890194d37960152": 30000000000000000,
            "011889a0988ccbed7f488878c62c020587de23ebbbae9ba56dd67fd9f432f808": 30000000000000000
       }

  The example below, suitable to use for generating a testnet genesis block, distributes 900M tokens to 10 developers testnet accounts, and 100M to existing Ignis holders:

       {
         "8d84ea81a017e8d87cc3f7f908a5c3dab027f460ca131ee726216d257120656c":9000000000000000,
         "930d01153ba45a794a896d5fae118ee8edcddbcd860c2d3ccc5f717e8c8b433e":9000000000000000,
         "584486d2ba4dbd7eaeadd071f9f8c3593cee620e1e374033551147d68899b529":9000000000000000,
         "5962b0c12905dc5448367a676a668a076606d921497447e0f61fc329c2da1f21":9000000000000000,
         "cc045e5f29aaa5a8464ff3b284e6763a9a37f72cccad8f5a671a73ee61733830":9000000000000000,
         "a172465db52bd3f19067527e4ae05679b9b6155e1533037ea4097a56d1b56a33":9000000000000000,
         "622d84aacd2edf1aac0c2c068486c144ea6b0f4cb7671d4b00f7b6aa528d5b2b":9000000000000000,
         "5b70849aa5e480e2737dce4a439e0893e909229eeade3d2d973cf150be8dea2e":9000000000000000,
         "27c4fa81aaf58d41775287d86ed560b54e5426e7e9f6c686834b3eaa9f43db3b":9000000000000000,
         "bfbce25fe31e375c1784ef932cdd9daf8f4635e25092ea4cb60d15e220d06a1d":9000000000000000
       }

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected boolean` | `allowRequiredBlockParameters()`
    `protected boolean` | `isChainSpecific()`
    `protected org.json.simple.JSONStreamAware` | `processRequest(javax.servlet.http.HttpServletRequest request)`
    `protected org.json.simple.JSONStreamAware` | `processRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)`
    `protected boolean` | `requireFullClient()`
    `protected boolean` | `requirePassword()`
    `protected boolean` | `requirePost()`

    - ### Methods inherited from class nxt.http.APIServlet.APIRequestHandler

      `getAPITags, getFileParameter, getParameters, isIgnisOnly, isPassword, isTextArea, requireBlockchain, startDbTransaction`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### processRequest

          protected org.json.simple.JSONStreamAware processRequest(javax.servlet.http.HttpServletRequest request,
                                                                   javax.servlet.http.HttpServletResponse response)
                                                            throws NxtException

      Overrides:
        `processRequest` in class `APIServlet.APIRequestHandler`
      Throws:
        `NxtException`

    - #### processRequest

          protected org.json.simple.JSONStreamAware processRequest(javax.servlet.http.HttpServletRequest request)

      Specified by:
        `processRequest` in class `APIServlet.APIRequestHandler`

    - #### requirePost

          protected boolean requirePost()

      Overrides:
        `requirePost` in class `APIServlet.APIRequestHandler`

    - #### requirePassword

          protected boolean requirePassword()

      Overrides:
        `requirePassword` in class `APIServlet.APIRequestHandler`

    - #### requireFullClient

          protected boolean requireFullClient()

      Overrides:
        `requireFullClient` in class `APIServlet.APIRequestHandler`

    - #### allowRequiredBlockParameters

          protected boolean allowRequiredBlockParameters()

      Overrides:
        `allowRequiredBlockParameters` in class `APIServlet.APIRequestHandler`

    - #### isChainSpecific

          protected boolean isChainSpecific()

      Overrides:
        `isChainSpecific` in class `APIServlet.APIRequestHandler`