Skip to content

Instantly share code, notes, and snippets.

@cyclux
Last active January 21, 2018 12:04
Show Gist options
  • Save cyclux/760eb64c87635e477d8954c2b5664b55 to your computer and use it in GitHub Desktop.
Save cyclux/760eb64c87635e477d8954c2b5664b55 to your computer and use it in GitHub Desktop.
IOTA address checker
/*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);
}
@cyclux
Copy link
Author

cyclux commented Oct 26, 2017

To check for addresses simply do:
node address_checker.js 0 100 YOURSEEED
Here 100 addresses get checked, starting at index 0. Can be modified to the amount needed

@cyclux
Copy link
Author

cyclux commented Oct 26, 2017

You have to adjust IOTA = require('./iota.lib.js/lib/iota'); where the actual lib is.

@cyclux
Copy link
Author

cyclux commented Oct 27, 2017

Full node can obviously be changed here:

var iotajs = new IOTA({
   'host': 'https://iota.kden.de',
   'port': 443
});```

@rocky3xr
Copy link

rocky3xr commented Dec 7, 2017

@cyclux Is it possible that another snapshot happened after 23-10-2017 ? me and a couple of mates we have a confirmed transaction that takes all the funds in the period between begining of Nov and 3 days ago, the seed have been generated by us (we discard that issue)

https://gyazo.com/8e356d4a522f727a2d9d19d01a385afa

https://gyazo.com/f3432fe65f728616dd43d54cdce5c8a1

Thanks & Regards

@cyclux
Copy link
Author

cyclux commented Jan 21, 2018

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment