fcoin/examples/node.js
2017-03-24 16:26:34 -07:00

27 lines
453 B
JavaScript

'use strict';
var FullNode = require('bcoin/lib/node/fullnode');
var node = new FullNode({
network: 'testnet',
db: 'memory'
});
async function main() {
await node.open();
await node.connect();
node.on('connect', function(entry, block) {
console.log('%s (%d) added to chain.', entry.rhash(), entry.height);
});
node.on('tx', function(tx) {
console.log('%s added to mempool.', tx.txid());
});
node.startSync();
}
main();