0.0.4 • Published 4 years ago
bitforge v0.0.4
bitforge
craft bitcoin experiences
bitforge is primarily a utility belt to assist the creation of realistic bitcoin test cases locally using a modified regtest node.
prerequisites:
- docker
- node
usage:
npm install --save bitforge
const bitforge = require('bitforge')
bitforge.last()
// returns last block header from node
bitforge.mine(n, address)
// mines `n` number of blocks to `address`
// parameters are optional. will use default if blank
bitforge.invalidate(n)
// creates fork at block `n-1` by invalidating `n`
// `n` can be hash or number
bitforge.chooseRandom(max)
// provides random block height and hash from chain within limit
// useful for creating tests
configure
default values can be set with environment variables inside a .env file.
DEFAULT_DELAY=2000
DEFAULT_ADDRESS='1DzqBck9oyCBzxJbbje2s15deZis6BeATi'
RPC_URL='http://root:bitcoin@127.0.0.1:18332'