0

Both commands generate blocks, and one specifies an address, what is the usage for each? Thanks!

1

generatetoaddress generates a block using transactions from the mempool. It uses the given address for the coinbase output.

generateblock generates a block with the given transactions in the given order. It does not automatically select transactions from the mempool like generatetoaddress does.

Both RPCs are only relevant on regtest and are used for testing. generatetoaddress is generally used when any unconfirmed transactions can be included in the block. generateblock is used when only some specific transactions should be included. generatetoaddress is also used to generate coins via coinbase transactions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.