Skip to content

Instantly share code, notes, and snippets.

@vidul-nikolaev-petrov
Last active June 14, 2017 02:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vidul-nikolaev-petrov/d59f9fc026456a2b08062eb867391de1 to your computer and use it in GitHub Desktop.
Save vidul-nikolaev-petrov/d59f9fc026456a2b08062eb867391de1 to your computer and use it in GitHub Desktop.
Simulate BTC balance
#!/usr/bin/env node
var blockexplorer = require('blockchain.info/blockexplorer')
// randomly chosen
var addresses = [
'1CEDQ9Vfq8pYVi3Anp926Zjac9Xiz394Y1',
'1CGXTwzjTHbUJXLAvWB4r7L2QLctEpWjti',
'1DUb2YYbQA1jjaNYzVXLZ7ZioEhLXtbUru',
'1Hz96kJKF2HLPGY15JWLB5m9qGNxvt8tHJ',
'3K34VEacgVG2tHJ7pb24jACJuLtpB3TDs2',
];
var promises = addresses.map(blockexplorer.getAddress);
Promise.all(promises).then(
data => console.log(data.reduce((a, e) => a += e.final_balance / 1e8, 0))
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment