GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • etclabscore/core-geth
  • CoreGeth
  • JSON RPC API
  • Core
  • Developers
  • Getting started
  • Postmortems
  • Tutorials
  • OpenRPC Discovery
  • "trace" Module Overview
  • Admin
  • Debug
  • Eth
  • Ethash

This view

  • Original page
  • New address

GeezerVison is showing etclabscore.github.io — Ethash - CoreGeth Documentation

Ethash

Entity Version
Source 1.12.14-unstable/generated-at:2023-09-04T08:02:34-06:00
OpenRPC 1.2.6

ethash_getHashrate¶

GetHashrate returns the current hashrate for local CPU miner and remote miner.

Params (0)¶

None

Result¶

uint64

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of the integer`
- pattern: `^0x[a-fA-F0-9]+$`
- title: `integer`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of the integer",
    "pattern": "^0x[a-fA-F0-9]+$",
    "title": "integer",
    "type": [
        "string"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "ethash_getHashrate", "params": []}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "ethash_getHashrate", "params": []}'
Javascript Console
1
ethash.getHashrate();
Source code

1
2
3
func (api *API) GetHashrate() uint64 {
    return uint64(api.ethash.Hashrate())
}// GetHashrate returns the current hashrate for local CPU miner and remote miner.
View on GitHub →


ethash_getWork¶

GetWork returns a work package for external miner.

The work package consists of 3 strings:

result[0] - 32 bytes hex encoded current block header pow-hash
result[1] - 32 bytes hex encoded seed hash used for DAG
result[2] - 32 bytes hex encoded boundary condition ("target"), 2^256/difficulty
result[3] - hex encoded block number

Params (0)¶

None

Result¶

num4string [4]string

  • Required: ✓ Yes
Schema
1
2
3
4
5
6
7
8
- items: 

        - type: string


- maxItems: `4`
- minItems: `4`
- type: array
Raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
{
    "items": [
        {
            "type": [
                "string"
            ]
        }
    ],
    "maxItems": 4,
    "minItems": 4,
    "type": [
        "array"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "ethash_getWork", "params": []}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "ethash_getWork", "params": []}'
Javascript Console
1
ethash.getWork();
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
func (api *API) GetWork() ([4]string, error) {
    if api.ethash.remote == nil {
        return [4]string{}, errors.New("not supported")
    }
    var (
        workCh  = make(chan [4]string, 1)
        errc    = make(chan error, 1)
    )
    select {
    case api.ethash.remote.fetchWorkCh <- &sealWork{errc: errc, res: workCh}:
    case <-api.ethash.remote.exitCh:
        return [4]string{}, errEthashStopped
    }
    select {
    case work := <-workCh:
        return work, nil
    case err := <-errc:
        return [4]string{}, err
    }
}// GetWork returns a work package for external miner.
//
// The work package consists of 3 strings:
//
//  result[0] - 32 bytes hex encoded current block header pow-hash
//  result[1] - 32 bytes hex encoded seed hash used for DAG
//  result[2] - 32 bytes hex encoded boundary condition ("target"), 2^256/difficulty
//  result[3] - hex encoded block number
View on GitHub →


ethash_submitHashrate¶

SubmitHashrate can be used for remote miners to submit their hash rate. This enables the node to report the combined hash rate of all miners which submit work through this node.

It accepts the miner hash rate and an identifier which must be unique between nodes.

Params (2)¶

Parameters must be given by position.

1: rate hexutil.Uint64

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of a uint64`
- pattern: `^0x([a-fA-F\d])+$`
- title: `uint64`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a uint64",
    "pattern": "^0x([a-fA-F\\d])+$",
    "title": "uint64",
    "type": [
        "string"
    ]
}

2: id common.Hash

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of a Keccak 256 hash`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a Keccak 256 hash",
    "pattern": "^0x[a-fA-F\\d]{64}$",
    "title": "keccak",
    "type": [
        "string"
    ]
}

Result¶

bool

  • Required: ✓ Yes

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "ethash_submitHashrate", "params": [<rate>, <id>]}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "ethash_submitHashrate", "params": [<rate>, <id>]}'
Javascript Console
1
ethash.submitHashrate(rate,id);
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
func (api *API) SubmitHashrate(rate hexutil.Uint64, id common.Hash) bool {
    if api.ethash.remote == nil {
        return false
    }
    var done = make(chan struct{}, 1)
    select {
    case api.ethash.remote.submitRateCh <- &hashrate{done: done, rate: uint64(rate), id: id}:
    case <-api.ethash.remote.exitCh:
        return false
    }
    <-done
    return true
}// SubmitHashrate can be used for remote miners to submit their hash rate.
// This enables the node to report the combined hash rate of all miners
// which submit work through this node.
//
// It accepts the miner hash rate and an identifier which must be unique
// between nodes.
View on GitHub →


ethash_submitWork¶

SubmitWork can be used by external miner to submit their POW solution. It returns an indication if the work was accepted. Note either an invalid solution, a stale work a non-existent work will return false.

Params (3)¶

Parameters must be given by position.

1: nonce types.BlockNonce

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of the integer`
- pattern: `^0x[a-fA-F0-9]+$`
- title: `integer`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of the integer",
    "pattern": "^0x[a-fA-F0-9]+$",
    "title": "integer",
    "type": [
        "string"
    ]
}

2: hash common.Hash

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of a Keccak 256 hash`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a Keccak 256 hash",
    "pattern": "^0x[a-fA-F\\d]{64}$",
    "title": "keccak",
    "type": [
        "string"
    ]
}

3: digest common.Hash

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of a Keccak 256 hash`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a Keccak 256 hash",
    "pattern": "^0x[a-fA-F\\d]{64}$",
    "title": "keccak",
    "type": [
        "string"
    ]
}

Result¶

bool

  • Required: ✓ Yes

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "ethash_submitWork", "params": [<nonce>, <hash>, <digest>]}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "ethash_submitWork", "params": [<nonce>, <hash>, <digest>]}'
Javascript Console
1
ethash.submitWork(nonce,hash,digest);
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
func (api *API) SubmitWork(nonce types.BlockNonce, hash, digest common.Hash) bool {
    if api.ethash.remote == nil {
        return false
    }
    var errc = make(chan error, 1)
    select {
    case api.ethash.remote.submitWorkCh <- &mineResult{nonce: nonce, mixDigest: digest, hash: hash, errc: errc}:
    case <-api.ethash.remote.exitCh:
        return false
    }
    err := <-errc
    return err == nil
}// SubmitWork can be used by external miner to submit their POW solution.
// It returns an indication if the work was accepted.
// Note either an invalid solution, a stale work a non-existent work will return false.
View on GitHub →



Last update: 2025-01-20
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.