Forrest logo
back to the bitcoin-cli tool

bitcoin-cli:tldr:9fc40

bitcoin-cli: Generate one or more blocks.
$ bitcoin-cli generate ${num_blocks}
try on your machine

The command "bitcoin-cli generate ${num_blocks}" is used in Bitcoin's command-line interface (CLI) to generate a specified number of new blocks in the blockchain.

Here's the breakdown of the command:

  • "bitcoin-cli": It refers to the command-line interface (CLI) tool provided by Bitcoin. It is used to interact with a running Bitcoin node via the command line.

  • "generate": It is a subcommand of bitcoin-cli used to generate new blocks. The generate command is also known as "mining" as it simulates the process of block creation.

  • "${num_blocks}": This is a variable that represents the number of blocks you want to generate. You need to replace "${num_blocks}" with an actual numeric value. For example, if you want to generate 5 new blocks, you can write "bitcoin-cli generate 5".

When you execute this command, your Bitcoin node will create the specified number of new blocks, adding them to the blockchain. Each new block will contain transactions, including a coinbase transaction that rewards miners with newly minted Bitcoins. The generation of blocks is a computationally intensive process that requires significant computational power (hashing power) due to the proof-of-work algorithm used by Bitcoin.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the bitcoin-cli tool