Server Information Operations
Event Register
Create, modify or remove an event listener which can report server events via Event Wait. POST only.
Request:
requestType
iseventRegister
event
is one of multiple server events from the following list of event names: (optional, default is all possible events)- Block.BLOCK-GENERATED
- Block.BLOCK-POPPED
- Block.BLOCK-PUSHED
- Peer.ADD-INBOUND
- Peer.ADDED-ACTIVE-PEER
- Peer.BLACKLIST
- Peer.CHANGED-ACTIVE-PEER
- Peer.DEACTIVATE
- Peer.NEW-PEER
- Peer.REMOVE
- Peer.REMOVE-INBOUND
- Peer.UNBLACKLIST
- Transaction.ADDED-CONFIRMED-TRANSACTIONS
- Transaction.ADDED-UNCONFIRMED-TRANSACTIONS
- Transaction.REJECT-PHASED-TRANSACTION
- Transaction.RELEASE-PHASED-TRANSACTION
- Transaction.REMOVE-UNCONFIRMED-TRANSACTIONS
event
is one of multiple server events (optional)add
istrue
to add events to an existing listener (optional, omit ifremove
istrue
)remove
istrue
to remove events from an existing listener (optional, omit ifadd
istrue
)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: To create a new event listener, omit both add
and remove
. To remove an existing event listener, set remove
to true
and omit event
; all registered events will be removed, any outstanding Event Wait will be completed and the listener will be deactivated.
Note: An event listener is automatically deactivated whenever all registered events are removed or if Event Wait is not called frequently enough, according to the nxt.apiEventTimeout
property. The timeout is not precise; the removal process runs every nxt.apiEventTimeout
/ 2 seconds, so that many extra seconds may elapse before removal; the first Event Wait call should be made immediately after registration to avoid deactivation.
Note: Each API user (with a unique address) can create only one event listener. When a new one is created, it will replace an existing one. The maximum number of unique users is controlled by the nxt.maxEventUsers
property.
Response:
registered
istrue
if the operation completed successfullylastBlock
(S) is the last block ID on the blockchain (applies ifrequireBlock
is provided but notrequireLastBlock
)requestProcessingTime
(N) is the API request processing time (in millisec)
Example: Refer to Event Register example.
Event Wait
Wait for events registered with Event Register. POST only.
Request:
requestType
iseventWait
timeout
is the amount of time (in seconds) to wait for an event before the call returns (optional, default and maximum is the nxt.apiEventTimeout property)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)
Notes: The call returns immediately if one or more events have occurred since the last call; multiple events are all returned together. If a new call is made before the last one returns, the timeout
timer resets to the new value. Event registration expires if wait calls are not made frequently enough, according to the nxt.apiEventTimeout
property.
Response:
events
(A) is an array of event objects each of which has the following fields:name
(S) is the name of the event (refer to Event Register for the list of event names)ids
(A) is an array of identifiers, depending on the type of event:- block string identifier (S) for a block event
- peer network address (S) for a peer event
- transaction string identifier (S) for a transaction event
lastBlock
(S) is the last block ID on the blockchain (applies ifrequireBlock
is provided but notrequireLastBlock
)requestProcessingTime
(N) is the API request processing time (in millisec)
Example: Refer to Event Wait example.
Get Blockchain Status
Get the blockchain status.
Request:
requestType
isgetBlockchainStatus
Response:
currentMinRollbackHeight
(N) is the current minimum rollback heightnumberOfBlocks
(N) is the number of blocks in the blockchain (height + 1)isTestnet
(B) istrue
if the node is connected to testnet,false
otherwiseincludeExpiredPrunable
(B) is the value of thenxt.includeExpiredPrunable
propertyrequestProcessingTime
(N) is the API request processing time (in millisec)version
(S) is the application versionmaxRollback
(N) is the value of thenxt.maxRollback
propertylastBlock
(S) is the last block ID on the blockchainapplication
(S) is application name, typicallyNRS
isScanning
(B) istrue
if the blockchain is being scanned by the application,false
otherwiseisDownloading
(B) istrue
if a download is in progress,false
otherwise;true
when a batch of more than 10 blocks at once has been downloaded from a peer, reset tofalse
when an attempt to download more blocks from a peer does not result in any new blockscumulativeDifficulty
(S) is the cumulative difficultylastBlockchainFeederHeight
(N) is the height of the last blockchain of greatest cumulative difficulty obtained from a peermaxPrunableLifetime
(N) is the maximum prunable lifetime (in seconds)time
(N) is the current timestamp (in seconds since the genesis block)lastBlockchainFeeder
(S) is the address or announced address of the peer providing the last blockchain of greatest cumulative difficultyblockchainState
(S) Current state of this node's blockchain (UP-TO-DATE or DOWNLOADING)
Example: Refer to Get Blockchain Status example.
Get Constants
Get all defined constants.
Request:
requestType
isgetConstants
Response:
maxBlockPayloadLength
(N) is the maximum block payload length (in bytes)maxArbitraryMessageLength
(N) is the maximum length (in bytes) of an arbitrary messagemaxPrunableMessageLength
(N) is the maximum length (in bytes) of a prunable messagemaxTaggedDataDataLength
(N) is the maximum length (in bytes) of tagged datamaxPhasingDuration
(N) is the maximum allowed phasing duration in block heightepochBeginning
(N) is the time in milliseconds when genesis block was createdgenesisAccountId
(S) is the genesis account numbergenesisBlockId
(S) is the genesis block IDtransactionTypes
(A) is an array of defined transaction types and subtypes (refer to the example below)transactionSubTypes
(A) is an array of defined transaction subtypes and subtypes (refer to the example below)peerStates
(A) is an array of defined peer states (refer to the example below)currencyTypes
(A) is an array of defined currency types (refer to the example below)disabledAPIs
(A) is an array of configured disabled apis (refer to the example below)apiTags
(A) is an array of defined api tags (refer to the example below)disabledAPITags
(A) is an array of configured disabled api tags (refer to the example below)votingModels
(A) is an array of defined voting models (refer to the example below)holdingTypes
(A) is an array of defined holding types (refer to the example below)minBalanceModels
(A) is an array of defined minimum balance models (refer to the example below)shufflingStages
(A) is an array of defined shuffling stages (refer to the example below)shufflingParticipantStates
(A) is an array of defined shuffling participant states (refer to the example below)hashAlgorithms
(A) is an array of defined hash algorithms (refer to the example below)mintingHashAlgorithms
(A) is an array of defined minting hash algorithms (refer to the example below)phasingHashAlgorithms
(A) is an array of defined phasing hash algorithms (refer to the example below)requestTypes
(A) is an array of decined request types (refer to the example below)
Get Plugins
Get a list of all installed plugins on the server.
Request:
requestType
isgetPlugins
Response:
plugins
(A) is an array of plugin names (S)requestProcessingTime
(N) is the API request processing time (in millisec)
Example: Refer to Get Plugins example.
Get State
Get the state of the server node and network.
Request:
requestType
isgetState
includeCounts
istrue
if the fields beginning withnumberOf...
are to be included (optional); password protected like the Debug Operations iftrue
.
Response:
numberOfPeers
(N) is the number of known peers on the networknumberOfGoods
(N) is the number of DGS goods in the blockchainnumberOfPolls
(N) is the number of polls in the blockchainnumberOfUnlockedAccounts
(N) is the number of unlocked accounts on this nodenumberOfTransfers
(N) is the number of AE transfers in the blockchainincludeExpiredPrunable
(B) is the value of thenxt.includeExpiredPrunable
propertynumberOfOrders
(N) is the number of AE orders in the blockchainnumberOfTransactions
(N) is the number of transactions in the blockchainmaxMemory
(N) is the maximum amount of memory the node may use (in Bytes)maxRollback
(N) is the value of thenxt.maxRollback
propertynumberOfOffers
(N) is the number of buy currency offers in the blockchainisDownloading
(B) istrue
if a download is in progress,false
otherwise;true
when a batch of more than 10 blocks at once has been downloaded from a peer, reset tofalse
when an attempt to download more blocks from a peer does not result in any new blocksisScanning
(B) istrue
if this node is scanning the blockchain,false
otherwisecumulativeDifficulty
(S) is the current cumulative forging difficultynumberOfCurrencies
(N) is the number of currencies in the blockchainnumberOfAssets
(N) is the number of AE assets in the blockchainnumberOfPrunableMessages
(N) is the number of prunable messages in the blockchainfreeMemory
(N) is the amount of free memory on this node (in Bytes)peerPort
(N) is the port used for connecting to peersnumberOfVotes
(N) is the number of votes in the blockchainavailableProcessors
(N) is the number of processors on this nodenumberOfTaggedData
(N) is the number of tagged data in the blockchainnumberOfActiveAccountLeases
(N) is the number of active account leases in the blockchainnumberOfAccountLeases
(N) is the total number of account leases including scheduled leases (first scheduled lease only) in the blockchainnumberOfAccounts
(N) is the number of accounts in the blockchainnumberOfDataTags
(N) is the number of data tags in the blockchainneedsAdminPassword
(B) istrue
if thenxt.disableAdminPassword
property isfalse
currentMinRollbackHeight
(N) is the current minimum rollback heightnumberOfBlocks
(N) is the number of blocks (height + 1) in the blockchainisTestnet
(B) istrue
if the node is connected to testnet,false
otherwisenumberOfCurrencyTransfers
(N) is the number of currency transfers in the blockchainrequestProcessingTime
(N) is the API request processing time (in millisec)numberOfPhasedTransactions
(N) is the number of phased transactions in the blockchainversion
(S) is the software version on this nodenumberOfBidOrders
(N) is the number of AE bid orders in the blockchainlastBlock
(S) is the last block addresstotalMemory
(N) is the amount of memory this node is using (in Bytes)application
(S) is the name of the software running on this node (typicallyNRS
)numberOfAliases
(N) is the number of aliases in the blockchainnumberOfActivePeers
(N) is the number of active peers on the networklastBlockchainFeederHeight
(N) is the height of the last blockchain feedermaxPrunableLifetime
(N) is the maximum prunable lifetime (in seconds)numberOfExchanges
(N) is the number of currency exchanges in the blockchainnumberOfTrades
(N) is the number of AE trades in the blockchainnumberOfPurchases
(N) is the number of DGS purchases in the blockchainnumberOfTags
(N) is the number of DGS tags in the blockchaintime
(N) is the current node time (in seconds since the genesis block)numberOfAskOrders
(N) is the number of AE ask orders in the blockchainlastBlockchainFeeder
(S) is the announced name of the feeder of the last blockchainisOffline
(B) istrue
if this node is connected to other peers,false
otherwise
Note: AE is Asset Exchange, DGS is Digital Goods Store
Example: Refer to Get State example.
Get Time
Get the current time.
Request:
requestType
isgetTime
Response:
time
(N) is the current time (in seconds since the genesis block).requestProcessingTime
(N) is the API request processing time (in millisec)
Example: Refer to Get Time example.