zcash.rpc.github.io/getblocktemplate.html

310 lines
14 KiB
HTML
Raw Normal View History

2018-03-08 17:34:40 -08:00
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=1200px, shrink-to-fit=yes">
<meta name="description" content="Bitcoin Core RPC Docs - getblocktemplate">
<meta name="author" content="">
<title>getblocktemplate - Bitcoin Core RPC Docs</title>
<!-- Bootstrap core CSS -->
<link href="./bootstrap.min.css" rel="stylesheet">
</head>
<style>
.card-body {
font-size:80%;
padding-top: 0.5em;
}
pre {
word-break: break-word;
white-space: pre-wrap;
}
</style>
<body>
<nav class="navbar navbar-dark bg-dark ">
<a class="navbar-brand" href="/">Bitcoin Core RPC docs</a>
</nav>
<main role="main" class="container-fluid" style="margin-top: 1pc;">
<div class="row">
<div class="col-8">
<h1>getblocktemplate - Bitcoin RPC</h1>
<pre>
getblocktemplate ( TemplateRequest )
2018-03-08 17:41:52 -08:00
If the request parameters include a &#39;mode&#39; key, that is used to explicitly select between the default &#39;template&#39; request or a &#39;proposal&#39;.
2018-03-08 17:34:40 -08:00
It returns data needed to construct a block to work on.
For full specification, see BIPs 22, 23, 9, and 145:
https://github.com/bitcoin/bips/blob/master/bip-0022.mediawiki
https://github.com/bitcoin/bips/blob/master/bip-0023.mediawiki
https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki#getblocktemplate_changes
https://github.com/bitcoin/bips/blob/master/bip-0145.mediawiki
Arguments:
1. template_request (json object, optional) A json object in the following spec
{
2018-03-08 17:41:52 -08:00
&#34;mode&#34;:&#34;template&#34; (string, optional) This must be set to &#34;template&#34;, &#34;proposal&#34; (see BIP 23), or omitted
&#34;capabilities&#34;:[ (array, optional) A list of strings
&#34;support&#34; (string) client side supported feature, &#39;longpoll&#39;, &#39;coinbasetxn&#39;, &#39;coinbasevalue&#39;, &#39;proposal&#39;, &#39;serverlist&#39;, &#39;workid&#39;
2018-03-08 17:34:40 -08:00
,...
],
2018-03-08 17:41:52 -08:00
&#34;rules&#34;:[ (array, optional) A list of strings
&#34;support&#34; (string) client side supported softfork deployment
2018-03-08 17:34:40 -08:00
,...
]
}
Result:
{
2018-03-08 17:41:52 -08:00
&#34;version&#34; : n, (numeric) The preferred block version
&#34;rules&#34; : [ &#34;rulename&#34;, ... ], (array of strings) specific block rules that are to be enforced
&#34;vbavailable&#34; : { (json object) set of pending, supported versionbit (BIP 9) softfork deployments
&#34;rulename&#34; : bitnumber (numeric) identifies the bit number as indicating acceptance and readiness for the named softfork rule
2018-03-08 17:34:40 -08:00
,...
},
2018-03-08 17:41:52 -08:00
&#34;vbrequired&#34; : n, (numeric) bit mask of versionbits the server requires set in submissions
&#34;previousblockhash&#34; : &#34;xxxx&#34;, (string) The hash of current highest block
&#34;transactions&#34; : [ (array) contents of non-coinbase transactions that should be included in the next block
2018-03-08 17:34:40 -08:00
{
2018-03-08 17:41:52 -08:00
&#34;data&#34; : &#34;xxxx&#34;, (string) transaction data encoded in hexadecimal (byte-for-byte)
&#34;txid&#34; : &#34;xxxx&#34;, (string) transaction id encoded in little-endian hexadecimal
&#34;hash&#34; : &#34;xxxx&#34;, (string) hash encoded in little-endian hexadecimal (including witness data)
&#34;depends&#34; : [ (array) array of numbers
n (numeric) transactions before this one (by 1-based index in &#39;transactions&#39; list) that must be present in the final block if this one is
2018-03-08 17:34:40 -08:00
,...
],
2018-03-08 17:41:52 -08:00
&#34;fee&#34;: 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&#39;t one
&#34;sigops&#34; : n, (numeric) total SigOps cost, as counted for purposes of block limits; if key is not present, sigop cost is unknown and clients MUST NOT assume it is zero
&#34;weight&#34; : n, (numeric) total transaction weight, as counted for purposes of block limits
&#34;required&#34; : true|false (boolean) if provided and true, this transaction must be in the final block
2018-03-08 17:34:40 -08:00
}
,...
],
2018-03-08 17:41:52 -08:00
&#34;coinbaseaux&#34; : { (json object) data that should be included in the coinbase&#39;s scriptSig content
&#34;flags&#34; : &#34;xx&#34; (string) key name is to be ignored, and value included in scriptSig
2018-03-08 17:34:40 -08:00
},
2018-03-08 17:41:52 -08:00
&#34;coinbasevalue&#34; : n, (numeric) maximum allowable input to coinbase transaction, including the generation award and transaction fees (in satoshis)
&#34;coinbasetxn&#34; : { ... }, (json object) information for coinbase transaction
&#34;target&#34; : &#34;xxxx&#34;, (string) The hash target
&#34;mintime&#34; : xxx, (numeric) The minimum timestamp appropriate for next block time in seconds since epoch (Jan 1 1970 GMT)
&#34;mutable&#34; : [ (array of string) list of ways the block template may be changed
&#34;value&#34; (string) A way the block template may be changed, e.g. &#39;time&#39;, &#39;transactions&#39;, &#39;prevblock&#39;
2018-03-08 17:34:40 -08:00
,...
],
2018-03-08 17:41:52 -08:00
&#34;noncerange&#34; : &#34;00000000ffffffff&#34;,(string) A range of valid nonces
&#34;sigoplimit&#34; : n, (numeric) limit of sigops in blocks
&#34;sizelimit&#34; : n, (numeric) limit of block size
&#34;weightlimit&#34; : n, (numeric) limit of block weight
&#34;curtime&#34; : ttt, (numeric) current timestamp in seconds since epoch (Jan 1 1970 GMT)
&#34;bits&#34; : &#34;xxxxxxxx&#34;, (string) compressed target of next block
&#34;height&#34; : n (numeric) The height of the next block
2018-03-08 17:34:40 -08:00
}
Examples:
2018-03-08 17:41:52 -08:00
&gt; bitcoin-cli getblocktemplate
&gt; curl --user myusername --data-binary &#39;{&#34;jsonrpc&#34;: &#34;1.0&#34;, &#34;id&#34;:&#34;curltest&#34;, &#34;method&#34;: &#34;getblocktemplate&#34;, &#34;params&#34;: [] }&#39; -H &#39;content-type: text/plain;&#39; http://127.0.0.1:8332/
2018-03-08 17:34:40 -08:00
</pre>
<hr>
<p>
This is a website, created out of frustration with uncomplete and outdated Bitcoin Core RPC documentation online.
</p>
<p>
It was inspired by <a href="http://chainquery.com/bitcoin-api">ChainQuery</a>, which seems to be abandoned. These docs are even simplier, so they can be regenerated by anyone.
</p>
<p>
Made by <a href="https://twitter.com/karel_3d">@karel_3d</a>; license of the docs is MIT (see <a href="https://github.com/bitcoin/bitcoin/">bitcoin repo</a>), license of the scripts and webpage is also MIT ((C) 2018 Karel Bilek) (<a href="https://github.com/bitcoin-rpc/bitcoin-rpc.github.io">github repo</a>)
</p>
<p>
Bitcoin version: 0.16.0.
</p>
<p>
Note that the RPC is from a regtest node (for completeness), so it includes some additional calls that a regular node doesn't have.
</p>
</div>
<div class="col-4">
<div class="card">
<div class="card-header">
Blockchain
</div>
<div class="card-body">
<a href="getbestblockhash.html">getbestblockhash</a><br>
<a href="getblock.html">getblock</a><br>
<a href="getblockchaininfo.html">getblockchaininfo</a><br>
<a href="getblockcount.html">getblockcount</a><br>
<a href="getblockhash.html">getblockhash</a><br>
<a href="getblockheader.html">getblockheader</a><br>
<a href="getchaintips.html">getchaintips</a><br>
<a href="getchaintxstats.html">getchaintxstats</a><br>
<a href="getdifficulty.html">getdifficulty</a><br>
<a href="getmempoolancestors.html">getmempoolancestors</a><br>
<a href="getmempooldescendants.html">getmempooldescendants</a><br>
<a href="getmempoolentry.html">getmempoolentry</a><br>
<a href="getmempoolinfo.html">getmempoolinfo</a><br>
<a href="getrawmempool.html">getrawmempool</a><br>
<a href="gettxout.html">gettxout</a><br>
<a href="gettxoutproof.html">gettxoutproof</a><br>
<a href="gettxoutsetinfo.html">gettxoutsetinfo</a><br>
<a href="preciousblock.html">preciousblock</a><br>
<a href="pruneblockchain.html">pruneblockchain</a><br>
<a href="savemempool.html">savemempool</a><br>
<a href="verifychain.html">verifychain</a><br>
<a href="verifytxoutproof.html">verifytxoutproof</a><br>
</div>
</div>
<br>
<div class="card">
<div class="card-header">
Control
</div>
<div class="card-body">
<a href="getmemoryinfo.html">getmemoryinfo</a><br>
<a href="help.html">help</a><br>
<a href="logging.html">logging</a><br>
<a href="stop.html">stop</a><br>
<a href="uptime.html">uptime</a><br>
</div>
</div>
<br>
<div class="card">
<div class="card-header">
Generating
</div>
<div class="card-body">
<a href="generate.html">generate</a><br>
<a href="generatetoaddress.html">generatetoaddress</a><br>
</div>
</div>
<br>
<div class="card">
<div class="card-header">
Mining
</div>
<div class="card-body">
<a href="getblocktemplate.html">getblocktemplate</a><br>
<a href="getmininginfo.html">getmininginfo</a><br>
<a href="getnetworkhashps.html">getnetworkhashps</a><br>
<a href="prioritisetransaction.html">prioritisetransaction</a><br>
<a href="submitblock.html">submitblock</a><br>
</div>
</div>
<br>
<div class="card">
<div class="card-header">
Network
</div>
<div class="card-body">
<a href="addnode.html">addnode</a><br>
<a href="clearbanned.html">clearbanned</a><br>
<a href="disconnectnode.html">disconnectnode</a><br>
<a href="getaddednodeinfo.html">getaddednodeinfo</a><br>
<a href="getconnectioncount.html">getconnectioncount</a><br>
<a href="getnettotals.html">getnettotals</a><br>
<a href="getnetworkinfo.html">getnetworkinfo</a><br>
<a href="getpeerinfo.html">getpeerinfo</a><br>
<a href="listbanned.html">listbanned</a><br>
<a href="ping.html">ping</a><br>
<a href="setban.html">setban</a><br>
<a href="setnetworkactive.html">setnetworkactive</a><br>
</div>
</div>
<br>
<div class="card">
<div class="card-header">
Rawtransactions
</div>
<div class="card-body">
<a href="combinerawtransaction.html">combinerawtransaction</a><br>
<a href="createrawtransaction.html">createrawtransaction</a><br>
<a href="decoderawtransaction.html">decoderawtransaction</a><br>
<a href="decodescript.html">decodescript</a><br>
<a href="fundrawtransaction.html">fundrawtransaction</a><br>
<a href="getrawtransaction.html">getrawtransaction</a><br>
<a href="sendrawtransaction.html">sendrawtransaction</a><br>
<a href="signrawtransaction.html">signrawtransaction</a><br>
</div>
</div>
<br>
<div class="card">
<div class="card-header">
Util
</div>
<div class="card-body">
<a href="createmultisig.html">createmultisig</a><br>
<a href="estimatefee.html">estimatefee</a><br>
<a href="estimatesmartfee.html">estimatesmartfee</a><br>
<a href="signmessagewithprivkey.html">signmessagewithprivkey</a><br>
<a href="validateaddress.html">validateaddress</a><br>
<a href="verifymessage.html">verifymessage</a><br>
</div>
</div>
<br>
<div class="card">
<div class="card-header">
Wallet
</div>
<div class="card-body">
<a href="abandontransaction.html">abandontransaction</a><br>
<a href="abortrescan.html">abortrescan</a><br>
<a href="addmultisigaddress.html">addmultisigaddress</a><br>
<a href="backupwallet.html">backupwallet</a><br>
<a href="bumpfee.html">bumpfee</a><br>
<a href="dumpprivkey.html">dumpprivkey</a><br>
<a href="dumpwallet.html">dumpwallet</a><br>
<a href="encryptwallet.html">encryptwallet</a><br>
<a href="getaccount.html">getaccount</a><br>
<a href="getaccountaddress.html">getaccountaddress</a><br>
<a href="getaddressesbyaccount.html">getaddressesbyaccount</a><br>
<a href="getbalance.html">getbalance</a><br>
<a href="getnewaddress.html">getnewaddress</a><br>
<a href="getrawchangeaddress.html">getrawchangeaddress</a><br>
<a href="getreceivedbyaccount.html">getreceivedbyaccount</a><br>
<a href="getreceivedbyaddress.html">getreceivedbyaddress</a><br>
<a href="gettransaction.html">gettransaction</a><br>
<a href="getunconfirmedbalance.html">getunconfirmedbalance</a><br>
<a href="getwalletinfo.html">getwalletinfo</a><br>
<a href="importaddress.html">importaddress</a><br>
<a href="importmulti.html">importmulti</a><br>
<a href="importprivkey.html">importprivkey</a><br>
<a href="importprunedfunds.html">importprunedfunds</a><br>
<a href="importpubkey.html">importpubkey</a><br>
<a href="importwallet.html">importwallet</a><br>
<a href="keypoolrefill.html">keypoolrefill</a><br>
<a href="listaccounts.html">listaccounts</a><br>
<a href="listaddressgroupings.html">listaddressgroupings</a><br>
<a href="listlockunspent.html">listlockunspent</a><br>
<a href="listreceivedbyaccount.html">listreceivedbyaccount</a><br>
<a href="listreceivedbyaddress.html">listreceivedbyaddress</a><br>
<a href="listsinceblock.html">listsinceblock</a><br>
<a href="listtransactions.html">listtransactions</a><br>
<a href="listunspent.html">listunspent</a><br>
<a href="listwallets.html">listwallets</a><br>
<a href="lockunspent.html">lockunspent</a><br>
<a href="move.html">move</a><br>
<a href="removeprunedfunds.html">removeprunedfunds</a><br>
<a href="rescanblockchain.html">rescanblockchain</a><br>
<a href="sendfrom.html">sendfrom</a><br>
<a href="sendmany.html">sendmany</a><br>
<a href="sendtoaddress.html">sendtoaddress</a><br>
<a href="setaccount.html">setaccount</a><br>
<a href="settxfee.html">settxfee</a><br>
<a href="signmessage.html">signmessage</a><br>
<a href="walletlock.html">walletlock</a><br>
<a href="walletpassphrase.html">walletpassphrase</a><br>
<a href="walletpassphrasechange.html">walletpassphrasechange</a><br>
</div>
</div>
<br> </div>
</div>
</main> <!-- /container -->
</body>
</html>