Giter Club home page Giter Club logo

btc-address-import's Introduction

BTC Address Import and Export Tools

Use the shell script on MacOS is nice

$ ./node-btc-address.sh

Use the javascript

Btc Address Export means ([Btc Node] -> [LocalDb File]) from Btc node to local db file.

Btc Address Import means ([LocalDb File] -> [Btc Node]) from local db file to Btc node.

We have three main function:

  1. Export: [Btc Node] -> [LocalDb File]
  2. Import: [LocalDb File] -> [Btc Node]
  3. Show: Show addresses and timestamp in local db file.

How to get the tools

$ git clone https://github.com/molin0000/btc-address-import.git
$ cd btc-address-import
$ npm install
$ node index.js

Step 1: Edit the coinNodeConfig.json File.

{
  "url":"127.0.0.1:8332",
  "network":"mainnet",
  "username":"",
  "password":""
}

As above the url is btc node's address and port.

The network fill mainnet or testnet.

And fill the username and password of btc node rpc.

Step 2: Try to Export from an exist btc node.

Use the command below to export addresses to local db file.

$ node -t export -f test.db

start
Using database file: /Users/molin/workspace/btc-address-import/test.db
[ [ [ '12KB7eQnfi3frX4fxA2NtCS1KzhDL75DBg', 0.01, '' ] ],
  [ [ '14p1T4TqKzUDhbe4YjLUwKWp2vprWH6VBS', 0.0072349, '' ] ],
  [ [ '1D1pqFX6zm9rVEwquZbdmHwAYYeCCVm6dE',
      0.0236448,
      'walletaddr_30release' ] ],
  [ [ '1FZeVAnjdTK4Upu3b1CjhvwkrgfzvF6YUS', 0.0106125, '' ] ],
  [ [ '1Gisb7SesumKajcF7NTxA8QvDwnvQykiiX', 0.01, '' ] ],
  [ [ '1H5LY3EK2s6wB4YPwUjai6bqixhFPB9tTh', 0.0098223, '' ] ],
  [ [ '1LcyJgYXRBNE8hTVrj3ef5p8rGdNApxLRf', 0.01, '' ] ] ]
Addres count in db: 0
Address [{"address":"12KB7eQnfi3frX4fxA2NtCS1KzhDL75DBg","time":1534000000,"meta":{"revision":0,"created":1541406400337,"version":0},"$loki":1}] added into database.
Address [{"address":"14p1T4TqKzUDhbe4YjLUwKWp2vprWH6VBS","time":1534000000,"meta":{"revision":0,"created":1541406400337,"version":0},"$loki":2}] added into database.
Address [{"address":"1D1pqFX6zm9rVEwquZbdmHwAYYeCCVm6dE","time":1534000000,"meta":{"revision":0,"created":1541406400338,"version":0},"$loki":3}] added into database.
Address [{"address":"1FZeVAnjdTK4Upu3b1CjhvwkrgfzvF6YUS","time":1534000000,"meta":{"revision":0,"created":1541406400338,"version":0},"$loki":4}] added into database.
Address [{"address":"1Gisb7SesumKajcF7NTxA8QvDwnvQykiiX","time":1534000000,"meta":{"revision":0,"created":1541406400338,"version":0},"$loki":5}] added into database.
Address [{"address":"1H5LY3EK2s6wB4YPwUjai6bqixhFPB9tTh","time":1534000000,"meta":{"revision":0,"created":1541406400338,"version":0},"$loki":6}] added into database.
Address [{"address":"1LcyJgYXRBNE8hTVrj3ef5p8rGdNApxLRf","time":1534000000,"meta":{"revision":0,"created":1541406400355,"version":0},"$loki":7}] added into database.
export finish!

Step 3: Show and View the addresses in local db file.

$ node index.js -t show -f test.db

start
Using database file: /Users/molin/workspace/btc-address-import/test.db
Addres count in db: 7
{ address: '12KB7eQnfi3frX4fxA2NtCS1KzhDL75DBg',
  time: 1534000000,
  meta: { revision: 0, created: 1541406400337, version: 0 },
  '$loki': 1 }
{ address: '14p1T4TqKzUDhbe4YjLUwKWp2vprWH6VBS',
  time: 1534000000,
  meta: { revision: 0, created: 1541406400337, version: 0 },
  '$loki': 2 }
{ address: '1D1pqFX6zm9rVEwquZbdmHwAYYeCCVm6dE',
  time: 1534000000,
  meta: { revision: 0, created: 1541406400338, version: 0 },
  '$loki': 3 }
{ address: '1FZeVAnjdTK4Upu3b1CjhvwkrgfzvF6YUS',
  time: 1534000000,
  meta: { revision: 0, created: 1541406400338, version: 0 },
  '$loki': 4 }
{ address: '1Gisb7SesumKajcF7NTxA8QvDwnvQykiiX',
  time: 1534000000,
  meta: { revision: 0, created: 1541406400338, version: 0 },
  '$loki': 5 }
{ address: '1H5LY3EK2s6wB4YPwUjai6bqixhFPB9tTh',
  time: 1534000000,
  meta: { revision: 0, created: 1541406400338, version: 0 },
  '$loki': 6 }
{ address: '1LcyJgYXRBNE8hTVrj3ef5p8rGdNApxLRf',
  time: 1534000000,
  meta: { revision: 0, created: 1541406400355, version: 0 },
  '$loki': 7 }
show finish

You can manually change the db file by any text editor in json language.

Step 4: Import from the db file to btc node.

$ node index.js -t import -f testnet.db

start
Using database file: /Users/molin/workspace/btc-address-import/testnet.db
total count:1
[ { scriptPubKey: { address: 'mzdneiM8dMSqw2mX8GQQo2aR63wG78EG6B' },
    timestamp: 1539000000,
    label: 'walletaddr_30release' } ]
importAllBtcAddressFromDb finish!
import finish!

btc-address-import's People

Contributors

lolieatcat avatar

Watchers

 avatar

Forkers

wanchain

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.