Package nxt.http
Class IssueCurrency
- java.lang.Object
-
- nxt.http.APIServlet.APIRequestHandler
-
- nxt.http.IssueCurrency
-
public final class IssueCurrency extends APIServlet.APIRequestHandler
Issue a currency on the NXT blockchainA currency is the basic block of the NXT Monetary System it can be exchanged with NXT, transferred between accounts, minted using proof of work methods, reserved and claimed as a crowd funding tool.
Pass the following parameters in order to issue a currency
- name - unique identifier of the currency composed of between 3 to 10 latin alphabetic symbols and numbers, name must be no shorter than code. name and code are mutually unique.
- code - unique 3 to 5 letter currency trading symbol composed of upper case latin letters
- description - free text description of the currency limited to 1000 characters
- type - a numeric value representing a bit vector modeling the currency capabilities (see below)
- ruleset - for future use, always set to 0
- maxSupply - the total number of currency units which can be created
- initialSupply - the number of currency units created when the currency is issued (pre-mine)
- decimals - currency units are divisible to this number of decimals
- issuanceHeight - the blockchain height at which the currency would become active
For
CurrencyType.RESERVABLE
currency - minReservePerUnitNQT - the minimum NXT value per unit to allow the currency to become active
For
CurrencyType.RESERVABLE
currency - reserveSupply - the number of units that will be distributed to founders when currency becomes active (less initialSupply)
For
CurrencyType.RESERVABLE
currency - minDifficulty - for mint-able currency, the exponent of the initial difficulty.
For
CurrencyType.MINTABLE
currency - maxDifficulty - for mint-able currency, the exponent of the final difficulty.
For
CurrencyType.MINTABLE
currency - algorithm - the hashing
algorithm
used for minting. ForCurrencyType.MINTABLE
currency
Constraints
- A given currency can not be neither
CurrencyType.EXCHANGEABLE
norCurrencyType.CLAIMABLE
.
- A
CurrencyType.RESERVABLE
currency becomes active once the blockchain height reaches the currency issuance height.
At this time, if the minReservePerUnitNQT has not been reached the currency issuance is cancelled and funds are returned to the founders.
Otherwise the currency becomes active and remains active until deleted, provided deletion is possible. When aCurrencyType.RESERVABLE
becomes active, in case it isCurrencyType.CLAIMABLE
the NXT used for reserving the currency are locked until they are claimed back. When aCurrencyType.RESERVABLE
becomes active, in case it is nonCurrencyType.CLAIMABLE
the NXT used for reserving the currency are sent to the issuer account as crowd funding. - When issuing a
CurrencyType.MINTABLE
currency, the number of units perCurrencyMint
cannot exceed 0.01% of the total supply. Therefore make sure totalSupply > 10000 or otherwise the currency cannot be minted - difficulty is calculated as follows
difficulty of minting the first unit is based on 2^minDifficulty
difficulty of minting the last unit is based on 2^maxDifficulty
difficulty increases linearly from min to max based on the ratio between the current number of units and the total supply
difficulty increases linearly with the number units minted perCurrencyMint
- See Also:
CurrencyType
,HashFunction
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
allowRequiredBlockParameters()
static java.util.List<java.lang.String>
getCommonParameters()
protected org.json.simple.JSONStreamAware
processRequest(javax.servlet.http.HttpServletRequest req)
protected boolean
requirePost()
-
Methods inherited from class nxt.http.APIServlet.APIRequestHandler
getAPITags, getFileParameter, getParameters, isPassword, isTextArea, processRequest, requireBlockchain, requireFullClient, requirePassword, startDbTransaction
-
-
-
-
Method Detail
-
processRequest
protected org.json.simple.JSONStreamAware processRequest(javax.servlet.http.HttpServletRequest req) throws NxtException
- Specified by:
processRequest
in classAPIServlet.APIRequestHandler
- Throws:
NxtException
-
requirePost
protected final boolean requirePost()
- Overrides:
requirePost
in classAPIServlet.APIRequestHandler
-
allowRequiredBlockParameters
protected final boolean allowRequiredBlockParameters()
- Overrides:
allowRequiredBlockParameters
in classAPIServlet.APIRequestHandler
-
getCommonParameters
public static java.util.List<java.lang.String> getCommonParameters()
-
-