R5 Network
WebsiteR5 LabsGitHub
  • Getting Started
    • Hello & Welcome!
  • About R5
    • Overview
    • R5 Components
    • Consensus Mechanism
    • zkNet (Privacy)
  • R5 Coin
  • R5 Tokenomics
  • Tutorials & Guides
    • Connect & Use R5
      • R5 Desktop Wallet
      • MetaMask
      • Rabby Wallet
      • Coinbase Wallet
    • zkNet Web Wallet
    • R5 Desktop Wallet
      • Interface Overview
      • Send a Transaction
      • Receive a Transaction
      • Backup Your Wallet
      • Retrieve Your Private Key
    • How To: Deploy a Node
    • How To: Mine R5
    • How To: GPU Mine R5
    • How To: Build R5 From Source
    • How To: Connect Local Nodes
  • For Developers
    • R5 SDK
      • R5 Relayer
      • R5 Console
      • JS Console
      • CLI Wallet
      • SCdev
      • SSL Proxy
    • Hardware Requirements
    • R5 Testnet
    • R5 Devnet
    • Local Networks
    • JSON-RPC API
      • admin
      • debug
      • ethash
      • miner
      • net
      • r5 (eth)
      • rpc
      • txpool
      • web3
    • Indexer API
    • zkNet API
    • Node Configuration
    • Ethash-R5
    • Smart Contracts
    • Wrapped R5 (Native)
    • Tokens & NFTs
  • Bug Bounty Program
  • Resources
    • Website
    • R5 Labs
    • R5 Labs GitHub
Powered by GitBook
On this page
  • miner_getHashrate
  • miner_setEtherbase
  • miner_setExtra
  • miner_setGasLimit
  • miner_setGasPrice
  • miner_setRecommitInterval
  • miner_start
  • miner_stop
  1. For Developers
  2. JSON-RPC API

miner

The miner namespace provides RPC endpoints for controlling the mining operations on your R5 node. These endpoints allow you to start and stop the mining process, adjust mining parameters such as extra data and gas price, and monitor the current mining hashrate. They are essential for managing and optimising the node’s mining performance.


miner_getHashrate

Description: Returns the current mining hashrate of the node as a hexadecimal string, representing the number of hashes computed per second.

Sample Request:

{
  "jsonrpc": "2.0",
  "method": "miner_getHashrate",
  "params": [],
  "id": 1
}

Expected Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x12"  // Example: 18 in hexadecimal
}

Parameters: None.


miner_setEtherbase

Description: Sets the Etherbase (coinbase) address for the miner. This address will receive the mining rewards.

Sample Request:

{
  "jsonrpc": "2.0",
  "method": "miner_setEtherbase",
  "params": ["0x288be778b666ed006357ce12f455fbb3c7d0ec94"],
  "id": 1
}

Expected Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}

Parameters:

  • address (string): The hexadecimal address to set as the Etherbase. &#xNAN;Example: "0x288be778b666ed006357ce12f455fbb3c7d0ec94".


miner_setExtra

Description: Sets the extra data field that will be included in mined block headers. This field can be used to include custom data or miner identification.

Sample Request:

{
  "jsonrpc": "2.0",
  "method": "miner_setExtra",
  "params": ["0x5265565734"],  // Example extra data in hex
  "id": 1
}

Expected Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}

Parameters:

  • extra (string): A hexadecimal string representing the extra data to be embedded in block headers. &#xNAN;Example: "0x5265565734".


miner_setGasLimit

Description: Sets the gas limit that will be used when mining new blocks. This parameter can control the maximum gas per block that the miner is willing to include.

Sample Request:

{
  "jsonrpc": "2.0",
  "method": "miner_setGasLimit",
  "params": ["0x7a1200"],
  "id": 1
}

Expected Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}

Parameters:

  • gasLimit (string): The gas limit for mining blocks, represented as a hexadecimal string. &#xNAN;Example: "0x7a1200".


miner_setGasPrice

Description: Sets the gas price (in wei) that the miner will use for including transactions in blocks.

Sample Request:

{
  "jsonrpc": "2.0",
  "method": "miner_setGasPrice",
  "params": ["0x4a817c800"],
  "id": 1
}

Expected Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}

Parameters:

  • gasPrice (string): The gas price in wei, represented as a hexadecimal string. &#xNAN;Example: "0x4a817c800" (which is 20 Gwei).


miner_setRecommitInterval

Description: Sets the interval (in seconds or blocks, as defined by the implementation) at which the miner recommits work. This can be used to adjust how frequently the mining work is updated.

Sample Request:

{
  "jsonrpc": "2.0",
  "method": "miner_setRecommitInterval",
  "params": [10],
  "id": 1
}

Expected Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "Recommit interval set to 10."
}

Parameters:

  • interval (number): The recommit interval value. The unit (seconds or blocks) depends on the node configuration. &#xNAN;Example: 10.


miner_start

Description: Starts the mining process on the node using the configured parameters. The node will begin performing proof-of-work calculations to mine new blocks.

Sample Request:

{
  "jsonrpc": "2.0",
  "method": "miner_start",
  "params": [2],
  "id": 1
}

Expected Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}

Parameters:

  • threads (number): The number of mining threads (workers) to run. &#xNAN;Example: 2.


miner_stop

Description: Stops the mining process on the node, halting proof-of-work calculations and block production.

Sample Request:

{
  "jsonrpc": "2.0",
  "method": "miner_stop",
  "params": [],
  "id": 1
}

Expected Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}

Parameters: None.

PreviousethashNextnet

Last updated 2 months ago