/**
* Validates that a nonce satisfies Nano proof-of-work requirements.
*
- * @param {string} work - Hexadecimal proof-of-work value
+ * @param {string} work - Hexadecimal proof-of-work value to validate
* @param {string} hash - Hexadecimal hash of previous block, or public key for new accounts
* @param {number} [threshold=0xfffffff8] - Difficulty of proof-of-work calculation
*/
<script type="module" src="https://cdn.jsdelivr.net/npm/nano-webgl-pow@1.1.1/nano-webgl-pow.js"></script>
<script type="module">
const { NanoPowGl, NanoPowGpu } = NanoPow
- const COUNT = 0xff
+ const COUNT = 0x20
let times = []
function random (size = 32) {
console.log(`%cNanoPowGpu `, 'color:green', `Calculate proof-of-work for ${COUNT} unique send block hashes`)
times = []
+ document.getElementById('output').innerHTML += `Now testing: NanoPowGpu<br/>`
for (let i = 0; i < COUNT; i++) {
const hash = random()
let work = null
console.log(`%cNanoPowGl `, 'color:green', `Calculate proof-of-work for ${COUNT} unique send block hashes`)
times = []
+ document.getElementById('output').innerHTML += `Now testing: NanoPowGl<br/>`
for (let i = 0; i < COUNT; i++) {
const hash = random()
const start = performance.now()
window.NanoWebglPow.width = 256 * Math.max(1, Math.floor(navigator.hardwareConcurrency))
window.NanoWebglPow.height = 256 * Math.max(1, Math.floor(navigator.hardwareConcurrency))
times = []
+ document.getElementById('output').innerHTML += `Now testing: nano-webgl-pow<br/>`
for (let i = 0; i < COUNT; i++) {
const hash = random()
const start = performance.now()