On this page

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.

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.

ParameterTypeDescription
guistringInformation to identify which app, tool or product is using the API, e.g. KomodoWallet iOS 1.0.1. Helps developers identify if an issue is related to specific builds or operating systems etc.
netidintegerNework ID number, telling the Komodo DeFi Framework which network to join. 8762 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.
passphrasestringYour passphrase; this is the source of each of your coins private keys. KEEP IT SAFE!
rpc_passwordstringFor RPC requests that need authentication, this will need to match the userpass value in the request body.
allow_weak_passwordbooleanOptional, 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 &.
dbdirstringOptional, defaults to a subfolder named DB in the path of your mm2 binary. This path will store the Komodo DeFi-API database data.
rpcipstringOptional, defaults to 127.0.0.1. IP address to bind to for RPC server.
rpcportintegerOptional, defaults to 7783. Port to use for RPC communication.
rpc_local_onlybooleanOptional, defaults to true. If false the Komodo DeFi Framework 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_seedbooleanOptional, defaults to false. Runs Komodo DeFi Framework API as a seed node mode (acting as a relay for Komodo DeFi Framework API clients). Use of this mode is not reccomended on the main network (8762) 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 Framework API clients using the same netID.
seednodeslist of stringsOptional. 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_hdbooleanOptional. If true, the Komodo DeFi-API will work in only the HD mode, and coins will need to have a coin derivation path entry in the coins file for activation. Defaults to false.
message_service_cfgobjectOptional. This data is used to configure Telegram messenger alerts for swap events when running using the makerbot functionality. For more information check out the telegram alerts guide
metricsintegerOptional, defaults to 300. The interval in seconds which metrics are logged. Set to 0 to disable metrics.
prometheusportintegerOptional. Only used if you are logging metrics in Prometheus and Grafana. For more information check out the Komodo DeFi metrics guide
prometheus_credentialsintegerOptional. Only used if you are logging metrics in Prometheus and Grafana with authentication. For more information check out the Komodo DeFi metrics guide
httpsbooleanOptional. Only used with wss. Defaults to false, set to true to allow TLS/SSL enabled RPC (e.g. remote queries to a domain with a valid SSL certificate).
wss_certsobjectOptional. Contains fields for server_priv_key and certificate to allow RPC or P2P communications over TLS/SSL.
event_stream_configurationobjectOptional, a standard EventStreamConfig object. Configuration for subscribing to events.
use_\trading_\proto_\v2booleanOptional, defaults to false. If true, the Komodo DeFi-API will use the upgraded v2 trading protocol introduced in Komodo DeFi Framework v2.1.0-beta.

{
  "gui": "DEVDOCS_CLI",
  "netid": 8762,
  "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": 8762,
  "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"
}

{
  "gui": "DEVDOCS_CLI",
  "netid": 8762,
  "rpc_password": "Ent3r_Un1Qu3_Pa$$w0rd",
  "passphrase": "ENTER_UNIQUE_SEED_PHRASE_DONT_USE_THIS_CHANGE_IT_OR_FUNDS_NOT_SAFU",
  "wss_certs": {
    "server_priv_key": "/path/to/privkey.pem",
    "certificate": "/path/to/fullchain.pem"
  }

}

If you are using HD wallets, you will need to set enable_hd to true in to your MM2.json file.

Using the same seed phrase with / without setting enable_hd to true 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 enable_hd is true in your MM2.json, the first address in the wallet returns the address 0x26cE5D1cD4CC673a1b0b980371C7c862B9503452 for ETH - If the enable_hd is false (or not set), the wallet will return the address 0x8c40a6E127c7a13e26ce95deA88354C3fb134580 for ETH

{
  "gui": "DEVDOCS_CLI",
  "netid": 8762,
  "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",
  "enable_hd": true
}

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
MM_CERT_PATHstringFull path to TLS/SSL certificate file.
MM_CERT_KEY_PATHstringFull path to TLS/SSL certificate key file.

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!