Skip to main content

IssueCurrency

Issues a new currency in the Shamwari Monetary System.

Request

POST /nxt?requestType=issueCurrency

Parameters

NameTypeDescriptionRequired
secretPhrasestringIssuer's secret passphraseYes
namestringCurrency name (3-10 alphanumeric, lowercase letters and numbers)Yes
codestringCurrency code (3-5 uppercase letters)Yes
descriptionstringCurrency descriptionOptional
propertystringWhitelist property nameOptional
typeintCurrency type bitmask (see CurrencyType values)Yes
initialSupplyQNTlongInitial supply amountYes
maxSupplyQNTlongMaximum supply amountYes
issuanceHeightintBlockchain height at which the currency becomes activeYes
minDifficultyintMinimum mining difficulty (1-255)Yes
maxDifficultyintMaximum mining difficulty (1-255)Yes
rulesetbyteReserved for future use (0-255)Yes
algorithmbyteHashing algorithm for minting (0-255)Yes
decimalsbyteDecimal places (0-8)Yes
adminPasswordstringAdmin password if requiredOptional

Currency Type Bitmask Values

ValueTypeDescription
1SHAREDShared currency
2PERSONALPersonal currency
4EXCHANGEABLETradable on exchange
8CLAIMABLEClaimable by holders
16MINTABLESupports minting
32CONTROLLABLESupports transaction/daily limits
64RESERVABLEReserved
128SOVEREIGNSovereign reference currency

Common combinations:

  • 0: Personal currency (no special properties)
  • 1: Shared currency
  • 3: Shared personal currency (1+2)
  • 4: Exchangeable only
  • 20: Exchangeable + Controllable (4+16)
  • 36: Exchangeable + Mintable + Controllable (4+32)

Response

{
"transaction": "1234567890123456789",
"fullHash": "abc123...",
"currency": "9876543210123456789",
"errorCode": 0,
"errorDescription": ""
}

Response Fields Description

FieldTypeDescription
transactionstringTransaction ID
fullHashstringFull transaction hash
currencystringNew currency ID
errorCodeint0 for success
errorDescriptionstringEmpty on success

The created currency object is also returned in the transaction attachment.

Example

curl -X POST http://localhost:22024/nxt \
-d "requestType=issueCurrency" \
-d "secretPhrase=your_phrase" \
-d "name=MyCoin" \
-d "code=MYC" \
-d "description=My custom currency" \
-d "type=4" \
-d "initialSupplyQNT=1000000" \
-d "maxSupplyQNT=10000000" \
-d "issuanceHeight=1000" \
-d "minDifficulty=1" \
-d "maxDifficulty=255" \
-d "ruleset=0" \
-d "algorithm=0" \
-d "decimals=8"

Implementation Notes

The IssueCurrency handler in src/java/nxt/http/IssueCurrency.java:

  • Validates currency name (3-10 chars, alphanumeric lowercase) and code (3-5 uppercase letters)
  • Creates a CurrencyIssuanceAttachment with the provided parameters
  • Sets the currency name, code, description, whitelist property, type, supply parameters
  • Configures minting parameters (algorithm, difficulty) for mintable currencies
  • Enforces issuance height to prevent immediate activation
  • Emits a currency issuance event on the blockchain
  • Currency can be transferred, minted, bought, sold, and used in exchanges via API endpoints