coindb
v1.0.14
Published
A lightweight coin wallet database middleware on mongodb the can store millions of addresses each coin
Downloads
20
Maintainers
Readme
coindb (under development)
A simple crypto-coin data storage.
It only stores addresses and transactions.
Requirement
- Nodejs v8+
- MongoDb 3.x listening on localhost:27017
Install
npm install coindb --save
Usage
All Api endpoints returns a Promise
const CoinDb = require('coindb');
(async () => {
const coindb = await CoinDb({ id: 'bitcoin', name: 'btc', bip44: 1 });
const getwallet = await coindb.getWallet();
console.log(getwallet);
//prints { id: 'bitcoin', name: 'btc', bip44: 1 }
await coindb.importAddress('1UniBRgb1QYyvMmm6VMFyutZfPoZgPUXX', 1, 4);
const address = await coindb.getAddress('1UniBRgb1QYyvMmm6VMFyutZfPoZgPUXX');
consle.log(address)
//prints { walletId: 'bitcoinner', address: '1UniBRgb1QYyvMmm6VMFyutZfPoZgPUXL', accountId: 1, index: 4 }
})()
Test
npm test
Debug
By default, Coindb stores current process log at process.env.HOME + '/.coindb'
. Log files gets overwritten every start instance.
To output logs on your console, initiate the CoinDb with a additional true
flag.
const coindb = await CoinDb({ id: 'bitcoin', name: 'btc', bip44: 1 },true);
Api
TODO: Add more description for each endpoint