From ed58f32153818d9a410eddd5eb5fff8d17989a9c Mon Sep 17 00:00:00 2001 From: Brannon King Date: Tue, 12 Feb 2019 13:40:36 -0700 Subject: [PATCH] move examples to separate section of api doc --- contrib/devtools/generate_json_api_v1.py | 27 +- contrib/devtools/generated/api_v1.json | 1026 +++++++++++++++++++--- 2 files changed, 939 insertions(+), 114 deletions(-) diff --git a/contrib/devtools/generate_json_api_v1.py b/contrib/devtools/generate_json_api_v1.py index e886a808c..014b4fdbe 100755 --- a/contrib/devtools/generate_json_api_v1.py +++ b/contrib/devtools/generate_json_api_v1.py @@ -50,6 +50,29 @@ def parse_params(args): return arguments +def process_examples(examples: str): + if not examples: + return [] + examples = examples.strip() + splits = examples.split('\n') + result = [] + inner = {} + for s in splits: + if not s: + continue + if '> curl' in s: + inner['curl'] = s.strip() + elif '> lbrycrd' in s: + inner['cli'] = s.strip() + else: + if 'title' in inner: + result.append(inner) + inner = {} + inner['title'] = s.strip() + result.append(inner) + return result + + def get_api(section_name, command, command_help): parsed = re_full.fullmatch(command_help) @@ -61,8 +84,7 @@ def get_api(section_name, command, command_help): arguments = parse_params(args) cmd_desc = re.sub('\s+', ' ', desc.strip()) if desc else '' - if exmp and '--skip_examples' not in sys.argv: - cmd_desc += '\nExamples:\n' + exmp.strip() + examp_desc = process_examples(exmp) cmd_resl = resl.strip() if resl else None ret = { @@ -70,6 +92,7 @@ def get_api(section_name, command, command_help): 'namespace': section_name, 'description': cmd_desc, 'arguments': arguments, + 'examples': examp_desc } if cmd_resl is not None: ret['returns'] = cmd_resl diff --git a/contrib/devtools/generated/api_v1.json b/contrib/devtools/generated/api_v1.json index d7ad79b2b..c91f127c4 100644 --- a/contrib/devtools/generated/api_v1.json +++ b/contrib/devtools/generated/api_v1.json @@ -23,6 +23,7 @@ "is_required": true } ], + "examples": [], "returns": "\"transactionid\" (string) The new transaction id." }, { @@ -49,8 +50,24 @@ "is_required": true } ], + "examples": [], "returns": "\"transactionid\" (string) The new transaction id." }, + { + "name": "checknormalization", + "namespace": "Claimtrie", + "description": "Given an unnormalized name of a claim, return normalized version of it", + "arguments": [ + { + "name": "name", + "type": "string", + "description": "the name to normalize", + "is_required": true + } + ], + "examples": [], + "returns": "\"normalized\" (string) fully normalized name" + }, { "name": "claimname", "namespace": "Claimtrie", @@ -75,6 +92,7 @@ "is_required": true } ], + "examples": [], "returns": "\"transactionid\" (string) The transaction id." }, { @@ -89,7 +107,8 @@ "is_required": true } ], - "returns": "{\n \"name\" (string) the name of the claim\n \"value\" (string) claim metadata\n \"claimId\" (string) the claimId of this claim\n \"txid\" (string) the hash of the transaction which has successfully claimed this name\n \"n\" (numeric) vout value\n \"amount\" (numeric) txout value\n \"effective amount\" (numeric) txout amount plus amount from all supports associated with the claim\n \"height\" (numeric) the height of the block in which this claim transaction is located\n \"supports\" (array of object) supports for this claim\n \"valid at height\" (numeric) the height at which the claim is valid\n [\n \"txid\" (string) the txid of the support\n \"n\" (numeric) the index of the support in the transaction's list of outputs\n \"height\" (numeric) the height at which the support was included in the blockchain\n \"valid at height\" (numeric) the height at which the support is valid\n \"amount\" (numeric) the amount of the support\n ]\n}" + "examples": [], + "returns": "{\n \"name\" (string) the original name of the claim (before normalization)\n \"normalized_name\" (string) the name of this claim (after normalization)\n \"value\" (string) claim metadata\n \"claimId\" (string) the claimId of this claim\n \"txid\" (string) the hash of the transaction which has successfully claimed this name\n \"n\" (numeric) vout value\n \"amount\" (numeric) txout value\n \"effective amount\" (numeric) txout amount plus amount from all supports associated with the claim\n \"supports\" (array of object) supports for this claim\n [\n \"txid\" (string) the txid of the support\n \"n\" (numeric) the index of the support in the transaction's list of outputs\n \"height\" (numeric) the height at which the support was included in the blockchain\n \"valid at height\" (numeric) the height at which the support is valid\n \"amount\" (numeric) the amount of the support\n ]\n \"height\" (numeric) the height of the block in which this claim transaction is located\n \"valid at height\" (numeric) the height at which the claim is valid\n}" }, { "name": "getclaimsforname", @@ -101,9 +120,16 @@ "type": "string", "description": "the name for which to get claims and supports", "is_required": true + }, + { + "name": "blockhash", + "type": "string", + "description": "get claims for name at the block specified by this block hash. If none is given, the latest active block will be used.", + "is_required": false } ], - "returns": "{\n \"nLastTakeoverheight\" (numeric) the last height at which ownership of the name changed\n \"claims\": [ (array of object) claims for this name\n {\n \"claimId\" (string) the claimId of this claim\n \"txid\" (string) the txid of this claim\n \"n\" (numeric) the index of the claim in the transaction's list of outputs\n \"nHeight\" (numeric) the height at which the claim was included in the blockchain\n \"nValidAtHeight\" (numeric) the height at which the claim became/becomes valid\n \"nAmount\" (numeric) the amount of the claim\n \"nEffectiveAmount\" (numeric) the total effective amount of the claim, taking into effect whether the claim or support has reached its nValidAtHeight\n \"supports\" : [ (array of object) supports for this claim\n \"txid\" (string) the txid of the support\n \"n\" (numeric) the index of the support in the transaction's list of outputs\n \"nHeight\" (numeric) the height at which the support was included in the blockchain\n \"nValidAtHeight\" (numeric) the height at which the support became/becomes valid\n \"nAmount\" (numeric) the amount of the support\n ]\n }\n ],\n \"unmatched supports\": [ (array of object) supports that did not match a claim for this name\n {\n \"txid\" (string) the txid of the support\n \"n\" (numeric) the index of the support in the transaction's list of outputs\n \"nHeight\" (numeric) the height at which the support was included in the blockchain\n \"nValidAtHeight\" (numeric) the height at which the support became/becomes valid\n \"nAmount\" (numeric) the amount of the support\n }\n ]\n}" + "examples": [], + "returns": "{\n \"nLastTakeoverHeight\" (numeric) the last height at which ownership of the name changed\n \"normalized_name\" (string) the name of these claims after normalization\n \"claims\": [ (array of object) claims for this name\n {\n \"claimId\" (string) the claimId of this claim\n \"txid\" (string) the txid of this claim\n \"n\" (numeric) the index of the claim in the transaction's list of outputs\n \"nHeight\" (numeric) the height at which the claim was included in the blockchain\n \"nValidAtHeight\" (numeric) the height at which the claim became/becomes valid\n \"nAmount\" (numeric) the amount of the claim\n \"value\" (string) the value of the name, if it exists\n \"nEffectiveAmount\" (numeric) the total effective amount of the claim, taking into effect whether the claim or support has reached its nValidAtHeight\n \"supports\" : [ (array of object) supports for this claim\n \"txid\" (string) the txid of the support\n \"n\" (numeric) the index of the support in the transaction's list of outputs\n \"nHeight\" (numeric) the height at which the support was included in the blockchain\n \"nValidAtHeight\" (numeric) the height at which the support became/becomes valid\n \"nAmount\" (numeric) the amount of the support\n ]\n \"name\" (string) the original name of this claim before normalization\n }\n ],\n \"supports without claims\": [ (array of object) supports that did not match a claim for this name\n {\n \"txid\" (string) the txid of the support\n \"n\" (numeric) the index of the support in the transaction's list of outputs\n \"nHeight\" (numeric) the height at which the support was included in the blockchain\n \"nValidAtHeight\" (numeric) the height at which the support became/becomes valid\n \"nAmount\" (numeric) the amount of the support\n }\n ]\n}" }, { "name": "getclaimsfortx", @@ -117,7 +143,8 @@ "is_required": true } ], - "returns": "[\n {\n \"nOut\" (numeric) the index of the claim or support in the transaction's list out outputs\n \"claim type\" (string) 'claim' or 'support'\n \"name\" (string) the name claimed or supported\n \"value\" (string) if a name claim, the value of the claim\n \"supported txid\" (string) if a support, the txid of the supported claim\n \"supported nout\" (numeric) if a support, the index of the supported claim in its transaction\n \"depth\" (numeric) the depth of the transaction in the main chain\n \"in claim trie\" (boolean) if a name claim, whether the claim is active, i.e. has made it into the trie\n \"is controlling\" (boolean) if a name claim, whether the claim is the current controlling claim for the name\n \"in support map\" (boolean) if a support, whether the support is active, i.e. has made it into the support map\n \"in queue\" (boolean) whether the claim is in a queue waiting to be inserted into the trie or support map\n \"blocks to valid\" (numeric) if in a queue, the number of blocks until it's inserted into the trie or support map\n }\n]" + "examples": [], + "returns": "[\n {\n \"nOut\" (numeric) the index of the claim or support in the transaction's list out outputs\n \"claim type\" (string) 'claim' or 'support'\n \"name\" (string) the name claimed or supported\n \"claimId\" (string) if a claim, its ID\n \"value\" (string) if a name claim, the value of the claim\n \"supported txid\" (string) if a support, the txid of the supported claim\n \"supported nout\" (numeric) if a support, the index of the supported claim in its transaction\n \"depth\" (numeric) the depth of the transaction in the main chain\n \"in claim trie\" (boolean) if a name claim, whether the claim is active, i.e. has made it into the trie\n \"is controlling\" (boolean) if a name claim, whether the claim is the current controlling claim for the name\n \"in support map\" (boolean) if a support, whether the support is active, i.e. has made it into the support map\n \"in queue\" (boolean) whether the claim is in a queue waiting to be inserted into the trie or support map\n \"blocks to valid\" (numeric) if in a queue, the number of blocks until it's inserted into the trie or support map\n }\n]" }, { "name": "getclaimsintrie", @@ -125,27 +152,29 @@ "description": "Return all claims in the name trie.", "arguments": [ { - "name": "minconf", - "type": "number", - "description": "the number of required confirmations", + "name": "blockhash", + "type": "string", + "description": "get claims in the trie at the block specified by this block hash. If none is given, the latest active block will be used.", "is_required": false } ], - "returns": "[\n {\n \"name\" (string) the name claimed\n \"claims\": [ (array of object) the claims for this name\n {\n \"claimId\" (string) the claimId of the claim\n \"txid\" (string) the txid of the claim\n \"n\" (numeric) the vout value of the claim\n \"amount\" (numeric) txout amount\n \"height\" (numeric) the height of the block in which this transaction is located\n \"value\" (string) the value of this claim\n }\n ]\n }\n]" + "examples": [], + "returns": "[\n {\n \"normalized_name\" (string) the name of these claims (after normalization)\n \"claims\": [ (array of object) the claims for this name\n {\n \"claimId\" (string) the claimId of the claim\n \"txid\" (string) the txid of the claim\n \"n\" (numeric) the vout value of the claim\n \"amount\" (numeric) txout amount\n \"height\" (numeric) the height of the block in which this transaction is located\n \"value\" (string) the value of this claim\n \"name\" (string) the original name of this claim (before normalization)\n }\n ]\n }\n]" }, { "name": "getclaimtrie", "namespace": "Claimtrie", - "description": "Return the entire name trie.", + "description": "DEPRECATED. Return the entire name trie.", "arguments": [ { - "name": "minconf", - "type": "number", - "description": "the number of required confirmations", + "name": "blockhash", + "type": "string", + "description": "get claim in the trie at the block specified by this block hash. If none is given, the latest active block will be used.", "is_required": false } ], - "returns": "{\n \"name\" (string) the name of the node\n \"hash\" (string) the hash of the node\n \"txid\" (string) (if value exists) the hash of the transaction which has successfully claimed this name\n \"n\" (numeric) (if value exists) vout value\n \"value\" (numeric) (if value exists) txout value\n \"height\" (numeric) (if value exists) the height of the block in which this transaction is located\n}" + "examples": [], + "returns": "[\n {\n \"name\" (string) the name of the node\n \"hash\" (string) the hash of the node\n \"txid\" (string) (if value exists) the hash of the transaction which has successfully claimed this name\n \"n\" (numeric) (if value exists) vout value\n \"value\" (numeric) (if value exists) txout value\n \"height\" (numeric) (if value exists) the height of the block in which this transaction is located\n }\n]" }, { "name": "getnameproof", @@ -165,6 +194,7 @@ "is_required": false } ], + "examples": [], "returns": "{\n \"nodes\" : [ (array of object) full nodes (i.e.\n those which lead to\n the requested name)\n \"children\" : [ (array of object) the children of\n this node\n \"child\" : { (object) a child node, either leaf or\n reference to a full node\n \"character\" : \"char\" (string) the character which\n leads from the parent\n to this child node\n \"nodeHash\" : \"hash\" (string, if exists) the hash of\n the node if\n this is a \n leaf node\n }\n ]\n \"valueHash\" (string, if exists) the hash of this\n node's value, if\n it has one. If \n this is the\n requested name\n this will not\n exist whether\n the node has a\n value or not\n ]\n \"txhash\" : \"hash\" (string, if exists) the txid of the\n claim which controls\n this name, if there\n is one.\n \"nOut\" : n, (numeric) the nOut of the claim which\n controls this name, if there\n is one.\n \"last takeover height\" (numeric) the most recent height at\n which the value of a name\n changed other than through\n an update to the winning\n bid\n }\n}" }, { @@ -172,6 +202,7 @@ "namespace": "Claimtrie", "description": "Return the total number of names that have been successfully claimed, and therefore exist in the trie", "arguments": [], + "examples": [], "returns": "\"total names\" (numeric) the total number of\n names in the trie" }, { @@ -179,6 +210,7 @@ "namespace": "Claimtrie", "description": "Return the total number of active claims in the trie", "arguments": [], + "examples": [], "returns": "\"total claims\" (numeric) the total number\n of active claims" }, { @@ -193,12 +225,13 @@ "is_required": true } ], + "examples": [], "returns": "\"total value\" (numeric) the total value of the\n claims in the trie" }, { "name": "getvalueforname", "namespace": "Claimtrie", - "description": "Return the value associated with a name, if one exists", + "description": "Return the winning value associated with a name, if one exists", "arguments": [ { "name": "name", @@ -207,13 +240,14 @@ "is_required": true }, { - "name": "minconf", - "type": "number", - "description": "the number of required confirmations", + "name": "blockhash", + "type": "string", + "description": "get the value associated with the name at the block specified by this block hash. If none is given, the latest active block will be used.", "is_required": false } ], - "returns": "\"value\" (string) the value of the name, if it exists\n\"claimId\" (string) the claimId for this name claim\n\"txid\" (string) the hash of the transaction which successfully claimed the name\n\"n\" (numeric) vout value\n\"amount\" (numeric) txout amount\n\"effective amount\" (numeric) txout amount plus amount from all supports associated with the claim\n\"height\" (numeric) the height of the block in which this transaction is located" + "examples": [], + "returns": "\"value\" (string) the value of the name, if it exists\n\"claimId\" (string) the claimId for this name claim\n\"txid\" (string) the hash of the transaction which successfully claimed the name\n\"n\" (numeric) vout value\n\"amount\" (numeric) txout amount\n\"effective amount\" (numeric) txout amount plus amount from all supports associated with the claim\n\"height\" (numeric) the height of the block in which this transaction is located\n\"name\" (string) the original name of this claim (before normalization)" }, { "name": "listnameclaims", @@ -239,6 +273,7 @@ "is_required": false } ], + "examples": [], "returns": "[\n {\n \"name\":\"claimedname\", (string) The name that is claimed.\n \"claimtype\":\"claimtype\", (string) CLAIM or SUPPORT.\n \"claimId\":\"claimId\", (string) The claimId of the claim.\n \"value\":\"value\" (string) The value assigned to the name, if claimtype is CLAIM.\n \"account\":\"accountname\", (string) The account name associated with the transaction. \n It will be \"\" for the default account.\n \"address\":\"lbrycrdaddress\", (string) The lbrycrd address of the transaction.\n \"category\":\"name\" (string) Always name\n \"amount\": x.xxx, (numeric) The amount in LBC.\n \"vout\": n, (numeric) The vout value\n \"fee\": x.xxx, (numeric) The amount of the fee in LBC.\n \"height\": n (numeric) The height of the block in which this transaction was included.\n \"confirmations\": n, (numeric) The number of confirmations for the transaction\n \"blockhash\": \"hashvalue\", (string) The block hash containing the transaction.\n \"blockindex\": n, (numeric) The block index containing the transaction.\n \"txid\": \"transactionid\", (string) The transaction id.\n \"time\": xxx, (numeric) The transaction time in seconds since epoch (midnight Jan 1 1970 GMT).\n \"timereceived\": xxx, (numeric) The time received in seconds since epoch (midnight Jan 1 1970 GMT).\n \"comment\": \"...\", (string) If a comment is associated with the transaction.\n }\n]" }, { @@ -265,6 +300,7 @@ "is_required": true } ], + "examples": [], "returns": "\"transactionid\" (string) The transaction id of the support." }, { @@ -291,18 +327,25 @@ "is_required": true } ], + "examples": [], "returns": "\"transactionid\" (string) The new transaction id." }, { "name": "getbestblockhash", "namespace": "Blockchain", - "description": "Returns the hash of the best (tip) block in the longest block chain. Result \"hex\" (string) the block hash hex encoded\nExamples:\n> lbrycrd-cli getbestblockhash \n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getbestblockhash\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", - "arguments": [] + "description": "Returns the hash of the best (tip) block in the longest block chain. Result \"hex\" (string) the block hash hex encoded", + "arguments": [], + "examples": [ + { + "cli": "> lbrycrd-cli getbestblockhash", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getbestblockhash\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ] }, { "name": "getblock", "namespace": "Blockchain", - "description": "If verbose is false, returns a string that is serialized, hex-encoded data for block 'hash'. If verbose is true, returns an Object with information about block .\nExamples:\n> lbrycrd-cli getblock \"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getblock\", \"params\": [\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "If verbose is false, returns a string that is serialized, hex-encoded data for block 'hash'. If verbose is true, returns an Object with information about block .", "arguments": [ { "name": "hash", @@ -317,26 +360,44 @@ "is_required": false } ], + "examples": [ + { + "cli": "> lbrycrd-cli getblock \"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getblock\", \"params\": [\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "{\n \"hash\" : \"hash\", (string) the block hash (same as provided)\n \"confirmations\" : n, (numeric) The number of confirmations, or -1 if the block is not on the main chain\n \"size\" : n, (numeric) The block size\n \"height\" : n, (numeric) The block height or index\n \"version\" : n, (numeric) The block version\n \"versionHex\" : \"00000000\", (string) The block version formatted in hexadecimal\n \"merkleroot\" : \"xxxx\", (string) The merkle root\n \"nameclaimroot\" : \"xxxx\", (string) The hash of the root of the name claim trie\n \"tx\" : [ (array of string) The transaction ids\n \"transactionid\" (string) The transaction id\n ,...\n ],\n \"time\" : ttt, (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)\n \"mediantime\" : ttt, (numeric) The median block time in seconds since epoch (Jan 1 1970 GMT)\n \"nonce\" : n, (numeric) The nonce\n \"bits\" : \"1d00ffff\", (string) The bits\n \"difficulty\" : x.xxx, (numeric) The difficulty\n \"chainwork\" : \"xxxx\", (string) Expected number of hashes required to produce the chain up to this block (in hex)\n \"previousblockhash\" : \"hash\", (string) The hash of the previous block\n \"nextblockhash\" : \"hash\" (string) The hash of the next block\n}\n\nResult (for verbose=false):\n\"data\" (string) A string that is serialized, hex-encoded data for block 'hash'." }, { "name": "getblockchaininfo", "namespace": "Blockchain", - "description": "Returns an object containing various state info regarding block chain processing.\nExamples:\n> lbrycrd-cli getblockchaininfo \n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getblockchaininfo\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Returns an object containing various state info regarding block chain processing.", "arguments": [], + "examples": [ + { + "cli": "> lbrycrd-cli getblockchaininfo", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getblockchaininfo\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "{\n \"chain\": \"xxxx\", (string) current network name as defined in BIP70 (main, test, regtest)\n \"blocks\": xxxxxx, (numeric) the current number of blocks processed in the server\n \"headers\": xxxxxx, (numeric) the current number of headers we have validated\n \"bestblockhash\": \"...\", (string) the hash of the currently best block\n \"difficulty\": xxxxxx, (numeric) the current difficulty\n \"mediantime\": xxxxxx, (numeric) median time for the current best block\n \"verificationprogress\": xxxx, (numeric) estimate of verification progress [0..1]\n \"chainwork\": \"xxxx\" (string) total amount of work in active chain, in hexadecimal\n \"pruned\": xx, (boolean) if the blocks are subject to pruning\n \"pruneheight\": xxxxxx, (numeric) heighest block available\n \"softforks\": [ (array) status of softforks in progress\n {\n \"id\": \"xxxx\", (string) name of softfork\n \"version\": xx, (numeric) block version\n \"enforce\": { (object) progress toward enforcing the softfork rules for new-version blocks\n \"status\": xx, (boolean) true if threshold reached\n \"found\": xx, (numeric) number of blocks with the new version found\n \"required\": xx, (numeric) number of blocks required to trigger\n \"window\": xx, (numeric) maximum size of examined window of recent blocks\n },\n \"reject\": { ... } (object) progress toward rejecting pre-softfork blocks (same fields as \"enforce\")\n }, ...\n ],\n \"bip9_softforks\": { (object) status of BIP9 softforks in progress\n \"xxxx\" : { (string) name of the softfork\n \"status\": \"xxxx\", (string) one of \"defined\", \"started\", \"lockedin\", \"active\", \"failed\"\n \"bit\": xx, (numeric) the bit, 0-28, in the block version field used to signal this soft fork\n \"startTime\": xx, (numeric) the minimum median time past of a block at which the bit gains its meaning\n \"timeout\": xx (numeric) the median time past of a block at which the deployment is considered failed if not yet locked in\n }\n }\n}" }, { "name": "getblockcount", "namespace": "Blockchain", - "description": "Returns the number of blocks in the longest block chain.\nExamples:\n> lbrycrd-cli getblockcount \n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getblockcount\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Returns the number of blocks in the longest block chain.", "arguments": [], + "examples": [ + { + "cli": "> lbrycrd-cli getblockcount", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getblockcount\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "n (numeric) The current block count" }, { "name": "getblockhash", "namespace": "Blockchain", - "description": "Returns hash of block in best-block-chain at index provided.\nExamples:\n> lbrycrd-cli getblockhash 1000\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getblockhash\", \"params\": [1000] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Returns hash of block in best-block-chain at index provided.", "arguments": [ { "name": "index", @@ -345,12 +406,18 @@ "is_required": true } ], + "examples": [ + { + "cli": "> lbrycrd-cli getblockhash 1000", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getblockhash\", \"params\": [1000] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "\"hash\" (string) The block hash" }, { "name": "getblockheader", "namespace": "Blockchain", - "description": "If verbose is false, returns a string that is serialized, hex-encoded data for blockheader 'hash'. If verbose is true, returns an Object with information about blockheader .\nExamples:\n> lbrycrd-cli getblockheader \"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getblockheader\", \"params\": [\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "If verbose is false, returns a string that is serialized, hex-encoded data for blockheader 'hash'. If verbose is true, returns an Object with information about blockheader .", "arguments": [ { "name": "hash", @@ -365,33 +432,57 @@ "is_required": false } ], + "examples": [ + { + "cli": "> lbrycrd-cli getblockheader \"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getblockheader\", \"params\": [\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "{\n \"hash\" : \"hash\", (string) the block hash (same as provided)\n \"confirmations\" : n, (numeric) The number of confirmations, or -1 if the block is not on the main chain\n \"height\" : n, (numeric) The block height or index\n \"version\" : n, (numeric) The block version\n \"versionHex\" : \"00000000\", (string) The block version formatted in hexadecimal\n \"merkleroot\" : \"xxxx\", (string) The merkle root\n \"time\" : ttt, (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)\n \"mediantime\" : ttt, (numeric) The median block time in seconds since epoch (Jan 1 1970 GMT)\n \"nonce\" : n, (numeric) The nonce\n \"bits\" : \"1d00ffff\", (string) The bits\n \"difficulty\" : x.xxx, (numeric) The difficulty\n \"previousblockhash\" : \"hash\", (string) The hash of the previous block\n \"nextblockhash\" : \"hash\", (string) The hash of the next block\n \"chainwork\" : \"0000...1f3\" (string) Expected number of hashes required to produce the current chain (in hex)\n}\n\nResult (for verbose=false):\n\"data\" (string) A string that is serialized, hex-encoded data for block 'hash'." }, { "name": "getchaintips", "namespace": "Blockchain", - "description": "Return information about all known tips in the block tree, including the main chain as well as orphaned branches.\nExamples:\n> lbrycrd-cli getchaintips \n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getchaintips\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Return information about all known tips in the block tree, including the main chain as well as orphaned branches.", "arguments": [], + "examples": [ + { + "cli": "> lbrycrd-cli getchaintips", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getchaintips\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "[\n {\n \"height\": xxxx, (numeric) height of the chain tip\n \"hash\": \"xxxx\", (string) block hash of the tip\n \"branchlen\": 0 (numeric) zero for main chain\n \"status\": \"active\" (string) \"active\" for the main chain\n },\n {\n \"height\": xxxx,\n \"hash\": \"xxxx\",\n \"branchlen\": 1 (numeric) length of branch connecting the tip to the main chain\n \"status\": \"xxxx\" (string) status of the chain (active, valid-fork, valid-headers, headers-only, invalid)\n }\n]\nPossible values for status:\n1. \"invalid\" This branch contains at least one invalid block\n2. \"headers-only\" Not all blocks for this branch are available, but the headers are valid\n3. \"valid-headers\" All blocks are available for this branch, but they were never fully validated\n4. \"valid-fork\" This branch is not part of the active chain, but is fully validated\n5. \"active\" This is the tip of the active main chain, which is certainly valid" }, { "name": "getdifficulty", "namespace": "Blockchain", - "description": "Returns the proof-of-work difficulty as a multiple of the minimum difficulty.\nExamples:\n> lbrycrd-cli getdifficulty \n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getdifficulty\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Returns the proof-of-work difficulty as a multiple of the minimum difficulty.", "arguments": [], + "examples": [ + { + "cli": "> lbrycrd-cli getdifficulty", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getdifficulty\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "n.nnn (numeric) the proof-of-work difficulty as a multiple of the minimum difficulty." }, { "name": "getmempoolinfo", "namespace": "Blockchain", - "description": "Returns details on the active state of the TX memory pool.\nExamples:\n> lbrycrd-cli getmempoolinfo \n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getmempoolinfo\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Returns details on the active state of the TX memory pool.", "arguments": [], + "examples": [ + { + "cli": "> lbrycrd-cli getmempoolinfo", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getmempoolinfo\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "{\n \"size\": xxxxx, (numeric) Current tx count\n \"bytes\": xxxxx, (numeric) Sum of all tx sizes\n \"usage\": xxxxx, (numeric) Total memory usage for the mempool\n \"maxmempool\": xxxxx, (numeric) Maximum memory usage for the mempool\n \"mempoolminfee\": xxxxx (numeric) Minimum fee for tx to be accepted\n}" }, { "name": "getrawmempool", "namespace": "Blockchain", - "description": "Returns all transaction ids in memory pool as a json array of string transaction ids.\nExamples:\n> lbrycrd-cli getrawmempool true\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getrawmempool\", \"params\": [true] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Returns all transaction ids in memory pool as a json array of string transaction ids.", "arguments": [ { "name": "verbose", @@ -400,12 +491,18 @@ "is_required": false } ], + "examples": [ + { + "cli": "> lbrycrd-cli getrawmempool true", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getrawmempool\", \"params\": [true] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "[ (json array of string)\n \"transactionid\" (string) The transaction id\n ,...\n]\n\nResult: (for verbose = true):\n{ (json object)\n \"transactionid\" : { (json object)\n \"size\" : n, (numeric) transaction size in bytes\n \"fee\" : n, (numeric) transaction fee in LBC\n \"modifiedfee\" : n, (numeric) transaction fee with fee deltas used for mining priority\n \"time\" : n, (numeric) local time transaction entered pool in seconds since 1 Jan 1970 GMT\n \"height\" : n, (numeric) block height when transaction entered pool\n \"startingpriority\" : n, (numeric) priority when transaction entered pool\n \"currentpriority\" : n, (numeric) transaction priority now\n \"descendantcount\" : n, (numeric) number of in-mempool descendant transactions (including this one)\n \"descendantsize\" : n, (numeric) size of in-mempool descendants (including this one)\n \"descendantfees\" : n, (numeric) modified fees (see above) of in-mempool descendants (including this one)\n \"depends\" : [ (array) unconfirmed transactions used as inputs for this transaction\n \"transactionid\", (string) parent transaction id\n ... ]\n }, ...\n}" }, { "name": "gettxout", "namespace": "Blockchain", - "description": "Returns details about an unspent transaction output.\nExamples:\nGet unspent transactions\n> lbrycrd-cli listunspent \n\nView the details\n> lbrycrd-cli gettxout \"txid\" 1\n\nAs a json rpc call\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"gettxout\", \"params\": [\"txid\", 1] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Returns details about an unspent transaction output.", "arguments": [ { "name": "txid", @@ -426,6 +523,20 @@ "is_required": false } ], + "examples": [ + { + "title": "Get unspent transactions", + "cli": "> lbrycrd-cli listunspent" + }, + { + "title": "View the details", + "cli": "> lbrycrd-cli gettxout \"txid\" 1" + }, + { + "title": "As a json rpc call", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"gettxout\", \"params\": [\"txid\", 1] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "{\n \"bestblock\" : \"hash\", (string) the block hash\n \"confirmations\" : n, (numeric) The number of confirmations\n \"value\" : x.xxx, (numeric) The transaction value in LBC\n \"scriptPubKey\" : { (json object)\n \"asm\" : \"code\", (string) \n \"hex\" : \"hex\", (string) \n \"reqSigs\" : n, (numeric) Number of required signatures\n \"type\" : \"pubkeyhash\", (string) The type, eg pubkeyhash\n \"addresses\" : [ (array of string) array of lbrycrd addresses\n \"lbrycrdaddress\" (string) lbrycrd address\n ,...\n ]\n },\n \"version\" : n, (numeric) The version\n \"coinbase\" : true|false (boolean) Coinbase or not\n}" }, { @@ -446,19 +557,26 @@ "is_required": false } ], + "examples": [], "returns": "\"data\" (string) A string that is a serialized, hex-encoded data for the proof." }, { "name": "gettxoutsetinfo", "namespace": "Blockchain", - "description": "Returns statistics about the unspent transaction output set. Note this call may take some time.\nExamples:\n> lbrycrd-cli gettxoutsetinfo \n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"gettxoutsetinfo\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Returns statistics about the unspent transaction output set. Note this call may take some time.", "arguments": [], + "examples": [ + { + "cli": "> lbrycrd-cli gettxoutsetinfo", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"gettxoutsetinfo\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "{\n \"height\":n, (numeric) The current block height (index)\n \"bestblock\": \"hex\", (string) the best block hash hex\n \"transactions\": n, (numeric) The number of transactions\n \"txouts\": n, (numeric) The number of output transactions\n \"bytes_serialized\": n, (numeric) The serialized size\n \"hash_serialized\": \"hash\", (string) The serialized hash\n \"total_amount\": x.xxx (numeric) The total amount\n}" }, { "name": "verifychain", "namespace": "Blockchain", - "description": "Verifies blockchain database.\nExamples:\n> lbrycrd-cli verifychain \n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"verifychain\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Verifies blockchain database.", "arguments": [ { "name": "checklevel", @@ -473,6 +591,12 @@ "is_required": false } ], + "examples": [ + { + "cli": "> lbrycrd-cli verifychain", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"verifychain\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "true|false (boolean) Verified or not" }, { @@ -487,13 +611,20 @@ "is_required": true } ], + "examples": [], "returns": "[\"txid\"] (array, strings) The txid(s) which the proof commits to, or empty array if the proof is invalid" }, { "name": "getinfo", "namespace": "Control", - "description": "Returns an object containing various state info.\nExamples:\n> lbrycrd-cli getinfo \n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getinfo\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Returns an object containing various state info.", "arguments": [], + "examples": [ + { + "cli": "> lbrycrd-cli getinfo", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getinfo\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "{\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 lbrycrd 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 \"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 \"paytxfee\": x.xxxx, (numeric) the transaction fee set in LBC/kB\n \"relayfee\": x.xxxx, (numeric) minimum relay fee for non-free transactions in LBC/kB\n \"errors\": \"...\" (string) any error messages\n}" }, { @@ -508,18 +639,20 @@ "is_required": false } ], + "examples": [], "returns": "\"text\" (string) The help text" }, { "name": "stop", "namespace": "Control", "description": "Stop LBRYcrd server.", - "arguments": [] + "arguments": [], + "examples": [] }, { "name": "generate", "namespace": "Generating", - "description": "Mine up to numblocks blocks immediately (before the RPC call returns)\nExamples:\nGenerate 11 blocks\n> lbrycrd-cli generate 11", + "description": "Mine up to numblocks blocks immediately (before the RPC call returns)", "arguments": [ { "name": "numblocks", @@ -533,12 +666,18 @@ "description": "How many iterations to try (default = 1000000). Result [ blockhashes ] (array) hashes of blocks generated", "is_required": false } + ], + "examples": [ + { + "title": "Generate 11 blocks", + "cli": "> lbrycrd-cli generate 11" + } ] }, { "name": "generatetoaddress", "namespace": "Generating", - "description": "Mine blocks immediately to a specified address (before the RPC call returns)\nExamples:\nGenerate 11 blocks to myaddress\n> lbrycrd-cli generatetoaddress 11 \"myaddress\"", + "description": "Mine blocks immediately to a specified address (before the RPC call returns)", "arguments": [ { "name": "numblocks", @@ -558,12 +697,18 @@ "description": "How many iterations to try (default = 1000000). Result [ blockhashes ] (array) hashes of blocks generated", "is_required": false } + ], + "examples": [ + { + "title": "Generate 11 blocks to myaddress", + "cli": "> lbrycrd-cli generatetoaddress 11 \"myaddress\"" + } ] }, { "name": "getblocktemplate", "namespace": "Mining", - "description": "If the request parameters include a 'mode' key, that is used to explicitly select between the default 'template' request or a 'proposal'. It returns data needed to construct a block to work on. See https://en.bitcoin.it/wiki/BIP_0022 for full specification.\nExamples:\n> lbrycrd-cli getblocktemplate \n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getblocktemplate\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "If the request parameters include a 'mode' key, that is used to explicitly select between the default 'template' request or a 'proposal'. It returns data needed to construct a block to work on. See https://en.bitcoin.it/wiki/BIP_0022 for full specification.", "arguments": [ { "name": "jsonrequestobject", @@ -572,32 +717,56 @@ "is_required": false } ], + "examples": [ + { + "cli": "> lbrycrd-cli getblocktemplate", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getblocktemplate\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "{\n \"version\" : n, (numeric) The block version\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 \"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}" }, { "name": "getgenerate", "namespace": "Mining", - "description": "Return if the server is set to generate coins or not. The default is false. It is set with the command line argument -gen (or lbrycrd.conf setting gen) It can also be set with the setgenerate call. Result true|false (boolean) If the server is set to generate coins or not\nExamples:\n> lbrycrd-cli getgenerate \n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getgenerate\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", - "arguments": [] + "description": "Return if the server is set to generate coins or not. The default is false. It is set with the command line argument -gen (or lbrycrd.conf setting gen) It can also be set with the setgenerate call. Result true|false (boolean) If the server is set to generate coins or not", + "arguments": [], + "examples": [ + { + "cli": "> lbrycrd-cli getgenerate", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getgenerate\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ] }, { "name": "gethashespersec", "namespace": "Mining", - "description": "Returns a recent hashes per second performance measurement while generating. See the getgenerate and setgenerate calls to turn generation on and off.\nExamples:\n> lbrycrd-cli gethashespersec \n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"gethashespersec\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Returns a recent hashes per second performance measurement while generating. See the getgenerate and setgenerate calls to turn generation on and off.", "arguments": [], + "examples": [ + { + "cli": "> lbrycrd-cli gethashespersec", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"gethashespersec\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "n (numeric) The recent hashes per second when generation is on (will return 0 if generation is off)" }, { "name": "getmininginfo", "namespace": "Mining", - "description": "Returns a json object containing mining-related information.\nExamples:\n> lbrycrd-cli getmininginfo \n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getmininginfo\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Returns a json object containing mining-related information.", "arguments": [], + "examples": [ + { + "cli": "> lbrycrd-cli getmininginfo", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getmininginfo\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "{\n \"blocks\": nnn, (numeric) The current block\n \"currentblocksize\": nnn, (numeric) The last block size\n \"currentblocktx\": nnn, (numeric) The last block transaction\n \"difficulty\": xxx.xxxxx (numeric) The current difficulty\n \"errors\": \"...\" (string) Current errors\n \"generate\": true|false (boolean) If the generation is on or off (see getgenerate or setgenerate calls)\n \"genproclimit\": n (numeric) The processor limit for generation. -1 if no generation. (see getgenerate or setgenerate calls)\n \"hashespersec\": n (numeric) The hashes per second of the generation, or 0 if no generation.\n \"pooledtx\": n (numeric) The size of the mem pool\n \"testnet\": true|false (boolean) If using testnet or not\n \"chain\": \"xxxx\", (string) current network name as defined in BIP70 (main, test, regtest)\n}" }, { "name": "getnetworkhashps", "namespace": "Mining", - "description": "Returns the estimated network hashes per second based on the last n blocks. Pass in [blocks] to override # of blocks, -1 specifies since last difficulty change. Pass in [height] to estimate the network speed at the time when a certain block was found.\nExamples:\n> lbrycrd-cli getnetworkhashps \n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getnetworkhashps\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Returns the estimated network hashes per second based on the last n blocks. Pass in [blocks] to override # of blocks, -1 specifies since last difficulty change. Pass in [height] to estimate the network speed at the time when a certain block was found.", "arguments": [ { "name": "blocks", @@ -612,12 +781,18 @@ "is_required": false } ], + "examples": [ + { + "cli": "> lbrycrd-cli getnetworkhashps", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getnetworkhashps\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "x (numeric) Hashes per second estimated" }, { "name": "prioritisetransaction", "namespace": "Mining", - "description": "Accepts the transaction into mined blocks at a higher (or lower) priority\nExamples:\n> lbrycrd-cli prioritisetransaction \"txid\" 0.0 10000\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"prioritisetransaction\", \"params\": [\"txid\", 0.0, 10000] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Accepts the transaction into mined blocks at a higher (or lower) priority", "arguments": [ { "name": "txid", @@ -637,12 +812,18 @@ "description": "The fee value (in satoshis) to add (or subtract, if negative). The fee is not actually paid, only the algorithm for selecting transactions into a block considers the transaction as it would have paid a higher (or lower) fee. Result true (boolean) Returns true", "is_required": true } + ], + "examples": [ + { + "cli": "> lbrycrd-cli prioritisetransaction \"txid\" 0.0 10000", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"prioritisetransaction\", \"params\": [\"txid\", 0.0, 10000] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } ] }, { "name": "setgenerate", "namespace": "Mining", - "description": "Set 'generate' true or false to turn generation on or off. Generation is limited to 'genproclimit' processors, -1 is unlimited. See the getgenerate call for the current setting.\nExamples:\nSet the generation on with a limit of one processor\n> lbrycrd-cli setgenerate true 1\n\nCheck the setting\n> lbrycrd-cli getgenerate \n\nTurn off generation\n> lbrycrd-cli setgenerate false\n\nUsing json rpc\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"setgenerate\", \"params\": [true, 1] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Set 'generate' true or false to turn generation on or off. Generation is limited to 'genproclimit' processors, -1 is unlimited. See the getgenerate call for the current setting.", "arguments": [ { "name": "generate", @@ -656,12 +837,30 @@ "description": "Set the processor limit for when generation is on. Can be -1 for unlimited.", "is_required": false } + ], + "examples": [ + { + "title": "Set the generation on with a limit of one processor", + "cli": "> lbrycrd-cli setgenerate true 1" + }, + { + "title": "Check the setting", + "cli": "> lbrycrd-cli getgenerate" + }, + { + "title": "Turn off generation", + "cli": "> lbrycrd-cli setgenerate false" + }, + { + "title": "Using json rpc", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"setgenerate\", \"params\": [true, 1] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } ] }, { "name": "submitblock", "namespace": "Mining", - "description": "Attempts to submit new block to network. The 'jsonparametersobject' parameter is currently ignored. See https://en.bitcoin.it/wiki/BIP_0022 for full specification.\nExamples:\n> lbrycrd-cli submitblock \"mydata\"\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"submitblock\", \"params\": [\"mydata\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Attempts to submit new block to network. The 'jsonparametersobject' parameter is currently ignored. See https://en.bitcoin.it/wiki/BIP_0022 for full specification.", "arguments": [ { "name": "hexdata", @@ -676,12 +875,18 @@ "is_required": false } ], + "examples": [ + { + "cli": "> lbrycrd-cli submitblock \"mydata\"", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"submitblock\", \"params\": [\"mydata\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "" }, { "name": "addnode", "namespace": "Network", - "description": "Attempts add or remove a node from the addnode list. Or try a connection to a node once.\nExamples:\n> lbrycrd-cli addnode \"192.168.0.6:8333\" \"onetry\"\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"addnode\", \"params\": [\"192.168.0.6:8333\", \"onetry\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Attempts add or remove a node from the addnode list. Or try a connection to a node once.", "arguments": [ { "name": "node", @@ -695,18 +900,30 @@ "description": "'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", "is_required": true } + ], + "examples": [ + { + "cli": "> lbrycrd-cli addnode \"192.168.0.6:8333\" \"onetry\"", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"addnode\", \"params\": [\"192.168.0.6:8333\", \"onetry\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } ] }, { "name": "clearbanned", "namespace": "Network", - "description": "Clear all banned IPs.\nExamples:\n> lbrycrd-cli clearbanned \n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"clearbanned\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", - "arguments": [] + "description": "Clear all banned IPs.", + "arguments": [], + "examples": [ + { + "cli": "> lbrycrd-cli clearbanned", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"clearbanned\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ] }, { "name": "disconnectnode", "namespace": "Network", - "description": "Immediately disconnects from the specified node.\nExamples:\n> lbrycrd-cli disconnectnode \"192.168.0.6:8333\"\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"disconnectnode\", \"params\": [\"192.168.0.6:8333\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Immediately disconnects from the specified node.", "arguments": [ { "name": "node", @@ -714,12 +931,18 @@ "description": "The node (see getpeerinfo for nodes)", "is_required": true } + ], + "examples": [ + { + "cli": "> lbrycrd-cli disconnectnode \"192.168.0.6:8333\"", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"disconnectnode\", \"params\": [\"192.168.0.6:8333\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } ] }, { "name": "getaddednodeinfo", "namespace": "Network", - "description": "Returns information about the given added node, or all added nodes (note that onetry addnodes are not listed here) If dns is false, only a list of added nodes will be provided, otherwise connected information will also be available.\nExamples:\n> lbrycrd-cli getaddednodeinfo true\n> lbrycrd-cli getaddednodeinfo true \"192.168.0.201\"\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getaddednodeinfo\", \"params\": [true, \"192.168.0.201\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Returns information about the given added node, or all added nodes (note that onetry addnodes are not listed here) If dns is false, only a list of added nodes will be provided, otherwise connected information will also be available.", "arguments": [ { "name": "dns", @@ -734,52 +957,94 @@ "is_required": false } ], + "examples": [ + { + "cli": "> lbrycrd-cli getaddednodeinfo true \"192.168.0.201\"", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getaddednodeinfo\", \"params\": [true, \"192.168.0.201\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "[\n {\n \"addednode\" : \"192.168.0.201\", (string) The node ip address\n \"connected\" : true|false, (boolean) If connected\n \"addresses\" : [\n {\n \"address\" : \"192.168.0.201:8333\", (string) The lbrycrd server host and port\n \"connected\" : \"outbound\" (string) connection, inbound or outbound\n }\n ,...\n ]\n }\n ,...\n]" }, { "name": "getconnectioncount", "namespace": "Network", - "description": "Returns the number of connections to other nodes.\nExamples:\n> lbrycrd-cli getconnectioncount \n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getconnectioncount\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Returns the number of connections to other nodes.", "arguments": [], + "examples": [ + { + "cli": "> lbrycrd-cli getconnectioncount", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getconnectioncount\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "n (numeric) The connection count" }, { "name": "getnettotals", "namespace": "Network", - "description": "Returns information about network traffic, including bytes in, bytes out, and current time.\nExamples:\n> lbrycrd-cli getnettotals \n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getnettotals\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Returns information about network traffic, including bytes in, bytes out, and current time.", "arguments": [], + "examples": [ + { + "cli": "> lbrycrd-cli getnettotals", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getnettotals\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "{\n \"totalbytesrecv\": n, (numeric) Total bytes received\n \"totalbytessent\": n, (numeric) Total bytes sent\n \"timemillis\": t, (numeric) Total cpu time\n \"uploadtarget\":\n {\n \"timeframe\": n, (numeric) Length of the measuring timeframe in seconds\n \"target\": n, (numeric) Target in bytes\n \"target_reached\": true|false, (boolean) True if target is reached\n \"serve_historical_blocks\": true|false, (boolean) True if serving historical blocks\n \"bytes_left_in_cycle\": t, (numeric) Bytes left in current time cycle\n \"time_left_in_cycle\": t (numeric) Seconds left in current time cycle\n }\n}" }, { "name": "getnetworkinfo", "namespace": "Network", - "description": "Returns an object containing various state info regarding P2P networking.\nExamples:\n> lbrycrd-cli getnetworkinfo \n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getnetworkinfo\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Returns an object containing various state info regarding P2P networking.", "arguments": [], + "examples": [ + { + "cli": "> lbrycrd-cli getnetworkinfo", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getnetworkinfo\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "{\n \"version\": xxxxx, (numeric) the server version\n \"subversion\": \"/Satoshi:x.x.x/\", (string) the server subversion string\n \"protocolversion\": xxxxx, (numeric) the protocol version\n \"localservices\": \"xxxxxxxxxxxxxxxx\", (string) the services we offer to the network\n \"timeoffset\": xxxxx, (numeric) the time offset\n \"connections\": xxxxx, (numeric) the number of connections\n \"networks\": [ (array) information per network\n {\n \"name\": \"xxx\", (string) network (ipv4, ipv6 or onion)\n \"limited\": true|false, (boolean) is the network limited using -onlynet?\n \"reachable\": true|false, (boolean) is the network reachable?\n \"proxy\": \"host:port\" (string) the proxy that is used for this network, or empty if none\n }\n ,...\n ],\n \"relayfee\": x.xxxxxxxx, (numeric) minimum relay fee for non-free transactions in LBC/kB\n \"localaddresses\": [ (array) list of local addresses\n {\n \"address\": \"xxxx\", (string) network address\n \"port\": xxx, (numeric) network port\n \"score\": xxx (numeric) relative score\n }\n ,...\n ]\n \"warnings\": \"...\" (string) any network warnings (such as alert messages) \n}" }, { "name": "getpeerinfo", "namespace": "Network", - "description": "Returns data about each connected network node as a json array of objects.\nExamples:\n> lbrycrd-cli getpeerinfo \n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getpeerinfo\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Returns data about each connected network node as a json array of objects.", "arguments": [], + "examples": [ + { + "cli": "> lbrycrd-cli getpeerinfo", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getpeerinfo\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "[\n {\n \"id\": n, (numeric) Peer index\n \"addr\":\"host:port\", (string) The ip address and port of the peer\n \"addrlocal\":\"ip:port\", (string) local address\n \"services\":\"xxxxxxxxxxxxxxxx\", (string) The services offered\n \"relaytxes\":true|false, (boolean) Whether peer has asked us to relay transactions to it\n \"lastsend\": ttt, (numeric) The time in seconds since epoch (Jan 1 1970 GMT) of the last send\n \"lastrecv\": ttt, (numeric) The time in seconds since epoch (Jan 1 1970 GMT) of the last receive\n \"bytessent\": n, (numeric) The total bytes sent\n \"bytesrecv\": n, (numeric) The total bytes received\n \"conntime\": ttt, (numeric) The connection time in seconds since epoch (Jan 1 1970 GMT)\n \"timeoffset\": ttt, (numeric) The time offset in seconds\n \"pingtime\": n, (numeric) ping time (if available)\n \"minping\": n, (numeric) minimum observed ping time (if any at all)\n \"pingwait\": n, (numeric) ping wait (if non-zero)\n \"version\": v, (numeric) The peer version, such as 7001\n \"subver\": \"/Satoshi:0.8.5/\", (string) The string version\n \"inbound\": true|false, (boolean) Inbound (true) or Outbound (false)\n \"startingheight\": n, (numeric) The starting height (block) of the peer\n \"banscore\": n, (numeric) The ban score\n \"synced_headers\": n, (numeric) The last header we have in common with this peer\n \"synced_blocks\": n, (numeric) The last block we have in common with this peer\n \"inflight\": [\n n, (numeric) The heights of blocks we're currently asking from this peer\n ...\n ]\n \"bytessent_per_msg\": {\n \"addr\": n, (numeric) The total bytes sent aggregated by message type\n ...\n }\n \"bytesrecv_per_msg\": {\n \"addr\": n, (numeric) The total bytes received aggregated by message type\n ...\n }\n }\n ,...\n]" }, { "name": "listbanned", "namespace": "Network", - "description": "List all banned IPs/Subnets.\nExamples:\n> lbrycrd-cli listbanned \n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"listbanned\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", - "arguments": [] + "description": "List all banned IPs/Subnets.", + "arguments": [], + "examples": [ + { + "cli": "> lbrycrd-cli listbanned", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"listbanned\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ] }, { "name": "ping", "namespace": "Network", - "description": "Requests that a ping be sent to all other nodes, to measure ping time. Results provided in getpeerinfo, pingtime and pingwait fields are decimal seconds. Ping command is handled in queue with all other commands, so it measures processing backlog, not just network ping.\nExamples:\n> lbrycrd-cli ping \n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"ping\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", - "arguments": [] + "description": "Requests that a ping be sent to all other nodes, to measure ping time. Results provided in getpeerinfo, pingtime and pingwait fields are decimal seconds. Ping command is handled in queue with all other commands, so it measures processing backlog, not just network ping.", + "arguments": [], + "examples": [ + { + "cli": "> lbrycrd-cli ping", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"ping\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ] }, { "name": "setban", "namespace": "Network", - "description": "Attempts add or remove a IP/Subnet from the banned list.\nExamples:\n> lbrycrd-cli setban \"192.168.0.6\" \"add\" 86400\n> lbrycrd-cli setban \"192.168.0.0/24\" \"add\"\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"setban\", \"params\": [\"192.168.0.6\", \"add\" 86400] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Attempts add or remove a IP/Subnet from the banned list.", "arguments": [ { "name": "ip(/netmask)", @@ -805,12 +1070,18 @@ "description": "If set, the bantime must be a absolute timestamp in seconds since epoch (Jan 1 1970 GMT)", "is_required": false } + ], + "examples": [ + { + "cli": "> lbrycrd-cli setban \"192.168.0.0/24\" \"add\"", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"setban\", \"params\": [\"192.168.0.6\", \"add\" 86400] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } ] }, { "name": "createrawtransaction", "namespace": "Rawtransactions", - "description": "Create a transaction spending the given inputs and creating new outputs. Outputs can be addresses or data. Returns hex-encoded raw transaction. Note that the transaction's inputs are not signed, and it is not stored in the wallet or transmitted to the network.\nExamples:\n> lbrycrd-cli createrawtransaction \"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"{\\\"address\\\":0.01}\"\n> lbrycrd-cli createrawtransaction \"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"{\\\"data\\\":\\\"00010203\\\"}\"\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"createrawtransaction\", \"params\": [\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"{\\\"address\\\":0.01}\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"createrawtransaction\", \"params\": [\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"{\\\"data\\\":\\\"00010203\\\"}\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Create a transaction spending the given inputs and creating new outputs. Outputs can be addresses or data. Returns hex-encoded raw transaction. Note that the transaction's inputs are not signed, and it is not stored in the wallet or transmitted to the network.", "arguments": [ { "name": "transactions", @@ -831,12 +1102,18 @@ "is_required": false } ], + "examples": [ + { + "cli": "> lbrycrd-cli createrawtransaction \"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"{\\\"data\\\":\\\"00010203\\\"}\"", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"createrawtransaction\", \"params\": [\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"{\\\"data\\\":\\\"00010203\\\"}\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "\"transaction\" (string) hex string of the transaction" }, { "name": "decoderawtransaction", "namespace": "Rawtransactions", - "description": "Return a JSON object representing the serialized, hex-encoded transaction.\nExamples:\n> lbrycrd-cli decoderawtransaction \"hexstring\"\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"decoderawtransaction\", \"params\": [\"hexstring\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Return a JSON object representing the serialized, hex-encoded transaction.", "arguments": [ { "name": "hex", @@ -845,12 +1122,18 @@ "is_required": true } ], + "examples": [ + { + "cli": "> lbrycrd-cli decoderawtransaction \"hexstring\"", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"decoderawtransaction\", \"params\": [\"hexstring\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "{\n \"txid\" : \"id\", (string) The transaction id\n \"size\" : n, (numeric) The transaction size\n \"version\" : n, (numeric) The version\n \"locktime\" : ttt, (numeric) The lock time\n \"vin\" : [ (array of json objects)\n {\n \"txid\": \"id\", (string) The transaction id\n \"vout\": n, (numeric) The output number\n \"scriptSig\": { (json object) The script\n \"asm\": \"asm\", (string) asm\n \"hex\": \"hex\" (string) hex\n },\n \"sequence\": n (numeric) The script sequence number\n }\n ,...\n ],\n \"vout\" : [ (array of json objects)\n {\n \"value\" : x.xxx, (numeric) The value in LBC\n \"n\" : n, (numeric) index\n \"scriptPubKey\" : { (json object)\n \"asm\" : \"asm\", (string) the asm\n \"hex\" : \"hex\", (string) the hex\n \"reqSigs\" : n, (numeric) The required sigs\n \"type\" : \"pubkeyhash\", (string) The type, eg 'pubkeyhash'\n \"addresses\" : [ (json array of string)\n \"12tvKAXCxZjSmdNbao16dKXC8tRWfcF5oc\" (string) lbrycrd address\n ,...\n ]\n }\n }\n ,...\n ],\n}" }, { "name": "decodescript", "namespace": "Rawtransactions", - "description": "Decode a hex-encoded script.\nExamples:\n> lbrycrd-cli decodescript \"hexstring\"\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"decodescript\", \"params\": [\"hexstring\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Decode a hex-encoded script.", "arguments": [ { "name": "hex", @@ -859,12 +1142,18 @@ "is_required": true } ], + "examples": [ + { + "cli": "> lbrycrd-cli decodescript \"hexstring\"", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"decodescript\", \"params\": [\"hexstring\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "{\n \"asm\":\"asm\", (string) Script public key\n \"hex\":\"hex\", (string) hex encoded public key\n \"type\":\"type\", (string) The output type\n \"reqSigs\": n, (numeric) The required signatures\n \"addresses\": [ (json array of string)\n \"address\" (string) lbrycrd address\n ,...\n ],\n \"p2sh\",\"address\" (string) script address\n}" }, { "name": "fundrawtransaction", "namespace": "Rawtransactions", - "description": "Add inputs to a transaction until it has enough in value to meet its out value. This will not modify existing inputs, and will add one change output to the outputs. Note that inputs which were signed may need to be resigned after completion since in/outputs have been added. The inputs added will not be signed, use signrawtransaction for that. Note that all existing inputs must have their previous output transaction be in the wallet. Note that all inputs selected must be of standard form and P2SH scripts must be in the wallet using importaddress or addmultisigaddress (to calculate fees). Only pay-to-pubkey, multisig, and P2SH versions thereof are currently supported for watch-only\nExamples:\nCreate a transaction with no inputs\n> lbrycrd-cli createrawtransaction \"[]\" \"{\\\"myaddress\\\":0.01}\"\n\nAdd sufficient unsigned inputs to meet the output value\n> lbrycrd-cli fundrawtransaction \"rawtransactionhex\"\n\nSign the transaction\n> lbrycrd-cli signrawtransaction \"fundedtransactionhex\"\n\nSend the transaction\n> lbrycrd-cli sendrawtransaction \"signedtransactionhex\"", + "description": "Add inputs to a transaction until it has enough in value to meet its out value. This will not modify existing inputs, and will add one change output to the outputs. Note that inputs which were signed may need to be resigned after completion since in/outputs have been added. The inputs added will not be signed, use signrawtransaction for that. Note that all existing inputs must have their previous output transaction be in the wallet. Note that all inputs selected must be of standard form and P2SH scripts must be in the wallet using importaddress or addmultisigaddress (to calculate fees). Only pay-to-pubkey, multisig, and P2SH versions thereof are currently supported for watch-only", "arguments": [ { "name": "hexstring", @@ -879,12 +1168,30 @@ "is_required": false } ], + "examples": [ + { + "title": "Create a transaction with no inputs", + "cli": "> lbrycrd-cli createrawtransaction \"[]\" \"{\\\"myaddress\\\":0.01}\"" + }, + { + "title": "Add sufficient unsigned inputs to meet the output value", + "cli": "> lbrycrd-cli fundrawtransaction \"rawtransactionhex\"" + }, + { + "title": "Sign the transaction", + "cli": "> lbrycrd-cli signrawtransaction \"fundedtransactionhex\"" + }, + { + "title": "Send the transaction", + "cli": "> lbrycrd-cli sendrawtransaction \"signedtransactionhex\"" + } + ], "returns": "{\n \"hex\": \"value\", (string) The resulting raw transaction (hex-encoded string)\n \"fee\": n, (numeric) Fee the resulting transaction pays\n \"changepos\": n (numeric) The position of the added change output, or -1\n}\n\"hex\"" }, { "name": "getrawtransaction", "namespace": "Rawtransactions", - "description": "NOTE: By default this function only works sometimes. This is when the tx is in the mempool or there is an unspent output in the utxo for this transaction. To make it always work, you need to maintain a transaction index, using the -txindex command line option. Return the raw transaction data. If verbose=0, returns a string that is serialized, hex-encoded data for 'txid'. If verbose is non-zero, returns an Object with information about 'txid'.\nExamples:\n> lbrycrd-cli getrawtransaction \"mytxid\"\n> lbrycrd-cli getrawtransaction \"mytxid\" 1\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getrawtransaction\", \"params\": [\"mytxid\", 1] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "NOTE: By default this function only works sometimes. This is when the tx is in the mempool or there is an unspent output in the utxo for this transaction. To make it always work, you need to maintain a transaction index, using the -txindex command line option. Return the raw transaction data. If verbose=0, returns a string that is serialized, hex-encoded data for 'txid'. If verbose is non-zero, returns an Object with information about 'txid'.", "arguments": [ { "name": "txid", @@ -899,12 +1206,18 @@ "is_required": false } ], + "examples": [ + { + "cli": "> lbrycrd-cli getrawtransaction \"mytxid\" 1", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getrawtransaction\", \"params\": [\"mytxid\", 1] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "\"data\" (string) The serialized, hex-encoded data for 'txid'\n\nResult (if verbose > 0):\n{\n \"hex\" : \"data\", (string) The serialized, hex-encoded data for 'txid'\n \"txid\" : \"id\", (string) The transaction id (same as provided)\n \"size\" : n, (numeric) The transaction size\n \"version\" : n, (numeric) The version\n \"locktime\" : ttt, (numeric) The lock time\n \"vin\" : [ (array of json objects)\n {\n \"txid\": \"id\", (string) The transaction id\n \"vout\": n, (numeric) \n \"scriptSig\": { (json object) The script\n \"asm\": \"asm\", (string) asm\n \"hex\": \"hex\" (string) hex\n },\n \"sequence\": n (numeric) The script sequence number\n }\n ,...\n ],\n \"vout\" : [ (array of json objects)\n {\n \"value\" : x.xxx, (numeric) The value in LBC\n \"n\" : n, (numeric) index\n \"scriptPubKey\" : { (json object)\n \"asm\" : \"asm\", (string) the asm\n \"hex\" : \"hex\", (string) the hex\n \"reqSigs\" : n, (numeric) The required sigs\n \"type\" : \"pubkeyhash\", (string) The type, eg 'pubkeyhash'\n \"addresses\" : [ (json array of string)\n \"lbrycrdaddress\" (string) lbrycrd address\n ,...\n ]\n }\n }\n ,...\n ],\n \"blockhash\" : \"hash\", (string) the block hash\n \"confirmations\" : n, (numeric) The confirmations\n \"time\" : ttt, (numeric) The transaction time in seconds since epoch (Jan 1 1970 GMT)\n \"blocktime\" : ttt (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)\n}" }, { "name": "sendrawtransaction", "namespace": "Rawtransactions", - "description": "Submits raw transaction (serialized, hex-encoded) to local node and network. Also see createrawtransaction and signrawtransaction calls.\nExamples:\nCreate a transaction\n> lbrycrd-cli createrawtransaction \"[{\\\"txid\\\" : \\\"mytxid\\\",\\\"vout\\\":0}]\" \"{\\\"myaddress\\\":0.01}\"\nSign the transaction, and get back the hex\n> lbrycrd-cli signrawtransaction \"myhex\"\n\nSend the transaction (signed hex)\n> lbrycrd-cli sendrawtransaction \"signedhex\"\n\nAs a json rpc call\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"sendrawtransaction\", \"params\": [\"signedhex\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Submits raw transaction (serialized, hex-encoded) to local node and network. Also see createrawtransaction and signrawtransaction calls.", "arguments": [ { "name": "hexstring", @@ -919,12 +1232,30 @@ "is_required": false } ], + "examples": [ + { + "title": "Create a transaction", + "cli": "> lbrycrd-cli createrawtransaction \"[{\\\"txid\\\" : \\\"mytxid\\\",\\\"vout\\\":0}]\" \"{\\\"myaddress\\\":0.01}\"" + }, + { + "title": "Sign the transaction, and get back the hex", + "cli": "> lbrycrd-cli signrawtransaction \"myhex\"" + }, + { + "title": "Send the transaction (signed hex)", + "cli": "> lbrycrd-cli sendrawtransaction \"signedhex\"" + }, + { + "title": "As a json rpc call", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"sendrawtransaction\", \"params\": [\"signedhex\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "\"hex\" (string) The transaction hash in hex" }, { "name": "signrawtransaction", "namespace": "Rawtransactions", - "description": "Sign inputs for raw transaction (serialized, hex-encoded). The second optional argument (may be null) is an array of previous transaction outputs that this transaction depends on but may not yet be in the block chain. The third optional argument (may be null) is an array of base58-encoded private keys that, if given, will be the only keys used to sign the transaction.\nExamples:\n> lbrycrd-cli signrawtransaction \"myhex\"\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"signrawtransaction\", \"params\": [\"myhex\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Sign inputs for raw transaction (serialized, hex-encoded). The second optional argument (may be null) is an array of previous transaction outputs that this transaction depends on but may not yet be in the block chain. The third optional argument (may be null) is an array of base58-encoded private keys that, if given, will be the only keys used to sign the transaction.", "arguments": [ { "name": "hexstring", @@ -951,12 +1282,18 @@ "is_required": false } ], + "examples": [ + { + "cli": "> lbrycrd-cli signrawtransaction \"myhex\"", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"signrawtransaction\", \"params\": [\"myhex\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "{\n \"hex\" : \"value\", (string) The hex-encoded raw transaction with signature(s)\n \"complete\" : true|false, (boolean) If the transaction has a complete set of signatures\n \"errors\" : [ (json array of objects) Script verification errors (if there are any)\n {\n \"txid\" : \"hash\", (string) The hash of the referenced, previous transaction\n \"vout\" : n, (numeric) The index of the output to spent and used as input\n \"scriptSig\" : \"hex\", (string) The hex-encoded signature script\n \"sequence\" : n, (numeric) Script sequence number\n \"error\" : \"text\" (string) Verification or signing error related to the input\n }\n ,...\n ]\n}" }, { "name": "createmultisig", "namespace": "Util", - "description": "Creates a multi-signature address with n signature of m keys required. It returns a json object with the address and redeemScript.\nExamples:\nCreate a multisig address from 2 addresses\n> lbrycrd-cli createmultisig 2 \"[\\\"16sSauSf5pF2UkUwvKGq4qjNRzBZYqgEL5\\\",\\\"171sgjn4YtPu27adkKGrdDwzRTxnRkBfKV\\\"]\"\n\nAs a json rpc call\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"createmultisig\", \"params\": [2, \"[\\\"16sSauSf5pF2UkUwvKGq4qjNRzBZYqgEL5\\\",\\\"171sgjn4YtPu27adkKGrdDwzRTxnRkBfKV\\\"]\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Creates a multi-signature address with n signature of m keys required. It returns a json object with the address and redeemScript.", "arguments": [ { "name": "nrequired", @@ -971,12 +1308,22 @@ "is_required": true } ], + "examples": [ + { + "title": "Create a multisig address from 2 addresses", + "cli": "> lbrycrd-cli createmultisig 2 \"[\\\"16sSauSf5pF2UkUwvKGq4qjNRzBZYqgEL5\\\",\\\"171sgjn4YtPu27adkKGrdDwzRTxnRkBfKV\\\"]\"" + }, + { + "title": "As a json rpc call", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"createmultisig\", \"params\": [2, \"[\\\"16sSauSf5pF2UkUwvKGq4qjNRzBZYqgEL5\\\",\\\"171sgjn4YtPu27adkKGrdDwzRTxnRkBfKV\\\"]\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "{\n \"address\":\"multisigaddress\", (string) The value of the new multisig address.\n \"redeemScript\":\"script\" (string) The string value of the hex-encoded redemption script.\n}" }, { "name": "estimatefee", "namespace": "Util", - "description": "Estimates the approximate fee per kilobyte needed for a transaction to begin confirmation within nblocks blocks.\nExamples:\n> lbrycrd-cli estimatefee 6", + "description": "Estimates the approximate fee per kilobyte needed for a transaction to begin confirmation within nblocks blocks.", "arguments": [ { "name": "nblocks", @@ -985,12 +1332,17 @@ "is_required": true } ], + "examples": [ + { + "cli": "> lbrycrd-cli estimatefee 6" + } + ], "returns": "n (numeric) estimated fee-per-kilobyte\n\nA negative value is returned if not enough transactions and blocks\nhave been observed to make an estimate." }, { "name": "estimatepriority", "namespace": "Util", - "description": "Estimates the approximate priority a zero-fee transaction needs to begin confirmation within nblocks blocks.\nExamples:\n> lbrycrd-cli estimatepriority 6", + "description": "Estimates the approximate priority a zero-fee transaction needs to begin confirmation within nblocks blocks.", "arguments": [ { "name": "nblocks", @@ -999,12 +1351,17 @@ "is_required": true } ], + "examples": [ + { + "cli": "> lbrycrd-cli estimatepriority 6" + } + ], "returns": "n (numeric) estimated priority\n\nA negative value is returned if not enough transactions and blocks\nhave been observed to make an estimate." }, { "name": "estimatesmartfee", "namespace": "Util", - "description": "WARNING: This interface is unstable and may disappear or change! Estimates the approximate fee per kilobyte needed for a transaction to begin confirmation within nblocks blocks if possible and return the number of blocks for which the estimate is valid.\nExamples:\n> lbrycrd-cli estimatesmartfee 6", + "description": "WARNING: This interface is unstable and may disappear or change! Estimates the approximate fee per kilobyte needed for a transaction to begin confirmation within nblocks blocks if possible and return the number of blocks for which the estimate is valid.", "arguments": [ { "name": "nblocks", @@ -1013,12 +1370,17 @@ "is_required": true } ], + "examples": [ + { + "cli": "> lbrycrd-cli estimatesmartfee 6" + } + ], "returns": "{\n \"feerate\" : x.x, (numeric) estimate fee-per-kilobyte (in BTC)\n \"blocks\" : n (numeric) block number where estimate was found\n}\n\nA negative value is returned if not enough transactions and blocks\nhave been observed to make an estimate for any number of blocks.\nHowever it will not return a value below the mempool reject fee." }, { "name": "estimatesmartpriority", "namespace": "Util", - "description": "WARNING: This interface is unstable and may disappear or change! Estimates the approximate priority a zero-fee transaction needs to begin confirmation within nblocks blocks if possible and return the number of blocks for which the estimate is valid.\nExamples:\n> lbrycrd-cli estimatesmartpriority 6", + "description": "WARNING: This interface is unstable and may disappear or change! Estimates the approximate priority a zero-fee transaction needs to begin confirmation within nblocks blocks if possible and return the number of blocks for which the estimate is valid.", "arguments": [ { "name": "nblocks", @@ -1027,12 +1389,17 @@ "is_required": true } ], + "examples": [ + { + "cli": "> lbrycrd-cli estimatesmartpriority 6" + } + ], "returns": "{\n \"priority\" : x.x, (numeric) estimated priority\n \"blocks\" : n (numeric) block number where estimate was found\n}\n\nA negative value is returned if not enough transactions and blocks\nhave been observed to make an estimate for any number of blocks.\nHowever if the mempool reject fee is set it will return 1e9 * MAX_MONEY." }, { "name": "validateaddress", "namespace": "Util", - "description": "Return information about the given lbrycrd address.\nExamples:\n> lbrycrd-cli validateaddress \"1PSSGeFHDnKNxiEyFrD1wcEaHr9hrQDDWc\"\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"validateaddress\", \"params\": [\"1PSSGeFHDnKNxiEyFrD1wcEaHr9hrQDDWc\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Return information about the given lbrycrd address.", "arguments": [ { "name": "lbrycrdaddress", @@ -1041,12 +1408,18 @@ "is_required": true } ], + "examples": [ + { + "cli": "> lbrycrd-cli validateaddress \"1PSSGeFHDnKNxiEyFrD1wcEaHr9hrQDDWc\"", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"validateaddress\", \"params\": [\"1PSSGeFHDnKNxiEyFrD1wcEaHr9hrQDDWc\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "{\n \"isvalid\" : true|false, (boolean) If the address is valid or not. If not, this is the only property returned.\n \"address\" : \"lbrycrdaddress\", (string) The lbrycrd address validated\n \"scriptPubKey\" : \"hex\", (string) The hex encoded scriptPubKey generated by the address\n \"ismine\" : true|false, (boolean) If the address is yours or not\n \"iswatchonly\" : true|false, (boolean) If the address is watchonly\n \"isscript\" : true|false, (boolean) If the key is a script\n \"pubkey\" : \"publickeyhex\", (string) The hex value of the raw public key\n \"iscompressed\" : true|false, (boolean) If the address is compressed\n \"account\" : \"account\" (string) DEPRECATED. The account associated with the address, \"\" is the default account\n}" }, { "name": "verifymessage", "namespace": "Util", - "description": "Verify a signed message\nExamples:\nUnlock the wallet for 30 seconds\n> lbrycrd-cli walletpassphrase \"mypassphrase\" 30\n\nCreate the signature\n> lbrycrd-cli signmessage \"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\" \"my message\"\n\nVerify the signature\n> lbrycrd-cli verifymessage \"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\" \"signature\" \"my message\"\n\nAs json rpc\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"verifymessage\", \"params\": [\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\", \"signature\", \"my message\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Verify a signed message", "arguments": [ { "name": "lbrycrdaddress", @@ -1067,12 +1440,30 @@ "is_required": true } ], + "examples": [ + { + "title": "Unlock the wallet for 30 seconds", + "cli": "> lbrycrd-cli walletpassphrase \"mypassphrase\" 30" + }, + { + "title": "Create the signature", + "cli": "> lbrycrd-cli signmessage \"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\" \"my message\"" + }, + { + "title": "Verify the signature", + "cli": "> lbrycrd-cli verifymessage \"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\" \"signature\" \"my message\"" + }, + { + "title": "As json rpc", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"verifymessage\", \"params\": [\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\", \"signature\", \"my message\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "true|false (boolean) If the signature is verified or not." }, { "name": "abandontransaction", "namespace": "Wallet", - "description": "Mark in-wallet transaction as abandoned This will mark this transaction and all its in-wallet descendants as abandoned which will allow for their inputs to be respent. It can be used to replace \"stuck\" or evicted transactions. It only works on transactions which are not included in a block and are not currently in the mempool. It has no effect on transactions which are already conflicted or abandoned.\nExamples:\n> lbrycrd-cli abandontransaction \"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"abandontransaction\", \"params\": [\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Mark in-wallet transaction as abandoned This will mark this transaction and all its in-wallet descendants as abandoned which will allow for their inputs to be respent. It can be used to replace \"stuck\" or evicted transactions. It only works on transactions which are not included in a block and are not currently in the mempool. It has no effect on transactions which are already conflicted or abandoned.", "arguments": [ { "name": "txid", @@ -1081,12 +1472,18 @@ "is_required": true } ], + "examples": [ + { + "cli": "> lbrycrd-cli abandontransaction \"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"abandontransaction\", \"params\": [\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "" }, { "name": "addmultisigaddress", "namespace": "Wallet", - "description": "Add a nrequired-to-sign multisignature address to the wallet. Each key is a Bitcoin address or hex-encoded public key. If 'account' is specified (DEPRECATED), assign address to that account.\nExamples:\nAdd a multisig address from 2 addresses\n> lbrycrd-cli addmultisigaddress 2 \"[\\\"16sSauSf5pF2UkUwvKGq4qjNRzBZYqgEL5\\\",\\\"171sgjn4YtPu27adkKGrdDwzRTxnRkBfKV\\\"]\"\n\nAs json rpc call\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"addmultisigaddress\", \"params\": [2, \"[\\\"16sSauSf5pF2UkUwvKGq4qjNRzBZYqgEL5\\\",\\\"171sgjn4YtPu27adkKGrdDwzRTxnRkBfKV\\\"]\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Add a nrequired-to-sign multisignature address to the wallet. Each key is a Bitcoin address or hex-encoded public key. If 'account' is specified (DEPRECATED), assign address to that account.", "arguments": [ { "name": "nrequired", @@ -1107,12 +1504,22 @@ "is_required": false } ], + "examples": [ + { + "title": "Add a multisig address from 2 addresses", + "cli": "> lbrycrd-cli addmultisigaddress 2 \"[\\\"16sSauSf5pF2UkUwvKGq4qjNRzBZYqgEL5\\\",\\\"171sgjn4YtPu27adkKGrdDwzRTxnRkBfKV\\\"]\"" + }, + { + "title": "As json rpc call", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"addmultisigaddress\", \"params\": [2, \"[\\\"16sSauSf5pF2UkUwvKGq4qjNRzBZYqgEL5\\\",\\\"171sgjn4YtPu27adkKGrdDwzRTxnRkBfKV\\\"]\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "\"lbrycrdaddress\" (string) A lbrycrd address associated with the keys." }, { "name": "backupwallet", "namespace": "Wallet", - "description": "Safely copies current wallet file to destination, which can be a directory or a path with filename.\nExamples:\n> lbrycrd-cli backupwallet \"backup.dat\"\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"backupwallet\", \"params\": [\"backup.dat\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Safely copies current wallet file to destination, which can be a directory or a path with filename.", "arguments": [ { "name": "destination", @@ -1120,12 +1527,18 @@ "description": "The destination directory or file", "is_required": true } + ], + "examples": [ + { + "cli": "> lbrycrd-cli backupwallet \"backup.dat\"", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"backupwallet\", \"params\": [\"backup.dat\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } ] }, { "name": "dumpprivkey", "namespace": "Wallet", - "description": "Reveals the private key corresponding to 'lbrycrdaddress'. Then the importprivkey can be used with this output\nExamples:\n> lbrycrd-cli dumpprivkey \"myaddress\"\n> lbrycrd-cli importprivkey \"mykey\"\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"dumpprivkey\", \"params\": [\"myaddress\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Reveals the private key corresponding to 'lbrycrdaddress'. Then the importprivkey can be used with this output", "arguments": [ { "name": "lbrycrdaddress", @@ -1134,12 +1547,18 @@ "is_required": true } ], + "examples": [ + { + "cli": "> lbrycrd-cli importprivkey \"mykey\"", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"dumpprivkey\", \"params\": [\"myaddress\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "\"key\" (string) The private key" }, { "name": "dumpwallet", "namespace": "Wallet", - "description": "Dumps all wallet keys in a human-readable format.\nExamples:\n> lbrycrd-cli dumpwallet \"test\"\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"dumpwallet\", \"params\": [\"test\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Dumps all wallet keys in a human-readable format.", "arguments": [ { "name": "filename", @@ -1147,12 +1566,18 @@ "description": "The filename", "is_required": true } + ], + "examples": [ + { + "cli": "> lbrycrd-cli dumpwallet \"test\"", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"dumpwallet\", \"params\": [\"test\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } ] }, { "name": "encryptwallet", "namespace": "Wallet", - "description": "Encrypts the wallet with 'passphrase'. This is for first time encryption. After this, any calls that interact with private keys such as sending or signing will require the passphrase to be set prior the making these calls. Use the walletpassphrase call for this, and then walletlock call. If the wallet is already encrypted, use the walletpassphrasechange call. Note that this will shutdown the server.\nExamples:\nEncrypt you wallet\n> lbrycrd-cli encryptwallet \"my pass phrase\"\n\nNow set the passphrase to use the wallet, such as for signing or sending LBC\n> lbrycrd-cli walletpassphrase \"my pass phrase\"\n\nNow we can so something like sign\n> lbrycrd-cli signmessage \"lbrycrdaddress\" \"test message\"\n\nNow lock the wallet again by removing the passphrase\n> lbrycrd-cli walletlock \n\nAs a json rpc call\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"encryptwallet\", \"params\": [\"my pass phrase\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Encrypts the wallet with 'passphrase'. This is for first time encryption. After this, any calls that interact with private keys such as sending or signing will require the passphrase to be set prior the making these calls. Use the walletpassphrase call for this, and then walletlock call. If the wallet is already encrypted, use the walletpassphrasechange call. Note that this will shutdown the server.", "arguments": [ { "name": "passphrase", @@ -1160,12 +1585,34 @@ "description": "The pass phrase to encrypt the wallet with. It must be at least 1 character, but should be long.", "is_required": true } + ], + "examples": [ + { + "title": "Encrypt you wallet", + "cli": "> lbrycrd-cli encryptwallet \"my pass phrase\"" + }, + { + "title": "Now set the passphrase to use the wallet, such as for signing or sending LBC", + "cli": "> lbrycrd-cli walletpassphrase \"my pass phrase\"" + }, + { + "title": "Now we can so something like sign", + "cli": "> lbrycrd-cli signmessage \"lbrycrdaddress\" \"test message\"" + }, + { + "title": "Now lock the wallet again by removing the passphrase", + "cli": "> lbrycrd-cli walletlock" + }, + { + "title": "As a json rpc call", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"encryptwallet\", \"params\": [\"my pass phrase\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } ] }, { "name": "getaccount", "namespace": "Wallet", - "description": "DEPRECATED. Returns the account associated with the given address.\nExamples:\n> lbrycrd-cli getaccount \"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\"\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getaccount\", \"params\": [\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "DEPRECATED. Returns the account associated with the given address.", "arguments": [ { "name": "lbrycrdaddress", @@ -1174,12 +1621,18 @@ "is_required": true } ], + "examples": [ + { + "cli": "> lbrycrd-cli getaccount \"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\"", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getaccount\", \"params\": [\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "\"accountname\" (string) the account address" }, { "name": "getaccountaddress", "namespace": "Wallet", - "description": "DEPRECATED. Returns the current Bitcoin address for receiving payments to this account.\nExamples:\n> lbrycrd-cli getaccountaddress \n> lbrycrd-cli getaccountaddress \"\"\n> lbrycrd-cli getaccountaddress \"myaccount\"\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getaccountaddress\", \"params\": [\"myaccount\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "DEPRECATED. Returns the current Bitcoin address for receiving payments to this account.", "arguments": [ { "name": "account", @@ -1188,12 +1641,18 @@ "is_required": true } ], + "examples": [ + { + "cli": "> lbrycrd-cli getaccountaddress \"myaccount\"", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getaccountaddress\", \"params\": [\"myaccount\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "\"lbrycrdaddress\" (string) The account lbrycrd address" }, { "name": "getaddressesbyaccount", "namespace": "Wallet", - "description": "DEPRECATED. Returns the list of addresses for the given account.\nExamples:\n> lbrycrd-cli getaddressesbyaccount \"tabby\"\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getaddressesbyaccount\", \"params\": [\"tabby\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "DEPRECATED. Returns the list of addresses for the given account.", "arguments": [ { "name": "account", @@ -1202,12 +1661,18 @@ "is_required": true } ], + "examples": [ + { + "cli": "> lbrycrd-cli getaddressesbyaccount \"tabby\"", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getaddressesbyaccount\", \"params\": [\"tabby\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "[ (json array of string)\n \"lbrycrdaddress\" (string) a lbrycrd address associated with the given account\n ,...\n]" }, { "name": "getbalance", "namespace": "Wallet", - "description": "If account is not specified, returns the server's total available balance. If account is specified (DEPRECATED), returns the balance in the account. Note that the account \"\" is not the same as leaving the parameter out. The server total may be different to the balance in the default \"\" account.\nExamples:\nThe total amount in the wallet\n> lbrycrd-cli getbalance \n\nThe total amount in the wallet at least 5 blocks confirmed\n> lbrycrd-cli getbalance \"*\" 6\n\nAs a json rpc call\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getbalance\", \"params\": [\"*\", 6] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "If account is not specified, returns the server's total available balance. If account is specified (DEPRECATED), returns the balance in the account. Note that the account \"\" is not the same as leaving the parameter out. The server total may be different to the balance in the default \"\" account.", "arguments": [ { "name": "account", @@ -1228,12 +1693,26 @@ "is_required": false } ], + "examples": [ + { + "title": "The total amount in the wallet", + "cli": "> lbrycrd-cli getbalance" + }, + { + "title": "The total amount in the wallet at least 5 blocks confirmed", + "cli": "> lbrycrd-cli getbalance \"*\" 6" + }, + { + "title": "As a json rpc call", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getbalance\", \"params\": [\"*\", 6] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "amount (numeric) The total amount in LBC received for this account." }, { "name": "getnewaddress", "namespace": "Wallet", - "description": "Returns a new Bitcoin address for receiving payments. If 'account' is specified (DEPRECATED), it is added to the address book so payments received with the address will be credited to 'account'.\nExamples:\n> lbrycrd-cli getnewaddress \n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getnewaddress\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Returns a new Bitcoin address for receiving payments. If 'account' is specified (DEPRECATED), it is added to the address book so payments received with the address will be credited to 'account'.", "arguments": [ { "name": "account", @@ -1242,19 +1721,31 @@ "is_required": false } ], + "examples": [ + { + "cli": "> lbrycrd-cli getnewaddress", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getnewaddress\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "\"lbrycrdaddress\" (string) The new lbrycrd address" }, { "name": "getrawchangeaddress", "namespace": "Wallet", - "description": "Returns a new Bitcoin address, for receiving change. This is for use with raw transactions, NOT normal use.\nExamples:\n> lbrycrd-cli getrawchangeaddress \n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getrawchangeaddress\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Returns a new Bitcoin address, for receiving change. This is for use with raw transactions, NOT normal use.", "arguments": [], + "examples": [ + { + "cli": "> lbrycrd-cli getrawchangeaddress", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getrawchangeaddress\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "\"address\" (string) The address" }, { "name": "getreceivedbyaccount", "namespace": "Wallet", - "description": "DEPRECATED. Returns the total amount received by addresses with in transactions with at least [minconf] confirmations.\nExamples:\nAmount received by the default account with at least 1 confirmation\n> lbrycrd-cli getreceivedbyaccount \"\"\n\nAmount received at the tabby account including unconfirmed amounts with zero confirmations\n> lbrycrd-cli getreceivedbyaccount \"tabby\" 0\n\nThe amount with at least 6 confirmation, very safe\n> lbrycrd-cli getreceivedbyaccount \"tabby\" 6\n\nAs a json rpc call\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getreceivedbyaccount\", \"params\": [\"tabby\", 6] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "DEPRECATED. Returns the total amount received by addresses with in transactions with at least [minconf] confirmations.", "arguments": [ { "name": "account", @@ -1269,12 +1760,30 @@ "is_required": false } ], + "examples": [ + { + "title": "Amount received by the default account with at least 1 confirmation", + "cli": "> lbrycrd-cli getreceivedbyaccount \"\"" + }, + { + "title": "Amount received at the tabby account including unconfirmed amounts with zero confirmations", + "cli": "> lbrycrd-cli getreceivedbyaccount \"tabby\" 0" + }, + { + "title": "The amount with at least 6 confirmation, very safe", + "cli": "> lbrycrd-cli getreceivedbyaccount \"tabby\" 6" + }, + { + "title": "As a json rpc call", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getreceivedbyaccount\", \"params\": [\"tabby\", 6] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "amount (numeric) The total amount in LBC received for this account." }, { "name": "getreceivedbyaddress", "namespace": "Wallet", - "description": "Returns the total amount received by the given lbrycrdaddress in transactions with at least minconf confirmations.\nExamples:\nThe amount from transactions with at least 1 confirmation\n> lbrycrd-cli getreceivedbyaddress \"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\"\n\nThe amount including unconfirmed transactions, zero confirmations\n> lbrycrd-cli getreceivedbyaddress \"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\" 0\n\nThe amount with at least 6 confirmation, very safe\n> lbrycrd-cli getreceivedbyaddress \"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\" 6\n\nAs a json rpc call\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getreceivedbyaddress\", \"params\": [\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\", 6] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Returns the total amount received by the given lbrycrdaddress in transactions with at least minconf confirmations.", "arguments": [ { "name": "lbrycrdaddress", @@ -1289,12 +1798,30 @@ "is_required": false } ], + "examples": [ + { + "title": "The amount from transactions with at least 1 confirmation", + "cli": "> lbrycrd-cli getreceivedbyaddress \"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\"" + }, + { + "title": "The amount including unconfirmed transactions, zero confirmations", + "cli": "> lbrycrd-cli getreceivedbyaddress \"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\" 0" + }, + { + "title": "The amount with at least 6 confirmation, very safe", + "cli": "> lbrycrd-cli getreceivedbyaddress \"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\" 6" + }, + { + "title": "As a json rpc call", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getreceivedbyaddress\", \"params\": [\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\", 6] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "amount (numeric) The total amount in LBC received at this address." }, { "name": "gettransaction", "namespace": "Wallet", - "description": "Get detailed information about in-wallet transaction \nExamples:\n> lbrycrd-cli gettransaction \"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"\n> lbrycrd-cli gettransaction \"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\" true\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"gettransaction\", \"params\": [\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Get detailed information about in-wallet transaction ", "arguments": [ { "name": "txid", @@ -1309,25 +1836,38 @@ "is_required": false } ], + "examples": [ + { + "cli": "> lbrycrd-cli gettransaction \"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\" true", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"gettransaction\", \"params\": [\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "{\n \"amount\" : x.xxx, (numeric) The transaction amount in LBC\n \"confirmations\" : n, (numeric) The number of confirmations\n \"blockhash\" : \"hash\", (string) The block hash\n \"blockindex\" : xx, (numeric) The index of the transaction in the block that includes it\n \"blocktime\" : ttt, (numeric) The time in seconds since epoch (1 Jan 1970 GMT)\n \"txid\" : \"transactionid\", (string) The transaction id.\n \"time\" : ttt, (numeric) The transaction time in seconds since epoch (1 Jan 1970 GMT)\n \"timereceived\" : ttt, (numeric) The time received in seconds since epoch (1 Jan 1970 GMT)\n \"bip125-replaceable\": \"yes|no|unknown\" (string) Whether this transaction could be replaced due to BIP125 (replace-by-fee);\n may be unknown for unconfirmed transactions not in the mempool\n \"details\" : [\n {\n \"account\" : \"accountname\", (string) DEPRECATED. The account name involved in the transaction, can be \"\" for the default account.\n \"address\" : \"lbrycrdaddress\", (string) The lbrycrd address involved in the transaction\n \"category\" : \"send|receive\", (string) The category, either 'send' or 'receive'\n \"amount\" : x.xxx, (numeric) The amount in LBC\n \"label\" : \"label\", (string) A comment for the address/transaction, if any\n \"vout\" : n, (numeric) the vout value\n }\n ,...\n ],\n \"hex\" : \"data\" (string) Raw data for transaction\n}" }, { "name": "getunconfirmedbalance", "namespace": "Wallet", "description": "Returns the server's total unconfirmed balance", - "arguments": [] + "arguments": [], + "examples": [] }, { "name": "getwalletinfo", "namespace": "Wallet", - "description": "Returns an object containing various wallet state info.\nExamples:\n> lbrycrd-cli getwalletinfo \n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getwalletinfo\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Returns an object containing various wallet state info.", "arguments": [], + "examples": [ + { + "cli": "> lbrycrd-cli getwalletinfo", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getwalletinfo\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "{\n \"walletversion\": xxxxx, (numeric) the wallet version\n \"balance\": xxxxxxx, (numeric) the total confirmed balance of the wallet in LBC\n \"unconfirmed_balance\": xxx, (numeric) the total unconfirmed balance of the wallet in LBC\n \"immature_balance\": xxxxxx, (numeric) the total immature balance of the wallet in LBC\n \"txcount\": xxxxxxx, (numeric) the total number of transactions in the wallet\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 \"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 \"paytxfee\": x.xxxx, (numeric) the transaction fee configuration, set in LBC/kB\n}" }, { "name": "importaddress", "namespace": "Wallet", - "description": "Adds a script (in hex) or address that can be watched as if it were in your wallet but cannot be used to spend.\nExamples:\nImport a script with rescan\n> lbrycrd-cli importaddress \"myscript\"\n\nImport using a label without rescan\n> lbrycrd-cli importaddress \"myscript\" \"testing\" false\n\nAs a JSON-RPC call\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"importaddress\", \"params\": [\"myscript\", \"testing\", false] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Adds a script (in hex) or address that can be watched as if it were in your wallet but cannot be used to spend.", "arguments": [ { "name": "script", @@ -1353,12 +1893,26 @@ "description": "Add the P2SH version of the script as well Note: This call can take minutes to complete if rescan is true. If you have the full public key, you should call importpubkey instead of this.", "is_required": false } + ], + "examples": [ + { + "title": "Import a script with rescan", + "cli": "> lbrycrd-cli importaddress \"myscript\"" + }, + { + "title": "Import using a label without rescan", + "cli": "> lbrycrd-cli importaddress \"myscript\" \"testing\" false" + }, + { + "title": "As a JSON-RPC call", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"importaddress\", \"params\": [\"myscript\", \"testing\", false] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } ] }, { "name": "importprivkey", "namespace": "Wallet", - "description": "Adds a private key (as returned by dumpprivkey) to your wallet.\nExamples:\nDump a private key\n> lbrycrd-cli dumpprivkey \"myaddress\"\n\nImport the private key with rescan\n> lbrycrd-cli importprivkey \"mykey\"\n\nImport using a label and without rescan\n> lbrycrd-cli importprivkey \"mykey\" \"testing\" false\n\nAs a JSON-RPC call\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"importprivkey\", \"params\": [\"mykey\", \"testing\", false] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Adds a private key (as returned by dumpprivkey) to your wallet.", "arguments": [ { "name": "lbrycrdprivkey", @@ -1378,6 +1932,24 @@ "description": "Rescan the wallet for transactions Note: This call can take minutes to complete if rescan is true.", "is_required": false } + ], + "examples": [ + { + "title": "Dump a private key", + "cli": "> lbrycrd-cli dumpprivkey \"myaddress\"" + }, + { + "title": "Import the private key with rescan", + "cli": "> lbrycrd-cli importprivkey \"mykey\"" + }, + { + "title": "Import using a label and without rescan", + "cli": "> lbrycrd-cli importprivkey \"mykey\" \"testing\" false" + }, + { + "title": "As a JSON-RPC call", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"importprivkey\", \"params\": [\"mykey\", \"testing\", false] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } ] }, { @@ -1403,12 +1975,13 @@ "description": "An optional label", "is_required": false } - ] + ], + "examples": [] }, { "name": "importpubkey", "namespace": "Wallet", - "description": "Adds a public key (in hex) that can be watched as if it were in your wallet but cannot be used to spend.\nExamples:\nImport a public key with rescan\n> lbrycrd-cli importpubkey \"mypubkey\"\n\nImport using a label without rescan\n> lbrycrd-cli importpubkey \"mypubkey\" \"testing\" false\n\nAs a JSON-RPC call\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"importpubkey\", \"params\": [\"mypubkey\", \"testing\", false] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Adds a public key (in hex) that can be watched as if it were in your wallet but cannot be used to spend.", "arguments": [ { "name": "pubkey", @@ -1428,12 +2001,26 @@ "description": "Rescan the wallet for transactions Note: This call can take minutes to complete if rescan is true.", "is_required": false } + ], + "examples": [ + { + "title": "Import a public key with rescan", + "cli": "> lbrycrd-cli importpubkey \"mypubkey\"" + }, + { + "title": "Import using a label without rescan", + "cli": "> lbrycrd-cli importpubkey \"mypubkey\" \"testing\" false" + }, + { + "title": "As a JSON-RPC call", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"importpubkey\", \"params\": [\"mypubkey\", \"testing\", false] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } ] }, { "name": "importwallet", "namespace": "Wallet", - "description": "Imports keys from a wallet dump file (see dumpwallet).\nExamples:\nDump the wallet\n> lbrycrd-cli dumpwallet \"test\"\n\nImport the wallet\n> lbrycrd-cli importwallet \"test\"\n\nImport using the json rpc call\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"importwallet\", \"params\": [\"test\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Imports keys from a wallet dump file (see dumpwallet).", "arguments": [ { "name": "filename", @@ -1441,12 +2028,26 @@ "description": "The wallet file", "is_required": true } + ], + "examples": [ + { + "title": "Dump the wallet", + "cli": "> lbrycrd-cli dumpwallet \"test\"" + }, + { + "title": "Import the wallet", + "cli": "> lbrycrd-cli importwallet \"test\"" + }, + { + "title": "Import using the json rpc call", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"importwallet\", \"params\": [\"test\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } ] }, { "name": "keypoolrefill", "namespace": "Wallet", - "description": "Fills the keypool.\nExamples:\n> lbrycrd-cli keypoolrefill \n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"keypoolrefill\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Fills the keypool.", "arguments": [ { "name": "newsize", @@ -1454,12 +2055,18 @@ "description": "The new keypool size", "is_required": false } + ], + "examples": [ + { + "cli": "> lbrycrd-cli keypoolrefill", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"keypoolrefill\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } ] }, { "name": "listaccounts", "namespace": "Wallet", - "description": "DEPRECATED. Returns Object that has account names as keys, account balances as values.\nExamples:\nList account balances where there at least 1 confirmation\n> lbrycrd-cli listaccounts \n\nList account balances including zero confirmation transactions\n> lbrycrd-cli listaccounts 0\n\nList account balances for 6 or more confirmations\n> lbrycrd-cli listaccounts 6\n\nAs json rpc call\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"listaccounts\", \"params\": [6] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "DEPRECATED. Returns Object that has account names as keys, account balances as values.", "arguments": [ { "name": "minconf", @@ -1474,26 +2081,72 @@ "is_required": false } ], + "examples": [ + { + "title": "List account balances where there at least 1 confirmation", + "cli": "> lbrycrd-cli listaccounts" + }, + { + "title": "List account balances including zero confirmation transactions", + "cli": "> lbrycrd-cli listaccounts 0" + }, + { + "title": "List account balances for 6 or more confirmations", + "cli": "> lbrycrd-cli listaccounts 6" + }, + { + "title": "As json rpc call", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"listaccounts\", \"params\": [6] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "{ (json object where keys are account names, and values are numeric balances\n \"account\": x.xxx, (numeric) The property name is the account name, and the value is the total balance for the account.\n ...\n}" }, { "name": "listaddressgroupings", "namespace": "Wallet", - "description": "Lists groups of addresses which have had their common ownership made public by common use as inputs or as the resulting change in past transactions\nExamples:\n> lbrycrd-cli listaddressgroupings \n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"listaddressgroupings\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Lists groups of addresses which have had their common ownership made public by common use as inputs or as the resulting change in past transactions", "arguments": [], + "examples": [ + { + "cli": "> lbrycrd-cli listaddressgroupings", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"listaddressgroupings\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "[\n [\n [\n \"lbrycrdaddress\", (string) The lbrycrd address\n amount, (numeric) The amount in LBC\n \"account\" (string, optional) The account (DEPRECATED)\n ]\n ,...\n ]\n ,...\n]" }, { "name": "listlockunspent", "namespace": "Wallet", - "description": "Returns list of temporarily unspendable outputs. See the lockunspent call to lock and unlock transactions for spending.\nExamples:\nList the unspent transactions\n> lbrycrd-cli listunspent \n\nLock an unspent transaction\n> lbrycrd-cli lockunspent false \"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":1}]\"\n\nList the locked transactions\n> lbrycrd-cli listlockunspent \n\nUnlock the transaction again\n> lbrycrd-cli lockunspent true \"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":1}]\"\n\nAs a json rpc call\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"listlockunspent\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Returns list of temporarily unspendable outputs. See the lockunspent call to lock and unlock transactions for spending.", "arguments": [], + "examples": [ + { + "title": "List the unspent transactions", + "cli": "> lbrycrd-cli listunspent" + }, + { + "title": "Lock an unspent transaction", + "cli": "> lbrycrd-cli lockunspent false \"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":1}]\"" + }, + { + "title": "List the locked transactions", + "cli": "> lbrycrd-cli listlockunspent" + }, + { + "title": "Unlock the transaction again", + "cli": "> lbrycrd-cli lockunspent true \"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":1}]\"" + }, + { + "title": "As a json rpc call", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"listlockunspent\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "[\n {\n \"txid\" : \"transactionid\", (string) The transaction id locked\n \"vout\" : n (numeric) The vout value\n }\n ,...\n]" }, { "name": "listreceivedbyaccount", "namespace": "Wallet", - "description": "DEPRECATED. List balances by account.\nExamples:\n> lbrycrd-cli listreceivedbyaccount \n> lbrycrd-cli listreceivedbyaccount 6 true\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"listreceivedbyaccount\", \"params\": [6, true, true] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "DEPRECATED. List balances by account.", "arguments": [ { "name": "minconf", @@ -1514,12 +2167,18 @@ "is_required": false } ], + "examples": [ + { + "cli": "> lbrycrd-cli listreceivedbyaccount 6 true", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"listreceivedbyaccount\", \"params\": [6, true, true] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "[\n {\n \"involvesWatchonly\" : true, (bool) Only returned if imported addresses were involved in transaction\n \"account\" : \"accountname\", (string) The account name of the receiving account\n \"amount\" : x.xxx, (numeric) The total amount received by addresses with this account\n \"confirmations\" : n, (numeric) The number of confirmations of the most recent transaction included\n \"label\" : \"label\" (string) A comment for the address/transaction, if any\n }\n ,...\n]" }, { "name": "listreceivedbyaddress", "namespace": "Wallet", - "description": "List balances by receiving address.\nExamples:\n> lbrycrd-cli listreceivedbyaddress \n> lbrycrd-cli listreceivedbyaddress 6 true\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"listreceivedbyaddress\", \"params\": [6, true, true] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "List balances by receiving address.", "arguments": [ { "name": "minconf", @@ -1540,12 +2199,18 @@ "is_required": false } ], + "examples": [ + { + "cli": "> lbrycrd-cli listreceivedbyaddress 6 true", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"listreceivedbyaddress\", \"params\": [6, true, true] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "[\n {\n \"involvesWatchonly\" : true, (bool) Only returned if imported addresses were involved in transaction\n \"address\" : \"receivingaddress\", (string) The receiving address\n \"account\" : \"accountname\", (string) DEPRECATED. The account of the receiving address. The default account is \"\".\n \"amount\" : x.xxx, (numeric) The total amount in LBC received by the address\n \"confirmations\" : n, (numeric) The number of confirmations of the most recent transaction included\n \"label\" : \"label\" (string) A comment for the address/transaction, if any\n }\n ,...\n]" }, { "name": "listsinceblock", "namespace": "Wallet", - "description": "Get all transactions in blocks since block [blockhash], or all transactions if omitted\nExamples:\n> lbrycrd-cli listsinceblock \n> lbrycrd-cli listsinceblock \"000000000000000bacf66f7497b7dc45ef753ee9a7d38571037cdb1a57f663ad\" 6\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"listsinceblock\", \"params\": [\"000000000000000bacf66f7497b7dc45ef753ee9a7d38571037cdb1a57f663ad\", 6] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Get all transactions in blocks since block [blockhash], or all transactions if omitted", "arguments": [ { "name": "blockhash", @@ -1566,12 +2231,18 @@ "is_required": false } ], + "examples": [ + { + "cli": "> lbrycrd-cli listsinceblock \"000000000000000bacf66f7497b7dc45ef753ee9a7d38571037cdb1a57f663ad\" 6", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"listsinceblock\", \"params\": [\"000000000000000bacf66f7497b7dc45ef753ee9a7d38571037cdb1a57f663ad\", 6] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "{\n \"transactions\": [\n \"account\":\"accountname\", (string) DEPRECATED. The account name associated with the transaction. Will be \"\" for the default account.\n \"address\":\"lbrycrdaddress\", (string) The lbrycrd address of the transaction. Not present for move transactions (category = move).\n \"category\":\"send|receive\", (string) The transaction category. 'send' has negative amounts, 'receive' has positive amounts.\n \"amount\": x.xxx, (numeric) The amount in LBC. This is negative for the 'send' category, and for the 'move' category for moves \n outbound. It is positive for the 'receive' category, and for the 'move' category for inbound funds.\n \"vout\" : n, (numeric) the vout value\n \"fee\": x.xxx, (numeric) The amount of the fee in LBC. This is negative and only available for the 'send' category of transactions.\n \"confirmations\": n, (numeric) The number of confirmations for the transaction. Available for 'send' and 'receive' category of transactions.\n \"blockhash\": \"hashvalue\", (string) The block hash containing the transaction. Available for 'send' and 'receive' category of transactions.\n \"blockindex\": n, (numeric) The index of the transaction in the block that includes it. Available for 'send' and 'receive' category of transactions.\n \"blocktime\": xxx, (numeric) The block time in seconds since epoch (1 Jan 1970 GMT).\n \"txid\": \"transactionid\", (string) The transaction id. Available for 'send' and 'receive' category of transactions.\n \"time\": xxx, (numeric) The transaction time in seconds since epoch (Jan 1 1970 GMT).\n \"timereceived\": xxx, (numeric) The time received in seconds since epoch (Jan 1 1970 GMT). Available for 'send' and 'receive' category of transactions.\n \"comment\": \"...\", (string) If a comment is associated with the transaction.\n \"label\" : \"label\" (string) A comment for the address/transaction, if any\n \"to\": \"...\", (string) If a comment to is associated with the transaction.\n ],\n \"lastblock\": \"lastblockhash\" (string) The hash of the last block\n}" }, { "name": "listtransactions", "namespace": "Wallet", - "description": "Returns up to 'count' most recent transactions skipping the first 'from' transactions for account 'account'.\nExamples:\nList the most recent 10 transactions in the systems\n> lbrycrd-cli listtransactions \n\nList transactions 100 to 120\n> lbrycrd-cli listtransactions \"*\" 20 100\n\nAs a json rpc call\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"listtransactions\", \"params\": [\"*\", 20, 100] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Returns up to 'count' most recent transactions skipping the first 'from' transactions for account 'account'.", "arguments": [ { "name": "account", @@ -1598,19 +2269,39 @@ "is_required": false } ], + "examples": [ + { + "title": "List the most recent 10 transactions in the systems", + "cli": "> lbrycrd-cli listtransactions" + }, + { + "title": "List transactions 100 to 120", + "cli": "> lbrycrd-cli listtransactions \"*\" 20 100" + }, + { + "title": "As a json rpc call", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"listtransactions\", \"params\": [\"*\", 20, 100] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "[\n {\n \"account\":\"accountname\", (string) DEPRECATED. The account name associated with the transaction. \n It will be \"\" for the default account.\n \"address\":\"lbrycrdaddress\", (string) The lbrycrd address of the transaction. Not present for \n move transactions (category = move).\n \"category\":\"send|receive|move\", (string) The transaction category. 'move' is a local (off blockchain)\n transaction between accounts, and not associated with an address,\n transaction id or block. 'send' and 'receive' transactions are \n associated with an address, transaction id and block details\n \"amount\": x.xxx, (numeric) The amount in LBC. This is negative for the 'send' category, and for the\n 'move' category for moves outbound. It is positive for the 'receive' category,\n and for the 'move' category for inbound funds.\n \"vout\": n, (numeric) the vout value\n \"fee\": x.xxx, (numeric) The amount of the fee in LBC. This is negative and only available for the \n 'send' category of transactions.\n \"abandoned\": xxx (bool) 'true' if the transaction has been abandoned (inputs are respendable).\n \"confirmations\": n, (numeric) The number of confirmations for the transaction. Available for 'send' and \n 'receive' category of transactions. Negative confirmations indicate the\n transaction conflicts with the block chain\n \"trusted\": xxx (bool) Whether we consider the outputs of this unconfirmed transaction safe to spend.\n \"blockhash\": \"hashvalue\", (string) The block hash containing the transaction. Available for 'send' and 'receive'\n category of transactions.\n \"blockindex\": n, (numeric) The index of the transaction in the block that includes it. Available for 'send' and 'receive'\n category of transactions.\n \"blocktime\": xxx, (numeric) The block time in seconds since epoch (1 Jan 1970 GMT).\n \"txid\": \"transactionid\", (string) The transaction id. Available for 'send' and 'receive' category of transactions.\n \"time\": xxx, (numeric) The transaction time in seconds since epoch (midnight Jan 1 1970 GMT).\n \"timereceived\": xxx, (numeric) The time received in seconds since epoch (midnight Jan 1 1970 GMT). Available \n for 'send' and 'receive' category of transactions.\n \"comment\": \"...\", (string) If a comment is associated with the transaction.\n \"label\": \"label\" (string) A comment for the address/transaction, if any\n \"otheraccount\": \"accountname\", (string) For the 'move' category of transactions, the account the funds came \n from (for receiving funds, positive amounts), or went to (for sending funds,\n negative amounts).\n \"bip125-replaceable\": \"yes|no|unknown\" (string) Whether this transaction could be replaced due to BIP125 (replace-by-fee);\n may be unknown for unconfirmed transactions not in the mempool\n }\n]" }, { "name": "listunspent", "namespace": "Wallet", - "description": "Returns array of unspent transaction outputs with between minconf and maxconf (inclusive) confirmations. Optionally filter to only include txouts paid to specified addresses.\nExamples:\n> lbrycrd-cli listunspent \n> lbrycrd-cli listunspent 6 9999999 \"[\\\"1PGFqEzfmQch1gKD3ra4k18PNj3tTUUSqg\\\",\\\"1LtvqCaApEdUGFkpKMM4MstjcaL4dKg8SP\\\"]\"\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"listunspent\", \"params\": [6, 9999999 \"[\\\"1PGFqEzfmQch1gKD3ra4k18PNj3tTUUSqg\\\",\\\"1LtvqCaApEdUGFkpKMM4MstjcaL4dKg8SP\\\"]\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Returns array of unspent transaction outputs with between minconf and maxconf (inclusive) confirmations. Optionally filter to only include txouts paid to specified addresses.", "arguments": [], + "examples": [ + { + "cli": "> lbrycrd-cli listunspent 6 9999999 \"[\\\"1PGFqEzfmQch1gKD3ra4k18PNj3tTUUSqg\\\",\\\"1LtvqCaApEdUGFkpKMM4MstjcaL4dKg8SP\\\"]\"", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"listunspent\", \"params\": [6, 9999999 \"[\\\"1PGFqEzfmQch1gKD3ra4k18PNj3tTUUSqg\\\",\\\"1LtvqCaApEdUGFkpKMM4MstjcaL4dKg8SP\\\"]\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "{txid, vout, scriptPubKey, amount, confirmations}\n\nArguments:\n1. minconf (numeric, optional, default=1) The minimum confirmations to filter\n2. maxconf (numeric, optional, default=9999999) The maximum confirmations to filter\n3. \"addresses\" (string) A json array of lbrycrd addresses to filter\n [\n \"address\" (string) lbrycrd address\n ,...\n ]\n\nResult\n[ (array of json object)\n {\n \"txid\" : \"txid\", (string) the transaction id \n \"vout\" : n, (numeric) the vout value\n \"address\" : \"address\", (string) the lbrycrd address\n \"account\" : \"account\", (string) DEPRECATED. The associated account, or \"\" for the default account\n \"scriptPubKey\" : \"key\", (string) the script key\n \"amount\" : x.xxx, (numeric) the transaction amount in LBC\n \"confirmations\" : n (numeric) The number of confirmations\n }\n ,...\n]" }, { "name": "lockunspent", "namespace": "Wallet", - "description": "Updates list of temporarily unspendable outputs. Temporarily lock (unlock=false) or unlock (unlock=true) specified transaction outputs. If no transaction outputs are specified when unlocking then all current locked transaction outputs are unlocked. A locked transaction output will not be chosen by automatic coin selection, when spending LBC. Locks are stored in memory only. Nodes start with zero locked outputs, and the locked output list is always cleared (by virtue of process exit) when a node stops or fails. Also see the listunspent call\nExamples:\nList the unspent transactions\n> lbrycrd-cli listunspent \n\nLock an unspent transaction\n> lbrycrd-cli lockunspent false \"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":1}]\"\n\nList the locked transactions\n> lbrycrd-cli listlockunspent \n\nUnlock the transaction again\n> lbrycrd-cli lockunspent true \"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":1}]\"\n\nAs a json rpc call\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"lockunspent\", \"params\": [false, \"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":1}]\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Updates list of temporarily unspendable outputs. Temporarily lock (unlock=false) or unlock (unlock=true) specified transaction outputs. If no transaction outputs are specified when unlocking then all current locked transaction outputs are unlocked. A locked transaction output will not be chosen by automatic coin selection, when spending LBC. Locks are stored in memory only. Nodes start with zero locked outputs, and the locked output list is always cleared (by virtue of process exit) when a node stops or fails. Also see the listunspent call", "arguments": [ { "name": "unlock", @@ -1625,12 +2316,34 @@ "is_required": false } ], + "examples": [ + { + "title": "List the unspent transactions", + "cli": "> lbrycrd-cli listunspent" + }, + { + "title": "Lock an unspent transaction", + "cli": "> lbrycrd-cli lockunspent false \"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":1}]\"" + }, + { + "title": "List the locked transactions", + "cli": "> lbrycrd-cli listlockunspent" + }, + { + "title": "Unlock the transaction again", + "cli": "> lbrycrd-cli lockunspent true \"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":1}]\"" + }, + { + "title": "As a json rpc call", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"lockunspent\", \"params\": [false, \"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":1}]\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "true|false (boolean) Whether the command was successful or not" }, { "name": "move", "namespace": "Wallet", - "description": "DEPRECATED. Move a specified amount from one account in your wallet to another.\nExamples:\nMove 0.01 LBC from the default account to the account named tabby\n> lbrycrd-cli move \"\" \"tabby\" 0.01\n\nMove 0.01 LBC timotei to akiko with a comment and funds have 6 confirmations\n> lbrycrd-cli move \"timotei\" \"akiko\" 0.01 6 \"happy birthday!\"\n\nAs a json rpc call\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"move\", \"params\": [\"timotei\", \"akiko\", 0.01, 6, \"happy birthday!\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "DEPRECATED. Move a specified amount from one account in your wallet to another.", "arguments": [ { "name": "fromaccount", @@ -1663,12 +2376,26 @@ "is_required": false } ], + "examples": [ + { + "title": "Move 0.01 LBC from the default account to the account named tabby", + "cli": "> lbrycrd-cli move \"\" \"tabby\" 0.01" + }, + { + "title": "Move 0.01 LBC timotei to akiko with a comment and funds have 6 confirmations", + "cli": "> lbrycrd-cli move \"timotei\" \"akiko\" 0.01 6 \"happy birthday!\"" + }, + { + "title": "As a json rpc call", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"move\", \"params\": [\"timotei\", \"akiko\", 0.01, 6, \"happy birthday!\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "true|false (boolean) true if successful." }, { "name": "removeprunedfunds", "namespace": "Wallet", - "description": "Deletes the specified transaction from the wallet. Meant for use with pruned wallets and as a companion to importprunedfunds. This will effect wallet balances.\nExamples:\n> lbrycrd-cli removeprunedfunds \"a8d0c0184dde994a09ec054286f1ce581bebf46446a512166eae7628734ea0a5\"\n\nAs a JSON-RPC call\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"removprunedfunds\", \"params\": [\"a8d0c0184dde994a09ec054286f1ce581bebf46446a512166eae7628734ea0a5\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Deletes the specified transaction from the wallet. Meant for use with pruned wallets and as a companion to importprunedfunds. This will effect wallet balances.", "arguments": [ { "name": "txid", @@ -1676,12 +2403,19 @@ "description": "The hex-encoded id of the transaction you are deleting", "is_required": true } + ], + "examples": [ + { + "cli": "> lbrycrd-cli removeprunedfunds \"a8d0c0184dde994a09ec054286f1ce581bebf46446a512166eae7628734ea0a5\"", + "title": "As a JSON-RPC call", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"removprunedfunds\", \"params\": [\"a8d0c0184dde994a09ec054286f1ce581bebf46446a512166eae7628734ea0a5\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } ] }, { "name": "sendfrom", "namespace": "Wallet", - "description": "DEPRECATED (use sendtoaddress). Sent an amount from an account to a lbrycrd address.\nExamples:\nSend 0.01 LBC from the default account to the address, must have at least 1 confirmation\n> lbrycrd-cli sendfrom \"\" \"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\" 0.01\n\nSend 0.01 from the tabby account to the given address, funds must have at least 6 confirmations\n> lbrycrd-cli sendfrom \"tabby\" \"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\" 0.01 6 \"donation\" \"seans outpost\"\n\nAs a json rpc call\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"sendfrom\", \"params\": [\"tabby\", \"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\", 0.01, 6, \"donation\", \"seans outpost\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "DEPRECATED (use sendtoaddress). Sent an amount from an account to a lbrycrd address.", "arguments": [ { "name": "fromaccount", @@ -1720,12 +2454,26 @@ "is_required": false } ], + "examples": [ + { + "title": "Send 0.01 LBC from the default account to the address, must have at least 1 confirmation", + "cli": "> lbrycrd-cli sendfrom \"\" \"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\" 0.01" + }, + { + "title": "Send 0.01 from the tabby account to the given address, funds must have at least 6 confirmations", + "cli": "> lbrycrd-cli sendfrom \"tabby\" \"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\" 0.01 6 \"donation\" \"seans outpost\"" + }, + { + "title": "As a json rpc call", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"sendfrom\", \"params\": [\"tabby\", \"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\", 0.01, 6, \"donation\", \"seans outpost\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "\"transactionid\" (string) The transaction id." }, { "name": "sendmany", "namespace": "Wallet", - "description": "Send multiple times. Amounts are double-precision floating point numbers.\nExamples:\nSend two amounts to two different addresses:\n> lbrycrd-cli sendmany \"\" \"{\\\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\\\":0.01,\\\"1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz\\\":0.02}\"\n\nSend two amounts to two different addresses setting the confirmation and comment:\n> lbrycrd-cli sendmany \"\" \"{\\\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\\\":0.01,\\\"1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz\\\":0.02}\" 6 \"testing\"\n\nSend two amounts to two different addresses, subtract fee from amount:\n> lbrycrd-cli sendmany \"\" \"{\\\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\\\":0.01,\\\"1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz\\\":0.02}\" 1 \"\" \"[\\\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\\\",\\\"1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz\\\"]\"\n\nAs a json rpc call\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"sendmany\", \"params\": [\"\", \"{\\\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\\\":0.01,\\\"1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz\\\":0.02}\", 6, \"testing\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Send multiple times. Amounts are double-precision floating point numbers.", "arguments": [ { "name": "fromaccount", @@ -1758,12 +2506,30 @@ "is_required": false } ], + "examples": [ + { + "title": "Send two amounts to two different addresses:", + "cli": "> lbrycrd-cli sendmany \"\" \"{\\\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\\\":0.01,\\\"1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz\\\":0.02}\"" + }, + { + "title": "Send two amounts to two different addresses setting the confirmation and comment:", + "cli": "> lbrycrd-cli sendmany \"\" \"{\\\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\\\":0.01,\\\"1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz\\\":0.02}\" 6 \"testing\"" + }, + { + "title": "Send two amounts to two different addresses, subtract fee from amount:", + "cli": "> lbrycrd-cli sendmany \"\" \"{\\\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\\\":0.01,\\\"1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz\\\":0.02}\" 1 \"\" \"[\\\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\\\",\\\"1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz\\\"]\"" + }, + { + "title": "As a json rpc call", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"sendmany\", \"params\": [\"\", \"{\\\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\\\":0.01,\\\"1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz\\\":0.02}\", 6, \"testing\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "\"transactionid\" (string) The transaction id for the send. Only 1 transaction is created regardless of \n the number of addresses." }, { "name": "sendtoaddress", "namespace": "Wallet", - "description": "Send an amount to a given address.\nExamples:\n> lbrycrd-cli sendtoaddress \"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\" 0.1\n> lbrycrd-cli sendtoaddress \"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\" 0.1 \"donation\" \"seans outpost\"\n> lbrycrd-cli sendtoaddress \"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\" 0.1 \"\" \"\" true\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"sendtoaddress\", \"params\": [\"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\", 0.1, \"donation\", \"seans outpost\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Send an amount to a given address.", "arguments": [ { "name": "lbrycrdaddress", @@ -1796,12 +2562,18 @@ "is_required": false } ], + "examples": [ + { + "cli": "> lbrycrd-cli sendtoaddress \"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\" 0.1 \"\" \"\" true", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"sendtoaddress\", \"params\": [\"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\", 0.1, \"donation\", \"seans outpost\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "\"transactionid\" (string) The transaction id." }, { "name": "setaccount", "namespace": "Wallet", - "description": "DEPRECATED. Sets the account associated with the given address.\nExamples:\n> lbrycrd-cli setaccount \"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\" \"tabby\"\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"setaccount\", \"params\": [\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\", \"tabby\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "DEPRECATED. Sets the account associated with the given address.", "arguments": [ { "name": "lbrycrdaddress", @@ -1815,12 +2587,18 @@ "description": "The account to assign the address to.", "is_required": true } + ], + "examples": [ + { + "cli": "> lbrycrd-cli setaccount \"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\" \"tabby\"", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"setaccount\", \"params\": [\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\", \"tabby\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } ] }, { "name": "settxfee", "namespace": "Wallet", - "description": "Set the transaction fee per kB. Overwrites the paytxfee parameter.\nExamples:\n> lbrycrd-cli settxfee 0.00001\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"settxfee\", \"params\": [0.00001] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Set the transaction fee per kB. Overwrites the paytxfee parameter.", "arguments": [ { "name": "amount", @@ -1828,12 +2606,18 @@ "description": "The transaction fee in LBC/kB Result true|false (boolean) Returns true if successful", "is_required": true } + ], + "examples": [ + { + "cli": "> lbrycrd-cli settxfee 0.00001", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"settxfee\", \"params\": [0.00001] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } ] }, { "name": "signmessage", "namespace": "Wallet", - "description": "Sign a message with the private key of an address\nExamples:\nUnlock the wallet for 30 seconds\n> lbrycrd-cli walletpassphrase \"mypassphrase\" 30\n\nCreate the signature\n> lbrycrd-cli signmessage \"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\" \"my message\"\n\nVerify the signature\n> lbrycrd-cli verifymessage \"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\" \"signature\" \"my message\"\n\nAs json rpc\n> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"signmessage\", \"params\": [\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\", \"my message\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "description": "Sign a message with the private key of an address", "arguments": [ { "name": "lbrycrdaddress", @@ -1848,6 +2632,24 @@ "is_required": true } ], + "examples": [ + { + "title": "Unlock the wallet for 30 seconds", + "cli": "> lbrycrd-cli walletpassphrase \"mypassphrase\" 30" + }, + { + "title": "Create the signature", + "cli": "> lbrycrd-cli signmessage \"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\" \"my message\"" + }, + { + "title": "Verify the signature", + "cli": "> lbrycrd-cli verifymessage \"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\" \"signature\" \"my message\"" + }, + { + "title": "As json rpc", + "curl": "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"signmessage\", \"params\": [\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\", \"my message\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/" + } + ], "returns": "\"signature\" (string) The signature of the message encoded in base 64" } ]