Perform Proof of Work
You can perform Proof of Work(POW) operations using the following functions :
- NeonPowProvider.pow(message, targetScore).
- NodePowProvider.pow(message, targetScore).
- WasmPowProvider.pow(message, targetScore).
- LocalPow.pow(message, targetScore).
You will need to provide a block
and a targetScore
to any of these functions. If successful, they will return nonce.
Example Code
stardust/packages/iota/examples/pow/src/index.ts
loading...
Expected Output
Neon Pow
Target Score 100
Data Length 500
Iterations 1
Iteration 1
Nonce 173109
Score 118.098
Average Time (s) 0.62
Node Pow
Target Score 100
Data Length 500
Iterations 1
Iteration 1
Nonce 173109
Score 118.098
Average Time (s) 27.11
Wasm Pow
Target Score 100
Data Length 500
Iterations 1
Iteration 1
Nonce 173109
Score 118.098
Average Time (s) 25.42
Local Pow
Target Score 100
Data Length 500
Iterations 1
Iteration 1
Nonce 173109
Score 118.098
Average Time (s) 24.54
Done