Skip to content

AugustoResende/nano-webgl-pow

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WebGL2 Nano Currency Proof of Work Generation

Javascript module to generate the proof of work value for Nano currency transactions with the GPU by using a WebGL2 fragment shader that calculates a Blake2B hash.

See the demo for a working implementation.

WebGL 2 provides bitwise operators unavailable in WebGL 1. These are required for the Blake2B calculation. As of time of writing, WebGL2 is supported in Chrome and Firefox, on desktop and Android. See the WebGL2 compatibility table for more information.

Implements

window.NanoWebglPow(hashHex, callback, progressCallback);

Due to using window.requestAnimationFrame() to prevent blocking the main thread during generation, the browser tab must remain open during generation.

  • hashHex <String> Previous Block Hash as Hex String
  • callback <Function> Function Called when work value found. Receives single string argument, work value as hex.
  • progressCallback <Function> Optional. Receives single argument: n, number of frames so far. Return true to abort.

Acknowledgements

License

MIT

About

WebGL2 Nano Currency Proof of Work Generation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 86.7%
  • HTML 13.3%