Skip to main content

generateBlock

Overview

The 'generateBlock' method allows you to mine a block with a set of ordered transactions immediately to a specified address or descriptor before the RPC call returns. This is a powerful tool for developers looking to integrate Bitcoin mining functionalities in their applications.

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":"generateBlock","params": [ ]}
' \
'https://bitcoin-mainnet.node.coinapi.io'

Request Parameters

  • OUTPUT (Argument #1): The address or descriptor where the newly generated bitcoins will be sent to. This parameter is required.
  • TRANSACTIONS (Argument #2): A JSON array containing hex strings which are either transaction IDs or raw transactions. Transaction IDs must reference transactions currently in the mempool. All transactions must be valid and in the correct order, otherwise, the block will be rejected. This parameter is required.

Response

  • hash: A string representing the hash of the generated block.