Skip to content

Commit 9158684

Browse files
committed
Merge #526: Adding RPC documentation
8572871 Cleanup RPC doc generating script (Karel Bilek) 7625ce8 RPC ToC is expanded without JS (Karel Bilek) 5c56a0f Generated RPC docs 0.16.0 (Karel Bilek) 24d6530 Add RPC doc blurb into contrib readme (Karel Bilek) b6235fc Correcting strange CSS bug with menu overlap (Karel Bilek) 2846d12 RPC doc to dev menu (Karel Bilek) b6e50f4 RPC indexes (Karel Bilek) c218e2f Style for generated RPC docs (Karel Bilek) ecf0a91 Layouts + header for generated RPC docs (Karel Bilek) c29ee3d RPC doc as a collection in config (Karel Bilek) 37c1494 Golang script for generating RPC docs (Karel Bilek) ef3cf45 Prepare JS, SASS, layout for more headers in TOC (Karel Bilek) Pull request description: I have added auto-generated RPC docs. I think the best place for Bitcoin Core documentation is Bitcoin Core website. The script is in doc-gen folder. I have reused ToC component for the RPC list; this needed some change in the javascript. I unfortunately needed to edit the minified javascript by hand (see #525) It looks fairly good in my opinion. Tree-SHA512: 0a1052248c1d8647532abd86dcaf16e39f9ff4651f6cb978b90aa1ba8e5ea33ceea199031c55fda70a7e365a43812de6c4b8dc7f7a5004beb900ac8b4223540d
2 parents cc71ae2 + 8572871 commit 9158684

File tree

122 files changed

+4005
-8
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+4005
-8
lines changed

_config.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,16 @@ defaults:
8181
layout: page
8282
lang: en
8383
share: true
84+
- scope:
85+
path: ""
86+
type: doc
87+
values:
88+
layout: doc
89+
lang: en
90+
share: true
8491

8592
collections:
8693
releases:
8794
output: true
95+
doc:
96+
output: true

_doc/en/0.16.0/index.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
name: index
3+
btcversion: 0.16.0
4+
btcgroup: index
5+
permalink: en/doc/0.16.0/
6+
---
7+
8+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: getbestblockhash
3+
btcversion: 0.16.0
4+
btcgroup: blockchain
5+
permalink: en/doc/0.16.0/rpc/blockchain/getbestblockhash/
6+
---
7+
8+
getbestblockhash
9+
10+
Returns the hash of the best (tip) block in the longest blockchain.
11+
12+
Result:
13+
"hex" (string) the block hash hex encoded
14+
15+
Examples:
16+
> bitcoin-cli getbestblockhash
17+
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getbestblockhash", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
18+
19+
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
name: getblock
3+
btcversion: 0.16.0
4+
btcgroup: blockchain
5+
permalink: en/doc/0.16.0/rpc/blockchain/getblock/
6+
---
7+
8+
getblock "blockhash" ( verbosity )
9+
10+
If verbosity is 0, returns a string that is serialized, hex-encoded data for block 'hash'.
11+
If verbosity is 1, returns an Object with information about block <hash>.
12+
If verbosity is 2, returns an Object with information about block <hash> and information about each transaction.
13+
14+
Arguments:
15+
1. "blockhash" (string, required) The block hash
16+
2. verbosity (numeric, optional, default=1) 0 for hex encoded data, 1 for a json object, and 2 for json object with transaction data
17+
18+
Result (for verbosity = 0):
19+
"data" (string) A string that is serialized, hex-encoded data for block 'hash'.
20+
21+
Result (for verbosity = 1):
22+
{
23+
"hash" : "hash", (string) the block hash (same as provided)
24+
"confirmations" : n, (numeric) The number of confirmations, or -1 if the block is not on the main chain
25+
"size" : n, (numeric) The block size
26+
"strippedsize" : n, (numeric) The block size excluding witness data
27+
"weight" : n (numeric) The block weight as defined in BIP 141
28+
"height" : n, (numeric) The block height or index
29+
"version" : n, (numeric) The block version
30+
"versionHex" : "00000000", (string) The block version formatted in hexadecimal
31+
"merkleroot" : "xxxx", (string) The merkle root
32+
"tx" : [ (array of string) The transaction ids
33+
"transactionid" (string) The transaction id
34+
,...
35+
],
36+
"time" : ttt, (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)
37+
"mediantime" : ttt, (numeric) The median block time in seconds since epoch (Jan 1 1970 GMT)
38+
"nonce" : n, (numeric) The nonce
39+
"bits" : "1d00ffff", (string) The bits
40+
"difficulty" : x.xxx, (numeric) The difficulty
41+
"chainwork" : "xxxx", (string) Expected number of hashes required to produce the chain up to this block (in hex)
42+
"previousblockhash" : "hash", (string) The hash of the previous block
43+
"nextblockhash" : "hash" (string) The hash of the next block
44+
}
45+
46+
Result (for verbosity = 2):
47+
{
48+
..., Same output as verbosity = 1.
49+
"tx" : [ (array of Objects) The transactions in the format of the getrawtransaction RPC. Different from verbosity = 1 "tx" result.
50+
,...
51+
],
52+
,... Same output as verbosity = 1.
53+
}
54+
55+
Examples:
56+
> bitcoin-cli getblock "00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09"
57+
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblock", "params": ["00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
58+
59+
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
name: getblockchaininfo
3+
btcversion: 0.16.0
4+
btcgroup: blockchain
5+
permalink: en/doc/0.16.0/rpc/blockchain/getblockchaininfo/
6+
---
7+
8+
getblockchaininfo
9+
Returns an object containing various state info regarding blockchain processing.
10+
11+
Result:
12+
{
13+
"chain": "xxxx", (string) current network name as defined in BIP70 (main, test, regtest)
14+
"blocks": xxxxxx, (numeric) the current number of blocks processed in the server
15+
"headers": xxxxxx, (numeric) the current number of headers we have validated
16+
"bestblockhash": "...", (string) the hash of the currently best block
17+
"difficulty": xxxxxx, (numeric) the current difficulty
18+
"mediantime": xxxxxx, (numeric) median time for the current best block
19+
"verificationprogress": xxxx, (numeric) estimate of verification progress [0..1]
20+
"initialblockdownload": xxxx, (bool) (debug information) estimate of whether this node is in Initial Block Download mode.
21+
"chainwork": "xxxx" (string) total amount of work in active chain, in hexadecimal
22+
"size_on_disk": xxxxxx, (numeric) the estimated size of the block and undo files on disk
23+
"pruned": xx, (boolean) if the blocks are subject to pruning
24+
"pruneheight": xxxxxx, (numeric) lowest-height complete block stored (only present if pruning is enabled)
25+
"automatic_pruning": xx, (boolean) whether automatic pruning is enabled (only present if pruning is enabled)
26+
"prune_target_size": xxxxxx, (numeric) the target size used by pruning (only present if automatic pruning is enabled)
27+
"softforks": [ (array) status of softforks in progress
28+
{
29+
"id": "xxxx", (string) name of softfork
30+
"version": xx, (numeric) block version
31+
"reject": { (object) progress toward rejecting pre-softfork blocks
32+
"status": xx, (boolean) true if threshold reached
33+
},
34+
}, ...
35+
],
36+
"bip9_softforks": { (object) status of BIP9 softforks in progress
37+
"xxxx" : { (string) name of the softfork
38+
"status": "xxxx", (string) one of "defined", "started", "locked_in", "active", "failed"
39+
"bit": xx, (numeric) the bit (0-28) in the block version field used to signal this softfork (only for "started" status)
40+
"startTime": xx, (numeric) the minimum median time past of a block at which the bit gains its meaning
41+
"timeout": xx, (numeric) the median time past of a block at which the deployment is considered failed if not yet locked in
42+
"since": xx, (numeric) height of the first block to which the status applies
43+
"statistics": { (object) numeric statistics about BIP9 signalling for a softfork (only for "started" status)
44+
"period": xx, (numeric) the length in blocks of the BIP9 signalling period
45+
"threshold": xx, (numeric) the number of blocks with the version bit set required to activate the feature
46+
"elapsed": xx, (numeric) the number of blocks elapsed since the beginning of the current period
47+
"count": xx, (numeric) the number of blocks with the version bit set in the current period
48+
"possible": xx (boolean) returns false if there are not enough blocks left in this period to pass activation threshold
49+
}
50+
}
51+
}
52+
"warnings" : "...", (string) any network and blockchain warnings.
53+
}
54+
55+
Examples:
56+
> bitcoin-cli getblockchaininfo
57+
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockchaininfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
58+
59+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: getblockcount
3+
btcversion: 0.16.0
4+
btcgroup: blockchain
5+
permalink: en/doc/0.16.0/rpc/blockchain/getblockcount/
6+
---
7+
8+
getblockcount
9+
10+
Returns the number of blocks in the longest blockchain.
11+
12+
Result:
13+
n (numeric) The current block count
14+
15+
Examples:
16+
> bitcoin-cli getblockcount
17+
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockcount", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
18+
19+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: getblockhash
3+
btcversion: 0.16.0
4+
btcgroup: blockchain
5+
permalink: en/doc/0.16.0/rpc/blockchain/getblockhash/
6+
---
7+
8+
getblockhash height
9+
10+
Returns hash of block in best-block-chain at height provided.
11+
12+
Arguments:
13+
1. height (numeric, required) The height index
14+
15+
Result:
16+
"hash" (string) The block hash
17+
18+
Examples:
19+
> bitcoin-cli getblockhash 1000
20+
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockhash", "params": [1000] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
21+
22+
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
name: getblockheader
3+
btcversion: 0.16.0
4+
btcgroup: blockchain
5+
permalink: en/doc/0.16.0/rpc/blockchain/getblockheader/
6+
---
7+
8+
getblockheader "hash" ( verbose )
9+
10+
If verbose is false, returns a string that is serialized, hex-encoded data for blockheader 'hash'.
11+
If verbose is true, returns an Object with information about blockheader <hash>.
12+
13+
Arguments:
14+
1. "hash" (string, required) The block hash
15+
2. verbose (boolean, optional, default=true) true for a json object, false for the hex encoded data
16+
17+
Result (for verbose = true):
18+
{
19+
"hash" : "hash", (string) the block hash (same as provided)
20+
"confirmations" : n, (numeric) The number of confirmations, or -1 if the block is not on the main chain
21+
"height" : n, (numeric) The block height or index
22+
"version" : n, (numeric) The block version
23+
"versionHex" : "00000000", (string) The block version formatted in hexadecimal
24+
"merkleroot" : "xxxx", (string) The merkle root
25+
"time" : ttt, (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)
26+
"mediantime" : ttt, (numeric) The median block time in seconds since epoch (Jan 1 1970 GMT)
27+
"nonce" : n, (numeric) The nonce
28+
"bits" : "1d00ffff", (string) The bits
29+
"difficulty" : x.xxx, (numeric) The difficulty
30+
"chainwork" : "0000...1f3" (string) Expected number of hashes required to produce the current chain (in hex)
31+
"previousblockhash" : "hash", (string) The hash of the previous block
32+
"nextblockhash" : "hash", (string) The hash of the next block
33+
}
34+
35+
Result (for verbose=false):
36+
"data" (string) A string that is serialized, hex-encoded data for block 'hash'.
37+
38+
Examples:
39+
> bitcoin-cli getblockheader "00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09"
40+
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockheader", "params": ["00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
41+
42+
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
name: getchaintips
3+
btcversion: 0.16.0
4+
btcgroup: blockchain
5+
permalink: en/doc/0.16.0/rpc/blockchain/getchaintips/
6+
---
7+
8+
getchaintips
9+
Return information about all known tips in the block tree, including the main chain as well as orphaned branches.
10+
11+
Result:
12+
[
13+
{
14+
"height": xxxx, (numeric) height of the chain tip
15+
"hash": "xxxx", (string) block hash of the tip
16+
"branchlen": 0 (numeric) zero for main chain
17+
"status": "active" (string) "active" for the main chain
18+
},
19+
{
20+
"height": xxxx,
21+
"hash": "xxxx",
22+
"branchlen": 1 (numeric) length of branch connecting the tip to the main chain
23+
"status": "xxxx" (string) status of the chain (active, valid-fork, valid-headers, headers-only, invalid)
24+
}
25+
]
26+
Possible values for status:
27+
1. "invalid" This branch contains at least one invalid block
28+
2. "headers-only" Not all blocks for this branch are available, but the headers are valid
29+
3. "valid-headers" All blocks are available for this branch, but they were never fully validated
30+
4. "valid-fork" This branch is not part of the active chain, but is fully validated
31+
5. "active" This is the tip of the active main chain, which is certainly valid
32+
33+
Examples:
34+
> bitcoin-cli getchaintips
35+
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getchaintips", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
36+
37+
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
name: getchaintxstats
3+
btcversion: 0.16.0
4+
btcgroup: blockchain
5+
permalink: en/doc/0.16.0/rpc/blockchain/getchaintxstats/
6+
---
7+
8+
getchaintxstats ( nblocks blockhash )
9+
10+
Compute statistics about the total number and rate of transactions in the chain.
11+
12+
Arguments:
13+
1. nblocks (numeric, optional) Size of the window in number of blocks (default: one month).
14+
2. "blockhash" (string, optional) The hash of the block that ends the window.
15+
16+
Result:
17+
{
18+
"time": xxxxx, (numeric) The timestamp for the final block in the window in UNIX format.
19+
"txcount": xxxxx, (numeric) The total number of transactions in the chain up to that point.
20+
"window_block_count": xxxxx, (numeric) Size of the window in number of blocks.
21+
"window_tx_count": xxxxx, (numeric) The number of transactions in the window. Only returned if "window_block_count" is > 0.
22+
"window_interval": xxxxx, (numeric) The elapsed time in the window in seconds. Only returned if "window_block_count" is > 0.
23+
"txrate": x.xx, (numeric) The average rate of transactions per second in the window. Only returned if "window_interval" is > 0.
24+
}
25+
26+
Examples:
27+
> bitcoin-cli getchaintxstats
28+
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getchaintxstats", "params": [2016] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
29+
30+

0 commit comments

Comments
 (0)