Last active
January 21, 2018 12:04
-
-
Save cyclux/760eb64c87635e477d8954c2b5664b55 to your computer and use it in GitHub Desktop.
IOTA address checker
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
/*eslint no-console: ["error", { allow: ["log", "error"] }] */ | |
'use strict'; | |
var IOTA; | |
IOTA = require('./iota.lib.js/lib/iota'); | |
var index_start = process.argv[2]; | |
var index_end = process.argv[3]; | |
var seed = process.argv[4]; | |
if (index_end == 0 || index_end == false){ | |
index_end = 50; | |
} | |
// IOTA fullnode config | |
var iotajs = new IOTA({ | |
'host': 'https://iota.kden.de', | |
'port': 443 | |
}); | |
function checkBalance(seed, index_start, index){ | |
console.log(''); | |
console.log('[CHECKING] Fullnode: ' + iotajs.host); | |
console.log('[CHECKING] Seed: ' + seed.substring(0,30) + '...'); | |
console.log('[CHECKING] Searching ' + (index - index_start) + ' addresses (starting @ ' + index_start +') ..'); | |
var index_search = index - 1; // Because index starts @ 0 | |
var options = { | |
'start': parseInt(index_start), | |
'end': parseInt(index_search), | |
'security': 2 | |
}; | |
iotajs.api.getInputs(seed, options, function(error, account) { | |
if (!error) { | |
var current_balance = parseInt(account.totalBalance); | |
var inputs = account.inputs; | |
console.log(''); | |
console.log('[RESULT] Balance (of ' + (index - index_start) + ' addresses) : ' + current_balance + ' IOTA (' + current_balance / 1000000 + ' MIOTA)'); | |
console.log('[RESULT] # of addresses with balance found: ' + inputs.length); | |
inputs.map(function(input){ | |
console.log('[RESULT] Address index #: ' + input.keyIndex + ' | balance: ' + input.balance + ' ('+ input.balance / 1000000 +' MIOTA)'); | |
}); | |
} else { | |
console.log('[RESULT] ' + error); | |
} | |
}); | |
} | |
// Init | |
if (seed == undefined || seed == false || seed == 0){ | |
console.log('No seed given. Please check your parameters..'); | |
console.log('EXAMPLE (checks 100 addresses):'); | |
console.log('node address_checker.js 0 100 999YOUR999SEED999'); | |
} else { | |
checkBalance(seed, index_start, index_end); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@rocky3xr No there was no snapshot after the last announced one (don't know the date). For further assistance please go to discord https://discordapp.com/invite/fNGZXvh