From: Chris Duncan Date: Wed, 4 Dec 2024 00:06:59 +0000 (-0800) Subject: Add block pow to test webpage. X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=814acd53c523b8d133bee3890582d6a858fd0118;p=libnemo.git Add block pow to test webpage. --- diff --git a/test.html b/test.html index 6d46a69..fe7737b 100644 --- a/test.html +++ b/test.html @@ -27,16 +27,46 @@ console.log(blakeAccount.publicKey) console.log(blakeAccount.address) - console.log('pow') - const receive = new libnemo.ReceiveBlock( - 'nano_1xmastiputrdrhnf35jdh4yj1q339tyuk86w3k6oy5knede8zfowpa1rgjpn', - '0', - 'FB0D886948EF4BBC410C0C64C16291E31AB360BEB21B338988A6C37D89C24362', - '10000000000000000000000000000', - 'nano_3rw4un6ys57hrb39sy1qx8qy5wukst1iiponztrz9qiz6qqa55kxzx4491or', - 'B320F9AD2C3341E0FA6EFAF093C2D618036D10DB800F14830A928A44B8DD265C') - let w = await receive.pow() - console.log(`pow done: ${w}`) + console.log('PoW') + let blocks = [] + console.log(`send blocks`) + now = performance.now() + for (let i = 0; i < 10; i++) { + const block = new libnemo.SendBlock( + 'nano_1xmastiputrdrhnf35jdh4yj1q339tyuk86w3k6oy5knede8zfowpa1rgjpn', + '100000000000000000000000000', + 'nano_1xmastreedxwfhpktqxppwgwwhdx1p6hiskpw7jt8g5y19khyy38axg4tohm', + '1', + 'nano_3rw4un6ys57hrb39sy1qx8qy5wukst1iiponztrz9qiz6qqa55kxzx4491or', + '4E5004CA14899B8F9AABA7A76D010F73E6BAE54948912588B8C4FE0A3B558CA5') + try { + await block.pow() + console.log(`block ${i + 1} work: ${block.work}`) + } catch (err) { + console.error(err) + } + blocks.push(block) + } + console.log(`send pow done (${performance.now() - now} ms)`) + now = performance.now() + for (let i = 0; i < 10; i++) { + const block = new libnemo.ReceiveBlock( + 'nano_1xmastiputrdrhnf35jdh4yj1q339tyuk86w3k6oy5knede8zfowpa1rgjpn', + '0', + 'FB0D886948EF4BBC410C0C64C16291E31AB360BEB21B338988A6C37D89C24362', + '1', + 'nano_3rw4un6ys57hrb39sy1qx8qy5wukst1iiponztrz9qiz6qqa55kxzx4491or', + 'B320F9AD2C3341E0FA6EFAF093C2D618036D10DB800F14830A928A44B8DD265C') + try { + await block.pow() + console.log(`block ${i + 1} work: ${block.work}`) + } catch (err) { + console.error(err) + } + blocks.push(block) + } + console.log(`receive done (${performance.now() - now} ms)`) + console.log(`pow done (${performance.now() - now} ms)`)