IssueCurrency
Issues a new currency in the Shamwari Monetary System.
Request
POST /nxt?requestType=issueCurrency
Parameters
| Name | Type | Description | Required |
|---|---|---|---|
secretPhrase | string | Issuer's secret passphrase | Yes |
name | string | Currency name (3-10 alphanumeric, lowercase letters and numbers) | Yes |
code | string | Currency code (3-5 uppercase letters) | Yes |
description | string | Currency description | Optional |
property | string | Whitelist property name | Optional |
type | int | Currency type bitmask (see CurrencyType values) | Yes |
initialSupplyQNT | long | Initial supply amount | Yes |
maxSupplyQNT | long | Maximum supply amount | Yes |
issuanceHeight | int | Blockchain height at which the currency becomes active | Yes |
minDifficulty | int | Minimum mining difficulty (1-255) | Yes |
maxDifficulty | int | Maximum mining difficulty (1-255) | Yes |
ruleset | byte | Reserved for future use (0-255) | Yes |
algorithm | byte | Hashing algorithm for minting (0-255) | Yes |
decimals | byte | Decimal places (0-8) | Yes |
adminPassword | string | Admin password if required | Optional |
Currency Type Bitmask Values
| Value | Type | Description |
|---|---|---|
| 1 | SHARED | Shared currency |
| 2 | PERSONAL | Personal currency |
| 4 | EXCHANGEABLE | Tradable on exchange |
| 8 | CLAIMABLE | Claimable by holders |
| 16 | MINTABLE | Supports minting |
| 32 | CONTROLLABLE | Supports transaction/daily limits |
| 64 | RESERVABLE | Reserved |
| 128 | SOVEREIGN | Sovereign reference currency |
Common combinations:
0: Personal currency (no special properties)1: Shared currency3: Shared personal currency (1+2)4: Exchangeable only20: Exchangeable + Controllable (4+16)36: Exchangeable + Mintable + Controllable (4+32)
Response
{
"transaction": "1234567890123456789",
"fullHash": "abc123...",
"currency": "9876543210123456789",
"errorCode": 0,
"errorDescription": ""
}
Response Fields Description
| Field | Type | Description |
|---|---|---|
transaction | string | Transaction ID |
fullHash | string | Full transaction hash |
currency | string | New currency ID |
errorCode | int | 0 for success |
errorDescription | string | Empty 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"
Related
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
CurrencyIssuanceAttachmentwith 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