Public | Automated Build

Last pushed: 7 months ago
Short Description
One click bitcoin test server for your app
Full Description

Bitcoin regtest

Aka regtest mode is
an environment where you can easily issue new bitcoins perform transactions

This is extremely helpful to be used as mock to create integration tests for
your bitcoin application.

This image provides a way of building a docker image for your needs. It creates several bitcoind instances
running in regtest mode and connects each other into a single network.

Each daemon provides their own JSON-RPC port in order to support mimic of several wallets/users.

Using the image


npm install

This step is optional - generated users.json is already included with the source files.

node generate config [number] [startPort]

this will create users.json file which is used for further configuration.
It specifies test user names and JSON-RPC port for sending commands on their behalf.
Each user will have their own bitcoind process in a single container.

After this step you can edit generated users.json file if required.

node generate

Creates Dockerfile, main script for the image - run_servers, several cli/user* scripts to call
bitcoin commands on a user behalf. And bitcoin config dir for using by bitcoind servers.

Build and install image to your docker environment


Running the container


Since this all is about testing, it would be good to clean up to refresh
environment for subsequent tests:


This opearations could be also easily done using mupliple docker
availiable whithin your test suites.

Connecting to the container

Use scripts generated by generate to run bit coin commands. E.g.

$ cli/user1 generate 101
# ...
$ cli/user3 listreceivedbyaddress 0 true
    "address": "mwXtxU5AFw8T88SggNYGrR5CXxqajdEc2t",
    "account": "",
    "amount": 0.00000000,
    "confirmations": 0,
    "label": "",
    "txids": [
$ cli/user1 sendtoaddress mwXtxU5AFw8T88SggNYGrR5CXxqajdEc2t 5
$ cli/user3 listreceivedbyaddress 0 true
    "address": "mwXtxU5AFw8T88SggNYGrR5CXxqajdEc2t",
    "account": "",
    "amount": 5.00000000,
    "confirmations": 0,
    "label": "",
    "txids": [

That's it user3 has received 5 BTC generated by user1 on to his address.

(c) 2015-2016 Alexey Lunacharsky

Docker Pull Command
Source Repository

Comments (0)