Merge pull request #48 from matiu/feature/v0.1.8

Feature/v0.1.8
This commit is contained in:
Mario Colque 2014-04-17 09:46:24 -03:00
commit 552f56f9ca
4 changed files with 26 additions and 8 deletions

View File

@ -99,7 +99,8 @@ If bitcoind is shutdown, *insight* needs to be stopped and restarted once bitcoi
### DB storage requirement
To store the blockchain and address related information, *insight* uses LevelDB. Two DBs are created: txs and blocks. By default these are stored on
```<insight root>/db```
```<user's home>/db```
Please note that previous version's of Insight-API store that on `<insight's root>/db`
this can be changed on config/config.js. As of February 2014, storing the livenet blockchain takes ~30GB of disk space (2GB for the testnet).

View File

@ -1,6 +1,7 @@
'use strict';
var path = require('path'),
fs = require('fs'),
rootPath = path.normalize(__dirname + '/..'),
env,
db,
@ -8,16 +9,23 @@ var path = require('path'),
b_port,
p2p_port;
function getUserHome() {
return process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME'];
}
var home = process.env.INSIGHT_DB || ( getUserHome() + '/.insight' );
if (process.env.INSIGHT_NETWORK === 'livenet') {
env = 'livenet';
db = rootPath + '/db';
db = home;
port = '3000';
b_port = '8332';
p2p_port = '8333';
}
else {
env = 'testnet';
db = rootPath + '/db/testnet';
db = home + '/testnet';
port = '3001';
b_port = '18332';
p2p_port = '18333';
@ -48,6 +56,13 @@ if (!dataDir) {
}
dataDir += network === 'testnet' ? 'testnet3' : '';
if (! fs.existsSync(db)){
console.log('## ERROR ##\n\tDB Directory "%s" not found. \n\tCreate it, move your old DB there or set the INSIGHT_DB environment variable.\n\tNOTE: In older insight-api versions, db was stored at <insight-root>/db', db);
process.exit(-1);
}
module.exports = {
root: rootPath,
publicPath: process.env.INSIGHT_PUBLIC_PATH || false,

View File

@ -30,6 +30,8 @@ var Rpc = imports.rpc || require('./Rpc'),
async = require('async'),
config = require('../config/config'),
assert = require('assert');
var db = imports.db || levelup(config.leveldb + '/txs',{maxOpenFiles: MAX_OPEN_FILES} );
var Script = require('bitcore/Script');
// This is 0.1.2 = > c++ version of base57-native

View File

@ -1,7 +1,7 @@
{
"name": "insight-bitcore-api",
"description": "An open-source bitcoin blockchain API. The Insight API provides you with a convenient, powerful and simple way to query and broadcast data on the bitcoin network and build your own services with it.",
"version": "0.1.7",
"version": "0.1.8",
"author": {
"name": "Ryan X Charles",
"email": "ryan@bitpay.com"
@ -50,13 +50,13 @@
"start": "node node_modules/grunt-cli/bin/grunt"
},
"dependencies": {
"bitcore": "git://github.com/bitpay/bitcore.git#9ef8b781826eac502783ff74b3dc2949cfc237ed",
"bitcore": "=0.1.8",
"base58-native": "0.1.2",
"async": "*",
"leveldown": "*",
"levelup": "*",
"glob": "*",
"soop": "git://github.com/gasteve/node-soop.git",
"soop": "=0.1.3",
"commander": "*",
"bignum": "*",
"express": "~3.4.7",
@ -66,8 +66,8 @@
"moment": "~2.5.0",
"sinon": "~1.7.3",
"chai": "~1.8.1",
"bufferput": "git://github.com/bitpay/node-bufferput.git",
"xmlhttprequest": "~1.6.0"
"xmlhttprequest": "~1.6.0",
"bufferput": "git://github.com/bitpay/node-bufferput.git"
},
"devDependencies": {
"grunt": "~0.4.2",