Requires wallet support.

The generate RPC nearly instantly generates PAIs.

Parameter #1—the number of blocks to generate

Name Type Presence Description
Blocks number (int) Required
(exactly 1)
The number of blocks to generate. The RPC call will not return until all blocks have been generated or the maxium number of iterations has been reached

Parameter #2—the maximum number of iterations to try

Name Type Presence Description
Maxtries number (int) Optional
(0 or 1)
The maximum number of iterations that are tried to create the requested number of blocks. Default is 1000000

Result—the generated PAI header hashes

Name Type Presence Description
result array Required
(exactly 1)
An array containing the block header hashes of the generated PAIs (may be empty if used with generate 0)

Header Hashes
string (hex) Required
(1 or more)
The hashes of the headers of the blocks generated in regtest mode, as hex in RPC byte order


Using regtest mode (also works in normal mode), generate 2 blocks:

pai-cli -regtest generate 2 500000



See also

  • GenerateToAddress: mines blocks immediately to a specified address.
  • GetMiningInfo: returns various mining-related information.
  • GetPAITemplate: gets a block template or proposal for use with mining software.