eth_hashrate
マイニングしているノードが秒間あたりに計算するハッシュ数を返します。
パラメータ
なし
戻り値
QUANTITY
秒間あたりのハッシュ数
サンプル
code:example.sh
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_hashrate","params":[],"id":71}'
// Result
{
"id":71,
"jsonrpc": "2.0",
"result": "0x38a"
}
Infura を使用したサンプル
GET
code:infura_example_get.sh
curl https://api.infura.io/v1/jsonrpc/mainnet/eth_hashrate
POST
code:infura_example_post.sh
curl -i -X POST \
-H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"eth_hashrate","params":[],"id":1}' \
"https://mainnet.infura.io/"
RESPONSE
code:infura_response.sh
{"jsonrpc":"2.0","id":1,"result":"0x0"}
動作サンプル
実行
code:demo.js
$.get('https://api.infura.io/v1/jsonrpc/mainnet/eth_hashrate')
.then((response) => {
console.log(response)
$(document.body).append('<textarea cols="100" rows="30">' + JSON.stringify(response, null, '\t') + '</textarea>')
})
参考
https://github.com/ethresearch/en-ethereum-wiki/blob/master/json-rpc.md#eth_hashrate
https://infura.io/docs/api/get/eth_hashrate
#JSON_RPC_API
Ethereum JSON RPC API 日本語リファレンス