Created
March 9, 2018 21:25
-
-
Save jonajosejg/94f2a7e91e91d599dfeb00d9c7429197 to your computer and use it in GitHub Desktop.
Regtest Blocks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
process.title = 'bcoin'; | |
const assert = require('assert'); | |
const FullNode = require('bcoin/lib/node/fullnode'); | |
const plugin = require('bcoin/lib/wallet/plugin'); | |
const node = new FullNode({ | |
network: 'regtest', | |
db: 'memory', | |
prefix: '/home/rojikku/.bcoin', | |
apiKey: 'bikeshed', | |
nodes: '127.0.0.1', | |
port: 48444, | |
logConsole: true, | |
logLevel: 'debug', | |
env: true, | |
workers: true, | |
plugins: [plugin] | |
}); | |
process.on('unhandledRejection', (err, promise) => { | |
throw err; | |
}); | |
(async function connection() { | |
await node.open(); | |
await node.connect(); | |
await node.pool.connect(); | |
await node.pool.startSync(); | |
})().then(async function mining() { | |
const wdb = node.require('walletdb'); | |
await node.miner.addAddress(wdb.primary.getReceive()); | |
for (let i = 0; i < 1024; i++) { | |
const block = await node.miner.mineBlock(); | |
await node.chain.add(block); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment