Skip to content

Commit

Permalink
Merge f4e23d5 into 75c7103
Browse files Browse the repository at this point in the history
  • Loading branch information
smk762 authored Nov 17, 2024
2 parents 75c7103 + f4e23d5 commit 3963166
Show file tree
Hide file tree
Showing 16 changed files with 61 additions and 60 deletions.
6 changes: 3 additions & 3 deletions src/data/sidebar.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@
"href": "/komodo-defi-framework/tutorials/api-docker-telegram/"
},
{
"title": "Compile MM2 from Source",
"title": "Compile KDF from Source",
"href": "/komodo-defi-framework/tutorials/how-to-compile-mm2-from-source/"
},
{
"title": "How to Query the MM2 SQLite Database",
"title": "How to Query the KDF SQLite Database",
"href": "/komodo-defi-framework/tutorials/query-the-mm2-database/"
},
{
Expand Down Expand Up @@ -331,7 +331,7 @@
"href": "/komodo-wallet/desktop/access-log-files/"
},
{
"title": "Send Commands to an MM2 Instance Being Run by Komodo Wallet using Postman",
"title": "Send Commands to an KDF Instance Being Run by Komodo Wallet using Postman",
"href": "/komodo-wallet/desktop/send-commands-to-mm2-instance/"
}
]
Expand Down
1 change: 1 addition & 0 deletions src/pages/komodo-defi-framework/api/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Below is a table of the currently available legacy, v2.0 and v2.0 (Dev) methods:
| [get\_relay\_mesh](/komodo-defi-framework/api/legacy/get_relay_mesh/#get-relay-mesh) | | |
| | [get\_staking\_infos](/komodo-defi-framework/api/v20/get_staking_infos/#get-staking-infos) | |
| [get\_trade\_fee](/komodo-defi-framework/api/legacy/get_trade_fee/#get-trade-fee) | | |
| | [get\_wallet\_names](/komodo-defi-framework/api/v20/get_wallet_names/#get-wallet-names) | |
| [import\_swaps](/komodo-defi-framework/api/legacy/import_swaps/#import-swaps) | | |
| [kmd\_rewards\_info](/komodo-defi-framework/api/legacy/kmd_rewards_info/#kmd-rewards-info) | | |
| | | [lightning::nodes::add\_trusted\_node](/komodo-defi-framework/api/v20-dev/lightning/nodes/#add-trusted-node) |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export const title = "Komodo DeFi Framework Method: Add Node to Version Stat";
export const description = "The add_node_to_version_stat method adds a Node's name, IP address and PeerID to a local database to track which version of MM2 it is running.";
export const description = "The add_node_to_version_stat method adds a Node's name, IP address and PeerID to a local database to track which version of KDF it is running.";

# add\_node\_to\_version\_stat

The `add_node_to_version_stat` method adds a Node's name, IP address and PeerID to a local database to track which version of MM2 it is running. The name parameter is an arbitrary identifying string, such as "seed\_alpha" or "dragonhound\_DEV". The address parameter is the node's IP address or domain names. The Peer ID can be found in the MM2 log file after a connection has been initiated, and looks like the below:
The `add_node_to_version_stat` method adds a Node's name, IP address and PeerID to a local database to track which version of KDF it is running. The name parameter is an arbitrary identifying string, such as "seed\_alpha" or "dragonhound\_DEV". The address parameter is the node's IP address or domain names. The Peer ID can be found in the KDF log file after a connection has been initiated, and looks like the below:

`07 09:33:58, atomicdex_behaviour:610] INFO Local peer id: PeerId("12D3KooWReXsTVCKGAna1tzrD1jaUttTSs17ULFuvvzoGD9bqmmA")
`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export const title = "Komodo DeFi Framework Method: Remove Node from Version Stat";
export const description = "The remove_node_from_version_stat method removes a Node from the local database that tracks which version of MM2 it is running.";
export const description = "The remove_node_from_version_stat method removes a Node from the local database that tracks which version of KDF it is running.";

# remove\_node\_from\_version\_stat

The `remove_node_from_version_stat` method removes a Node (by name) from the local database which tracks which version of MM2 it is running. The name parameter is an arbitrary identifying string, such as "seed\_alpha" or "dragonhound\_DEV".
The `remove_node_from_version_stat` method removes a Node (by name) from the local database which tracks which version of KDF it is running. The name parameter is an arbitrary identifying string, such as "seed\_alpha" or "dragonhound\_DEV".

## Arguments

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ export const description =

# 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](https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/mm2_main/src/mm2.rs#L151-L205), and can be viewed by running the `./mm2 --help`.
Komodo DeFi-API configuration parameters, along with additional runtime flags, and per-process environment variables are [listed in the source code](https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/mm2_main/src/mm2.rs#L151-L205), and can be viewed by running the `./kdf --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.
When running the Komodo DeFi API via commandline with the `kdf` binary, some basic configuration parameters need to be defined in either an `MM2.json` file, or at runtime.

### Configuration Parameters

Expand All @@ -19,7 +19,7 @@ When running the Komodo DeFi API via commandline with the `mm2` binary, some bas
| 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. |
| dbdir | string | Optional, defaults to a subfolder named `DB` in the path of your `kdf` 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 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. |
Expand Down Expand Up @@ -111,7 +111,7 @@ The structure for adding additional coins can vary, please refer to the [listing

| Variable | Type | Description |
| ------------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| MM2\_CONF\_PATH | string | A file path to load the `MM2.json` configuration file. Defaults to `MM2.json` in the same folder as the `mm2` binary. |
| MM2\_CONF\_PATH | string | A file path to load the `MM2.json` configuration file. Defaults to `MM2.json` in the same folder as the `kdf` binary. |
| MM\_COINS\_PATH | string | A file path to load the `coins` configuration file. A comprehensive version for public use is maintained in the [Komodo Platform coins github repository](https://github.com/KomodoPlatform/coins/blob/master/coins) |
| MM\_LOG | string | A file path to store the Komodo DeFi-API logs. |
| USERPASS | string | For convenience, this variable can store the value of your `rpc_password` to be referenced in any shell scripts |
Expand Down
2 changes: 1 addition & 1 deletion src/pages/komodo-defi-framework/setup/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,4 @@ If everything installed successfully, a response that is similar to the followin
“Finished dev [optimized + debuginfo] target(s) in 3m 33s”
```

The Komodo DeFi Framework API executable is now built and available here: `~/komodo-defi-framework/target/debug/mm2`
The Komodo DeFi Framework API executable is now built and available here: `~/komodo-defi-framework/target/debug/kdf`
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ We also need to create an MM2.json file in the same directory as the `coins` fil
The MM2.json configuration commands can also be supplied at runtime, as below:

```bash
stdbuf -oL ./mm2 "{\"gui\":\"Docs_Walkthru\",\"netid\":8762, \"passphrase\":\"YOUR_PASSPHRASE_HERE\", \"rpc_password\":\"YOUR_PASSWORD_HERE\"}" &
stdbuf -oL ./kdf "{\"gui\":\"Docs_Walkthru\",\"netid\":8762, \"passphrase\":\"YOUR_PASSPHRASE_HERE\", \"rpc_password\":\"YOUR_PASSWORD_HERE\"}" &
```

Replace `YOUR_PASSPHRASE_HERE` and `YOUR_PASSWORD_HERE` with your actual passphrase and password, and then execute the command in the terminal.
Expand Down Expand Up @@ -167,7 +167,7 @@ You should now see your userpass printed to the console.
The `userpass` environment variable will remain in memory until the session is
closed. When you open up a new session later, you'll need to create the
`userpass` environment variable again. Additional environment variables for
the Komodo DeFi Framework API can be found in the [configure mm2
the Komodo DeFi Framework API can be found in the [configure KDF
guide](/komodo-defi-framework/setup/configure-mm2-json/).
</Note>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ export const description = "This guide describes how to update a coins file in a

## Instructions

* Compile the latest `mm2` binary following [these instructions](/komodo-defi-framework/setup/)
* Place the `coins` file in the old format in the same directory as the compiled `mm2` binary
* Compile the latest `kdf` binary following [these instructions](/komodo-defi-framework/setup/)
* Place the `coins` file in the old format in the same directory as the compiled `kdf` binary
* Open a terminal and navigate to the directory with both the files
* Run the following command `./mm2 update_config coins coins_new`
* Run the following command `./kdf update_config coins coins_new`

<Note>
`mm2` can accept any valid paths as the arguments for the source and destination files
Expand All @@ -23,7 +23,7 @@ Success

* You will find a new file named `coins_new` in the same directory with the new format expected by Komodo DeFi Framework
* Rename the file named `coins` to `coins_old` and then `coins_new` to `coins`
* `mm2` will use the `coins` file in the new format the next time it is launched
* `kdf` will use the `coins` file in the new format the next time it is launched

## Examples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ For example:
```bash
mkdir -p ~/komodo-defi-framework/target/debug
cd ~/komodo-defi-framework/target/debug
wget https://github.com/KomodoPlatform/komodo-defi-framework/releases/download/beta-2.1.4315/mm2-9fe6e9402-Linux-Release.zip
unzip mm2-9fe6e9402-Linux-Release.zip
wget $(curl --silent https://api.github.com/repos/KomodoPlatform/komodo-defi-framework/releases | jq -r '.[0].assets[] | select(.name | endswith("Linux-Release.zip")).browser_download_url')
unzip *Linux-Release.zip
```

Then you can proceed to [download the coins configuration file](/komodo-defi-framework/tutorials/how-to-become-a-liquidity-provider/#step-2-download-the-coins-configuration-file).
Expand Down Expand Up @@ -187,7 +187,7 @@ We now have basic scripts to use the Komodo DeFi Framework API as a liquidity pr
To start the Komodo DeFi Framework API:
```bash
stdbuf -oL nohup ./mm2
stdbuf -oL nohup ./kdf
```
</Note>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export const description = "This guide describes how to query the MM2 SQLite dat

# How to Query the MM2 SQLite Database

The Komodo DeFi Framework API stores historical information such as swaps and orders within an SQLite database, located under the DB user data folder (e.g. {'{folder continaing mm2 binary}'}/DB/{'{wallet identifying hex string}'}/MM2.db').
The Komodo DeFi Framework API stores historical information such as swaps and orders within an SQLite database, located under the DB user data folder (e.g. {'{folder continaing kdf binary}'}/DB/{'{wallet identifying hex string}'}/MM2.db').

There are a variety of methods to query sqlite databases. Examples below show how to do a sqlite query in Linux terminal, but first you might need to install sqlite with `sudo apt install sqlite3`.

Expand Down Expand Up @@ -124,7 +124,7 @@ This table stores a record of results returned by registered nodes [tracked for
| -- | --------- | ------------ | -------------------------------------------- |
| 0 | id | INTEGER | Primary Key |
| 1 | name | VARCHAR(255) | Node name |
| 2 | version | VARCHAR(255) | Node Komodo DeFi Framework API (mm2) version |
| 2 | version | VARCHAR(255) | Node Komodo DeFi Framework API (kdf) version |
| 3 | timestamp | INTEGER | Timestamp |
| 4 | error | VARCHAR(255) | Error details |

Expand Down
Loading

0 comments on commit 3963166

Please sign in to comment.