Based on the proposal, update the help message of rpc methods
- strings arguments are in double quotes rather than square brackets
- numeric arguments have no quotes (and no default value)
- optional parameters are surrounded by round brackets
- json arguments are strings but don't use double quotes
Added 3 sections for the details
- Arguments: lists each argument, it's type, required or not, a default, and a description
- Result: The method result, with json format if applicable, type, and a description
- Examples: examples calls using bitcoin-cli and curl for json rpc call
Problems
- maybe this is too verbose
- lines might be too long
- description are not good or complete
- examples may be too much
pull/1/head
sje9 years agocommitted byWladimir J. van der Laan
"\"previousblockhash\" : \"xxxx\", (string) The hash of current highest block\n"
"\"transactions\" : [ (array) contents of non-coinbase transactions that should be included in the next block\n"
" {\n"
"\"data\" : \"xxxx\", (string) transaction data encoded in hexadecimal (byte-for-byte)\n"
"\"hash\" : \"xxxx\", (string) hash/id encoded in little-endian hexadecimal\n"
"\"depends\" : [ (array) array of numbers \n"
" n (numeric) transactions before this one (by 1-based index in 'transactions' list) that must be present in the final block if this one is\n"
" ,...\n"
" ],\n"
"\"fee\": n, (numeric) difference in value between transaction inputs and outputs (in Satoshis); for coinbase transactions, this is a negative Number of the total collected block fees (ie, not including the block subsidy); if key is not present, fee is unknown and clients MUST NOT assume there isn't one\n"
"\"sigops\" : n, (numeric) total number of SigOps, as counted for purposes of block limits; if key is not present, sigop count is unknown and clients MUST NOT assume there aren't any\n"
"\"required\" : true|false (boolean) if provided and true, this transaction must be in the final block\n"
" }\n"
" ,...\n"
" ],\n"
"\"coinbaseaux\" : { (json object) data that should be included in the coinbase's scriptSig content\n"
"\"flags\" : \"flags\" (string) \n"
" },\n"
"\"coinbasevalue\" : n, (numeric) maximum allowable input to coinbase transaction, including the generation award and transaction fees (in Satoshis)\n"
"\"coinbasetxn\" : { ... }, (json object) information for coinbase transaction\n"
"\"target\" : \"xxxx\", (string) The hash target\n"
"\"mintime\" : xxx, (numeric) The minimum timestamp appropriate for next block time in seconds since epoch (Jan 1 1970 GMT)\n"
"\"mutable\" : [ (array of string) list of ways the block template may be changed \n"
"\"value\" (string) A way the block template may be changed, e.g. 'time', 'transactions', 'prevblock'\n"
" ,...\n"
" ],\n"
"\"noncerange\" : \"00000000ffffffff\", (string) A range of valid nonces\n"
"\"sigoplimit\" : n, (numeric) limit of sigops in blocks\n"
"\"sizelimit\" : n, (numeric) limit of block size\n"
"\"curtime\" : ttt, (numeric) current timestamp in seconds since epoch (Jan 1 1970 GMT)\n"
"\"bits\" : \"xxx\", (string) compressed target of next block\n"
"\"height\" : n (numeric) The height of the next block\n"
"}\n"
"\nExamples:\n"
+HelpExampleCli("getblocktemplate","")
+HelpExampleRpc("getblocktemplate","")
);
std::stringstrMode="template";
if(params.size()>0)
@ -434,10 +540,22 @@ Value submitblock(const Array& params, bool fHelp)
@@ -434,10 +540,22 @@ Value submitblock(const Array& params, bool fHelp)
{
if(fHelp||params.size()<1||params.size()>2)
throwruntime_error(
"submitblock <hex data> [optional-params-obj]\n"
"[optional-params-obj] parameter is currently ignored.\n"
"Attempts to submit new block to network.\n"
"See https://en.bitcoin.it/wiki/BIP_0022 for full specification.");
"Attempts add or remove <node> from the addnode list or try a connection to <node> once.");
"addnode \"node\"\"add|remove|onetry\"\n"
"\nAttempts add or remove a node from the addnode list.\n"
"Or try a connection to a node once.\n"
"\nArguments:\n"
"1. \"node\" (string, required) The node (see getpeerinfo for nodes)\n"
"2. \"command\" (string, required) 'add' to add a node to the list, 'remove' to remove a node from the list, 'onetry' to try a connection to the node once\n"
@ -73,7 +82,29 @@ Value getinfo(const Array& params, bool fHelp)
@@ -73,7 +82,29 @@ Value getinfo(const Array& params, bool fHelp)
if(fHelp||params.size()!=0)
throwruntime_error(
"getinfo\n"
"Returns an object containing various state info.");
"Returns an object containing various state info.\n"
"\nResult:\n"
"{\n"
"\"version\": xxxxx, (numeric) the server version\n"
"\"protocolversion\": xxxxx, (numeric) the protocol version\n"
"\"walletversion\": xxxxx, (numeric) the wallet version\n"
"\"balance\": xxxxxxx, (numeric) the total bitcoin balance of the wallet\n"
"\"blocks\": xxxxxx, (numeric) the current number of blocks processed in the server\n"
"\"timeoffset\": xxxxx, (numeric) the time offset\n"
"\"connections\": xxxxx, (numeric) the number of connections\n"
"\"proxy\": \"host:port\", (string, optional) the proxy used by the server\n"
"\"difficulty\": xxxxxx, (numeric) the current difficulty\n"
"\"testnet\": true|false, (boolean) if the server is using testnet or not\n"
"\"keypoololdest\": xxxxxx, (numeric) the timestamp (seconds since GMT epoch) of the oldest pre-generated key in the key pool\n"
"\"keypoolsize\": xxxx, (numeric) how many new keys are pre-generated\n"
"\"paytxfee\": x.xxxx, (numeric) the transaction fee set in btc\n"
"\"unlocked_until\": ttt, (numeric) the timestamp in seconds since epoch (midnight Jan 1 1970 GMT) that the wallet is unlocked for transfers, or 0 if the wallet is locked\n"
"\"errors\": \"...\" (string) any error messages\n"
"}\n"
"\nExamples:\n"
+HelpExampleCli("getinfo","")
+HelpExampleRpc("getinfo","")
);
proxyTypeproxy;
GetProxy(NET_IPV4,proxy);
@ -108,10 +139,20 @@ Value getnewaddress(const Array& params, bool fHelp)
@@ -108,10 +139,20 @@ Value getnewaddress(const Array& params, bool fHelp)
{
if(fHelp||params.size()>1)
throwruntime_error(
"getnewaddress [account]\n"
"Returns a new Bitcoin address for receiving payments. "
"If [account] is specified (recommended), it is added to the address book "
"so payments received with the address will be credited to [account].");
"getnewaddress ( \"account\" )\n"
"\nReturns a new Bitcoin address for receiving payments.\n"
"If 'account' is specified (recommended), it is added to the address book \n"
"so payments received with the address will be credited to 'account'.\n"
"\nArguments:\n"
"1. \"account\" (string, optional) The account name for the address to be linked to. if not provided, the default account \"\" is used. It can also be set to the empty string \"\" to represent the default account. The account does not need to exist, it will be created if there is no account by the given name.\n"
"\nResult:\n"
"\"bitcoinaddress\" (string) The new bitcoin address\n"
"\nExamples:\n"
+HelpExampleCli("getnewaddress","")
+HelpExampleCli("getnewaddress","\"\"")
+HelpExampleCli("getnewaddress","\"myaccount\"")
+HelpExampleRpc("getnewaddress","\"myaccount\"")
);
// Parse the account first so we don't generate a key if there's an error
stringstrAccount;
@ -175,8 +216,18 @@ Value getaccountaddress(const Array& params, bool fHelp)
@@ -175,8 +216,18 @@ Value getaccountaddress(const Array& params, bool fHelp)
{
if(fHelp||params.size()!=1)
throwruntime_error(
"getaccountaddress <account>\n"
"Returns the current Bitcoin address for receiving payments to this account.");
"getaccountaddress \"account\"\n"
"\nReturns the current Bitcoin address for receiving payments to this account.\n"
"\nArguments:\n"
"1. \"account\" (string, required) The account name for the address. It can also be set to the empty string \"\" to represent the default account. The account does not need to exist, it will be created and a new address created if there is no account by the given name.\n"
"\nResult:\n"
"\"bitcoinaddress\" (string) The account bitcoin address\n"