Send Commands to an MM2 Instance Being Run by Komodo Wallet Desktop Using Postman
Why Postman: Postman allows easy sending of RPC requests to an Komodo DeFi Framework instance launched by the Komodo Wallet Desktop application through a friendly GUI.
Prerequisites: Download and install the latest versions of Komodo Wallet Desktop and Postman on your computer.
On Komodo Wallet Desktop:
-
Start the application and login to your wallet
-
Click the settings button on the bottom left part of the application
- Under the Security section, click "Show" on the line that says "View seed and private keys"
- Input your password and click View in the dialog box that pops out
- Click the copy button beside "RPC Password" to copy it. This "RPC Password" is also referred to as "userpass". It is reset every time the Komodo Wallet Desktop application is restarted
- Save the "userpass" value to a text file for later usage and leave the Komodo Wallet Desktop application running
On Postman:
- Launch the application. If it is your first time launching it, you will see a screen similar to the following. Click the "Skip and go to the app" link to skip account creation/login
- Click the “Eye icon” in the top right part of the screen to create a new Environment
- In the popout dialog menu, Click the "Add" button in the Environment section
- In the new tab that opens, change the Environment's name to KomodoWallet and add variables as shown in the next step
- Add a variable with the name "userpass" and for its value, paste the "RPC password" value copied and saved from Komodo Wallet Desktop. Then, add another variable with the name "url" and set its value as "localhost:7783" and save as shown in the picture below
- Change environment to KomodoWallet by clicking on the dropdown that says "No Environment" beside the eye icon and selecting "KomodoWallet"
- Click "New" to start creating a new RPC request
- In the popout menu, select "HTTP Request"
- Select "Post" as the request type
- Input "{{url}}" in the input bar beside POST
- Next select "Body" → "raw" → "JSON" as shown in the picture below
- In the text area available, you can input the data part of any of the RPC requests from the docs. Example: version | Komodo Documentation
The RPC call looks like:
curl --url "http://127.0.0.1:7783" --data "{
\"method\":\"version\",
\"userpass\":\"$userpass\"
}"
the --data part is:
"{
\"method\":\"version\",
\"userpass\":\"$userpass\"
}"
remove the quotes outside the brackets, replace escaped quotes: " with regular quotes: " and "$userpass" with "{{userpass}}"
you will get:
{
"method":"version",
"userpass":"{{userpass}}"
}
input it in the text area and click the Send button to receive output from the Komodo DeFi Framework instance launched by the Komodo Wallet Desktop application
The same method can be used to execute any other RPC command from the docs at Note About Rational Number Type | Komodo Documentation
Note: Every time the Komodo Wallet Desktop application is restarted, the "RPC password/userpass" is also reset. So copy it and update the value of the "userpass" variable in the environment named "KomodoWallet" in Postman