Generating RPCs
Generate
Limited Support
Since Dash Core 0.14, this RPC is not available in the official Windows/Mac binaries. The Linux binary and binaries self-compiled (with the appropriate options) continue to support this feature. See PR #2778 for additional details.
Requires wallet support (unavailable on masternodes).
The generate
RPC mines blocks immediately (before the RPC call returns).
Parameter #1---the number of blocks to generate
Name | Type | Presence | Description |
---|---|---|---|
numblocks | number (int) | Required (exactly 1) | The number of blocks to generate. The RPC call will not return until all blocks have been generated. |
Parameter #2---the number of iterations
Name | Type | Presence | Description |
---|---|---|---|
maxtries | number (int) | Required (exactly 1) | The number of iterations to try (default = 1000000). |
Result---the generated block header hashes
Name | Type | Presence | Description |
---|---|---|---|
result | array | Required (exactly 1) | An array containing the block header hashes of the generated blocks (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 |
Example from Dash Core 0.12.2
Using regtest mode, generate 2 blocks:
dash-cli -regtest generate 2
Result:
[
"55a4c47da8151c0823eec22c41ebc6d690a0288302179625bae9eb6f36808266",
"3f07b9aa4e3bcd5518610945c4a6b32699acac71b1762605ff79ba553111fc79"
]
See also
- GenerateToAddress: mines blocks immediately to a specified address.
- GetBlockTemplate: gets a block template or proposal for use with mining software.
- GetGenerate: was removed in Dash Core 0.12.3.
- GetMiningInfo: returns various mining-related information.
- SetGenerate: was removed in Dash Core 0.12.3.
GenerateToAddress
Limited Support
Since Dash Core 0.14, this RPC is not available in the official Windows/Mac binaries. The Linux binary and binaries self-compiled (with the appropriate options) continue to support this feature. See PR #2778 for additional details.
Added in Dash Core 0.12.3 / Bitcoin Core 0.13.0
The generatetoaddress
RPC mines blocks immediately to a specified address.
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 maximum number of iterations has been reached |
Parameter #2---a transaction identifier (TXID)
Name | Type | Presence | Description |
---|---|---|---|
Address | string (base58) | Required (exactly 1) | The address that will receive the newly generated Dash |
Parameter #3---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 block header hashes
Name | Type | Presence | Description |
---|---|---|---|
result | array | Required (exactly 1) | An array containing the block header hashes of the generated blocks (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, as hex in RPC byte order |
Example from Dash Core 0.12.3
Using regtest mode, generate 2 blocks with maximal 500000 iterations:
dash-cli -regtest generatetoaddress 2 "yaQzdWrDVYGncLKSKG4bHQ\
ML9UdAe726QN" 500000
Result:
[
"34726c518d1688a9c56b3399e892089d3a639b43de194517c07da2b168a3a89c",
"1f030abe2bb323b8895542e3a85ed8386bd92c67af9d19fe9c163a4c5f5ef149"
]
See also
- Generate: mines blocks immediately (before the RPC call returns).
- GetMiningInfo: returns various mining-related information.
- GetBlockTemplate: gets a block template or proposal for use with mining software.
Updated over 4 years ago