Browse Source

Fixed Cryptonote APIs description.

wsl
Jianping Wu 6 years ago
parent
commit
d89d414627
  1. 83
      src/rpc/mining.cpp

83
src/rpc/mining.cpp

@ -737,6 +737,7 @@ UniValue getblocktemplate_original(const JSONRPCRequest& request) @@ -737,6 +737,7 @@ UniValue getblocktemplate_original(const JSONRPCRequest& request)
return result;
}
// Cryptonote RPC API. Not to be confused with the Bitcoin imlementation (see getblocktemplate_original).
UniValue getblocktemplate(const JSONRPCRequest& request)
{
// JSON-RPC2 request
@ -744,78 +745,25 @@ UniValue getblocktemplate(const JSONRPCRequest& request) @@ -744,78 +745,25 @@ UniValue getblocktemplate(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 2)
throw std::runtime_error(
"getblocktemplate ( TemplateRequest )\n"
"\nIf the request parameters include a 'mode' key, that is used to explicitly select between the default 'template' request or a 'proposal'.\n"
"It returns data needed to construct a block to work on.\n"
"For full specification, see BIPs 22, 23, 9, and 145:\n"
" https://github.com/bitcoin/bips/blob/master/bip-0022.mediawiki\n"
" https://github.com/bitcoin/bips/blob/master/bip-0023.mediawiki\n"
" https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki#getblocktemplate_changes\n"
" https://github.com/bitcoin/bips/blob/master/bip-0145.mediawiki\n"
"\nThis is a Cryptonote API and is not compatible with original bitcoin implementation (See getblocktemplate_original).\n"
"Get a block template on which mining a new block.\n"
"\nArguments:\n"
"1. template_request (json object, optional) A json object in the following spec\n"
" {\n"
" \"mode\":\"template\" (string, optional) This must be set to \"template\", \"proposal\" (see BIP 23), or omitted\n"
" \"capabilities\":[ (array, optional) A list of strings\n"
" \"support\" (string) client side supported feature, 'longpoll', 'coinbasetxn', 'coinbasevalue', 'proposal', 'serverlist', 'workid'\n"
" ,...\n"
" ],\n"
" \"rules\":[ (array, optional) A list of strings\n"
" \"support\" (string) client side supported softfork deployment\n"
" ,...\n"
" ]\n"
" }\n"
"\n"
"1. reserve_size (unsigned int) Reserve size\n"
"2. wallet_address (string) Address of wallet to receive coinbase transactions if block is successfully mined.\n"
"\nResult:\n"
"{\n"
" \"version\" : n, (numeric) The preferred block version\n"
" \"rules\" : [ \"rulename\", ... ], (array of strings) specific block rules that are to be enforced\n"
" \"vbavailable\" : { (json object) set of pending, supported versionbit (BIP 9) softfork deployments\n"
" \"rulename\" : bitnumber (numeric) identifies the bit number as indicating acceptance and readiness for the named softfork rule\n"
" ,...\n"
" },\n"
" \"vbrequired\" : n, (numeric) bit mask of versionbits the server requires set in submissions\n"
" \"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"
" \"txid\" : \"xxxx\", (string) transaction id encoded in little-endian hexadecimal\n"
" \"hash\" : \"xxxx\", (string) hash encoded in little-endian hexadecimal (including witness data)\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 SigOps cost, as counted for purposes of block limits; if key is not present, sigop cost is unknown and clients MUST NOT assume it is zero\n"
" \"weight\" : n, (numeric) total transaction weight, as counted for purposes of block limits\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\" : \"xx\" (string) key name is to be ignored, and value included in scriptSig\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"
" \"weightlimit\" : n, (numeric) limit of block weight\n"
" \"curtime\" : ttt, (numeric) current timestamp in seconds since epoch (Jan 1 1970 GMT)\n"
" \"bits\" : \"xxxxxxxx\", (string) compressed target of next block\n"
" \"height\" : n (numeric) The height of the next block\n"
" \"blocktemplate_blob\" : \"xxxx\", (string) Blob on which to try to mine a new block.\n"
" \"blockhashing_blob\" : \"xxxx\", (string) Blob on which to try to find a valid nonce.\n"
" \"difficulty\" : n, (unsigned int) Difficulty of next block.\n"
" \"expected_reward\" : n, (unsigned int) Coinbase reward expected to be received if block is successfully mined.\n"
" \"height\" : n, (unsigned int) maximum allowable input to coinbase transaction, including the generation award and transaction fees (in satoshis)\n"
" \"prev_hash\" : \"xxxx\", (string) Hash of the most recent block on which to mine the next block.\n"
" \"reserved_offset\" : \"xxxx\", (unsigned int) Reserved offset.\n"
" \"status\" : \"xxx\", (string) General RPC error code. \"OK\" means everything looks good.\n"
" \"untrusted\" : n, (boolean) States if the result is obtained using the bootstrap mode, and is therefore not trusted (true), or when the daemon is fully synced (false).\n"
"}\n"
"\nExamples:\n"
+ HelpExampleCli("getblocktemplate", "")
+ HelpExampleRpc("getblocktemplate", "")
+ HelpExampleCli("getblocktemplate", "8 TGcYLSTvYRy9uaqEZMfs2i1fXdfourYXDb")
);
int reserve_size;
@ -1118,6 +1066,7 @@ UniValue submitblock(const JSONRPCRequest& request) @@ -1118,6 +1066,7 @@ UniValue submitblock(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 1) {
throw std::runtime_error(
"submitblock \"hexdata\"\n"
"\nThis is a Cryptonote API and is not compatible with original bitcoin implementation (See submitblock_original).\n"
"\nAttempts to submit new block to network.\n"
"\nArguments\n"

Loading…
Cancel
Save