GithubHelp home page GithubHelp logo

isabella232 / bitcore-wallet-bdb2jsonl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bitpay/bitcore-wallet-bdb2jsonl

0.0 0.0 0.0 64.95 MB

Node C++ bindings for Bitcoin Core/Berkeley DB 4.8 wallet.dat

License: MIT License

Python 7.98% Shell 0.89% JavaScript 27.28% C++ 63.85%

bitcore-wallet-bdb2jsonl's Introduction

Purpose

To export/extract keys from a Bitcoin wallet.dat file. This module can be imported and used programmatically from another nodejs module, or you can use a convenient command line tool.

Dependencies/Prerequisties

  • C++ compiler and build tools
  • Mac/Linux (Windows not yet supported)
  • node version >= 4.x

Installation

$ npm install

Usage

The command line tool can be used as follows:

$ wallet-bdb2jsonl -f wallet.dat

Or you may load and use it as a nodejs module:

var exporter = require('bitcore-bdb2jsonl');

exporter({ filePath: './wallet.dat' }); //to stdout -or- send in your own emitter, just needs to be able to emit a data, close and error signal

var EventEmitter = require('events');

var emitter = new EventEmitter();

exporter({ filePath: './wallet.dat', emitter: emitter }); //send in an emitter
emitter.on('data', function(value) {
  console.log(value);
});
exporter.start(); //this allows the db to be opened, read, and sent out record by record
export.close(); //this will finish sending the record in progress, then close the stream out for good

To pause/resume the exporter

exporter.pause();
exporter.resume();

Implementation notes

The process doing the reading of the database is on a separate thread from the main node process (the one running your script). We can't rely on the normal reactor pattern coding when it comes to signaling the worker process. The worker process doesn't know anything about setImmediate or nextTick, etc.. This means that a start function must be explicitly called if we are going to have any chance predicting when a subsequent pause signal might be considered by the worker thread. You may call pause() before start() for the purposes of emitting one record before pausing. Calling pause() after start() will ensure that will get at least one more record (but maybe 2 or 3) before pausing. Calling resume() will pick up where things left off.

Common issues

  • If you get an error/exception about crypto support not available, then please read the following:
    • This native addon includes Berkeley DB source code compatible with Bitcoin's wallet.dat file, but it does not come with cryptography support. Government export restrictions are to blame.
    • Wallet.dat files used in older versions of Bitcoin used Berkeley DB-based crypto (such aes-cbc routines). Newer Bitcoin wallet.dat files use crypto routines provided by Openssl or Bitcoin's source code directly. So if you have an older wallet.dat file needing crypto support in Berkeley DB, then get Berkeley DB's source code from Oracle, version 4.8.x, and compile it and install it. DO NOT get source code that has 'NC' on the file name. You can also get older versions of Berkeley DB from brew or apt-get. I've added a conditional check during the build process that checks your system's library paths for "libdb_cxx-4.8.{a|so|dylib}", the build system will use your installed library before compiling the included source code.
  • This module does not handle unencrypted keys (e.g. wallet.dat files that are not encrypted). It is incredibly dangerous to store a wallet file unencrypted. Please always encrypt your wallet.dat file in Bitcoin.
  • The "master" key is always streamed out first. This allows consumers of the output to decrypt the master key with a passphrase, then decrypt each key, if desired, for verification or construction of a new transaction.

bitcore-wallet-bdb2jsonl's People

Contributors

gasteve avatar kleetus avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.