Please note, this is a STATIC archive of website bitcoinsv.io from 08 Oct 2020, cach3.com does not collect or store any user information, there is no "phishing" involved.
mAPI

The following instructions describe installing mAPI using tools available in most mainstream Linux distributions. We assume you use a Bourne-like shell such as bash.

The BRFC (Bitcoin request for comment) specification can be found here.

The open source code of the reference implementation can be found here.

Support

For support and general discussion of both standard and reference implementations please join the following telegram group.

Configuration

mAPI configuration relies on a settings.conf file for the main service configurations as well as one or more fees*.json files (ex. fees.json for default fees, fees_low.json for lower fees, fees_user1.json for user1, etc.) to specify fees to be charged.

In order to sign responses, you will also need to run Miner ID and provide the endpoint to mAPI in the settings configurations.

All settings can be overwritten with environment variables

settings.conf File

Open settings.conf and edit it with your settings:

  • change httpAddress or httpsAddress to bind on specific interfaces
  • change jwtKey for tokens Generate new JWT key:

console $ node -e "console.log(require('crypto').randomBytes(32).toString('hex'));"

  • change quoteExpiryMinutes to set feeQuote expiry time
  • change count of Bitcoin nodes that mAPI is connected to as well as their respective Bitcoin RPC parameters:
  • bitcoin_count
  • bitcoin_1_host
  • bitcoin_1_port
  • bitcoin_1_username
  • bitcoin_1_password
  • change minerId_URL and minerId_alias to set URL alias of Miner ID

fees*.json Files

Please see the Fee Spec BRFC for the fees JSON format.

Build from source

Make sure you have Golang installed on your machine and the clone the repo

git clone [email protected]:bitcoin-sv/merchantapi-reference.git

Run

$ ./run.sh

Build

$ ./build.sh

Test

Run individual tests or run all tests with:

$ go test ./...

Docker

Build Image

You can build the image yourself with your own modifications or own configurations.

$ docker build . -t mapi_reference:1.1.0

Pull Image

You can also pull it from the public Docker Hub repository for mAPI here.

$ docker pull bitcoinsv/mapi:1.1.0

Run Container

Example configuration:

$ docker run -p 9004:9004 \
    -e httpAddress=:9004 \
    -e bitcoin_1_host=host.docker.internal \
    -e minerId_URL=https://host.docker.internal:9002/minerid \
    -e minerId_alias=testMiner \
    bitcoinsv/mapi:1.1.0

Example running in daemon mode:

$ docker run -p 9004:9004 \
    -e httpAddress=:9004 \
    -e bitcoin_1_host=host.docker.internal \
    -e minerId_URL=https://host.docker.internal:9002/minerid \
    -e minerId_alias=testMiner \
    --restart=always -d \
    bitcoinsv/mapi:1.1.0

Note: The settings.conf configurations will get overwritten with the above environment variables.