Monetary System
General Monetary System documentation is available here. Documentation on the MintWorker tool for currency minting is available here.
Can Delete Currency
Determine if a currency can be deleted.
Request:
- requestType is canDeleteCurrency
- account is the account ID
- currency is the currency ID
- requireBlock is the block ID of a block that must be present in the blockchain during execution (optional)
- requireLastBlock is the block ID of a block that must be last in the blockchain during execution (optional)
Response:
- canDelete (B) is true if the currency can be deleted, false otherwise
- lastBlock (S) is the last block ID on the blockchain (applies if requireBlock is provided but not requireLastBlock)
- requestProcessingTime (N) is the API request processing time (in millisec)
Note: a currency can be deleted only when all units of the currency are held by account. A reservable currency that has not yet been issued can be deleted by the issuer. A mintable currency that has not completed minting cannot be deleted by a non-issuer.
Can Delete Currency Example
http://localhost:7876/nxt?
requestType=canDeleteCurrency&
account=NXT-2HCZ-6GCJ-2XGV-EDRPH&
currency=4923907272718555444
{
"canDelete": true,
"requestProcessingTime": 1
}
Currency Buy / Sell
Make an exchange request to buy or sell an exchangeable currency. POST only.
Request: Refer to Create Transaction Request for common parameters.
- requestType is currencyBuy or currencySell
- currency is the currency ID
- rateNQT is the exchange rate (in NQT per QNT)
- units is the amount of the currency to buy or sell (in QNT)
Note: An exchange request is immediately executed once accepted onto the blockchain based only on currently available offers (refer to Publish Exchange Offer). The request then expires, regardless of the amount of currency exchanged; the request may be completely filled, partially filled, or expire without any exchange if no matching offers are found.
Response: Refer to Create Transaction Response.
Currency Buy / Sell Example
http://localhost:7876/nxt?
requestType=currencyBuy&
currency=6520756875632314476&
rateNQT=1500000000&
units=200&
secretPhrase=SECRETPHRASE&
feeNQT=100000000&
deadline=60
{
"signatureHash": "0471907734d4aae7fc708131726f8660a68e66fe873fa17cab4f0cb3f879243f",
"unsignedTransactionBytes": "051607cb08023c0010f09c34f225d425306e5be55a49469081...",
"transactionJSON": {
"senderPublicKey": "10f09c34f225d425306e5be55a4946908156072afbead4d574a512d7e086ef5c",
"signature": "dda6c065344827bfdecfee179b22dfee1d5280fa5da5431b012d9ea045a0d80b9d4...",
"feeNQT": "100000000",
"type": 5,
"fullHash": "d388798c9ecaf2cd28578cfcb8fb7e8f07d308e36e2a5674bb1c7766595b8435",
"version": 1,
"ecBlockId": "10096636210021430702",
"signatureHash": "0471907734d4aae7fc708131726f8660a68e66fe873fa17cab4f0cb3f879243f",
"attachment": {
"currency": "6520756875632314476",
"version.ExchangeSell": 1,
"units": "200",
"rateNQT": "1500000000"
},
"senderRS": "NXT-4VDY-LNVT-LMAY-FMCKA",
"subtype": 6,
"amountNQT": "0",
"sender": "15295723609781267838",
"ecBlockHeight": 162266,
"deadline": 60,
"transaction": "14840146504449624275",
"timestamp": 34130695,
"height": 2147483647
},
"broadcasted": true,
"requestProcessingTime": 331,
"transactionBytes": "051607cb08023c0010f09c34f225d425306e5be55a49469081560...",
"fullHash": "d388798c9ecaf2cd28578cfcb8fb7e8f07d308e36e2a5674bb1c7766595b8435",
"transaction": "14840146504449624275"
}
Currency Buy
Refer to Currency Buy / Sell.
Currency Sell
Refer to Currency Buy / Sell.
Currency Mint
Submit a valid computed nonce to the blockchain in return for newly minted currency. POST only.
Request: Refer to Create Transaction Request for common parameters.
- requestType is currencyMint
- currency is the mintable currency ID
- nonce is the computed nonce
- units is the amount (in QNT) of currency to mint
- counter (N) is the counter associated with the minting account
Note: The hash of nonce must be less than targetBytes provided by Get Minting Target for given units and counter. counter must be increased with each submission.
Response: Refer to Create Transaction Response.
Currency Mint Example
http://localhost:7876/nxt?
requestType=currencyMint&
currency=9207767346829573996&
nonce=-6757092571753666960&
units=1&
counter=26&
secretPhrase=SECRETPHRASE&
feeNQT=100000000&
deadline=60
{
"signatureHash": "f0e9f3b040890043fbc2d1b235377eb566805419f459184bc9290051bacdf80f",
"unsignedTransactionBytes": "0517655a0c023c0010f09c34f225d425306e5be55a49469081...",
"transactionJSON": {
"senderPublicKey": "10f09c34f225d425306e5be55a4946908156072afbead4d574a512d7e086ef5c",
"signature": "e961f58250dd256bb5f0628df342beb6ce042765d7cdad8d7598495759d7ec00ad8...",
"feeNQT": "100000000",
"type": 5,
"fullHash": "05cbe451cdece14bab56c5684d30cd7eb62e45a86136071e90ae26981d4c1fc3",
"version": 1,
"ecBlockId": "12526333689713738846",
"signatureHash": "f0e9f3b040890043fbc2d1b235377eb566805419f459184bc9290051bacdf80f",
"attachment": {
"currency": "9207767346829573996",
"units": "1",
"counter": "26",
"version.CurrencyMinting": 1,
"nonce": "-6757092571753666960"
},
"senderRS": "NXT-4VDY-LNVT-LMAY-FMCKA",
"subtype": 7,
"amountNQT": "0",
"sender": "15295723609781267838",
"ecBlockHeight": 160721,
"deadline": 60,
"transaction": "5467911789190892293",
"timestamp": 34364005,
"height": 2147483647
},
"broadcasted": true,
"requestProcessingTime": 815,
"transactionBytes": "0517655a0c023c0010f09c34f225d425306e5be55a49469081560...",
"fullHash": "05cbe451cdece14bab56c5684d30cd7eb62e45a86136071e90ae26981d4c1fc3",
"transaction": "5467911789190892293"
}
Currency Reserve Claim
Claim currency reserve. POST only.
Request: Refer to Create Transaction Request for common parameters.
- requestType is currencyReserveClaim
- currency is the currency ID
- units is the amount (in QNT) of reserve currency to claim
Note: Holders of a claimable currency may claim the locked NQT backing their units, thus reducing the supply of the currency.
Response: Refer to Create Transaction Response.
Currency Reserve Claim Example
http://localhost:7876/nxt?
requestType=currencyReserveClaim&
currency=15992040603642022742&
units=36
{
"signatureHash": "6daef8c9b8653a9b78b64e400c2ab64ea201e9888b8bc54ec6c9a28814b0a69e",
"unsignedTransactionBytes": "0512a7830b023c00169cf83994b0e8c48a152ddc50606d58bd...",
"transactionJSON": {
"senderPublicKey": "169cf83994b0e8c48a152ddc50606d58bd4b2b85ec2f5bbbaae93d838443df7f",
"signature": "5ab6605aca7a958b10e5f0198660eccd01bff1418f2bf172105ba39e9c911d09709...",
"feeNQT": "100000000",
"type": 5,
"fullHash": "f32e02362dce767c6f4b069f793f2cd8c6b89bad04847c8abe98d8998cede94f",
"version": 1,
"ecBlockId": "14980969893438059909",
"signatureHash": "6daef8c9b8653a9b78b64e400c2ab64ea201e9888b8bc54ec6c9a28814b0a69e",
"attachment": {
"version.ReserveClaim": 1,
"currency": "15992040603642022742",
"units": "36"
},
"senderRS": "NXT-BMUV-8QQR-47VK-CR7F3",
"subtype": 2,
"amountNQT": "0",
"sender": "11580081983047651163",
"ecBlockHeight": 160064,
"deadline": 60,
"transaction": "8968582401529884403",
"timestamp": 34309031,
"height": 2147483647
},
"broadcasted": true,
"requestProcessingTime": 7,
"transactionBytes": "0512a7830b023c00169cf83994b0e8c48a152ddc50606d58bd4b2...",
"fullHash": "f32e02362dce767c6f4b069f793f2cd8c6b89bad04847c8abe98d8998cede94f",
"transaction": "8968582401529884403"
}
Currency Reserve Increase
Increase the currency reserve of an unissued reservable currency. POST only.
Request: Refer to Create Transaction Request for common parameters.
- requestType is currencyReserveIncrease
- currency is the currency ID
- amountPerUnitNQT is the additional amount (in NQT per QNT of reserveSupply) to reserve (refer to Issue Currency)
Note: An additional amountPerUnitNQT * reserveSupply NQT (beyond what has previously been reserved) will be locked until the issuanceHeight is reached. Upon issuance, if the currency is claimable the NQT will remain locked until claimed; otherwise the NQT will transfer to the issuing account. Also upon issuance, a portion of the reserveSupply QNT will be transfered to each reserving account in proportion to the NQT that was contributed.
Response: Refer to Create Transaction Response.
Currency Reserve Increase Example
http://localhost:7876/nxt?
requestType=currencyReserveIncrease&
currency=11847174313362984527
amountPerUnitNQT=40000000
{
"signatureHash": "0ba69ec678e0d4c4f94ee576d9520bf13a1c88b87e46c79d937b8f998a4a1f54",
"unsignedTransactionBytes": "05115c930b023c00169cf83994b0e8c48a152ddc50606d58bd...",
"transactionJSON": {
"senderPublicKey": "169cf83994b0e8c48a152ddc50606d58bd4b2b85ec2f5bbbaae93d838443df7f",
"signature": "01ab2e01e8543321bb93baef1cdfd24335b2f98f4898c0203ebb372f6ea2140f609...",
"feeNQT": "100000000",
"type": 5,
"fullHash": "0e583d097aa7832ef97f49bf1c43fe6fa26592cd7b60cd1c652b1139719c9404",
"version": 1,
"ecBlockId": "3894856940593871962",
"signatureHash": "0ba69ec678e0d4c4f94ee576d9520bf13a1c88b87e46c79d937b8f998a4a1f54",
"attachment": {
"amountPerUnitNQT": "40000000",
"currency": "11847174313362984527",
"version.ReserveIncrease": 1
},
"senderRS": "NXT-BMUV-8QQR-47VK-CR7F3",
"subtype": 1,
"amountNQT": "0",
"sender": "11580081983047651163",
"ecBlockHeight": 160118,
"deadline": 60,
"transaction": "3351706690276644878",
"timestamp": 34313052,
"height": 2147483647
},
"broadcasted": true,
"requestProcessingTime": 7,
"transactionBytes": "05115c930b023c00169cf83994b0e8c48a152ddc50606d58bd4b2...",
"fullHash": "0e583d097aa7832ef97f49bf1c43fe6fa26592cd7b60cd1c652b1139719c9404",
"transaction": "3351706690276644878"
}
Delete Currency
Delete a deletable currency (refer to Can Delete Currency). POST only.
Request: Refer to Create Transaction Request for common parameters.
- requestType is deleteCurrency
- currency is the currency ID
Response: Refer to Create Transaction Response.
Delete Currency Example
http://localhost:7876/nxt?
requestType=deleteCurrency&
currency=7103310507724273660&
secretPhrase=SECRETPHRASE&
feeNQT=100000000&
deadline=60
{
"signatureHash": "3f2b029337263728f4d4fed1f774252b06706159659e6ba9116b2d74b67a8435",
"unsignedTransactionBytes": "05189d7208023c0010f09c34f225d425306e5be55a49469081...",
"transactionJSON": {
"senderPublicKey": "10f09c34f225d425306e5be55a4946908156072afbead4d574a512d7e086ef5c",
"signature": "09c7be5b0742191f3777cc850f9478af21bd42225aec5e0793b57cd188767a0be6f...",
"feeNQT": "100000000",
"type": 5,
"fullHash": "a877379e3f3713e2f8baaa777c9a48af23d7da74e00301f12a4051dcf747243f",
"version": 1,
"ecBlockId": "2688066685599408512",
"signatureHash": "3f2b029337263728f4d4fed1f774252b06706159659e6ba9116b2d74b67a8435",
"attachment": {
"version.CurrencyDeletion": 1,
"currency": "7103310507724273660"
},
"senderRS": "NXT-4VDY-LNVT-LMAY-FMCKA",
"subtype": 8,
"amountNQT": "0",
"sender": "15295723609781267838",
"ecBlockHeight": 162004,
"deadline": 60,
"transaction": "16290425023506118568",
"timestamp": 34108061,
"height": 2147483647
},
"broadcasted": true,
"requestProcessingTime": 112,
"transactionBytes": "05189d7208023c0010f09c34f225d425306e5be55a49469081...",
"fullHash": "a877379e3f3713e2f8baaa777c9a48af23d7da74e00301f12a4051dcf747243f",
"transaction": "16290425023506118568"
}
Get Account Currencies
Get the currencies issued by a given account.
Request:
- requestType is getAccountCurrencies
- account is the account ID
- currency is a currency ID filter (optional)
- height is the blockchain height at which the response applies (optional, default is the current height)
- includeCurrencyInfo is true if several currency information properties is to be included (optional)
- requireBlock is the block ID of a block that must be present in the blockchain during execution (optional)
- requireLastBlock is the block ID of a block that must be last in the blockchain during execution (optional)
Response:
- accountCurrencies (A) is an array of currency objects with the following fields:
- code (S) is the currency code
- unconfirmedUnits (S) is the amount of unconfirmed currency units (in QNT)
- decimals (N) is the number of currency decimal places
- name (S) is the currency name
- currency (S) is the currency ID
- units (S) is the amount of currency (in QNT)
- issuanceHeight (N) is the blockchain height of issuance for a reservable currency
- type (N) is the currency type bitmask (refer to Get Currency)
- issuerAccountRS (S) is the Reed-Solomon address of the issuer account
- issuerAccount (S) is the issuer account ID
- lastBlock (S) is the last block ID on the blockchain (applies if requireBlock is provided but not requireLastBlock)
- requestProcessingTime (N) is the API request processing time (in millisec)
Get Account Currencies Example
http://localhost:7876/nxt?
requestType=getAccountCurrencies&
account=NXT-4VDY-LNVT-LMAY-FMCKA
{
"accountCurrencies": [
{
"issuerAccountRS": "NXT-4VDY-LNVT-LMAY-FMCKA",
"code": "MYSTX",
"unconfirmedUnits": "10000",
"decimals": 2,
"name": "MystcoinX",
"currency": "6520756875632314476",
"units": "10000",
"issuanceHeight": 0,
"type": 1,
"issuerAccount": "15295723609781267838"
}
],
"requestProcessingTime": 1
}
Get Account Currency Count
Get the number of currencies issued by a given account.
Request:
- requestType is getAccountCurrencyCount
- account is the account ID
- height is the blockchain height at which the response applies (optional, default is the current height)
- requireBlock is the block ID of a block that must be present in the blockchain during execution (optional)
- requireLastBlock is the block ID of a block that must be last in the blockchain during execution (optional)
Response:
- numberOfCurrencies (N) is the number of currencies issued
- lastBlock (S) is the last block ID on the blockchain (applies if requireBlock is provided but not requireLastBlock)
- requestProcessingTime (N) is the API request processing time (in millisec)
Get Account Currency Count Example
http://localhost:7876/nxt?
requestType=getAccountCurrencyCount&
account=NXT-4VDY-LNVT-LMAY-FMCKA
{
"numberOfCurrencies": 1,
"requestProcessingTime": 1
}
Get Account Exchange Requests
Get the exchange requests associated with a given account and/or currency in reverse chronological order (or in expected order of execution for expected requests).
Request:
- requestType is either getAccountExchangeRequests or getExpectedExchangeRequests, where expected requests are from the unconfirmed transactions pool or are phased transactions scheduled to finish in the next block
- account is the account ID (optional for expected requests)
- currency is the currency ID (optional for expected requests if account provided)
- includeCurrencyInfo is true to include the response fields code, decimals, name, issuanceHeight, type, timestamp, issuerAccountRS and issuerAccount (optional, applies only to expected requests)
- firstIndex is a zero-based index to the first request to retrieve (optional, does not apply to expected requests)
- lastIndex is a zero-based index to the last request to retrieve (optional, does not apply to expected requests)
- requireBlock is the block ID of a block that must be present in the blockchain during execution (optional)
- requireLastBlock is the block ID of a block that must be last in the blockchain during execution (optional)
Response:
- exchangeRequests (A) is an array of requests with the following fields for each request:
- code (S) is a currency code
- subtype (N) is 5 for buy and 6 for sell
- decimals (N) is the number of decimal places
- name (S) is the currency name
- units (S) is the number of currency units to buy or sell (in QNT)
- issuanceHeight (N) is the blockchain height of issuance for a reservable currency, zero otherwise
- type (N) is the currency type bitmask (refer to Get Currency)
- transaction (S) is the transaction ID
- timestamp (N) is the timestamp (in seconds since the genesis block) of the block when the request was executed
- rateNQT (S) is the exchange rate (in NQT per QNT)
- issuerAccountRS (S) is the Reed-Solomon address of the issuer account
- issuerAccount (S) is the issuer account ID
- phased (B) is true if the transaction is phased (applies only to expected requests)
- lastBlock (S) is the last block ID on the blockchain (applies if requireBlock is provided but not requireLastBlock)
- requestProcessingTime (N) is the API request processing time (in millisec)
Notes: Even expired, unfilled requests will be retrieved. As of Nxt Software Version 1.5.13 phased exchange requests that have not yet finished, or have not been approved, are now excluded if requestType is getAccountExchangeRequests.
Get Account Exchange Requests Example
http://localhost:7876/nxt?
requestType=getAccountExchangeRequests&
account=NXT-4VDY-LNVT-LMAY-FMCKA&
currency=6520756875632314476
{
"exchangeRequests": [
{
"issuerAccountRS": "NXT-4VDY-LNVT-LMAY-FMCKA",
"code": "MYSTX",
"subtype": 6,
"decimals": 2,
"name": "MystcoinX",
"units": "200",
"issuanceHeight": 0,
"type": 1,
"transaction": "14840146504449624275",
"timestamp": 34130695,
"rateNQT": "1500000000",
"issuerAccount": "15295723609781267838"
}
],
"requestProcessingTime": 1
}
Get Expected Exchange Requests
Refer to Get Account Exchange Requests.
Get Funding Monitor
Get a funding monitor.
Request:
- requestType is getFundingMonitor
- secretPhrase is the secret phrase of the funding account, used to get a single monitor. (optional)
- adminPassword is the admin password, used to get a single monitor or all monitors (optional if secretPhrase is provided)
- includeMonitoredAccounts is true to include account info of the monitored accounts (optional)
- property is the name of the account property (optional)
- holdingType is a string representing the holding type (optional)
- holding is the holding ID (optional)
- account is the account ID (optional)
Response:
- monitors (A) is an array of monitor objects including the following fields:
- holding (S) is the holding ID
- amount (S) is the amount to fund the monitored accounts with (NQT or QNT)
- monitoredAccounts (A) is an array of monitored account objects including the following fields (only if includeMonitoredAccounts is true):
- amount (S) is the amount to fund the monitored accounts with. Overrides amount in parent object.
- account (S) is the monitored account ID
- accountRS (S) is the monitored account Reed Solomon address
- threshold (S) is the threshold. Overrides threshold in parent object.
- interval (N) is the interval. Overrides interval in parent object.
- holdingType (N) is the holding type
- account (S) is the monitoring account ID
- accountRS (S) is the Reed Solomon address of the monitoring account
- property (S) is the account property
- threshold (S) is the threshold
- interval (N) is the interval
- requestProcessingTime (N) is the API request processing time (in millisec)
Get Funding Monitor Example
http://localhost:7876/nxt?
requestType=getFundingMonitor&
property=funding&
secretPhrase=IWontTellYou&
includeMonitoredAccounts=true
{
"requestProcessingTime": 0,
"monitors": [
{
"holding": "0",
"amount": "1000000000",
"monitoredAccounts": [
{
"amount": "1000000000",
"accountRS": "NXT-5MYN-AP7M-NKMH-CRQJZ",
"threshold": "15000000000",
"interval": 10,
"account": "12664921794733526996"
},
{
"amount": "1000000000",
"accountRS": "NXT-G885-AKDX-5G2B-BLUCG",
"threshold": "15000000000",
"interval": 10,
"account": "10892890577210644675"
}
],
"holdingType": 0,
"accountRS": "NXT-7A48-47JL-T7LD-D5FS3",
"property": "funding",
"threshold": "15000000000",
"interval": 10,
"account": "12745647715474645062"
}
]
}
Get All Currencies
Get all currencies in reverse creation order.
Request:
- requestType is getAllCurrencies
- firstIndex is a zero-based index to the first currency to retrieve (optional)
- lastIndex is a zero-based index to the last currency to retrieve (optional)
- includeCounts is true to include numberOf... fields (optional)
- requireBlock is the block ID of a block that must be present in the blockchain during execution (optional)
- requireLastBlock is the block ID of a block that must be last in the blockchain during execution (optional)
Response:
- currencies (A) is an array of currency objects (refer to Get Currency for details)
- lastBlock (S) is the last block ID on the blockchain (applies if requireBlock is provided but not requireLastBlock)
- requestProcessingTime (N) is the API request processing time (in millisec)
Get All Currencies Example
http://localhost:7876/nxt?
requestType=getAllCurrencies&
firstIndex=2&
lastIndex=2
{
"requestProcessingTime": 3,
"currencies": [
{
"initialSupply": "10000",
"currentReservePerUnitNQT": "0",
"types": [
"EXCHANGEABLE"
],
"code": "MYSTX",
"creationHeight": 162067,
"minDifficulty": 0,
"numberOfTransfers": 0,
"description": "Exchangeable",
"minReservePerUnitNQT": "0",
"currentSupply": "10000",
"issuanceHeight": 0,
"type": 1,
"reserveSupply": "0",
"maxDifficulty": 0,
"accountRS": "NXT-4VDY-LNVT-LMAY-FMCKA",
"decimals": 2,
"name": "MystcoinX",
"numberOfExchanges": 12,
"currency": "6520756875632314476",
"maxSupply": "10000",
"account": "15295723609781267838",
"algorithm": 0
}
]
}
Get All Exchanges
Get all currency exchanges in reverse chronological order.
Request:
- requestType is getAllExchanges
- timestamp is the earliest timestamp to retrieve (optional)
- firstIndex is a zero-based index to the first exchange to retrieve (optional)
- lastIndex is a zero-based index to the last exchange to retrieve (optional)
- includeCurrencyInfo is true to include some currency details (optional)
- requireBlock is the block ID of a block that must be present in the blockchain during execution (optional)
- requireLastBlock is the block ID of a block that must be last in the blockchain during execution (optional)
Response:
- exchanges (A) is an array of exchange objects (refer to Get Exchanges for details)
- lastBlock (S) is the last block ID on the blockchain (applies if requireBlock is provided but not requireLastBlock)
- requestProcessingTime (N) is the API request processing time (in millisec)
Get All Exchanges Example
http://localhost:7876/nxt?
requestType=getAllExchanges&
firstIndex=7&
lastIndex=7
{
"exchanges": [
{
"issuerAccountRS": "NXT-4VDY-LNVT-LMAY-FMCKA",
"seller": "15295723609781267838",
"code": "MYSTX",
"sellerRS": "NXT-4VDY-LNVT-LMAY-FMCKA",
"units": "5000",
"issuanceHeight": 0,
"type": 1,
"rateNQT": "10000000",
"buyer": "11580081983047651163",
"offer": "17204924627068821879",
"buyerRS": "NXT-BMUV-8QQR-47VK-CR7F3",
"decimals": 2,
"name": "MystcoinX",
"currency": "6520756875632314476",
"block": "4816799421151726903",
"transaction": "2086609620693258113",
"timestamp": 34206117,
"height": 163202,
"issuerAccount": "15295723609781267838"
}
],
"requestProcessingTime": 1
}
Get Available To Buy
Calculates the rate required in order to completely fill an exchange request.
Request:
- requestType is getAvailableToBuy or getAvailableToSell
- currency is the currency ID
- units is the number of units to buy
- requireBlock is the block ID of a block that must be present in the blockchain during execution (optional)
- requireLastBlock is the block ID of a block that must be last in the blockchain during execution (optional)
Response:
- amountNQT (S) is the total amount needed to fill the exchange request
- units (S) is the number of units
- rateNQT (S) is the rate for the currency units
- requestProcessingTime (N) is the API request processing time (in millisec)
Get Available To Buy Example
http://localhost:7876/nxt?
requestType=getAvailableToBuy&
currency=4855695375693311301&
units=1
{
"amountNQT": "1087",
"units": "1",
"requestProcessingTime": 0,
"rateNQT": "1087"
}
Get Available To Sell
Refer to Get Available To Buy.
Get Buy / Sell Offers
Get currency buy or sell offers given a currency ID and/or an account ID in order of rate (if sortByRate is true for expected offers, otherwise in the expected order of execution).
Request:
- requestType is one of getBuyOffers, getSellOffers, getExpectedBuyOffers or getExpectedSellOffers, where expected offers are from the unconfirmed transactions pool or are phased transactions scheduled to finish in the next block
- currency is the currency ID (optional)
- account is the account ID (optional if currency provided)
- availableOnly is true to include only offers with non-zero supply and limit, but is ignored when both currency and account are given (optional, does not apply to expected offers)
- sortByRate is true to sort by rate (optional, applies only to expected offers, which are returned in expected order of execution by default)
- firstIndex is a zero-based index to the first offer to retrieve (optional, does not apply to expected offers)
- lastIndex is a zero-based index to the last offer to retrieve (optional, does not apply to expected offers)
- requireBlock is the block ID of a block that must be present in the blockchain during execution (optional)
- requireLastBlock is the block ID of a block that must be last in the blockchain during execution (optional)
Response:
- offers (A) is an array of buy or sell offer objects (refer to Get Offer for details) with the following additional field only for an expected offer:
- phased (B) is true if the offer is phased, false otherwise
- lastBlock (S) is the last block ID on the blockchain (applies if requireBlock is provided but not requireLastBlock)
- requestProcessingTime (N) is the API request processing time (in millisec)
Get Buy / Sell Offers Example
http://localhost:7876/nxt?
requestType=getSellOffers&
currency=6520756875632314476
{
"offers": [
{
"offer": "4813417617929273983",
"expirationHeight": 163125,
"accountRS": "NXT-4VDY-LNVT-LMAY-FMCKA",
"limit": "1000",
"currency": "6520756875632314476",
"supply": "500",
"account": "15295723609781267838",
"height": 163110,
"rateNQT": "20000000"
}
],
"requestProcessingTime": 1
}
Get Buy Offers
Refer to Get Buy / Sell Offers.
Get Sell Offers
Refer to Get Buy / Sell Offers.
Get Expected Buy Offers
Refer to Get Buy / Sell Offers.
Get Expected Sell Offers
Refer to Get Buy / Sell Offers.
Get Currencies
Get currencies given multiple currency IDs.
Request:
- requestType is getCurrencies
- currencies is one of multiple currency IDs
- currencies is one of multiple currency IDs
⋮
- includeCounts is true to include numberOf... fields (optional)
- requireBlock is the block ID of a block that must be present in the blockchain during execution (optional)
- requireLastBlock is the block ID of a block that must be last in the blockchain during execution (optional)
Response:
- currencies (A) is an array of currency objects (refer to Get Currency for details)
- lastBlock (S) is the last block ID on the blockchain (applies if requireBlock is provided but not requireLastBlock)
- requestProcessingTime (N) is the API request processing time (in millisec)
Get Currencies Example
http://localhost:7876/nxt?
requestType=getCurrencies&
currencies=6520756875632314476
{
"requestProcessingTime": 3,
"currencies": [
{
"initialSupply": "10000",
"currentReservePerUnitNQT": "0",
"types": [
"EXCHANGEABLE"
],
"code": "MYSTX",
"creationHeight": 162067,
"minDifficulty": 0,
"numberOfTransfers": 0,
"description": "Exchangeable",
"minReservePerUnitNQT": "0",
"currentSupply": "10000",
"issuanceHeight": 0,
"type": 1,
"reserveSupply": "0",
"maxDifficulty": 0,
"accountRS": "NXT-4VDY-LNVT-LMAY-FMCKA",
"decimals": 2,
"name": "MystcoinX",
"numberOfExchanges": 12,
"currency": "6520756875632314476",
"maxSupply": "10000",
"account": "15295723609781267838",
"algorithm": 0
}
]
}
Get Currencies By Issuer
Get currencies issued by multiple accounts in reverse creation order.
Request:
- requestType is getCurrenciesByIssuer
- account is one of multiple account IDs
- account is one of multiple account IDs
⋮
- firstIndex is a zero-based index to the first currency to retrieve (optional)
- lastIndex is a zero-based index to the last currency to retrieve (optional)
- includeCounts is true if numberOf... fields are to be included (optional)
- requireBlock is the block ID of a block that must be present in the blockchain during execution (optional)
- requireLastBlock is the block ID of a block that must be last in the blockchain during execution (optional)
Response:
- currencies (A) is an array of arrays of currency objects, where the outer array is indexed by the given account IDs (refer to Get Currency for details about the currency objects)
- lastBlock (S) is the last block ID on the blockchain (applies if requireBlock is provided but not requireLastBlock)
- requestProcessingTime (N) is the API request processing time (in millisec)
Get Currencies By Issuer Example
http://localhost:7876/nxt?
requestType=getCurrenciesByIssuer&
account=NXT-4VDY-LNVT-LMAY-FMCKA
{
"requestProcessingTime": 334,
"currencies": [
[
{
"initialSupply": "10000",
"currentReservePerUnitNQT": "0",
"types": [
"EXCHANGEABLE"
],
"code": "MYSTX",
"creationHeight": 162067,
"minDifficulty": 0,
"numberOfTransfers": 0,
"description": "Exchangeable",
"minReservePerUnitNQT": "0",
"currentSupply": "10000",
"issuanceHeight": 0,
"type": 1,
"reserveSupply": "0",
"maxDifficulty": 0,
"accountRS": "NXT-4VDY-LNVT-LMAY-FMCKA",
"decimals": 2,
"name": "MystcoinX",
"numberOfExchanges": 12,
"currency": "6520756875632314476",
"maxSupply": "10000",
"account": "15295723609781267838",
"algorithm": 0
}
]
]
}
Get Currency
Get the details of a currency.
Request:
- requestType is getCurrency
- currency is the currency ID (optional)
- code is the currency code (optional if currency provided)
- includeCounts is true if numberOf... fields are to be included (optional)
- requireBlock is the block ID of a block that must be present in the blockchain during execution (optional)
- requireLastBlock is the block ID of a block that must be last in the blockchain during execution (optional)
Response:
- initialSupply (S) is the initial currency supply (in QNT)
- currentReservePerUnitNQT (S) is the minimum currency reserve (in NQT per QNT)
- types (A) is an array of currency types, one or more of:
- EXCHANGEABLE
- CONTROLLABLE
- RESERVABLE
- CLAIMABLE
- MINTABLE
- NON_SHUFFLEABLE
- code (S) is the currency code
- creationHeight (N) is the blockchain height of the currency creation
- minDifficulty (N) is the minimum difficulty for a mintable currency
- numberOfTransfers (N) is the number of currency transfers
- description (S) is the currency description
- minReservePerUnitNQT (S) is the minimum currency reserve (in NQT per QNT) for a reservable currency
- currentSupply (S) is the current currency supply (in QNT)
- issuanceHeight (N) is the blockchain height of the currency issuance for a reservable currency
- requestProcessingTime (N) is the API request processing time (in millisec)
- type (N) is the currency type bitmask, from least to most significant bit: exchangeable, controllable, reservable, claimable, mintable, non-shuffleable
- reserveSupply (S) is the reserve currency supply (in NQT) for a reservable currency
- maxDifficulty (N) is the maximum difficulty for a mintable currency
- accountRS (S) is the Reed-Solomon address of the issuing account
- decimals (N) is the number of decimal places used by the currency
- name (S) is the name of the currency
- numberOfExchanges (N) is the number of currency exchanges
- currency (S) is the currency ID
- maxSupply (S) is the maximum currency supply (in QNT)
- account (S) is the account ID of the currency issuer
- algorithm (N) is the algorithm number for a mintable currency: 2 for SHA256, 3 for SHA3, 5 for Scrypt, 25 for Keccak25
- lastBlock (S) is the last block ID on the blockchain (applies if requireBlock is provided but not requireLastBlock)
Get Currency Example
http://localhost:7876/nxt?
requestType=getCurrency&
code=MYSTX
{
"initialSupply": "10000",
"currentReservePerUnitNQT": "0",
"types": [
"EXCHANGEABLE"
],
"code": "MYSTX",
"creationHeight": 162067,
"minDifficulty": 0,
"numberOfTransfers": 0,
"description": "Exchangeable",
"minReservePerUnitNQT": "0",
"currentSupply": "10000",
"issuanceHeight": 0,
"requestProcessingTime": 0,
"type": 1,
"reserveSupply": "0",
"maxDifficulty": 0,
"accountRS": "NXT-4VDY-LNVT-LMAY-FMCKA",
"decimals": 2,
"name": "MystcoinX",
"numberOfExchanges": 0,
"currency": "6520756875632314476",
"maxSupply": "10000",
"account": "15295723609781267838",
"algorithm": 0
}
Get Currency Account Count
Get the number of accounts that hold a given currency.
Request:
- requestType is getCurrencyAccountCount
- currency is the currency ID
- height is the blockchain height at which the response applies (optional, default is the current height)
- requireBlock is the block ID of a block that must be present in the blockchain during execution (optional)
- requireLastBlock is the block ID of a block that must be last in the blockchain during execution (optional)
Response:
- numberOfAccounts (N) is the number of accounts that hold the currency
- lastBlock (S) is the last block ID on the blockchain (applies if requireBlock is provided but not requireLastBlock)
- requestProcessingTime (N) is the API request processing time (in millisec)
Get Currency Account Count Example
http://localhost:7876/nxt?
requestType=getCurrencyAccountCount&
currency=6520756875632314476
{
"numberOfAccounts": 2,
"requestProcessingTime": 1
}
Get Currency Accounts
Get the accounts that hold a given currency in reverse units order.
Request:
- requestType is getCurrencyAccounts
- currency is the currency ID
- height is the blockchain height at which the response applies (optional, default is current height)
- firstIndex is a zero-based index to the first account to retrieve (optional)
- lastIndex is a zero-based index to the last account to retrieve (optional)
- requireBlock is the block ID of a block that must be present in the blockchain during execution (optional)
- requireLastBlock is the block ID of a block that must be last in the blockchain during execution (optional)
Response:
- accountCurrencies (A) is an array of account objects with the following fields:
- unconfirmedUnits (S) is the amount of unconfirmed currency units (in QNT)
- accountRS (S) is the Reed-Solomon address of the account
- currency (S) is the currency ID
- units (S) is the amount of currency (in QNT)
- account (S) is the account number
- lastBlock (S) is the last block ID on the blockchain (applies if requireBlock is provided but not requireLastBlock)
- requestProcessingTime (N) is the API request processing time (in millisec)
Get Currency Accounts Example
http://localhost:7876/nxt?
requestType=getCurrencyAccounts&
currency=6520756875632314476
{
"accountCurrencies": [
{
"unconfirmedUnits": "9000",
"accountRS": "NXT-4VDY-LNVT-LMAY-FMCKA",
"currency": "6520756875632314476",
"units": "9000",
"account": "15295723609781267838"
},
{
"unconfirmedUnits": "1000",
"accountRS": "NXT-BMUV-8QQR-47VK-CR7F3",
"currency": "6520756875632314476",
"units": "1000",
"account": "11580081983047651163"
}
],
"requestProcessingTime": 1
}
Get Currency Founders
Get a reservable currency's founders.
Request:
- requestType is getCurrencyFounders
- currency is the currency ID
- account is an account ID (optional)
- firstIndex is a zero-based index to the first founder to retrieve (optional)
- lastIndex is a zero-based index to the last founder to retrieve (optional)
- requireBlock is the block ID of a block that must be present in the blockchain during execution (optional)
- requireLastBlock is the block ID of a block that must be last in the blockchain during execution (optional)
Response:
- founders (A) is an array of founder objects each of which has the following fields:
- accountRS (S) is the Reed-Solomon address of the founding account
- amountPerUnitNQT (S) is the amount (in NQT per QNT of reserveSupply) reserved by the founder
- currency (S) is the currency ID
- account (S) is the founding account number
- lastBlock (S) is the last block ID on the blockchain (applies if requireBlock is provided but not requireLastBlock)
- requestProcessingTime (N) is the API request processing time (in millisec)
Get Currency Founders Example
http://localhost:7876/nxt?
requestType=getCurrencyFounders&
currency=16165836410580103964
{
"founders": [
{
"accountRS": "NXT-4VDY-LNVT-LMAY-FMCKA",
"amountPerUnitNQT": "100000000",
"currency": "16165836410580103964",
"account": "15295723609781267838"
}
],
"requestProcessingTime": 1
}
Get Currency Ids
Get all currency IDs in reverse chronological creation order.
Request:
- requestType is getCurrencyIds
- firstIndex is a zero-based index to the first currency to retrieve (optional)
- lastIndex is a zero-based index to the last currency to retrieve (optional)
- requireBlock is the block ID of a block that must be present in the blockchain during execution (optional)
- requireLastBlock is the block ID of a block that must be last in the blockchain during execution (optional)
Response:
- currencyIds(A) is an array of currency IDs
- lastBlock (S) is the last block ID on the blockchain (applies if requireBlock is provided but not requireLastBlock)
- requestProcessingTime (N) is the API request processing time (in millisec)
Get Currency Ids Example
http://localhost:7876/nxt?
requestType=getCurrencyIds&
lastIndex=2
{
"currencyIds": [
"3543596621551215845",
"6520756875632314476",
"10304209318415949524"
],
"requestProcessingTime": 2
}
Get Currency Transfers
Get currency transfers given a currency ID and/or an account ID in reverse block height order (or in expected order of execution for expected transfers).
Request:
- requestType is either getCurrencyTransfers or getExpectedCurrencyTransfers, where expected transfers are from the unconfirmed transactions pool or are phased transactions scheduled to finish in the next block
- currency is the currency ID (optional)
- account is the account ID (optional if currency provided)
- timestamp is the earliest transfer (in seconds since the genesis block) to retrieve (optional, does not apply to expected transfers)
- firstIndex is a zero-based index to the first transfer to retrieve (optional, does not apply to expected transfers)
- lastIndex is a zero-based index to the last transfer to retrieve (optional, does not apply to expected transfers)
- includeCurrencyInfo is true to include some currency fields (optional, does not apply to expected transfers)
- requireBlock is the block ID of a block that must be present in the blockchain during execution (optional)
- requireLastBlock is the block ID of a block that must be last in the blockchain during execution (optional)
Response:
- transfers (A) is an array of transfer objects with the following fields for each transfer:
- code (S) is the currency code
- units (S) is the amount (in QNT) of the transfer
- issuanceHeight (N) is the blockchain height of the currency issuance for a reservable currency
- type (N) is the currency type bitmask (refer to Get Currency for details)
- issuerAccountRS (S) is the Reed-Solomon address of the issuer account
- transfer (S) is the transfer ID
- senderRS (S) is the Reed-Solomon address of the sender account
- sender (S) is the account number of the sender account
- recipientRS (S) is the Reed-Solomon address of the recipient account
- decimals (N) is the number of decimal places used by the currency
- recipient (S) is the account number of the recipient account
- name (S) is the currency name
- currency (S) is the currency ID
- issuerAccount (S) is the issuer account ID
- height (N) is the blockchain height of the transfer
- timestamp (N) is the timestamp (in seconds since the genesis block) of the transfer block, does not apply to an expected transfer
- phased (B) is true if the transaction is phased, false otherwise, applies only to an expected transfer
- issuerAccountRS (S) is the Reed-Solomon address of the issuer account
- issuerAccount (S) is the issuer account ID
- lastBlock (S) is the last block ID on the blockchain (applies if requireBlock is provided but not requireLastBlock)
- requestProcessingTime (N) is the API request processing time (in millisec)
Get Currency Transfers Example
http://localhost:7876/nxt?
requestType=getCurrencyTransfers&
currency=9387514940677621191
{
"transfers": [
{
"issuerAccountRS": "NXT-4VDY-LNVT-LMAY-FMCKA",
"code": "MYSTX",
"units": "10",
"issuanceHeight": 0,
"type": 1,
"transfer": "12208608533071682262",
"senderRS": "NXT-4VDY-LNVT-LMAY-FMCKA",
"sender": "15295723609781267838",
"recipientRS": "NXT-BMUV-8QQR-47VK-CR7F3",
"decimals": 2,
"recipient": "11580081983047651163",
"name": "MystcoinX",
"currency": "9387514940677621191",
"issuerAccount": "15295723609781267838",
"height": 159732,
"timestamp": 34280949
}
],
"requestProcessingTime": 0
}
Get Expected Currency Transfers
Refer to Get Currency Transfers.
Get Exchanges
Get currency exchanges given a currency and/or an account in reverse chronological order.
Request:
- requestType is getExchanges
- currency is a currency ID (optional)
- account is an account ID (optional if currency provided)
- firstIndex is a zero-based index to the first currency exchange to retrieve (optional)
- lastIndex is a zero-based index to the last currency exchange to retrieve (optional)
- timestamp is the earliest block (in seconds since the genesis block) to retrieve (optional)
- includeCurrencyInfo is true to include several currency-related fields (optional)
- requireBlock is the block ID of a block that must be present in the blockchain during execution (optional)
- requireLastBlock is the block ID of a block that must be last in the blockchain during execution (optional)
Response:
- exchanges (A) is an array of exchange objects with the following fields for each exchange:
- seller (S) is the seller account number
- code (S) is the currency code
- sellerRS (S) is the Reed-Solomon address of the seller account
- units (S) is the amount of currency exchanged (in QNT)
- issuanceHeight (N) is the blockchain height of currency issuance for a reservable currency
- type (N) is the currency type bitmask (refer to Get Currency for details)
- rateNQT (S) is the currency exchange rate (in NQT per QNT)
- buyer (S) is the account number of the buyer
- offer (S) is the offer ID
- buyerRS (S) is the Reed-Solomon address of the buyer account
- decimals (N) is the number of decimal places used by the currency
- name (S) is the currency name
- currency (S) is the currency ID
- block (S) is the block ID of the block containing the exchange transaction
- transaction (S) is the transaction ID of the exchange
- timestamp (N) is the timestamp (in seconds since the genesis block) of the exchange
- height is the blockchain height of the block containing the exchange transaction
- issuerAccountRS (S) is the Reed-Solomon address of the issuer account
- issuerAccount (S) is the issuer account ID
- lastBlock (S) is the last block ID on the blockchain (applies if requireBlock is provided but not requireLastBlock)
- requestProcessingTime (N) is the API request processing time (in millisec)
Get Exchanges Example
http://localhost:7876/nxt?
requestType=getExchanges&
currency=6520756875632314476
{
"exchanges": [
{
"issuerAccountRS": "NXT-4VDY-LNVT-LMAY-FMCKA",
"seller": "15295723609781267838",
"code": "MYSTX",
"sellerRS": "NXT-4VDY-LNVT-LMAY-FMCKA",
"units": "1",
"issuanceHeight": 0,
"type": 1,
"rateNQT": "1500000000",
"buyer": "11580081983047651163",
"offer": "7762792906174207279",
"buyerRS": "NXT-BMUV-8QQR-47VK-CR7F3",
"decimals": 2,
"name": "MystcoinX",
"currency": "6520756875632314476",
"block": "2329341955641682831",
"transaction": "12589829502215822061",
"timestamp": 34137058,
"height": 162356,
"issuerAccount": "15295723609781267838"
}
],
"requestProcessingTime": 0
}
Get Exchanges By Exchange Request
Get currency exchanges given an exchange request transaction ID in reverse chronological order.
Request:
- requestType is getExchangesByExchangeRequest
- transaction is the transaction ID of the exchange request
- includeCurrencyInfo is true to include several currency-related fields (optional)
- requireBlock is the block ID of a block that must be present in the blockchain during execution (optional)
- requireLastBlock is the block ID of a block that must be last in the blockchain during execution (optional)
Response:
- exchanges (A) is an array of exchange objects (refer to Get Exchanges for details)
- lastBlock (S) is the last block ID on the blockchain (applies if requireBlock is provided but not requireLastBlock)
- requestProcessingTime (N) is the API request processing time (in millisec)
Get Exchanges By Exchange Request Example
http://localhost:7876/nxt?
requestType=getExchangesByExchangeRequest&
transaction=12589829502215822061
{
"exchanges": [
{
"issuerAccountRS": "NXT-4VDY-LNVT-LMAY-FMCKA",
"seller": "15295723609781267838",
"code": "MYSTX",
"sellerRS": "NXT-4VDY-LNVT-LMAY-FMCKA",
"units": "1",
"issuanceHeight": 0,
"type": 1,
"rateNQT": "1500000000",
"buyer": "11580081983047651163",
"offer": "7762792906174207279",
"buyerRS": "NXT-BMUV-8QQR-47VK-CR7F3",
"decimals": 2,
"name": "MystcoinX",
"currency": "6520756875632314476",
"block": "2329341955641682831",
"transaction": "12589829502215822061",
"timestamp": 34137058,
"height": 162356,
"issuerAccount": "15295723609781267838"
}
],
"requestProcessingTime": 1
}
Get Exchanges By Offer
Get currency exchanges given a currency offer ID in reverse chronological order.
Request:
- requestType is getExchangesByOffer
- offer (S) is a currency offer ID
- includeCurrencyInfo is true to include several currency-related fields (optional)
- firstIndex is a zero-based index to the first currency exchange to retrieve (optional)
- lastIndex is a zero-based index to the last currency exchange to retrieve (optional)
- requireBlock is the block ID of a block that must be present in the blockchain during execution (optional)
- requireLastBlock is the block ID of a block that must be last in the blockchain during execution (optional)
Response:
- exchanges (A) is an array of exchange objects (refer to Get Exchanges for details)
- lastBlock (S) is the last block ID on the blockchain (applies if requireBlock is provided but not requireLastBlock)
- requestProcessingTime (N) is the API request processing time (in millisec)
Get Exchanges By Offer Example
http://localhost:7876/nxt?
requestType=getExchangesByOffer&
offer=7762792906174207279
{
"exchanges": [
{
"issuerAccountRS": "NXT-4VDY-LNVT-LMAY-FMCKA",
"seller": "15295723609781267838",
"code": "MYSTX",
"sellerRS": "NXT-4VDY-LNVT-LMAY-FMCKA",
"units": "1",
"issuanceHeight": 0,
"type": 1,
"rateNQT": "1500000000",
"buyer": "11580081983047651163",
"offer": "7762792906174207279",
"buyerRS": "NXT-BMUV-8QQR-47VK-CR7F3",
"decimals": 2,
"name": "MystcoinX",
"currency": "6520756875632314476",
"block": "2329341955641682831",
"transaction": "12589829502215822061",
"timestamp": 34137058,
"height": 162356,
"issuerAccount": "15295723609781267838"
}
],
"requestProcessingTime": 1
}
Get Last Exchanges
Get the last exchange of each of multiple currencies.
Request:
- requestType is getLastExchanges
- currencies is one of multiple currency IDs
- currencies is one of multiple currency IDs
⋮
- requireBlock is the block ID of a block that must be present in the blockchain during execution (optional)
- requireLastBlock is the block ID of a block that must be last in the blockchain during execution (optional)
Response:
- exchanges (A) is an array of exchange objects (refer to Get Exchanges without name, decimals, code, issuanceHeight, type, issuerAccountRS and issuerAccount for details)
- requestProcessingTime (N) is the API request processing time (in millisec)
Get Last Exchanges Example
http://localhost:7876/nxt?
requestType=getLastExchanges&
currencies=12366259387060174981
{
"exchanges": [
{
"offer": "1659323201112235372",
"seller": "15295723609781267838",
"buyerRS": "NXT-4VDY-LNVT-LMAY-FMCKA",
"sellerRS": "NXT-4VDY-LNVT-LMAY-FMCKA",
"currency": "12366259387060174981",
"block": "15911141024340031754",
"units": "2",
"transaction": "13926698078551037914",
"timestamp": 35547397,
"rateNQT": "100000000",
"buyer": "15295723609781267838",
"height": 167709
}
],
"requestProcessingTime": 0
}
Get Minting Target
Get the current minting target of a mintable currency.
Request:
- requestType is getMintingTarget
- currency is the mintable currency ID
- account is the minting account ID
- units is the amount (in QNT) of currency to mint
- requireBlock is the block ID of a block that must be present in the blockchain during execution (optional)
- requireLastBlock is the block ID of a block that must be last in the blockchain during execution (optional)
Note: units cannot be greater than 1/10000 of the maxSupply (refer to Issue Currency). Increasing units decreases targetBytes.
Response:
- difficulty (S) is the current difficulty, an estimate of the number of hashes needed to meet the target
- targetBytes (S) is the 32-byte target (little endian), which must equal or exceed the computed hash of the nonce
- currency (S) is the currency ID
- counter (N) is the counter associated with the minting account, the value previously submitted to Currency Mint
- lastBlock (S) is the last block ID on the blockchain (applies if requireBlock is provided but not requireLastBlock)
- requestProcessingTime (N) is the API request processing time (in millisec)
Note: If a nonce is found such that its hash is less than the target, it can be submitted to the blockchain along with counter + 1 using Currency Mint, which results in units NQT being credited to the minting account. difficulty is inversely related to the target, and so increases exponentially as maxSupply is approached because the target is defined as (2exp-1)/units, where exp decreases linearly from 256-minDifficulty to 256-maxDifficulty. (Refer to Issue Currency for maxSupply, minDifficulty and maxDifficulty.)
Get Minting Target Example
http://localhost:7876/nxt?
requestType=getMintingTarget&
currency=9207767346829573996&
account=NXT-4VDY-LNVT-LMAY-FMCKA&
units=1
{
"difficulty": "1024",
"targetBytes": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff3f00",
"currency": "9207767346829573996",
"counter": 0,
"requestProcessingTime": 1
}
Get Offer
Get offer details given an offer ID.
Request:
- requestType is getOffer
- offer is the offer ID
- requireBlock is the block ID of a block that must be present in the blockchain during execution (optional)
- requireLastBlock is the block ID of a block that must be last in the blockchain during execution (optional)
Response:
- sellOffer and buyOffer (O) are objects with the following fields:
- offer (S) is the offer ID
- expirationHeight (N) is the blockchain height of offer expiration
- accountRS (S) is the Reed-Solomon address of the offering account
- limit (S) is the cumulative limit of currency buys or sells
- currency (S) is the currency ID
- supply (S) is the current currency supply
- account (S) is the offering account number
- height (N) is the blockchain height of offer creation
- rateNQT (S) is the currency exchange rate (in NQT per QNT)
- lastBlock (S) is the last block ID on the blockchain (applies if requireBlock is provided but not requireLastBlock)
- requestProcessingTime (N) is the API request processing time (in millisec)
Get Offer Example
http://localhost:7876/nxt?
requestType=getOffer&
offer=4813417617929273983
{
"sellOffer": {
"offer": "4813417617929273983",
"expirationHeight": 163125,
"accountRS": "NXT-4VDY-LNVT-LMAY-FMCKA",
"limit": "1000",
"currency": "6520756875632314476",
"supply": "500",
"account": "15295723609781267838",
"height": 163110,
"rateNQT": "20000000"
},
"buyOffer": {
"offer": "4813417617929273983",
"expirationHeight": 163125,
"accountRS": "NXT-4VDY-LNVT-LMAY-FMCKA",
"limit": "1000",
"currency": "6520756875632314476",
"supply": "500",
"account": "15295723609781267838",
"height": 163110,
"rateNQT": "10000000"
},
"requestProcessingTime": 0
}
Issue Currency
Issue a new currency or re-issue an existing currency with different properties. POST only.
Request: Refer to Create Transaction Request for common parameters.
- requestType is issueCurrency
- name is the currency name, 3 to 10 characters and longer than the currency code
- code is the uppercase currency code with the following fee structure: three letters 25000 NXT, four letters 1000 NXT, five letters 40 NXT, re-issue 40 NXT
- description is the currency description
- type is the currency type bitmask, from least to most significant bit: exchangeable, controllable, reservable, claimable, mintable, non-shuffleable
- initialSupply is the initial currency supply (in QNT) (must match maxSupply unless mintable or claimable, must be zero for claimable)
- reserveSupply is the reserve currency supply (in QNT) (must match maxSupply)
- maxSupply is the maximum currency supply (in QNT)
- issuanceHeight is the blockchain height at which a reservable currency is issued if the reserve minimum is met
- minReservePerUnitNQT is the minimum currency reserve (in NQT per QNT of reserveSupply) for issuance of a reservable currency
- minDifficulty is the minimum difficulty (minimum 1) for a mintable currency
- maxDifficulty is the maximum difficulty (maximum 255 and greater than minDifficulty) for a mintable currency
- ruleset is for future use, always set to zero
- algorithm is an algorithm code for a mintable currency: 2 for SHA256, 3 for SHA3, 5 for Scrypt, 25 for Keccak25
- decimals is the number of decimal places used by the currency (optional, default zero)
Notes: Reservable requires exchangeable and/or claimable, as does controllable; but mintable requires exchangeable. Claimable requires reservable, non-mintable and zero initialSupply.
Response: Refer to Create Transaction Response. The transaction ID is also the currency ID.
Issue Currency Example
http://localhost:7876/nxt?
requestType=issueCurrency&
name=MystcoinX&
code=MYSTX&
description=Exchangeable
type=1&
initialSupply=10000&
maxSupply=10000&
decimals=2&
secretPhrase=SECRETPHRASE&
feeNQT=4000000000&
deadline=60
{
"signatureHash": "c5ec66dd60bcc13fc0fe2cb617b4d7a05e7ef6360aacc591c911969785361491",
"unsignedTransactionBytes": "05100f8308023c0010f09c34f225d425306e5be55a49469081...",
"transactionJSON": {
"senderPublicKey": "10f09c34f225d425306e5be55a4946908156072afbead4d574a512d7e086ef5c",
"signature": "da27e4bead869d0e96fb9370f0afcd0c49eb17b7da503705384239d9abaec209733...",
"feeNQT": "4000000000",
"type": 5,
"fullHash": "6c08c076d4617e5a4be6f027c9b3e47ddb0e92fab87032d631546051dbdbfe8c",
"version": 1,
"ecBlockId": "2004481009157728964",
"signatureHash": "c5ec66dd60bcc13fc0fe2cb617b4d7a05e7ef6360aacc591c911969785361491",
"attachment": {
"initialSupply": "10000",
"code": "MYSTX",
"minDifficulty": 0,
"ruleset": 0,
"description": "Exchangeable",
"minReservePerUnitNQT": "0",
"issuanceHeight": 0,
"type": 1,
"reserveSupply": "0",
"version.CurrencyIssuance": 1,
"maxDifficulty": 0,
"decimals": 2,
"name": "MystcoinX",
"maxSupply": "10000",
"algorithm": 0
},
"senderRS": "NXT-4VDY-LNVT-LMAY-FMCKA",
"subtype": 0,
"amountNQT": "0",
"sender": "15295723609781267838",
"ecBlockHeight": 162060,
"deadline": 60,
"transaction": "6520756875632314476",
"timestamp": 34112271,
"height": 2147483647
},
"broadcasted": true,
"requestProcessingTime": 53,
"transactionBytes": "05100f8308023c0010f09c34f225d425306e5be55a49469081560...",
"fullHash": "6c08c076d4617e5a4be6f027c9b3e47ddb0e92fab87032d631546051dbdbfe8c",
"transaction": "6520756875632314476"
}
Publish Exchange Offer
Publish an exchange offer for an exchangeable currency. POST only.
Request: Refer to Create Transaction Request for common parameters.
- requestType is publishExchangeOffer
- currency is the currency ID
- buyRateNQT is the offered buy rate (in NQT per QNT)
- sellRateNQT is the offered sell rate (in NQT per QNT)
- totalBuyLimit is the cumulative limit (in QNT) of currency buys
- totalSellLimit is the cumulative limit (in QNT) of currency sells
- initialBuySupply is the initial amount (in QNT) of currency offered to buy, cannot exceed totalBuyLimit
- initialSellSupply is the initial amount (in QNT) of currency offered to sell, cannot exceed totalSellLimit
- expirationHeight is the blockchain height for expiration of the offer
Notes: Each time currency is bought in response to an exchange request to sell currency (refer to Currency Sell), totalBuyLimit is reduced and the supply of currency offered to sell increases by the amount bought. When totalBuyLimit becomes zero, the buy offer is withdrawn. These same notes apply if buy and sell are interchanged. Only the most recent offer associated with an account is valid, even if an earlier offer by that account has not yet expired or reached its limits.
Response: Refer to Create Transaction Response. The transaction ID is also the offer ID.
Publish Exchange Offer Example
http://localhost:7876/nxt?
requestType=publishExchangeOffer&
currency=6520756875632314476&
buyRateNQT=10000000&
sellRateNQT=20000000&
totalBuyLimit=1000&
totalSellLimit=1000&
initialBuySupply=500&
initialSellSupply=500&
expirationHeight=163080&
secretPhrase=SECRETPHRASE&
feeNQT=100000000&
deadline=60
{
"signatureHash": "6fd60fcbc6e7022f12adad82a76c0534d2f79a569b9857b02328bf7573cf93f8",
"unsignedTransactionBytes": "0514d7c409023c0010f09c34f225d425306e5be55a49469081...",
"transactionJSON": {
"senderPublicKey": "10f09c34f225d425306e5be55a4946908156072afbead4d574a512d7e086ef5c",
"signature": "b204a7d9622ac6b99936447a4314fac1c2f0c67e45f4021f4b1949755c081802a34...",
"feeNQT": "100000000",
"type": 5,
"fullHash": "fccb2c6200a04bbce82b9e623051b8d8ed9d519dbb0a12ec5a354c842da9a664",
"version": 1,
"ecBlockId": "6813726597245349906",
"signatureHash": "6fd60fcbc6e7022f12adad82a76c0534d2f79a569b9857b02328bf7573cf93f8",
"attachment": {
"totalSellLimit": "1000",
"buyRateNQT": "10000000",
"initialSellSupply": "500",
"totalBuyLimit": "1000",
"expirationHeight": 163080,
"sellRateNQT": "20000000",
"version.PublishExchangeOffer": 1,
"currency": "6520756875632314476",
"initialBuySupply": "500"
},
"senderRS": "NXT-4VDY-LNVT-LMAY-FMCKA",
"subtype": 4,
"amountNQT": "0",
"sender": "15295723609781267838",
"ecBlockHeight": 163049,
"deadline": 60,
"transaction": "13568114225891298300",
"timestamp": 34194647,
"height": 2147483647
},
"broadcasted": true,
"requestProcessingTime": 54,
"transactionBytes": "0514d7c409023c0010f09c34f225d425306e5be55a4946908156072...",
"transaction": "13568114225891298300"
}
Search Currencies
Get currencies having a code that matches a given query in reverse relevance order.
Request:
- requestType is searchCurrencies
- query is a full text query on the currency field code in the standard Lucene syntax
- firstIndex is a zero-based index to the first currency to retrieve (optional)
- lastIndex is a zero-based index to the last currency to retrieve (optional)
- includeCounts is true if the fields beginning with numberOf... are to be included (optional)
- requireBlock is the block ID of a block that must be present in the blockchain during execution (optional)
- requireLastBlock is the block ID of a block that must be last in the blockchain during execution (optional)
Response:
- currencies (A) is an array of currency objects (refer to Get Currency for details)
- lastBlock (S) is the last block ID on the blockchain (applies if requireBlock is provided but not requireLastBlock)
- requestProcessingTime (N) is the API request processing time (in millisec)
Search Currencies Example
http://localhost:7876/nxt?
requestType=searchCurrencies&
query=MYST?
{
"requestProcessingTime": 5,
"currencies": [
{
"initialSupply": "10000",
"currentReservePerUnitNQT": "0",
"types": [
"EXCHANGEABLE"
],
"code": "MYSTX",
"creationHeight": 159726,
"minDifficulty": 0,
"numberOfTransfers": 3,
"description": "Exchangeable",
"minReservePerUnitNQT": "0",
"currentSupply": "10000",
"issuanceHeight": 0,
"type": 1,
"reserveSupply": "0",
"maxDifficulty": 0,
"accountRS": "NXT-4VDY-LNVT-LMAY-FMCKA",
"decimals": 2,
"name": "MystcoinX",
"numberOfExchanges": 0,
"currency": "9387514940677621191",
"maxSupply": "10000",
"account": "15295723609781267838",
"algorithm": 0
}
]
}
Transfer Currency
Transfer currency to a given recipient. POST only.
Request: Refer to Create Transaction Request for common parameters.
- requestType is transferCurrency
- recipient is the account ID of the transfer recipient
- currency is the currency ID
- units is the amount (in QNT) of the transfer
Response: Refer to Create Transaction Response.
Transfer Currency Example
http://localhost:7876/nxt?
requestType=transferCurrency&
recipient=NXT-BMUV-8QQR-47VK-CR7F3&
currency=9387514940677621191&
units=10
{
"signatureHash": "eda8f238d164074170ddb8163d7d71f08062f1f1a51712f05670a670e64e5eff",
"unsignedTransactionBytes": "0513ad150b023c0010f09c34f225d425306e5be55a49469081...",
"transactionJSON": {
"senderPublicKey": "10f09c34f225d425306e5be55a4946908156072afbead4d574a512d7e086ef5c",
"signature": "7629cba6e776685c9e134f8d96c54a5bcad6915c433f833b1ca792c69e75ee0ac6f...",
"feeNQT": "100000000",
"type": 5,
"fullHash": "d65a8adfc6b06da98ce50bb36d52305a8c9300b8defbeed9f2582628d9e258f0",
"version": 1,
"ecBlockId": "13770841487927223834",
"signatureHash": "eda8f238d164074170ddb8163d7d71f08062f1f1a51712f05670a670e64e5eff",
"attachment": {
"currency": "9387514940677621191",
"version.CurrencyTransfer": 1,
"units": "10"
},
"senderRS": "NXT-4VDY-LNVT-LMAY-FMCKA",
"subtype": 3,
"amountNQT": "0",
"sender": "15295723609781267838",
"recipientRS": "NXT-BMUV-8QQR-47VK-CR7F3",
"recipient": "11580081983047651163",
"ecBlockHeight": 159721,
"deadline": 60,
"transaction": "12208608533071682262",
"timestamp": 34280877,
"height": 2147483647
},
"broadcasted": true,
"requestProcessingTime": 8,
"transactionBytes": "0513ad150b023c0010f09c34f225d425306e5be55a49469081560...",
"fullHash": "d65a8adfc6b06da98ce50bb36d52305a8c9300b8defbeed9f2582628d9e258f0",
"transaction": "12208608533071682262"
}