github.com/dashpay/godash@v0.0.0-20160726055534-e038a21e0e3d/rpcserverhelp.go (about) 1 // Copyright (c) 2015 The btcsuite developers 2 // Copyright (c) 2016 The Dash developers 3 // Use of this source code is governed by an ISC 4 // license that can be found in the LICENSE file. 5 6 package main 7 8 import ( 9 "errors" 10 "sort" 11 "strings" 12 "sync" 13 14 "github.com/dashpay/godash/btcjson" 15 ) 16 17 // helpDescsEnUS defines the English descriptions used for the help strings. 18 var helpDescsEnUS = map[string]string{ 19 // DebugLevelCmd help. 20 "debuglevel--synopsis": "Dynamically changes the debug logging level.\n" + 21 "The levelspec can either a debug level or of the form:\n" + 22 "<subsystem>=<level>,<subsystem2>=<level2>,...\n" + 23 "The valid debug levels are trace, debug, info, warn, error, and critical.\n" + 24 "The valid subsystems are AMGR, ADXR, BCDB, BMGR, BTCD, CHAN, DISC, PEER, RPCS, SCRP, SRVR, and TXMP.\n" + 25 "Finally the keyword 'show' will return a list of the available subsystems.", 26 "debuglevel-levelspec": "The debug level(s) to use or the keyword 'show'", 27 "debuglevel--condition0": "levelspec!=show", 28 "debuglevel--condition1": "levelspec=show", 29 "debuglevel--result0": "The string 'Done.'", 30 "debuglevel--result1": "The list of subsystems", 31 32 // AddNodeCmd help. 33 "addnode--synopsis": "Attempts to add or remove a persistent peer.", 34 "addnode-addr": "IP address and port of the peer to operate on", 35 "addnode-subcmd": "'add' to add a persistent peer, 'remove' to remove a persistent peer, or 'onetry' to try a single connection to a peer", 36 37 // NodeCmd help. 38 "node--synopsis": "Attempts to add or remove a peer.", 39 "node-subcmd": "'disconnect' to remove all matching non-persistent peers, 'remove' to remove a persistent peer, or 'connect' to connect to a peer", 40 "node-target": "Either the IP address and port of the peer to operate on, or a valid peer ID.", 41 "node-connectsubcmd": "'perm' to make the connected peer a permanent one, 'temp' to try a single connect to a peer", 42 43 // TransactionInput help. 44 "transactioninput-txid": "The hash of the input transaction", 45 "transactioninput-vout": "The specific output of the input transaction to redeem", 46 47 // CreateRawTransactionCmd help. 48 "createrawtransaction--synopsis": "Returns a new transaction spending the provided inputs and sending to the provided addresses.\n" + 49 "The transaction inputs are not signed in the created transaction.\n" + 50 "The signrawtransaction RPC command provided by wallet must be used to sign the resulting transaction.", 51 "createrawtransaction-inputs": "The inputs to the transaction", 52 "createrawtransaction-amounts": "JSON object with the destination addresses as keys and amounts as values", 53 "createrawtransaction-amounts--key": "address", 54 "createrawtransaction-amounts--value": "n.nnn", 55 "createrawtransaction-amounts--desc": "The destination address as the key and the amount in BTC as the value", 56 "createrawtransaction-locktime": "Locktime value; a non-zero value will also locktime-activate the inputs", 57 "createrawtransaction--result0": "Hex-encoded bytes of the serialized transaction", 58 59 // ScriptSig help. 60 "scriptsig-asm": "Disassembly of the script", 61 "scriptsig-hex": "Hex-encoded bytes of the script", 62 63 // PrevOut help. 64 "prevout-addresses": "previous output addresses", 65 "prevout-value": "previous output value", 66 67 // VinPrevOut help. 68 "vinprevout-coinbase": "The hex-encoded bytes of the signature script (coinbase txns only)", 69 "vinprevout-txid": "The hash of the origin transaction (non-coinbase txns only)", 70 "vinprevout-vout": "The index of the output being redeemed from the origin transaction (non-coinbase txns only)", 71 "vinprevout-scriptSig": "The signature script used to redeem the origin transaction as a JSON object (non-coinbase txns only)", 72 "vinprevout-prevOut": "Data from the origin transaction output with index vout.", 73 "vinprevout-sequence": "The script sequence number", 74 75 // Vin help. 76 "vin-coinbase": "The hex-encoded bytes of the signature script (coinbase txns only)", 77 "vin-txid": "The hash of the origin transaction (non-coinbase txns only)", 78 "vin-vout": "The index of the output being redeemed from the origin transaction (non-coinbase txns only)", 79 "vin-scriptSig": "The signature script used to redeem the origin transaction as a JSON object (non-coinbase txns only)", 80 "vin-sequence": "The script sequence number", 81 82 // ScriptPubKeyResult help. 83 "scriptpubkeyresult-asm": "Disassembly of the script", 84 "scriptpubkeyresult-hex": "Hex-encoded bytes of the script", 85 "scriptpubkeyresult-reqSigs": "The number of required signatures", 86 "scriptpubkeyresult-type": "The type of the script (e.g. 'pubkeyhash')", 87 "scriptpubkeyresult-addresses": "The bitcoin addresses associated with this script", 88 89 // Vout help. 90 "vout-value": "The amount in BTC", 91 "vout-n": "The index of this transaction output", 92 "vout-scriptPubKey": "The public key script used to pay coins as a JSON object", 93 94 // TxRawDecodeResult help. 95 "txrawdecoderesult-txid": "The hash of the transaction", 96 "txrawdecoderesult-version": "The transaction version", 97 "txrawdecoderesult-locktime": "The transaction lock time", 98 "txrawdecoderesult-vin": "The transaction inputs as JSON objects", 99 "txrawdecoderesult-vout": "The transaction outputs as JSON objects", 100 101 // DecodeRawTransactionCmd help. 102 "decoderawtransaction--synopsis": "Returns a JSON object representing the provided serialized, hex-encoded transaction.", 103 "decoderawtransaction-hextx": "Serialized, hex-encoded transaction", 104 105 // DecodeScriptResult help. 106 "decodescriptresult-asm": "Disassembly of the script", 107 "decodescriptresult-reqSigs": "The number of required signatures", 108 "decodescriptresult-type": "The type of the script (e.g. 'pubkeyhash')", 109 "decodescriptresult-addresses": "The bitcoin addresses associated with this script", 110 "decodescriptresult-p2sh": "The script hash for use in pay-to-script-hash transactions", 111 112 // DecodeScriptCmd help. 113 "decodescript--synopsis": "Returns a JSON object with information about the provided hex-encoded script.", 114 "decodescript-hexscript": "Hex-encoded script", 115 116 // GenerateCmd help 117 "generate--synopsis": "Generates a set number of blocks (simnet or regtest only) and returns a JSON\n" + 118 " array of their hashes.", 119 "generate-numblocks": "Number of blocks to generate", 120 "generate--result0": "The hashes, in order, of blocks generated by the call", 121 122 // GetAddedNodeInfoResultAddr help. 123 "getaddednodeinforesultaddr-address": "The ip address for this DNS entry", 124 "getaddednodeinforesultaddr-connected": "The connection 'direction' (inbound/outbound/false)", 125 126 // GetAddedNodeInfoResult help. 127 "getaddednodeinforesult-addednode": "The ip address or domain of the added peer", 128 "getaddednodeinforesult-connected": "Whether or not the peer is currently connected", 129 "getaddednodeinforesult-addresses": "DNS lookup and connection information about the peer", 130 131 // GetAddedNodeInfo help. 132 "getaddednodeinfo--synopsis": "Returns information about manually added (persistent) peers.", 133 "getaddednodeinfo-dns": "Specifies whether the returned data is a JSON object including DNS and connection information, or just a list of added peers", 134 "getaddednodeinfo-node": "Only return information about this specific peer instead of all added peers", 135 "getaddednodeinfo--condition0": "dns=false", 136 "getaddednodeinfo--condition1": "dns=true", 137 "getaddednodeinfo--result0": "List of added peers", 138 139 // GetBestBlockResult help. 140 "getbestblockresult-hash": "Hex-encoded bytes of the best block hash", 141 "getbestblockresult-height": "Height of the best block", 142 143 // GetBestBlockCmd help. 144 "getbestblock--synopsis": "Get block height and hash of best block in the main chain.", 145 "getbestblock--result0": "Get block height and hash of best block in the main chain.", 146 147 // GetBestBlockHashCmd help. 148 "getbestblockhash--synopsis": "Returns the hash of the of the best (most recent) block in the longest block chain.", 149 "getbestblockhash--result0": "The hex-encoded block hash", 150 151 // GetBlockCmd help. 152 "getblock--synopsis": "Returns information about a block given its hash.", 153 "getblock-hash": "The hash of the block", 154 "getblock-verbose": "Specifies the block is returned as a JSON object instead of hex-encoded string", 155 "getblock-verbosetx": "Specifies that each transaction is returned as a JSON object and only applies if the verbose flag is true (btcd extension)", 156 "getblock--condition0": "verbose=false", 157 "getblock--condition1": "verbose=true", 158 "getblock--result0": "Hex-encoded bytes of the serialized block", 159 160 // TxRawResult help. 161 "txrawresult-hex": "Hex-encoded transaction", 162 "txrawresult-txid": "The hash of the transaction", 163 "txrawresult-version": "The transaction version", 164 "txrawresult-locktime": "The transaction lock time", 165 "txrawresult-vin": "The transaction inputs as JSON objects", 166 "txrawresult-vout": "The transaction outputs as JSON objects", 167 "txrawresult-blockhash": "Hash of the block the transaction is part of", 168 "txrawresult-confirmations": "Number of confirmations of the block", 169 "txrawresult-time": "Transaction time in seconds since 1 Jan 1970 GMT", 170 "txrawresult-blocktime": "Block time in seconds since the 1 Jan 1970 GMT", 171 172 // SearchRawTransactionsResult help. 173 "searchrawtransactionsresult-hex": "Hex-encoded transaction", 174 "searchrawtransactionsresult-txid": "The hash of the transaction", 175 "searchrawtransactionsresult-version": "The transaction version", 176 "searchrawtransactionsresult-locktime": "The transaction lock time", 177 "searchrawtransactionsresult-vin": "The transaction inputs as JSON objects", 178 "searchrawtransactionsresult-vout": "The transaction outputs as JSON objects", 179 "searchrawtransactionsresult-blockhash": "Hash of the block the transaction is part of", 180 "searchrawtransactionsresult-confirmations": "Number of confirmations of the block", 181 "searchrawtransactionsresult-time": "Transaction time in seconds since 1 Jan 1970 GMT", 182 "searchrawtransactionsresult-blocktime": "Block time in seconds since the 1 Jan 1970 GMT", 183 184 // GetBlockVerboseResult help. 185 "getblockverboseresult-hash": "The hash of the block (same as provided)", 186 "getblockverboseresult-confirmations": "The number of confirmations", 187 "getblockverboseresult-size": "The size of the block", 188 "getblockverboseresult-height": "The height of the block in the block chain", 189 "getblockverboseresult-version": "The block version", 190 "getblockverboseresult-merkleroot": "Root hash of the merkle tree", 191 "getblockverboseresult-tx": "The transaction hashes (only when verbosetx=false)", 192 "getblockverboseresult-rawtx": "The transactions as JSON objects (only when verbosetx=true)", 193 "getblockverboseresult-time": "The block time in seconds since 1 Jan 1970 GMT", 194 "getblockverboseresult-nonce": "The block nonce", 195 "getblockverboseresult-bits": "The bits which represent the block difficulty", 196 "getblockverboseresult-difficulty": "The proof-of-work difficulty as a multiple of the minimum difficulty", 197 "getblockverboseresult-previousblockhash": "The hash of the previous block", 198 "getblockverboseresult-nextblockhash": "The hash of the next block (only if there is one)", 199 200 // GetBlockCountCmd help. 201 "getblockcount--synopsis": "Returns the number of blocks in the longest block chain.", 202 "getblockcount--result0": "The current block count", 203 204 // GetBlockHashCmd help. 205 "getblockhash--synopsis": "Returns hash of the block in best block chain at the given height.", 206 "getblockhash-index": "The block height", 207 "getblockhash--result0": "The block hash", 208 209 // GetBlockHeaderCmd help. 210 "getblockheader--synopsis": "Returns information about a block header given its hash.", 211 "getblockheader-hash": "The hash of the block", 212 "getblockheader-verbose": "Specifies the block header is returned as a JSON object instead of hex-encoded string", 213 "getblockheader--condition0": "verbose=false", 214 "getblockheader--condition1": "verbose=true", 215 "getblockheader--result0": "The block header hash", 216 217 // GetBlockHeaderVerboseResult help. 218 "getblockheaderverboseresult-hash": "The hash of the block (same as provided)", 219 "getblockheaderverboseresult-confirmations": "The number of confirmations", 220 "getblockheaderverboseresult-height": "The height of the block in the block chain", 221 "getblockheaderverboseresult-version": "The block version", 222 "getblockheaderverboseresult-merkleroot": "Root hash of the merkle tree", 223 "getblockheaderverboseresult-time": "The block time in seconds since 1 Jan 1970 GMT", 224 "getblockheaderverboseresult-nonce": "The block nonce", 225 "getblockheaderverboseresult-bits": "The bits which represent the block difficulty", 226 "getblockheaderverboseresult-difficulty": "The proof-of-work difficulty as a multiple of the minimum difficulty", 227 "getblockheaderverboseresult-previousblockhash": "The hash of the previous block", 228 "getblockheaderverboseresult-nextblockhash": "The hash of the next block (only if there is one)", 229 230 // TemplateRequest help. 231 "templaterequest-mode": "This is 'template', 'proposal', or omitted", 232 "templaterequest-capabilities": "List of capabilities", 233 "templaterequest-longpollid": "The long poll ID of a job to monitor for expiration; required and valid only for long poll requests ", 234 "templaterequest-sigoplimit": "Number of signature operations allowed in blocks (this parameter is ignored)", 235 "templaterequest-sizelimit": "Number of bytes allowed in blocks (this parameter is ignored)", 236 "templaterequest-maxversion": "Highest supported block version number (this parameter is ignored)", 237 "templaterequest-target": "The desired target for the block template (this parameter is ignored)", 238 "templaterequest-data": "Hex-encoded block data (only for mode=proposal)", 239 "templaterequest-workid": "The server provided workid if provided in block template (not applicable)", 240 241 // GetBlockTemplateResultTx help. 242 "getblocktemplateresulttx-data": "Hex-encoded transaction data (byte-for-byte)", 243 "getblocktemplateresulttx-hash": "Hex-encoded transaction hash (little endian if treated as a 256-bit number)", 244 "getblocktemplateresulttx-depends": "Other transactions before this one (by 1-based index in the 'transactions' list) that must be present in the final block if this one is", 245 "getblocktemplateresulttx-fee": "Difference in value between transaction inputs and outputs (in Satoshi)", 246 "getblocktemplateresulttx-sigops": "Total number of signature operations as counted for purposes of block limits", 247 248 // GetBlockTemplateResultAux help. 249 "getblocktemplateresultaux-flags": "Hex-encoded byte-for-byte data to include in the coinbase signature script", 250 251 // GetBlockTemplateResult help. 252 "getblocktemplateresult-bits": "Hex-encoded compressed difficulty", 253 "getblocktemplateresult-curtime": "Current time as seen by the server (recommended for block time); must fall within mintime/maxtime rules", 254 "getblocktemplateresult-height": "Height of the block to be solved", 255 "getblocktemplateresult-previousblockhash": "Hex-encoded big-endian hash of the previous block", 256 "getblocktemplateresult-sigoplimit": "Number of sigops allowed in blocks ", 257 "getblocktemplateresult-sizelimit": "Number of bytes allowed in blocks", 258 "getblocktemplateresult-transactions": "Array of transactions as JSON objects", 259 "getblocktemplateresult-version": "The block version", 260 "getblocktemplateresult-coinbaseaux": "Data that should be included in the coinbase signature script", 261 "getblocktemplateresult-coinbasetxn": "Information about the coinbase transaction", 262 "getblocktemplateresult-coinbasevalue": "Total amount available for the coinbase in Satoshi", 263 "getblocktemplateresult-workid": "This value must be returned with result if provided (not provided)", 264 "getblocktemplateresult-longpollid": "Identifier for long poll request which allows monitoring for expiration", 265 "getblocktemplateresult-longpolluri": "An alternate URI to use for long poll requests if provided (not provided)", 266 "getblocktemplateresult-submitold": "Not applicable", 267 "getblocktemplateresult-target": "Hex-encoded big-endian number which valid results must be less than", 268 "getblocktemplateresult-expires": "Maximum number of seconds (starting from when the server sent the response) this work is valid for", 269 "getblocktemplateresult-maxtime": "Maximum allowed time", 270 "getblocktemplateresult-mintime": "Minimum allowed time", 271 "getblocktemplateresult-mutable": "List of mutations the server explicitly allows", 272 "getblocktemplateresult-noncerange": "Two concatenated hex-encoded big-endian 32-bit integers which represent the valid ranges of nonces the miner may scan", 273 "getblocktemplateresult-capabilities": "List of server capabilities including 'proposal' to indicate support for block proposals", 274 "getblocktemplateresult-reject-reason": "Reason the proposal was invalid as-is (only applies to proposal responses)", 275 276 // GetBlockTemplateCmd help. 277 "getblocktemplate--synopsis": "Returns a JSON object with information necessary to construct a block to mine or accepts a proposal to validate.\n" + 278 "See BIP0022 and BIP0023 for the full specification.", 279 "getblocktemplate-request": "Request object which controls the mode and several parameters", 280 "getblocktemplate--condition0": "mode=template", 281 "getblocktemplate--condition1": "mode=proposal, rejected", 282 "getblocktemplate--condition2": "mode=proposal, accepted", 283 "getblocktemplate--result1": "An error string which represents why the proposal was rejected or nothing if accepted", 284 285 // GetConnectionCountCmd help. 286 "getconnectioncount--synopsis": "Returns the number of active connections to other peers.", 287 "getconnectioncount--result0": "The number of connections", 288 289 // GetCurrentNetCmd help. 290 "getcurrentnet--synopsis": "Get bitcoin network the server is running on.", 291 "getcurrentnet--result0": "The network identifer", 292 293 // GetDifficultyCmd help. 294 "getdifficulty--synopsis": "Returns the proof-of-work difficulty as a multiple of the minimum difficulty.", 295 "getdifficulty--result0": "The difficulty", 296 297 // GetGenerateCmd help. 298 "getgenerate--synopsis": "Returns if the server is set to generate coins (mine) or not.", 299 "getgenerate--result0": "True if mining, false if not", 300 301 // GetHashesPerSecCmd help. 302 "gethashespersec--synopsis": "Returns a recent hashes per second performance measurement while generating coins (mining).", 303 "gethashespersec--result0": "The number of hashes per second", 304 305 // InfoChainResult help. 306 "infochainresult-version": "The version of the server", 307 "infochainresult-protocolversion": "The latest supported protocol version", 308 "infochainresult-blocks": "The number of blocks processed", 309 "infochainresult-timeoffset": "The time offset", 310 "infochainresult-connections": "The number of connected peers", 311 "infochainresult-proxy": "The proxy used by the server", 312 "infochainresult-difficulty": "The current target difficulty", 313 "infochainresult-testnet": "Whether or not server is using testnet", 314 "infochainresult-relayfee": "The minimum relay fee for non-free transactions in BTC/KB", 315 "infochainresult-errors": "Any current errors", 316 317 // InfoWalletResult help. 318 "infowalletresult-version": "The version of the server", 319 "infowalletresult-protocolversion": "The latest supported protocol version", 320 "infowalletresult-walletversion": "The version of the wallet server", 321 "infowalletresult-balance": "The total bitcoin balance of the wallet", 322 "infowalletresult-blocks": "The number of blocks processed", 323 "infowalletresult-timeoffset": "The time offset", 324 "infowalletresult-connections": "The number of connected peers", 325 "infowalletresult-proxy": "The proxy used by the server", 326 "infowalletresult-difficulty": "The current target difficulty", 327 "infowalletresult-testnet": "Whether or not server is using testnet", 328 "infowalletresult-keypoololdest": "Seconds since 1 Jan 1970 GMT of the oldest pre-generated key in the key pool", 329 "infowalletresult-keypoolsize": "The number of new keys that are pre-generated", 330 "infowalletresult-unlocked_until": "The timestamp in seconds since 1 Jan 1970 GMT that the wallet is unlocked for transfers, or 0 if the wallet is locked", 331 "infowalletresult-paytxfee": "The transaction fee set in BTC/KB", 332 "infowalletresult-relayfee": "The minimum relay fee for non-free transactions in BTC/KB", 333 "infowalletresult-errors": "Any current errors", 334 335 // GetInfoCmd help. 336 "getinfo--synopsis": "Returns a JSON object containing various state info.", 337 338 // GetMempoolInfoCmd help. 339 "getmempoolinfo--synopsis": "Returns memory pool information", 340 341 // GetMempoolInfoResult help. 342 "getmempoolinforesult-bytes": "Size in bytes of the mempool", 343 "getmempoolinforesult-size": "Number of transactions in the mempool", 344 345 // GetMiningInfoResult help. 346 "getmininginforesult-blocks": "Height of the latest best block", 347 "getmininginforesult-currentblocksize": "Size of the latest best block", 348 "getmininginforesult-currentblocktx": "Number of transactions in the latest best block", 349 "getmininginforesult-difficulty": "Current target difficulty", 350 "getmininginforesult-errors": "Any current errors", 351 "getmininginforesult-generate": "Whether or not server is set to generate coins", 352 "getmininginforesult-genproclimit": "Number of processors to use for coin generation (-1 when disabled)", 353 "getmininginforesult-hashespersec": "Recent hashes per second performance measurement while generating coins", 354 "getmininginforesult-networkhashps": "Estimated network hashes per second for the most recent blocks", 355 "getmininginforesult-pooledtx": "Number of transactions in the memory pool", 356 "getmininginforesult-testnet": "Whether or not server is using testnet", 357 358 // GetMiningInfoCmd help. 359 "getmininginfo--synopsis": "Returns a JSON object containing mining-related information.", 360 361 // GetNetworkHashPSCmd help. 362 "getnetworkhashps--synopsis": "Returns the estimated network hashes per second for the block heights provided by the parameters.", 363 "getnetworkhashps-blocks": "The number of blocks, or -1 for blocks since last difficulty change", 364 "getnetworkhashps-height": "Perform estimate ending with this height or -1 for current best chain block height", 365 "getnetworkhashps--result0": "Estimated hashes per second", 366 367 // GetNetTotalsCmd help. 368 "getnettotals--synopsis": "Returns a JSON object containing network traffic statistics.", 369 370 // GetNetTotalsResult help. 371 "getnettotalsresult-totalbytesrecv": "Total bytes received", 372 "getnettotalsresult-totalbytessent": "Total bytes sent", 373 "getnettotalsresult-timemillis": "Number of milliseconds since 1 Jan 1970 GMT", 374 375 // GetPeerInfoResult help. 376 "getpeerinforesult-id": "A unique node ID", 377 "getpeerinforesult-addr": "The ip address and port of the peer", 378 "getpeerinforesult-addrlocal": "Local address", 379 "getpeerinforesult-services": "Services bitmask which represents the services supported by the peer", 380 "getpeerinforesult-lastsend": "Time the last message was received in seconds since 1 Jan 1970 GMT", 381 "getpeerinforesult-lastrecv": "Time the last message was sent in seconds since 1 Jan 1970 GMT", 382 "getpeerinforesult-bytessent": "Total bytes sent", 383 "getpeerinforesult-bytesrecv": "Total bytes received", 384 "getpeerinforesult-conntime": "Time the connection was made in seconds since 1 Jan 1970 GMT", 385 "getpeerinforesult-timeoffset": "The time offset of the peer", 386 "getpeerinforesult-pingtime": "Number of microseconds the last ping took", 387 "getpeerinforesult-pingwait": "Number of microseconds a queued ping has been waiting for a response", 388 "getpeerinforesult-version": "The protocol version of the peer", 389 "getpeerinforesult-subver": "The user agent of the peer", 390 "getpeerinforesult-inbound": "Whether or not the peer is an inbound connection", 391 "getpeerinforesult-startingheight": "The latest block height the peer knew about when the connection was established", 392 "getpeerinforesult-currentheight": "The current height of the peer", 393 "getpeerinforesult-banscore": "The ban score", 394 "getpeerinforesult-syncnode": "Whether or not the peer is the sync peer", 395 396 // GetPeerInfoCmd help. 397 "getpeerinfo--synopsis": "Returns data about each connected network peer as an array of json objects.", 398 399 // GetRawMempoolVerboseResult help. 400 "getrawmempoolverboseresult-size": "Transaction size in bytes", 401 "getrawmempoolverboseresult-fee": "Transaction fee in bitcoins", 402 "getrawmempoolverboseresult-time": "Local time transaction entered pool in seconds since 1 Jan 1970 GMT", 403 "getrawmempoolverboseresult-height": "Block height when transaction entered the pool", 404 "getrawmempoolverboseresult-startingpriority": "Priority when transaction entered the pool", 405 "getrawmempoolverboseresult-currentpriority": "Current priority", 406 "getrawmempoolverboseresult-depends": "Unconfirmed transactions used as inputs for this transaction", 407 408 // GetRawMempoolCmd help. 409 "getrawmempool--synopsis": "Returns information about all of the transactions currently in the memory pool.", 410 "getrawmempool-verbose": "Returns JSON object when true or an array of transaction hashes when false", 411 "getrawmempool--condition0": "verbose=false", 412 "getrawmempool--condition1": "verbose=true", 413 "getrawmempool--result0": "Array of transaction hashes", 414 415 // GetRawTransactionCmd help. 416 "getrawtransaction--synopsis": "Returns information about a transaction given its hash.", 417 "getrawtransaction-txid": "The hash of the transaction", 418 "getrawtransaction-verbose": "Specifies the transaction is returned as a JSON object instead of a hex-encoded string", 419 "getrawtransaction--condition0": "verbose=false", 420 "getrawtransaction--condition1": "verbose=true", 421 "getrawtransaction--result0": "Hex-encoded bytes of the serialized transaction", 422 423 // GetTxOutResult help. 424 "gettxoutresult-bestblock": "The block hash that contains the transaction output", 425 "gettxoutresult-confirmations": "The number of confirmations", 426 "gettxoutresult-value": "The transaction amount in BTC", 427 "gettxoutresult-scriptPubKey": "The public key script used to pay coins as a JSON object", 428 "gettxoutresult-version": "The transaction version", 429 "gettxoutresult-coinbase": "Whether or not the transaction is a coinbase", 430 431 // GetTxOutCmd help. 432 "gettxout--synopsis": "Returns information about an unspent transaction output..", 433 "gettxout-txid": "The hash of the transaction", 434 "gettxout-vout": "The index of the output", 435 "gettxout-includemempool": "Include the mempool when true", 436 437 // GetWorkResult help. 438 "getworkresult-data": "Hex-encoded block data", 439 "getworkresult-hash1": "(DEPRECATED) Hex-encoded formatted hash buffer", 440 "getworkresult-midstate": "(DEPRECATED) Hex-encoded precomputed hash state after hashing first half of the data", 441 "getworkresult-target": "Hex-encoded little-endian hash target", 442 443 // GetWorkCmd help. 444 "getwork--synopsis": "(DEPRECATED - Use getblocktemplate instead) Returns formatted hash data to work on or checks and submits solved data.", 445 "getwork-data": "Hex-encoded data to check", 446 "getwork--condition0": "no data provided", 447 "getwork--condition1": "data provided", 448 "getwork--result1": "Whether or not the solved data is valid and was added to the chain", 449 450 // HelpCmd help. 451 "help--synopsis": "Returns a list of all commands or help for a specified command.", 452 "help-command": "The command to retrieve help for", 453 "help--condition0": "no command provided", 454 "help--condition1": "command specified", 455 "help--result0": "List of commands", 456 "help--result1": "Help for specified command", 457 458 // PingCmd help. 459 "ping--synopsis": "Queues a ping to be sent to each connected peer.\n" + 460 "Ping times are provided by getpeerinfo via the pingtime and pingwait fields.", 461 462 // SearchRawTransactionsCmd help. 463 "searchrawtransactions--synopsis": "Returns raw data for transactions involving the passed address.\n" + 464 "Returned transactions are pulled from both the database, and transactions currently in the mempool.\n" + 465 "Transactions pulled from the mempool will have the 'confirmations' field set to 0.\n" + 466 "Usage of this RPC requires the optional --addrindex flag to be activated, otherwise all responses will simply return with an error stating the address index has not yet been built.\n" + 467 "Similarly, until the address index has caught up with the current best height, all requests will return an error response in order to avoid serving stale data.", 468 "searchrawtransactions-address": "The Bitcoin address to search for", 469 "searchrawtransactions-verbose": "Specifies the transaction is returned as a JSON object instead of hex-encoded string", 470 "searchrawtransactions--condition0": "verbose=0", 471 "searchrawtransactions--condition1": "verbose=1", 472 "searchrawtransactions-skip": "The number of leading transactions to leave out of the final response", 473 "searchrawtransactions-count": "The maximum number of transactions to return", 474 "searchrawtransactions-vinextra": "Specify that extra data from previous output will be returned in vin", 475 "searchrawtransactions-reverse": "Specifies that the transactions should be returned in reverse chronological order", 476 "searchrawtransactions-filteraddrs": "Address list. Only inputs or outputs with matching address will be returned", 477 "searchrawtransactions--result0": "Hex-encoded serialized transaction", 478 479 // SendRawTransactionCmd help. 480 "sendrawtransaction--synopsis": "Submits the serialized, hex-encoded transaction to the local peer and relays it to the network.", 481 "sendrawtransaction-hextx": "Serialized, hex-encoded signed transaction", 482 "sendrawtransaction-allowhighfees": "Whether or not to allow insanely high fees (btcd does not yet implement this parameter, so it has no effect)", 483 "sendrawtransaction--result0": "The hash of the transaction", 484 485 // SetGenerateCmd help. 486 "setgenerate--synopsis": "Set the server to generate coins (mine) or not.", 487 "setgenerate-generate": "Use true to enable generation, false to disable it", 488 "setgenerate-genproclimit": "The number of processors (cores) to limit generation to or -1 for default", 489 490 // StopCmd help. 491 "stop--synopsis": "Shutdown btcd.", 492 "stop--result0": "The string 'btcd stopping.'", 493 494 // SubmitBlockOptions help. 495 "submitblockoptions-workid": "This parameter is currently ignored", 496 497 // SubmitBlockCmd help. 498 "submitblock--synopsis": "Attempts to submit a new serialized, hex-encoded block to the network.", 499 "submitblock-hexblock": "Serialized, hex-encoded block", 500 "submitblock-options": "This parameter is currently ignored", 501 "submitblock--condition0": "Block successfully submitted", 502 "submitblock--condition1": "Block rejected", 503 "submitblock--result1": "The reason the block was rejected", 504 505 // ValidateAddressResult help. 506 "validateaddresschainresult-isvalid": "Whether or not the address is valid", 507 "validateaddresschainresult-address": "The bitcoin address (only when isvalid is true)", 508 509 // ValidateAddressCmd help. 510 "validateaddress--synopsis": "Verify an address is valid.", 511 "validateaddress-address": "Bitcoin address to validate", 512 513 // VerifyChainCmd help. 514 "verifychain--synopsis": "Verifies the block chain database.\n" + 515 "The actual checks performed by the checklevel parameter are implementation specific.\n" + 516 "For btcd this is:\n" + 517 "checklevel=0 - Look up each block and ensure it can be loaded from the database.\n" + 518 "checklevel=1 - Perform basic context-free sanity checks on each block.", 519 "verifychain-checklevel": "How thorough the block verification is", 520 "verifychain-checkdepth": "The number of blocks to check", 521 "verifychain--result0": "Whether or not the chain verified", 522 523 // VerifyMessageCmd help. 524 "verifymessage--synopsis": "Verify a signed message.", 525 "verifymessage-address": "The bitcoin address to use for the signature", 526 "verifymessage-signature": "The base-64 encoded signature provided by the signer", 527 "verifymessage-message": "The signed message", 528 "verifymessage--result0": "Whether or not the signature verified", 529 530 // -------- Websocket-specific help -------- 531 532 // Session help. 533 "session--synopsis": "Return details regarding a websocket client's current connection session.", 534 "sessionresult-sessionid": "The unique session ID for a client's websocket connection.", 535 536 // NotifyBlocksCmd help. 537 "notifyblocks--synopsis": "Request notifications for whenever a block is connected or disconnected from the main (best) chain.", 538 539 // StopNotifyBlocksCmd help. 540 "stopnotifyblocks--synopsis": "Cancel registered notifications for whenever a block is connected or disconnected from the main (best) chain.", 541 542 // NotifyNewTransactionsCmd help. 543 "notifynewtransactions--synopsis": "Send either a txaccepted or a txacceptedverbose notification when a new transaction is accepted into the mempool.", 544 "notifynewtransactions-verbose": "Specifies which type of notification to receive. If verbose is true, then the caller receives txacceptedverbose, otherwise the caller receives txaccepted", 545 546 // StopNotifyNewTransactionsCmd help. 547 "stopnotifynewtransactions--synopsis": "Stop sending either a txaccepted or a txacceptedverbose notification when a new transaction is accepted into the mempool.", 548 549 // NotifyReceivedCmd help. 550 "notifyreceived--synopsis": "Send a recvtx notification when a transaction added to mempool or appears in a newly-attached block contains a txout pkScript sending to any of the passed addresses.\n" + 551 "Matching outpoints are automatically registered for redeemingtx notifications.", 552 "notifyreceived-addresses": "List of address to receive notifications about", 553 554 // StopNotifyReceivedCmd help. 555 "stopnotifyreceived--synopsis": "Cancel registered receive notifications for each passed address.", 556 "stopnotifyreceived-addresses": "List of address to cancel receive notifications for", 557 558 // OutPoint help. 559 "outpoint-hash": "The hex-encoded bytes of the outpoint hash", 560 "outpoint-index": "The index of the outpoint", 561 562 // NotifySpentCmd help. 563 "notifyspent--synopsis": "Send a redeemingtx notification when a transaction spending an outpoint appears in mempool (if relayed to this btcd instance) and when such a transaction first appears in a newly-attached block.", 564 "notifyspent-outpoints": "List of transaction outpoints to monitor.", 565 566 // StopNotifySpentCmd help. 567 "stopnotifyspent--synopsis": "Cancel registered spending notifications for each passed outpoint.", 568 "stopnotifyspent-outpoints": "List of transaction outpoints to stop monitoring.", 569 570 // Rescan help. 571 "rescan--synopsis": "Rescan block chain for transactions to addresses.\n" + 572 "When the endblock parameter is omitted, the rescan continues through the best block in the main chain.\n" + 573 "Rescan results are sent as recvtx and redeemingtx notifications.\n" + 574 "This call returns once the rescan completes.", 575 "rescan-beginblock": "Hash of the first block to begin rescanning", 576 "rescan-addresses": "List of addresses to include in the rescan", 577 "rescan-outpoints": "List of transaction outpoints to include in the rescan", 578 "rescan-endblock": "Hash of final block to rescan", 579 } 580 581 // rpcResultTypes specifies the result types that each RPC command can return. 582 // This information is used to generate the help. Each result type must be a 583 // pointer to the type (or nil to indicate no return value). 584 var rpcResultTypes = map[string][]interface{}{ 585 "addnode": nil, 586 "createrawtransaction": {(*string)(nil)}, 587 "debuglevel": {(*string)(nil), (*string)(nil)}, 588 "decoderawtransaction": {(*btcjson.TxRawDecodeResult)(nil)}, 589 "decodescript": {(*btcjson.DecodeScriptResult)(nil)}, 590 "generate": {(*[]string)(nil)}, 591 "getaddednodeinfo": {(*[]string)(nil), (*[]btcjson.GetAddedNodeInfoResult)(nil)}, 592 "getbestblock": {(*btcjson.GetBestBlockResult)(nil)}, 593 "getbestblockhash": {(*string)(nil)}, 594 "getblock": {(*string)(nil), (*btcjson.GetBlockVerboseResult)(nil)}, 595 "getblockcount": {(*int64)(nil)}, 596 "getblockhash": {(*string)(nil)}, 597 "getblockheader": {(*string)(nil), (*btcjson.GetBlockHeaderVerboseResult)(nil)}, 598 "getblocktemplate": {(*btcjson.GetBlockTemplateResult)(nil), (*string)(nil), nil}, 599 "getconnectioncount": {(*int32)(nil)}, 600 "getcurrentnet": {(*uint32)(nil)}, 601 "getdifficulty": {(*float64)(nil)}, 602 "getgenerate": {(*bool)(nil)}, 603 "gethashespersec": {(*float64)(nil)}, 604 "getinfo": {(*btcjson.InfoChainResult)(nil)}, 605 "getmempoolinfo": {(*btcjson.GetMempoolInfoResult)(nil)}, 606 "getmininginfo": {(*btcjson.GetMiningInfoResult)(nil)}, 607 "getnettotals": {(*btcjson.GetNetTotalsResult)(nil)}, 608 "getnetworkhashps": {(*int64)(nil)}, 609 "getpeerinfo": {(*[]btcjson.GetPeerInfoResult)(nil)}, 610 "getrawmempool": {(*[]string)(nil), (*btcjson.GetRawMempoolVerboseResult)(nil)}, 611 "getrawtransaction": {(*string)(nil), (*btcjson.TxRawResult)(nil)}, 612 "gettxout": {(*btcjson.GetTxOutResult)(nil)}, 613 "getwork": {(*btcjson.GetWorkResult)(nil), (*bool)(nil)}, 614 "node": nil, 615 "help": {(*string)(nil), (*string)(nil)}, 616 "ping": nil, 617 "searchrawtransactions": {(*string)(nil), (*[]btcjson.SearchRawTransactionsResult)(nil)}, 618 "sendrawtransaction": {(*string)(nil)}, 619 "setgenerate": nil, 620 "stop": {(*string)(nil)}, 621 "submitblock": {nil, (*string)(nil)}, 622 "validateaddress": {(*btcjson.ValidateAddressChainResult)(nil)}, 623 "verifychain": {(*bool)(nil)}, 624 "verifymessage": {(*bool)(nil)}, 625 626 // Websocket commands. 627 "session": {(*btcjson.SessionResult)(nil)}, 628 "notifyblocks": nil, 629 "stopnotifyblocks": nil, 630 "notifynewtransactions": nil, 631 "stopnotifynewtransactions": nil, 632 "notifyreceived": nil, 633 "stopnotifyreceived": nil, 634 "notifyspent": nil, 635 "stopnotifyspent": nil, 636 "rescan": nil, 637 } 638 639 // helpCacher provides a concurrent safe type that provides help and usage for 640 // the RPC server commands and caches the results for future calls. 641 type helpCacher struct { 642 sync.Mutex 643 usage string 644 methodHelp map[string]string 645 } 646 647 // rpcMethodHelp returns an RPC help string for the provided method. 648 // 649 // This function is safe for concurrent access. 650 func (c *helpCacher) rpcMethodHelp(method string) (string, error) { 651 c.Lock() 652 defer c.Unlock() 653 654 // Return the cached method help if it exists. 655 if help, exists := c.methodHelp[method]; exists { 656 return help, nil 657 } 658 659 // Look up the result types for the method. 660 resultTypes, ok := rpcResultTypes[method] 661 if !ok { 662 return "", errors.New("no result types specified for method " + 663 method) 664 } 665 666 // Generate, cache, and return the help. 667 help, err := btcjson.GenerateHelp(method, helpDescsEnUS, resultTypes...) 668 if err != nil { 669 return "", err 670 } 671 c.methodHelp[method] = help 672 return help, nil 673 } 674 675 // rpcUsage returns one-line usage for all support RPC commands. 676 // 677 // This function is safe for concurrent access. 678 func (c *helpCacher) rpcUsage(includeWebsockets bool) (string, error) { 679 c.Lock() 680 defer c.Unlock() 681 682 // Return the cached usage if it is available. 683 if c.usage != "" { 684 return c.usage, nil 685 } 686 687 // Generate a list of one-line usage for every command. 688 usageTexts := make([]string, 0, len(rpcHandlers)) 689 for k := range rpcHandlers { 690 usage, err := btcjson.MethodUsageText(k) 691 if err != nil { 692 return "", err 693 } 694 usageTexts = append(usageTexts, usage) 695 } 696 697 // Include websockets commands if requested. 698 if includeWebsockets { 699 for k := range wsHandlers { 700 usage, err := btcjson.MethodUsageText(k) 701 if err != nil { 702 return "", err 703 } 704 usageTexts = append(usageTexts, usage) 705 } 706 } 707 708 sort.Sort(sort.StringSlice(usageTexts)) 709 c.usage = strings.Join(usageTexts, "\n") 710 return c.usage, nil 711 } 712 713 // newHelpCacher returns a new instance of a help cacher which provides help and 714 // usage for the RPC server commands and caches the results for future calls. 715 func newHelpCacher() *helpCacher { 716 return &helpCacher{ 717 methodHelp: make(map[string]string), 718 } 719 }