var usertable = users.map(function (u) { var vsBytes = Bitcoin.convert.hexToBytes(u.verificationSeed || '00000000000000000000'), offset = new Bitcoin.BigInteger.fromByteArrayUnsigned(vsBytes), key = new Bitcoin.BigInteger('' + u.tnx).multiply(twoToThe128).add(offset), pub = Bitcoin.convert.bytesToHex(new Bitcoin.Key(key).getPub()); counter = counter.add(key); return { vsHash: Bitcoin.Crypto.SHA256(u.verificationSeed), pubkey: pub }; });
db.User.find().toArray(mkrespcb(res, 400, function (users) { var twoToThe128 = new Bitcoin.BigInteger.fromByteArrayUnsigned([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), counter = new Bitcoin.BigInteger('0'); var usertable = users.map(function (u) { var vsBytes = Bitcoin.convert.hexToBytes(u.verificationSeed || '00000000000000000000'), offset = new Bitcoin.BigInteger.fromByteArrayUnsigned(vsBytes), key = new Bitcoin.BigInteger('' + u.tnx).multiply(twoToThe128).add(offset), pub = Bitcoin.convert.bytesToHex(new Bitcoin.Key(key).getPub()); counter = counter.add(key); return { vsHash: Bitcoin.Crypto.SHA256(u.verificationSeed), pubkey: pub }; }); res.json({ total: counter.toString(), users: usertable }); }));