1.0.22 • Published 7 years ago
curl.lib.js v1.0.22
curl.lib.js
IOTA Proof-of-Work algorithm ported to Javascript to work in WebGL2-enabled browsers
build
npm install
npm run compile
usage
An example of the usage of curl.lib.js:
var curl = require('curl.lib.js');
var minWeight = 18;
curl.pow({trytes: myTryteString, minWeight})
.then((nonce) =>{
console.log(myTryteString.substr(0, 2187-81).concat(nonce));
}).catch((error) => {
/*
woops.
maybe your trits were bad,
or your minWeightMagnitude was bad.
Perhaps you need to take a long introspection,
or just
*/
console.log(error);
});
Available functions:
pow({trytes, minWeight})
- gets the proof-of-work on a transaction
- possible errors:
- Webgl2 wasn't available
- Transaction Trits were wrong length
- Min Weight Magnitude was greater than Hash length (243)
setOffset(offset<int >0>)
- sets an offset to start pow search from
- useful for amortized proof of work
getHashCount()
- returns the number of concurrent hash rows copmleted by this worker
interrupt(void)
- interrupts the currently running proof-of-work function
resume(void)
- continues the proof-of-work that you just interrupted
remove(void)
- removes the proof-of-work job that you had previously queued
overrideAttachToTangle(api)
- overrides attachToTangle for iota.lib.js api object
In Browser
Include dist/curl.min.js
in your browser, and you'll find the curl
object
available in the window space.
To Do
- Improve speed
- Find out some way to perform iterative loops on Fragment Shader when each step needs to know the output of the last from a separate index (i,e. hacked-together compute shader).
1.0.22
7 years ago
1.0.21
7 years ago
1.0.20
7 years ago
1.0.19
7 years ago
1.0.18
7 years ago
1.0.17
7 years ago
1.0.16
7 years ago
1.0.15
7 years ago
1.0.14
7 years ago
1.0.13
7 years ago
1.0.12
7 years ago
1.0.10
7 years ago
1.0.9
7 years ago
1.0.8
7 years ago
1.0.7
7 years ago
1.0.6
7 years ago
1.0.5
7 years ago
1.0.4
7 years ago
1.0.3
7 years ago
1.0.2
7 years ago