Skip to content

Instantly share code, notes, and snippets.

@kendricktan
Created August 9, 2017 06:13
Show Gist options
  • Save kendricktan/1e62495150ad236b38616d733aac4eb9 to your computer and use it in GitHub Desktop.
Save kendricktan/1e62495150ad236b38616d733aac4eb9 to your computer and use it in GitHub Desktop.
Load bitcoin /zencash wallet.dat file in javascript
fs = require('fs')
fs.readFile('/home/kendrick/.zen/wallet.dat', function (err, data) {
var re = /\x30\x81\xD3\x02\x01\x01\x04\x20(.{32})/gm
var dataHexStr = data.toString('latin1')
var privateKeys = dataHexStr.match(re)
privateKeys = privateKeys.map(x => x.replace('\x30\x81\xD3\x02\x01\x01\x04\x20', ''))
privateKeys.map(x => console.log(Buffer.from(x, 'latin1').toString('hex')))
console.log('Found ' + privateKeys.length + ' keys')
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment