Last active
September 24, 2017 09:05
-
-
Save GpanosXP/5099e84925518d83f3767b4e61669771 to your computer and use it in GitHub Desktop.
Finds the % of non-zero value tips (unconfirmed transactions) on an IOTA full node.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var iota = new IOTA(); | |
var th, t, total, counter; | |
iota.api.getTips((error, tipHashes) => { | |
th = tipHashes; | |
console.log("Counting useful (non-zero) tips, please wait..."); | |
iota.api.getTransactionsObjects(tipHashes, (error, tips) => { | |
t = tips; | |
total = tips.length; | |
counter = 0; | |
for (var i = 0; i < total; i++) if (tips[i].value) counter++; | |
console.log("Total tips: " + total); | |
console.log("Useful tips: " + counter); | |
console.log("Useful tips percentage: " + (100 * counter / total).toFixed(3)); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment