Skip to main content

generatetodescriptor

Overview

The 'generatetodescriptor' method method allows you to mine blocks immediately to a specified descriptor before the RPC call returns. This method is a crucial tool for developers looking to integrate Bitcoin transactions and operations into their applications through the CoinAPI platform.

Request

wget --no-check-certificate --quiet \
--method POST \
--timeout=0 \
--header 'Content-Type: application/json' \
--header 'accept: application/json' \
--header 'X-CoinAPI-Key: 4303fb63-adec-42dc-b571-74bc2f2a5167' \
--body-data '{"jsonrpc":"2.0","id":1,"method":"Generatetodescriptor","params": [ ]}' \
'https://bitcoin-mainnet.node.coinapi.io'

Request Parameters

  • num_blocks (numeric, required): The number of blocks to be generated immediately.
  • descriptor (string, required): The descriptor where the newly generated bitcoins will be sent to.
  • maxtries (numeric, optional, default=1000000): The number of iterations to try during the block generation process.

Response

{
"result": null,
"error": {
"code": -1,
"message": "generatetodescriptor num_blocks \"descriptor\" ( maxtries )\n\nMine to a specified descriptor and return the block hashes.\n\nArguments:\n1. num_blocks (numeric, required) How many blocks are generated.\n2. descriptor (string, required) The descriptor to send the newly generated bitcoin to.\n3. maxtries (numeric, optional, default=1000000) How many iterations to try.\n\nResult:\n[ (json array) hashes of blocks generated\n \"hex\", (string) blockhash\n ...\n]\n\nExamples:\n\nGenerate 11 blocks to mydesc\n> bitcoin-cli generatetodescriptor 11 \"mydesc\"\n"
},
"id": 1
}