Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
takah committed Feb 14, 2016
0 parents commit e9f0e9e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/images
/node_modules
24 changes: 24 additions & 0 deletions generator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
var bitcore = require('bitcore');
var QRCode = require('qrcode');
var fs = require('fs');
var sprintf = require('sprintf-js').sprintf;

fs.mkdirSync('images');

for (var i=1; i<101; i++) {
var serial_num = sprintf('%05d', i);
var privateKey = new bitcore.PrivateKey();
var address = privateKey.toAddress();
console.log(serial_num + ', ' + address.toString() + ', ' + privateKey.toString());
generate(address, serial_num);
}

function generate(address, serial_num) {
QRCode.draw(address.toString(), function(error, canvas) {
var out = fs.createWriteStream('images/qrcode_' + serial_num + '.png');
var stream = canvas.pngStream();
stream.on('data', function(chunk) {
out.write(chunk);
});
});
}

0 comments on commit e9f0e9e

Please sign in to comment.