Getblocktemplate doesnt yield coinbasetxn? #11061

issue milewski openend this issue on August 16, 2017
  1. milewski commented at 4:11 am on August 16, 2017: none

    Hello accordenly with the “help” getblocktemplate shows:

     0Arguments:
     11. template_request         (json object, optional) A json object in the following spec
     2     {
     3       "mode":"template"    (string, optional) This must be set to "template", "proposal" (see BIP 23), or omitted
     4       "capabilities":[     (array, optional) A list of strings
     5           "support"          (string) client side supported feature, 'longpoll', 'coinbasetxn', 'coinbasevalue', 'proposal', 'serverlist', 'workid'
     6           ,...
     7       ],
     8       "rules":[            (array, optional) A list of strings
     9           "support"          (string) client side supported softfork deployment
    10           ,...
    11       ]
    12     }
    

    however passing any of these inputs longpoll, coinbasetxn, coinbasevalue, proposal, serverlist, workid seems to change the result in anyhow…

    im trying to get the coinbasetxn but it doesnt seem to yield it doesnt matter what capabilities i fill in… any known bug here?

    Bitcoin Core version v0.14.2 (64-bit)

  2. luke-jr commented at 4:13 am on August 16, 2017: member
    Bitcoin Core does not support coinbasetxn.
  3. milewski commented at 4:19 am on August 16, 2017: none
    So the help that it yields is inaccurate? (maybe outdated?) if so there are any other tools that does it? or i have to generate by hand?
  4. luke-jr commented at 4:22 am on August 16, 2017: member

    The help doesn’t say bitcoind does anything in particular with the client capabilities list.

    At least Eloipool supports coinbasetxn, but you can also generate one using libblkmaker, the reference GBT client.

  5. milewski commented at 4:25 am on August 16, 2017: none

    Look this is the entire output from the bitcoin-core

     0help getblocktemplate
     1
     2getblocktemplate ( TemplateRequest )
     3
     4If the request parameters include a 'mode' key, that is used to explicitly select between the default 'template' request or a 'proposal'.
     5It returns data needed to construct a block to work on.
     6For full specification, see BIPs 22, 23, 9, and 145:
     7    https://github.com/bitcoin/bips/blob/master/bip-0022.mediawiki
     8    https://github.com/bitcoin/bips/blob/master/bip-0023.mediawiki
     9    https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki#getblocktemplate_changes
    10    https://github.com/bitcoin/bips/blob/master/bip-0145.mediawiki
    11
    12Arguments:
    131. template_request         (json object, optional) A json object in the following spec
    14     {
    15       "mode":"template"    (string, optional) This must be set to "template", "proposal" (see BIP 23), or omitted
    16       "capabilities":[     (array, optional) A list of strings
    17           "support"          (string) client side supported feature, 'longpoll', 'coinbasetxn', 'coinbasevalue', 'proposal', 'serverlist', 'workid'
    18           ,...
    19       ],
    20       "rules":[            (array, optional) A list of strings
    21           "support"          (string) client side supported softfork deployment
    22           ,...
    23       ]
    24     }
    25
    26
    27Result:
    28{
    29  "version" : n,                    (numeric) The preferred block version
    30  "rules" : [ "rulename", ... ],    (array of strings) specific block rules that are to be enforced
    31  "vbavailable" : {                 (json object) set of pending, supported versionbit (BIP 9) softfork deployments
    32      "rulename" : bitnumber          (numeric) identifies the bit number as indicating acceptance and readiness for the named softfork rule
    33      ,...
    34  },
    35  "vbrequired" : n,                 (numeric) bit mask of versionbits the server requires set in submissions
    36  "previousblockhash" : "xxxx",     (string) The hash of current highest block
    37  "transactions" : [                (array) contents of non-coinbase transactions that should be included in the next block
    38      {
    39         "data" : "xxxx",             (string) transaction data encoded in hexadecimal (byte-for-byte)
    40         "txid" : "xxxx",             (string) transaction id encoded in little-endian hexadecimal
    41         "hash" : "xxxx",             (string) hash encoded in little-endian hexadecimal (including witness data)
    42         "depends" : [                (array) array of numbers 
    43             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
    44             ,...
    45         ],
    46         "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
    47         "sigops" : n,                (numeric) total SigOps cost, as counted for purposes of block limits; if key is not present, sigop cost is unknown and clients MUST NOT assume it is zero
    48         "weight" : n,                (numeric) total transaction weight, as counted for purposes of block limits
    49         "required" : true|false      (boolean) if provided and true, this transaction must be in the final block
    50      }
    51      ,...
    52  ],
    53  "coinbaseaux" : {                 (json object) data that should be included in the coinbase's scriptSig content
    54      "flags" : "xx"                  (string) key name is to be ignored, and value included in scriptSig
    55  },
    56  "coinbasevalue" : n,              (numeric) maximum allowable input to coinbase transaction, including the generation award and transaction fees (in Satoshis)
    57  "coinbasetxn" : { ... },          (json object) information for coinbase transaction
    58  "target" : "xxxx",                (string) The hash target
    59  "mintime" : xxx,                  (numeric) The minimum timestamp appropriate for next block time in seconds since epoch (Jan 1 1970 GMT)
    60  "mutable" : [                     (array of string) list of ways the block template may be changed 
    61     "value"                          (string) A way the block template may be changed, e.g. 'time', 'transactions', 'prevblock'
    62     ,...
    63  ],
    64  "noncerange" : "00000000ffffffff",(string) A range of valid nonces
    65  "sigoplimit" : n,                 (numeric) limit of sigops in blocks
    66  "sizelimit" : n,                  (numeric) limit of block size
    67  "weightlimit" : n,                (numeric) limit of block weight
    68  "curtime" : ttt,                  (numeric) current timestamp in seconds since epoch (Jan 1 1970 GMT)
    69  "bits" : "xxxxxxxx",              (string) compressed target of next block
    70  "height" : n                      (numeric) The height of the next block
    71}
    72
    73Examples:
    74> bitcoin-cli getblocktemplate 
    75> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblocktemplate", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
    

    Close look to

    0"coinbasetxn" : { ... },          (json object) information for coinbase transaction
    

    Maybe it’s misleading … i have tried using the bitcoin-cli and that console inside the bitcoin-core also have tried trough json rpc but none seems to work..

  6. laanwj added the label Mining on Aug 17, 2017
  7. annanay25 commented at 7:16 pm on December 18, 2017: none

    Bitcoin does not produce the coinbasetxn for you, you will have to build it manually.

    As suggested by @luke-jr , you could check the following - bitcoin / libblkmaker. Its official and pretty simple to use.

    Or, you could also go through bitcoin’s testing framework and see how coinbase is created. Check this link for starters.

  8. MarcoFalke closed this on Aug 6, 2019

  9. DrahtBot locked this on Dec 16, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-21 09:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me