Skip to content
A mock implementation of RTWire's HTTP endpoints to support unit and integration testing.
Go Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


mock is a mock implementation of the RTWire HTTP endpoints that allows local unit and integration testing. Documentation of the endpoints can be found at


Go 1.7 or newer.


Build From Source – (Linux Based Systems)

  • Install Go version 1.7 or newer according to the installation instructions here:

  • Ensure GOPATH is set correctly. It's usually set to a location such as your home directory:

$ export GOPATH=[directory you choose]
  • Run the following commands to download mock, all its dependencies and install:
$ export PATH=$GOPATH/bin:$PATH
$ go get -u
$ git clone $GOPATH/src/
$ cd $GOPATH/src/
$ glide install
$ go install
  • mock will now be installed in $GOPATH/bin.

Download Binaries


You can run mock as follows:

$ ./mock

This will run a local webserver that mimics RTWire's JSON endpoints at http://localhost:8085/v1/mainnet/. See our documentation for a description of available endpoints.

  • The default port of 8085 can be changed by using the -port argument.
  • The default authentication user name and password is user and pass respectively.
  • Unlike the live API there is an extra endpoint at http://localhost:[port]/v1/mainnet/addresses/[bitcoin address]. This can be used to credit a public key hash address owned by the system.

Example (Linux Based Systems)

The following example is taken from our API walkthrough.

Start the mock service from the command line:

$ ./mock

2017/02/01 18:00:00 RTWire service running at http://localhost:8085/v1/mainnet/.

Either make the mock service run in the background (Ctrl+Z and then type bg on MacOS) or open a new command line window.

Create an account:

$ curl --user user:pass --header "Accept: application/json" --request POST --data "" http://localhost:8085/v1/mainnet/accounts/


Create an address assoicated with the account:

curl --user user:pass --header "Accept: application/json" --request POST --data "" http://localhost:8085/v1/mainnet/accounts/8674665223082153552/addresses/


Send some funds to the address. (Note that this is a mock service specific endpoint. To fund a live account you would need to send a transaction to the address from a bitcoin wallet):

url --user user:pass --header "Content-Type: application/json" --header "Accept: application/json" --request POST --data '{"value": 2000}' http://localhost:8085/v1/mainnet/addresses/1CXZFGn4jAdV7KTQvFL4FVSgSuCj2UECez

Check that the funds have been sent to account 8674665223082153552:

curl --user user:pass --header "Accept: application/json" --request GET --data '' http://localhost:8085/v1/mainnet/accounts/8674665223082153552
You can’t perform that action at this time.