Bitcoin 101 generate coins error

PS C:\Program Files\Bitcoin\daemon> ./bitcoin-cli -regtest generate 1
error code: -32
error message:
The wallet generate rpc method is deprecated and will be fully removed in v0.19. To use generate in v0.18, restart bitcoind with -deprecatedrpc=generate.
Clients should transition to using the node rpc method generatetoaddress

What do I do?

1 Like

Seems like they have changed the command, now you have to specify which address should get the block reward (freshly minted coins).

  1. To generate a new address use ./bitcoin-cli -regtest getnewaddress
  2. Copy the address that gets generated
  3. Then run ./bitcoin-cli -regtest generatetoaddress 1 (paste address you copied).

Now that address you generated will get freshly minted coins from the block reward.

Hope this works!

4 Likes

Please check this solution as an alternative way to make the old method work:

However, it’s better that you learn the new way that I described above as this old method will be completely disabled in the future, we will update the course soon to only include generatetoaddress command.

1 Like