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.RESERVABLEcurrency - minReservePerUnitNQT - the minimum NXT value per unit to allow the currency to become active
For
CurrencyType.RESERVABLEcurrency - reserveSupply - the number of units that will be distributed to founders when currency becomes active (less initialSupply)
For
CurrencyType.RESERVABLEcurrency - minDifficulty - for mint-able currency, the exponent of the initial difficulty.
For
CurrencyType.MINTABLEcurrency - maxDifficulty - for mint-able currency, the exponent of the final difficulty.
For
CurrencyType.MINTABLEcurrency - algorithm - the hashing
algorithmused for minting. ForCurrencyType.MINTABLEcurrency
Constraints
- A given currency can not be neither
CurrencyType.EXCHANGEABLEnorCurrencyType.CLAIMABLE.
- A
CurrencyType.RESERVABLEcurrency 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.RESERVABLEbecomes active, in case it isCurrencyType.CLAIMABLEthe NXT used for reserving the currency are locked until they are claimed back. When aCurrencyType.RESERVABLEbecomes active, in case it is nonCurrencyType.CLAIMABLEthe NXT used for reserving the currency are sent to the issuer account as crowd funding. - When issuing a
CurrencyType.MINTABLEcurrency, the number of units perCurrencyMintcannot 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
-
-
Field Summary
-
Fields inherited from class nxt.http.APIServlet.APIRequestHandler
DESCRIPTION_FIELD, MESSAGE_FIELD, NAME_FIELD
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanallowRequiredBlockParameters()protected org.json.simple.JSONStreamAwareprocessRequest(javax.servlet.http.HttpServletRequest req)protected booleanrequirePost()-
Methods inherited from class nxt.http.APIServlet.APIRequestHandler
getAPITags, getFileParameter, getParameters, processRequest, requireBlockchain, requireFullClient, requirePassword, startDbTransaction
-
-
-
-
Method Detail
-
processRequest
protected org.json.simple.JSONStreamAware processRequest(javax.servlet.http.HttpServletRequest req) throws NxtException- Specified by:
processRequestin classAPIServlet.APIRequestHandler- Throws:
NxtException
-
requirePost
protected final boolean requirePost()
- Overrides:
requirePostin classAPIServlet.APIRequestHandler
-
allowRequiredBlockParameters
protected final boolean allowRequiredBlockParameters()
- Overrides:
allowRequiredBlockParametersin classAPIServlet.APIRequestHandler
-
-