latest contributor to this doc

Last Edit: @smk762 ,

Komodo DeFi API configuration

Komodo DeFi-API configuration parameters, along with additional runtime flags, and per-process environment variables are listed in the source code, and can be viewed by running the ./mm2 --help.


## MM2.json

When running the Komodo DeFi API via commandline with the `mm2` binary, some basic configuration parameters need to be defined in either an `MM2.json` file, or at runtime.

### Configuration Parameters

| Parameter               | Type            | Description                                                                                                                                                                                                                                                                                                                                                                                         |
| ----------------------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| gui                     | string          | Information to identify which app, tool or product is using the API, e.g. `Komodo DeFi iOS 1.0.1`. Helps developers identify if an issue is related to specific builds or operating systems etc.                                                                                                                                                                                                       |
| netid                   | integer         | Nework ID number, telling the Komodo DeFi-API which network to join. 7777 is the current main network, though alternative netids can be used for testing or "private" trades as long as seed nodes exist to support it.                                                                                                                                                                                |
| passphrase              | string          | Your passphrase; this is the source of each of your coins private keys. [**KEEP IT SAFE!**](https://www.youtube.com/watch?v=WFpxVbTqhB8)                                                                                                                                                                                                                                                            |
| rpc\_password           | string          | For RPC requests that need authentication, this will need to match the `userpass` value in the request body.                                                                                                                                                                                                                                                                                        |
| allow\_weak\_password   | boolean         | Optional, defaults to `false`. If `true`, will allow low entropy rpc\_password. If `false` rpc\_password must not have 3 of the same characters in a row, must be between 8-32 characters in length, must contain at least one of each of the following: numeric, uppercase, lowercase, special character (e.g. !#$\*). It also can not contain the word "password", or the chars `<`, `>`, or `&`. |
| dbdir                   | string          | Optional, defaults to a subfolder named `DB` in the path of your `mm2` binary. This path will store the Komodo DeFi-API database data.                                                                                                                                                                                                                                                                 |
| rpcip                   | string          | Optional, defaults to `127.0.0.1`. IP address to bind to for RPC server.                                                                                                                                                                                                                                                                                                                            |
| rpcport                 | integer         | Optional, defaults to `7783`. Port to use for RPC communication.                                                                                                                                                                                                                                                                                                                                    |
| rpc\_local\_only        | boolean         | Optional, defaults to `true`. If `false` the Komodo DeFi API will allow rpc methods sent from external IP addresses. **Warning:** Only use this if you know what you are doing, and have put the appropriate security measures in place.                                                                                                                                                               |
| i\_am\_seed             | boolean         | Optional, defaults to `false`. Runs Komodo DeFi API as a seed node mode (acting as a relay for Komodo DeFi API clients). Use of this mode is not reccomended on the main network (7777) as it could result in a pubkey ban if non-compliant. On alternative testing or private networks, at least one seed node is required to relay information to other Komodo DeFi API clients using the same netID.      |
| seednodes               | list of strings | Optional. If operating on a test or private netID, the IP address of at least one seed node is required (on the main network, these are already hardcoded)                                                                                                                                                                                                                                          |
| enable\_hd              | boolean         | Optional. If `true`, the Komodo DeFi-API will work in only the [HD mode](/atomicdex/api/v20-dev/hd_wallets_overview/), and coins will need to have a coin derivation path entry in the `coins` file for activation. Defaults to `false`.                                                                                                                                                               |
| message\_service\_cfg   | object          | Optional. This data is used to configure [Telegram](https://telegram.org/) messenger alerts for swap events when running using the [makerbot functionality](/atomicdex/api/v20/start_simple_market_maker_bot/). For more information check out the [telegram alerts guide](/atomicdex/api/v20/telegram_alerts/)                                                                                     |
| metrics                 | integer         | Optional, defaults to `300`. The interval in seconds which metrics are logged. Set to `0` to disable metrics.                                                                                                                                                                                                                                                                                       |
| prometheusport          | integer         | Optional. Only used if you are logging metrics in [Prometheus](https://prometheus.io/) and [Grafana](https://grafana.com/). For more information check out the [Komodo DeFi metrics guide](/atomicdex/tutorials/atomicdex-metrics/)                                                                                                                                                                    |
| prometheus\_credentials | integer         | Optional. Only used if you are logging metrics in [Prometheus](https://prometheus.io/) and [Grafana](https://grafana.com/) with authentication. For more information check out the [Komodo DeFi metrics guide](/atomicdex/tutorials/atomicdex-metrics/)                                                                                                                                                |

#### Example (allowing weak password):

```json
{
  "gui": "DEVDOCS_CLI",
  "netid": 7777,
  "rpc_password": "ENTER_UNIQUE_PASSWORD",
  "passphrase": "ENTER_UNIQUE_SEED_PHRASE_DONT_USE_THIS_CHANGE_IT_OR_FUNDS_NOT_SAFU",
  "allow_weak_password": true,
  "dbdir": "/path/to/DB/folder"
}

{
  "gui": "DEVDOCS_CLI",
  "netid": 7777,
  "rpc_password": "Ent3r_Un1Qu3_Pa$$w0rd",
  "passphrase": "ENTER_UNIQUE_SEED_PHRASE_DONT_USE_THIS_CHANGE_IT_OR_FUNDS_NOT_SAFU",
  "allow_weak_password": false,
  "dbdir": "/path/to/DB/folder"
}

If you are using HD wallets, you will need to add the hd_account_id value to your MM2.json file. This value will be used in the derivation path for all coins, and will take the place of the COIN_ID value in the following path: m/44'/COIN_ID'/<hd_account_id>'/CHAIN/ADDRESS_ID.

Using the same seed phrase with / without setting the hd_account_id value will result in different addresses being generated. For example, when using the seed phrase february soldier message acid member jump shadow walk novel impose puppy tornado: - If the hd_account_id value is set to 0 in MM2.json, the first address in the wallet returns the address 0x26cE5D1cD4CC673a1b0b980371C7c862B9503452 for ETH - If the hd_account_id value is not set, the wallet will return the address 0x8c40a6E127c7a13e26ce95deA88354C3fb134580 for ETH

{
  "gui": "DEVDOCS_CLI",
  "netid": 7777,
  "rpc_password": "Ent3r_Un1Qu3_Pa$$w0rd",
  "passphrase": "ENTER_UNIQUE_SEED_PHRASE_DONT_USE_THIS_CHANGE_IT_OR_FUNDS_NOT_SAFU",
  "allow_weak_password": false,
  "dbdir": "/path/to/DB/folder",
  "hd_account_id": 0
}

You can download and use this file as a starting point for your own coins file. It contains all of the coins that are currently supported by the Komodo DeFi API, and is maintained by the Komodo Platform team. The structure for adding additional coins can vary, please refer to the listing guide or contact the KomodoPlatform team for assistance.

VariableTypeDescription
MM2_CONF_PATHstringA file path to load the MM2.json configuration file. Defaults to MM2.json in the same folder as the mm2 binary.
MM_COINS_PATHstringA file path to load the coins configuration file. A comprehensive version for public use is maintained in the Komodo Platform coins github repository
MM_LOGstringA file path to store the Komodo DeFi-API logs.
USERPASSstringFor convenience, this variable can store the value of your rpc_password to be referenced in any shell scripts

Check out the rest of the Komodo DeFi API documentation for examples of how to:

If you have any questions or feedback, join us on the Komodo Platform Discord Server and tell us about your experience!