bitcoind-regtest
Version:
Run bitcoind in regtest mode for your own blockchain
40 lines (29 loc) • 1.61 kB
Markdown
[](https://www.npmjs.org/package/bitcoind-regtest)
[](http://travis-ci.org/fanatid/bitcoind-regtest)
[](https://coveralls.io/r/fanatid/bitcoind-regtest)
[](https://david-dm.org/fanatid/bitcoind-regtest#info=dependencies)
[](https://github.com/feross/standard)
```js
import RegtestBitcoind from 'bitcoind-regtest'
setImmediate(async () => {
let bitcoind = new RegtestBitcoind()
await bitcoind.ready
await bitcoind.generateBlocks(105)
let preload = await bitcoind.getPreload()
console.log(preload)
// {
// txId: '757f53cee55b38e564b37b7a06bc8f0758338621015b7ff02001317af0fa3b14',
// outIndex: 0,
// value: 1000000000,
// script: <Script: OP_DUP OP_HASH160 20 0x5d1ecf7e16de5ff76368d709cde74bb52dc7f3c4 OP_EQUALVERIFY OP_CHECKSIG>,
// privKey: <PrivateKey: 294d6127bdc8b6cac4137f13cae854030ef544e595e41b8519d8f6d4966d3764, network: regtest>
// }
await bitcoind.terminate()
})
```
[](https://github.com/fanatid/bitcoind-regtest/blob/master/API.md)
Code released under [the MIT license](https://github.com/fanatid/bitcoind-regtest/blob/master/LICENSE).