A simple crypto-coin data storage.
It only stores addresses and transactions.
- Nodejs v8+
- MongoDb 3.x listening on localhost:27017
npm install coindb --save
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 }
})()
npm test
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);
TODO: Add more description for each endpoint