web3.js web3.eth.getWork
web3.eth.getWork([callback])
マイナーがマイニングを行うため、現在のブロックのハッシュ、シードハッシュ および ターゲットの境界条件を返します。
パラメータ
1. Function
オプショナル
コールバック
第一引数に error オブジェクト、第二引数に result オブジェクトが渡されます。
戻り値
Array を返す Promise
配列は次のような構造になっています。
String
32バイト
インデックス 0
現在のブロックヘッダの PoWハッシュ
String
32バイト
インデックス 1
DAG に使用されるシードハッシュ
String
32バイト
インデックス 2
ターゲットの境界条件
2^256 / diffficulty
サンプル
code:example.js
web3.eth.getWork()
.then(console.log);
[
"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"0x5EED00000000000000000000000000005EED0000000000000000000000000000",
"0xd1ff1c01710000000000000000000000d1ff1c01710000000000000000000000"
]
参考
https://web3js.readthedocs.io/en/1.0/web3-eth.html#getwork
関連
eth_getWork
#web3.js #web3.js@1.0
web3.js 日本語 API リファレンス