bitcoind - Which rpc command is used when solo mining to submit successful hash

bitcoind – Which rpc command is used when solo mining to submit successful hash

 

Q1. Is the command bitcoin-cli submitheader or bitcoin-cli submitblock ?

Blocks are more than just a header, they contain transactions too. submitheader just takes a header, not the transactions. So it is not sufficient to just submit the header in order to relay a block to the network. Thus the correct RPC is submitblock.

As far as I can tell, submitheader does not actualy send the header to any peers either, while submitblock will.

Q2. Whatever the answer is in Q1, is the data to be passed to be formated within " " (double quotes) or can it be passed without the need of " " (double quotes).

If you are using a typical shell, it does not matter. If you are doing it programatically, then do not use double quotes.

bitcoind expects the argument to either RPC to be a string, although it is not receiving the string directly from your shell but rather via HTTP from bitcoin-cli. bitcoin-cli will take the string as provided by the shell and format it for use in the JSON-RPC protocol bitcoind uses. If you are writing a program, you need to follow the JSON-RPC protocol for how to format data.

But when using bitcoin-cli, it takes strings as provided by the shell. As the argument to both submitblock and submitheader is a hexadecimal string, there is no need to use any form of quotes (either single ' or double ") as there are no special characters in hex strings that shells would need to escape or otherwise be informed to not interpret. However, single or double quoting the string is completely harmless because shells will interpret those quotes and remove them before providing the string to bitcoin-cli.



Source link

Leave a Comment

Your email address will not be published. Required fields are marked *