getblock working!

This commit is contained in:
Matias Alejo Garcia 2014-01-06 19:02:33 -03:00
parent 6f90dce4e0
commit 1c96756743
4 changed files with 16 additions and 10 deletions

View File

@ -4,5 +4,10 @@ module.exports = {
db: "mongodb://localhost/mystery-dev", db: "mongodb://localhost/mystery-dev",
app: { app: {
name: "Mystery - Development" name: "Mystery - Development"
},
bitcoind: {
user: 'mystery',
pass: 'real_mystery',
protocol: 'http',
} }
} }

View File

@ -6,7 +6,9 @@ module.exports = function(app) {
var index = require('../app/controllers/index'); var index = require('../app/controllers/index');
app.get('/', index.render); app.get('/', index.render);
//TX routes //Block routes
//
var blocks = require('model/app/controllers/blocks');
app.get('/block/:block_hash', blocks.show);
}; };

View File

@ -32,6 +32,7 @@
"postinstall": "node node_modules/bower/bin/bower install" "postinstall": "node node_modules/bower/bin/bower install"
}, },
"dependencies": { "dependencies": {
"classtool": "*",
"express": "~3.4.7", "express": "~3.4.7",
"jade": "~1.0.2", "jade": "~1.0.2",
"mongoose": "~3.8.3", "mongoose": "~3.8.3",

View File

@ -1,17 +1,15 @@
#!/usr/bin/env node #!/usr/bin/env node
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
var RpcClient = require('../node_modules/bitcore/RpcClient').class(); var RpcClient = require('../node_modules/bitcore/RpcClient').class();
var config = require('../config/config');
var block_hash = process.argv[2] || '0000000000b6288775bbd326bedf324ca8717a15191da58391535408205aada4'; var block_hash = process.argv[2] || '0000000000b6288775bbd326bedf324ca8717a15191da58391535408205aada4';
var rpc = new RpcClient({
user: 'mystery', var rpc = new RpcClient(config.bitcoind);
pass: 'real_mystery',
protocol: 'http',
});
var block = rpc.getBlock(block_hash, function(err, block) { var block = rpc.getBlock(block_hash, function(err, block) {