General notes
Genesis Block
The Ardor Genesis Snapshot was scheduled to occur on December 28, 2017, at block height 1636363 in the Nxt blockchain. There is no genesis account for Ardor.
Flexible Account IDs
All API requests that require an account ID accept either an account number or the corresponding Reed-Solomon address.
Quantity Units
The Ardor multichain platform has several quantity units: ARDR, unitsQNT, priceNQTPerShare, priceNQTPerCoin and rateNQTPerUnit for representing all tokens within the platform. The parent chain ARDR is used to provide the proof of stake algorithm for all the system. Like all currencies, ARDR circulates in the system, moving from one user to another by payments and purchases. Also, a small fee is required for every transaction, including those in which no ARDR is transfered, such as simple messages. This fee goes to the owner of the node that forges (generates) the new block containing the transactions that are accepted onto the blockchain.
Prices and rates are now defined relative to a whole unit of the holding being bought or sold (asset, currency, coin), not to a QNT indivisible unit.
One billion ARDR were created in the as result of the Ardor snapshot from the blockchain called Nxt, and no new ARDR will ever be created. It is divisible to eight decimal places. Yet internally, the currency is still stored in integer form in units of NQT, where 1 ARDR = 108 NQT. All parameters and fields in the API involving a quantity of ARDR are denominated in units of NQT, for example feeNQT. The only exception is the field effectiveBalanceFQT, used in forging calculations.
The Ardor platform can be thought of as an asset owned by all who posses ARDR. In this sense ARDR quantifies ownership of or stake in the system. Stakeholders are entitled to forge blocks and collect transaction fees in proportion to the amount of ARDR they possess.
Other assets can be created within Ardor using the Ignis child chain Issue Asset. The issuer must specify the number of decimal places to use in quantifying the asset, and the amount of the asset to create in generic units of QNT or Quant, distinct from NQT. Quantities of assets are stored internally as integers in units of QNT, and assets are priced in NQT per QNT.
For example, an asset called jelBTC may be divisible to eight decimal places, like the original bitcoin (BTC) it is a proxy for. Therefore a QNT of jelBTC is equivalent to a Satoshi (10-8 BTC). To place an order to sell 25,000,000 QNT of the jelBTC asset at a price of 20,000 NQT per QNT, use the API Call Place Order with requestType=placeAskOrder, quantityQNT=25000000 and priceNQT=20000. If the entire quantity is sold on the Asset Exchange, the seller will receive 500,000,000,000 NQT (quantityQNT * priceNQT) from the buyer(s). This trade corresponds to selling 0.25 jelBTC for 5,000 IGNIS, which is how the trade appears in the NRS client. In this case, the price of 20,000 in NQT per QNT is also the price in NXT per jelBTC, since both jelBTC and Ignis are divisible to eight decimal places.
Currencies in the child chain (ie: Ignis) Monetary System are a special kind of asset with properties and exchange methods suitable for currencies. With respect to quantities, exchange rates and decimal places, the Monetary System API calls use a chain currency, NQT and QNT in exactly the same way as assets.
Creating Unsigned Transactions
All API requests that create a new transaction will accept either a secretPhrase or a publicKey parameter:
- If secretPhrase is supplied, a transaction is created, signed at the server, and broadcast by the server as usual.
- If only a publicKey parameter is supplied as a 64-digit (32-byte) hex string, the transaction will be prepared by the server and returned in the JSON response as transactionJSON without a signature. This JSON object along with secretPhrase can then be supplied to Sign Transaction as unsignedTransactionJSON and the resulting signed transactionJSON can then be supplied to Broadcast Transaction. This sequence allows for offline signing of transactions so that secretPhrase never needs to be exposed.
- unsignedTransactionBytes may be used instead of unsigned transactionJSON when there is no encrypted message. Messages to be encrypted require the secretPhrase for encryption and so cannot be included in unsignedTransactionBytes.
Escrow Operations
All API requests that create a new transaction will accept an optional referencedTransactionFullHash parameter which creates a chained transaction, meaning that the new transaction cannot be confirmed unless the referenced transaction is also confirmed. This feature allows a simple way of transaction escrow:
- Alice prepares and signs a transaction A, but doesn't broadcast it by setting the broadcast parameter to false. She sends to Bob the unsignedTransactionBytes, the fullHash of the transaction, and the signatureHash. All of those are included in the JSON returned by the API request. (Warning: make sure not to send the signed transactionBytes, or the signature itself, as then Bob can just broadcast transaction A himself).
- Bob prepares, signs and broadcasts transaction B, setting the referencedTransactionFullHash parameter to the fullHash of A provided by Alice. He can verify that this hash indeed belongs to the transaction he expects from Alice, by using Calculate Full Hash, which takes unsignedTransactionBytes and signatureHash (both of which Alice has also sent to Bob). He can also use Parse Transaction to decode the unsigned bytes and inspect all transaction fields.
- Transaction B is accepted in the unconfirmed transaction pool, but as long as A is still missing, B will not be confirmed, i.e. will not be included in the blockchain. If A is never submitted, B will eventually expire -- so Bob should make sure to set a long enough deadline, such as the maximum of 32767 minutes.
- Once in the unconfirmed transactions pool, Bob has no way of recalling B back. So now Alice can safely submit her transaction A, by just broadcasting the signedTransactionBytes she got in the first step. Transaction A will get included in the blockchain first, and in the next block Bob's transaction B will also be included.
Note that while the above scheme is good enough for a simple escrow, the blockchain does not enforce that if A is included, B will also be included. It may happen due to forks and blockchain reorganization, that B never gets a chance to be included and expires unconfirmed, while A still remains in the blockchain. However, it is not practically possible for Bob to intentionally cause such chain of events and to prevent B from being confirmed.
Prunable Data
Prunable data can be removed from the blockchain without affecting the integrity of the blockchain. When a transaction containing prunable data is created, only the 32-byte sha256 hash of the prunable data is included in the transactionBytes, not the prunable data itself. The non-prunable signed transactionBytes are used to verify the signature and to generate the transaction's fullHash and ID; when the prunable part of the transaction is removed at a later time, none of these operations are affected.
Prunable data has a predetermined minimum lifetime of two weeks (24 hours on the Testnet) from the timestamp of the transaction. Transactions and blocks received from peer nodes are not accepted if prunable data is missing before this time has elapsed. After this time has elapsed, prunable data is no longer included with transactions and blocks transmitted to peer nodes, and is no longer included in the transaction JSON returned by general-purpose API calls such as Get Transaction; the only way to retrieve it, if still available, is through special-purpose API calls such as Get Prunable Message.
Expired prunable data remains stored in the blockchain until removed at the same time derived tables are trimmed, which occurs automatically every 1000 blocks by default. Use Trim Derived Tables to remove expired prunable data immediately.
Prunable data can be preserved on a node beyond the predetermined minimum lifetime by setting the nxt.maxPrunableLifetime property to a larger value than two weeks or to -1 to preserve it indefinitely. To force the node to include such preserved prunable data when transactions and blocks are transmitted to peer nodes, set the nxt.includeExpiredPrunables property to true, thus making it an archival node.
Currently, there are two varieties of prunable data in the Nxt system: prunable Arbitrary Messages and Tagged Data. Both varities have a maximum prunable data length of 42 kilobytes.
Properties Files
The behavior of some API calls is affected by property settings loaded from files in the Ardor/conf directory during Ardor server intialization. This directory contains the nxt-default.properties and logging-default.properties files, both of which contain default property settings along with documentation. A few of the property settings can be obtained while the server is running through the Get Blockchain Status and Get State calls.
It is recommended not to modify default properties files because they can be overwritten during software updates. Instead, properties in the default files can be overridden by including them in optional nxt.properties and logging.properties files in the same directory. For example, a nxt.properties file can be created with the contents:
nxt.isTestnet=true
This causes the Ardor server to connect to the Testnet instead of the Mainnet.
Admin Password
Some API functions take an adminPassword parameter, which must match the nxt.adminPassword property unless the nxt.disableAdminPassword property is set to true or the API server only listens on the localhost interface (when the nxt.apiServerHost property is set to 127.0.0.1).
All Debug Operations require adminPassword since they require some kind of privilege. On some functions adminPassword is used so you can override maximum allowed value for lastIndex parameter, which is set to 100 by default by the nxt.maxAPIRecords property. Giving you the option to retrieve more than objects per request.
Roaming and Light Client Modes
The remote node to use when in roaming and light client modes is selected randomly, but can be changed manually in the UI, or using the new set API Proxy Peer API, or forced to a specific peer using the nxt.forceAPIProxyServerURL property.
Remote nodes can be blacklisted from the UI, or using the Blacklist API Proxy Peer API. This blacklisting is independent from peer blacklisting. The API proxy blacklisting period can be set using the nxt.apiProxyBlacklistingPeriod property (default 1800000 milliseconds).
API requests that require sending the secret phrase, shared key, or admin password to the server, for features like forging, shuffling, or running a funding monitor, are disabled when in roaming or light client mode.