Skip to content

Commit

Permalink
Update bloom filter program and add npm script for running it, includ…
Browse files Browse the repository at this point in the history
…e bloom_bitshares.dat
  • Loading branch information
svk31 committed Jan 13, 2017
1 parent 04a33aa commit d35ff7b
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 14 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bloom_filter
File renamed without changes.
Binary file added bloom_filter/bloom_bitshares.dat
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
#!/usr/bin/env node
/* eslint-disable */

// Filter BTS 0.9.2+ import keys export file so that it will include only private keys
// that may be found in the BTS 2.0 genesis block.

// Dependencies:
// ./bloom.dat (1,048,576 bytes) sha1 3cee441d8d28ab3b26aea149630fa2a96a91845c
// nodejs, npm, and: npm install coffee-script
// ./bloom_bitshares.dat (1,048,576 bytes) sha1 4d80faa41a5e868899febdc9dab48d1f2d567487992810cf0532f3c0ee2b266c
// nodejs, npm, and: npm install

/*
* ./bloom.dat is from bitshares/graphene/programs/genesis_util/create_bloom_filter.py
* The bloom filter was created with a genesis containing BTS prefixed keys. Create
* or dowload this file first.
*/

// ./bloom.dat is from bitshares/graphene/programs/genesis_util/create_bloom_filter.py
// The bloom filter was created with a genesis containing BTS prefixed keys. Create
// or dowload this file first.
// Automatic usage: name your wallet file wallet.json and run "npm start".
// Output is called "filtered_wallet.json"

// Usage: cat large_import_keys.json | node ./bloom_filter_wallet.js > filtered_import_keys.json
// Manual usage: cat large_import_keys.json | node ./bloom_filter_wallet.js > filtered_import_keys.json

var fs = require('fs')

require('coffee-script/register') // npm install coffee-script

var h = require('../web/lib/common/hash')
var key_utils = require('../web/lib/common/key_utils')
var chain_config = require('../web/lib/chain/config')

chain_config.address_prefix = "BTS"
var graphenejs = require("graphenejs-lib");
var h = graphenejs.hash;
var key_utils = graphenejs.key;

fs.readFile('bloom.dat', function (err, data) {
if (err) throw err
console.error('bloom.dat (' + data.length + ' bytes)','sha1',h.sha1(data).toString('hex'),'\n')
console.error('bloom_bitshares.dat (' + data.length + ' bytes)','sha1',h.sha1(data).toString('hex'),'\n')

var bits_in_filter = data.length * 8 // 8388608 (test data)
function in_bloom(str) {
Expand Down
Empty file.
16 changes: 16 additions & 0 deletions bloom_filter/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "bitshares-keys-bloom-filter",
"version": "1.0.0",
"description": "",
"main": "bloom_filter_wallet.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "cat wallet.json | node bloom_filter_wallet.js > filtered_wallet.json"
},
"author": "",
"license": "ISC",
"devDependencies": {
"coffee-script": "^1.12.2",
"graphenejs-lib": "^0.4.10"
}
}

0 comments on commit d35ff7b

Please sign in to comment.