Utils
Decode QR Code
Decodes a base64-encoded jpeg to a UTF-8 string. POST only.
Request:
- requestType is decodeQRCode
- qrCodeBase64 is a base64-encoded jpeg string to be decoded
Response
- qrCodeData (S) is a UTF-8 string containing the decoded data from the base64 string
- requestProcessingTime (N) is the API request processing time (in millisec)
Decode QR Code Example
http://localhost:27876/nxt?
requestType=decodeQRCode&
qrCodeBase64=/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRo...
{
"qrCodeData": "ARDOR-7A48-47JL-T7LD-D5FS3",
"requestProcessingTime": 15
}
Detect Mime Type
Gets the mime type of uploaded file or data.
Request:
- requestType is detectMimeType
- data is the data (optional)
- file is the pathname of a data file to upload (optional if data provided)
- filename is a filename to associate with data (optional if file uploaded in which case the uploaded filename is always used)
- isText is false if data is a hex string (optional)
Response
- type (S) is the mime type
- requestProcessingTime (N) is the API request processing time (in millisec)
Detect Mime Type Example
http://localhost:27876/nxt?
requestType=detectMimeType&
data=/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRo...&
isText=false
{
"requestProcessingTime": 348,
"type": "image/png"
}
Encode QR Code
Encodes a UTF-8 string to a base64-encoded jpeg. POST only.
Request:
- requestType is encodeQRCode
- qrCodeData is a UTF-8 text string to be encoded
- width is the width of the output image (optional)
- height is the height of the output image (optional)
Response
- qrCodeBase64 (S) is a base64 string encoding a jpeg image of the QR code
- requestProcessingTime (N) is the API request processing time (in millisec)
Encode QR Code Example
http://localhost:27876/nxt?
requestType=encodeQRCode&
qrCodeData=ARDOR-7A48-47JL-T7LD-D5FS3&
width=100&
height=100
{
"qrCodeBase64": "/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UH...",
"requestProcessingTime": 15
}
Evaluate Expression
Evaluates an approval composite phasing model based on one or more approval models.
Request:
- requestType is evaluateExpression
- expression is the logical expresion to be evaluated
- checkOptimality if set to true it performs an analysis of the expression (optional)
- evaluate if set to true then it evaluates the following key pairs vars, values
- vars variable
- values values of the variables
Response
- variables (A) is an array that contains the variables evaluated
- literalsCount (N) is the count of variables in the expression
- requestProcessingTime (N) is the API request processing time (in millisec)
Evaluate Expression Example
http://localhost:27876/nxt?
requestType=evaluateExpression&
expression=DMS|!DMS
{
"variables": [
"DMS"
],
"literalsCount": 2,
"requestProcessingTime": 0
}
Full Hash To Id
Converts a full hash to an ID.
Request:
- requestType is fullHashToId
- fullHash is the full hash 64-digit (32-byte) hex string
Response:
- stringId (S) is the ID corresponding to the hash, in the form of an decimal string
- longId (S) is the signed long integer (8-bytes) representation of the ID used internally, returned as a string
- requestProcessingTime (N) is the API request processing time (in millisec)
Full Hash To Id Example
http://localhost:27876/nxt?
requestType=fullHashToId&
fullHash=c34af8f1509e3be79c4562e24125ff2a8f026871fdd1a0366ad315bf8fab76b9
{
"stringId": "16662085316881435331",
"requestProcessingTime": 0,
"longId": "-1784658756828116285"
}
Hash
Calculates the hash of a secret for use in phased transactions with voting model 5 (Vote By Secret).
Request:
- requestType is hash
- hashAlgorithm is the hash function used: 2 for SHA256, 3 for SHA3, 5 for SCRYPT, 6 for RIPEMD160, 25 for Keccack25 and 62 for SHA256 followed by RIPEMD160, according to Get Constants
- secret is a secret phrase in text form or hex string form
- secretIsText is true if secret is text, false if it is a hex string (optional)
Note: secret is converted from a hex string to a byte array, which is what the hash algorithm expects, unless secretIsText is true, in which case secret is first converted from text to a UTF-8 hex string as by Hex Convert.
Response:
- hash (S) is the hash of the secret, in the form of a hex string
- requestProcessingTime (N) is the API request processing time (in millisec)
Hash Example
Note: 74657374 is the UTF-8 hex string for the secret phrase "test".
http://localhost:27876/nxt?
requestType=hash&
hashAlgorithm=2&
secret=74657374
{
"requestProcessingTime": 1,
"hash": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
}
Hex Convert
Converts a text string into a UTF-8 hex string and if the text input is already a hex string, also into text.
Request:
- requestType is hexConvert
- string is a text string, possibly a hex string
Response:
- binary (S) is the converted UTF-8 hex string
- text (S) is a text string converted from string if it is a valid UTF-8 hex string
- requestProcessingTime (N) is the API request processing time (in millisec)
Hex Convert Example
http://localhost:27876/nxt?
requestType=hexConvert&
string=616263
{
"binary": "363136323633",
"text": "abc",
"requestProcessingTime": 1
}
Long Convert
Converts an ID to the signed long integer representation used internally.
Request:
- requestType is longConvert
- id is a numerical ID, in decimal form but equivalent to an 8-byte unsigned integer as produced by SHA-256 hashing
Response:
- stringId (S) is the numerical ID
- longId (S) is the signed long integer (8-bytes) representation of the ID used internally, returned as a string
- requestProcessingTime (N) is the API request processing time (in millisec)
Note: Java does not support unsigned integers, so any unsigned ID (such as a block ID) visible in the NRS client is represented internally as a signed integer.
Long Convert Example
http://localhost:27876/nxt?
requestType=longConvert&
id=15323192282528158131
{
"stringId": "15323192282528158131",
"requestProcessingTime": 0,
"longId": "-3123551791181393485"
}
RS Convert
Get both the Reed-Solomon account address and the account number given an account ID.
Request:
- requestType is rsConvert
- account is an account ID (either RS address or number)
Response:
- accountRS (S) is the Reed-Solomon address of the account
- requestProcessingTime (N) is the API request processing time (in millisec)
- account (S) is the account number
RS Convert Example
http://localhost:27876/nxt?
requestType=rsConvert&
account=ARDOR-L6FM-89WK-VK8P-FCRBB
{
"accountRS": "ARDOR-L6FM-89WK-VK8P-FCRBB",
"requestProcessingTime": 1,
"account": "15323192282528158131"
}
Split Secret
Split a secret into pieces.
Request:
- requestType is splitSecret
- secret (S) is the secret to split, ignored if privateKey provided
- privateKey (S) is the privateKey (hex) of the derived account to be split (HD wallet, refer to: Getting the private key from the derived account)
- totalPieces (N) is the total number of pieces
- minimumPieces (N) is the minimum number of pieces required to reproduce the secret
- primeFieldSize (S) prime number used as the field size, only use it if you know what you are doing (optional)
Response:
- pieces (A) array of shared pieces
- totalPieces (N) the total number of pieces
- minimumPieces (N) the minimum number of pieces required to reproduce the secret
- actualPrimeFieldSize (S) the actual field size used when generating the secret
Split Secret Example
http://localhost:27876/nxt?
requestType=splitSecret&
secret=1234&
totalPieces=5&
minimumPieces=3
{
"pieces": [
"0:-1727339232:5:3:0:1:6f661e87",
"0:-1727339232:5:3:0:2:00ffcec648",
"0:-1727339232:5:3:0:3:01e26c2a77",
"0:-1727339232:5:3:0:4:03173e4b14",
"0:-1727339232:5:3:0:5:049e45281f"
],
"totalPieces": 5,
"actualPrimeFieldSize": "14976407493557531125525728362448106789840013430353915016137",
"minimumPieces": 3
}
Combine Secret
Combine a secret from its pieces.
Request:
- requestType is combineSecret
- pieces (A) multiple pieces from which to combine the original secret
Response:
- secret (S) the original secret if it was a passphrase or seed
- privateKey (S) the original secret if it was a private key
Combine Secret Example
http://localhost:27876/nxt?
requestType=combineSecret&
pieces=0:-1727339232:5:3:0:1:6f661e87&
pieces=0:-1727339232:5:3:0:2:00ffcec648&
pieces=0:-1727339232:5:3:0:5:049e45281f
{
"secret": "1234"
}
Get Configuration
Get the current configuration from a node.
Request:
- requestType is getConfiguration
- adminPassword (S) is the node admin password
Response:
- properties are the node properties
- requestProcessingTime (N) is the API request processing time (in millisec)
Get Configuration Example
http://localhost:27876/nxt?
requestType=getConfiguration&
adminPassword=IWontTellYou
{
"requestProcessingTime": 1,
"properties": [
{
"configuredValue": "false",
"installerValue": null,
"defaultValue": "false",
"name": "nxt.isPermissioned",
"description": "Indicate this is a permissioned blockchain (requires additional support)",
"type": "BOOLEAN",
"group": "PERMISSIONED BLOCKCHAIN"
},
{
"configuredValue": "",
"installerValue": null,
"defaultValue": "",
"name": "nxt.credentials.secretPhrase",
"description": "Authentication credentials secret phrase (account must have WRITER role)",
"type": "PASSWORD",
"group": "PERMISSIONED BLOCKCHAIN"
},
{
"configuredValue": "true",
"installerValue": null,
"defaultValue": "true",
"name": "nxt.shareMyAddress",
"description": "Announce my IP address/hostname to peers and allow them to share it with other\npeers. Incoming connections will not be allowed if this is set to false.",
"type": "BOOLEAN",
"group": "PEER NETWORKING"
},
{
"configuredValue": "27874",
"installerValue": null,
"min": 1,
"max": 65535,
"defaultValue": "27874",
"name": "nxt.peerServerPort",
"description": "Port for incoming peer to peer networking requests.",
"type": "INTEGER",
"group": "PEER NETWORKING"
},
{
"configuredValue": "10",
"installerValue": null,
"min": 0,
"max": null,
"defaultValue": "10",
"name": "nxt.peerConnectTimeout",
"description": "Peer connect timeout (seconds)",
"type": "INTEGER",
"group": "PEER NETWORKING"
},
{
"configuredValue": "20",
"installerValue": null,
"min": 0,
"max": null,
"defaultValue": "20",
"name": "nxt.peerReadTimeout",
"description": "Peer read timeout (seconds)",
"type": "INTEGER",
"group": "PEER NETWORKING"
},
{
"configuredValue": "true",
"installerValue": null,
"defaultValue": "true",
"name": "nxt.enablePeerUPnP",
"description": "Enable UPnP for the peer port.",
"type": "BOOLEAN",
"group": "PEER NETWORKING"
},
{
"configuredValue": "7000",
"installerValue": null,
"min": -1,
"max": null,
"defaultValue": "7000",
"name": "nxt.upnpGatewayTimeout",
"description": "UPnP gateway http read timeout, milliseconds. Set to -1 to disable.\nDefault 7000 if not set.",
"type": "INTEGER",
"group": "PEER NETWORKING"
},
{
"configuredValue": "3000",
"installerValue": null,
"min": -1,
"max": null,
"defaultValue": "3000",
"name": "nxt.upnpDiscoverTimeout",
"description": "UPnP gateway socket connection timeout, milliseconds. Set to -1 to disable.\nDefault 3000 if not set.",
"type": "INTEGER",
"group": "PEER NETWORKING"
},
{
"configuredValue": "0.0.0.0",
"installerValue": null,
"defaultValue": "0.0.0.0",
"name": "nxt.peerServerHost",
"description": "Host interface on which to listen for peer networking requests, default all.\nUse 0.0.0.0 to listen on all interfaces, including IPv6.",
"type": "STRING",
"isList": false,
"group": "PEER NETWORKING"
},
{
"configuredValue": "",
"installerValue": null,
"defaultValue": "",
"name": "nxt.myAddress",
"description": "My externally visible IP address or host name, to be announced to peers.\nIt can optionally include a port number, which will also be announced to\npeers, and may be different from nxt.peerServerPort (useful if you do port\nforwarding behind a router). Peers will use the external connection address \nif nxt.myAddress is not specified and nxt.shareMyAddress is set to true.",
"type": "STRING",
"isList": false,
"group": "PEER NETWORKING"
},
{
"configuredValue": "762228eeda9db068d1f713e2e91054",
"installerValue": null,
"defaultValue": "",
"name": "nxt.myPlatform",
"description": "My platform, to be announced to peers.",
"type": "STRING",
"isList": false,
"group": "PEER NETWORKING"
},
{
"configuredValue": "175.42.1.195; zuqka.duckdns.org; 51.38.82.75; 192.99.58.223; 185.156.175.43; 211.177.75.40; 160.20.147.194; 212.237.98.178; 71.59.74.163; 146.52.19.15; 80.211.167.215; 89.156.70.52; ardor.noip.me; 31.4.241.205; 108.48.117.180; 86.91.117.193; 85.145.115.107; 87.138.221.20; 142.44.212.178; 39.53.99.44; 202.89.157.145; 94.177.175.166; ardor.nxter.org; 51.38.130.28; 94.23.23.90; 37.139.16.86; 173.249.18.94; 81.241.56.178; 139.180.137.232; 162.243.242.8; 79.98.26.179; 79.98.28.184; 79.98.26.177; 80.211.129.144; 113.16.59.169; 188.243.186.2; 178.209.194.4; 94.214.92.173; 92.117.137.11; 47.188.76.98; 77.139.12.143; 208.94.38.216; 67.87.76.202; 91.46.16.253; ardor2.y.cz; bargu.szn.dk; 118.33.176.147; 111.192.161.60; 85.11.147.38; 108.161.166.82; 37.187.108.114; 83.162.253.185; 173.212.201.195; 91.134.116.47; 172.245.181.157; enricoip.no-ip.biz; 159.69.208.142; 58.6.143.217; 83.135.130.39; aws.scripterron.org; 88.151.148.10; 220.134.112.220; 1.234.18.162; 58.123.223.144; 209.222.98.250; 116.42.102.10; ardor.crypto.sargue.net; 190.16.43.52; 51.15.125.177; 163.172.69.51; 178.57.115.236; 207.38.89.20; 164.132.45.10; 71.237.3.210; 27.121.134.84; 88.99.235.240; wohnung.tzo.com; 5.200.23.15; 78.205.199.21; 77.120.240.209; 81.17.16.245; 81.133.72.43; 79.98.24.175; 47.147.192.177; 119.28.20.120; 45.61.157.82; 47.96.163.83; 37.153.41.175; 51.38.125.81; 52.166.50.170; 216.170.122.9; 82.137.127.100; 45.48.24.190; 134.249.113.211; 104.224.146.131; 173.255.141.23; 68.183.27.243; 62.143.228.58; 217.182.72.43; banditz.ddns.net; 52.69.126.207; 80.211.156.19; 86.17.121.86; 184.55.194.71; 45.63.78.182; 46.101.225.168; 185.240.242.162; 5.63.47.182; ardor3.y.cz; 142.44.241.198; 38.87.54.163; 80.211.13.113; 45.79.76.58; ardorx.ru; 144.217.162.55; 18.179.196.29; 218.52.23.45; zdani.szn.dk; 140.143.234.86; 5.132.116.162; 37.17.232.101; ardor.jelurida.com; bardor.mooo.com;",
"installerValue": null,
"defaultValue": "45.84.0.44; testlight01.jelurida.com; ardor2.sharedledger.net; ardor1.sharedledger.net; ardor.crypto.sargue.net; 160.20.147.194; 78.36.199.3; 178.201.141.127; 79.139.179.162; 54.39.51.25; 45.138.157.51; 51.15.125.177; 58.126.121.21; 98.144.62.21; ardor.noip.me; testardor.jelurida.com; 192.227.147.249; 164.132.45.10; 94.130.50.254; testlight03.jelurida.com; 87.121.37.156; 77.120.240.209; 87.138.221.20; 104.248.143.160; ardor.jelurida.com; 77.152.74.54; 95.79.5.145; 66.131.166.120; ardor.nxter.org; 37.17.232.124; 173.70.153.141; 116.124.242.76; 188.166.109.46; 116.124.242.151; 50.29.154.197; 85.13.123.9; 80.114.96.29; 52.69.126.207; 79.98.26.177; 178.44.48.34; 80.211.129.144; 45.63.78.182; 172.251.61.97; 70.19.52.19; ardor3.y.cz; 128.72.34.185; 118.223.32.121; 142.44.241.198; testlight02.jelurida.com; 136.243.105.43; 38.87.54.163; 178.209.194.4; 84.31.201.180; ardor.stratehm.fr; 180.129.112.174; 216.15.19.20; 47.147.217.170; 45.79.76.58; ardorx.ru; 190.17.205.43; 116.203.133.42; 144.217.162.55; 104.177.77.20; 24.117.192.175; 123.208.25.57; bargu.szn.dk; 18.179.196.29; 83.162.253.185; 104.167.5.119; ardor.some.one; 46.10.143.164; 67.0.206.87; 5.65.190.166; 172.245.181.157; 5.132.116.162; 217.182.89.35; fatman.jelurida.com;",
"name": "nxt.defaultPeers",
"description": "Default initial peers. Only used if nxt.usePeersDb=true.\nDo not modify. Add custom peers to nxt.wellKnownPeers instead.",
"type": "READONLY",
"group": "PEER NETWORKING"
},
{
"configuredValue": "",
"installerValue": null,
"defaultValue": "",
"name": "nxt.wellKnownPeers",
"description": "A list of well known peer addresses / host names, separated by '; '. These\npeers are always selected first when creating outbound connections.",
"type": "STRING",
"isList": true,
"group": "PEER NETWORKING"
},
{
"configuredValue": "",
"installerValue": null,
"defaultValue": "",
"name": "nxt.knownBlacklistedPeers",
"description": "Known bad peers to be blacklisted. Outbound connections will not be created\nand inbound connections will not be accepted.",
"type": "STRING",
"isList": true,
"group": "PEER NETWORKING"
},
{
"configuredValue": "164.132.99.1; ardor.testnet.crypto.sargue.net; 51.38.82.75; testlight01.jelurida.com; petko.ddns.net; 216.119.150.238; 54.39.17.89; 3.1.40.144; 64.91.248.147; 85.11.147.38; 198.105.223.72; 107.150.3.13; ardor.noip.me; 164.132.45.10; 85.214.207.118; enricoip.no-ip.biz; testlight02.jelurida.com; 38.87.54.163; 47.88.158.230; testlight03.jelurida.com; 5.200.23.15; testardor.jelurida.com; bardor.mooo.com;",
"installerValue": null,
"defaultValue": "94.130.142.86; 217.182.72.43; testlight01.jelurida.com; 104.248.143.160; ardor.jelurida.com; 80.211.156.19; 63.209.32.54; 212.186.184.152; 212.237.210.55; testardor.some.one; 46.10.143.164; 76.31.30.254; 120.79.143.243; enricoip.no-ip.biz; testlight02.jelurida.com; 38.87.54.163; 107.170.3.62; testlight03.jelurida.com; testardor.jelurida.com;",
"name": "nxt.defaultTestnetPeers",
"description": "Default initial peers used for testnet only. Only used if nxt.usePeersDb=true.\nDo not modify. Add custom testnet peers to nxt.testnetPeers instead.",
"type": "READONLY",
"group": "PEER NETWORKING"
},
{
"configuredValue": "",
"installerValue": null,
"defaultValue": "",
"name": "nxt.testnetPeers",
"description": "Well known testnet peers. These peers are always selected first when creating\noutbound connections.",
"type": "STRING",
"isList": true,
"group": "PEER NETWORKING"
},
[...]
]
}
Get Epoch Time
Get the current Epoch time.
Request:
- requestType is getEpochTime
- unixtime (N)
Response:
- time it returns the conversion to unix time
- requestProcessingTime (N) is the API request processing time (in millisec)
Get Epoch Time Example
http://localhost:27876/nxt?
requestType=1591214485
{
"time": 76917685,
"requestProcessingTime": 1
}
Set Configuration
Set the properties configuration of a node.
Request:
- requestType is setConfiguration
- propertiesJSON (A) is the properties configuration
- shutdown (S) is true or false
- adminPassword (S) is the node admin password
Response:
- requestProcessingTime (N) is the API request processing time (in millisec)
- shutdown (S) is true or false
Set Configuration Example
http://localhost:27876/nxt?
requestType=setConfiguration&
adminPassword=IWontTellYou&
propertiesJSON=[{"property":"nxt.maxPrunableLifetime","value":"-1"}]&
shutdown=true
{
"requestProcessingTime": 16,
"shutdown": true
}