Browse Source

Merge pull request #476 from DeckerSU/dev-decker-dev

added additional windows dexscripts and build script for windows
etomic
jl777 7 years ago
committed by GitHub
parent
commit
d6731620ff
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      iguana/dexscripts.win32/bot_buy.cmd
  2. 7
      iguana/dexscripts.win32/bot_list.cmd
  3. 7
      iguana/dexscripts.win32/bot_statuslist.cmd
  4. 7
      iguana/dexscripts.win32/bot_stop.cmd
  5. 9
      iguana/dexscripts.win32/electrum.cmd
  6. 2
      iguana/dexscripts.win32/help.cmd
  7. 62
      iguana/dexscripts.win32/how_to_use.md
  8. BIN
      iguana/dexscripts.win32/images/conemu_jq.png
  9. 5
      iguana/dexscripts.win32/sendrawtransaction.cmd
  10. 8
      iguana/dexscripts.win32/withdraw.cmd
  11. 14
      iguana/dexscripts.win32/withdraw_10_send.cmd
  12. 14
      iguana/dexscripts.win32/withdraw_send.cmd
  13. 47
      marketmaker_build_32_64.cmd

7
iguana/dexscripts.win32/bot_buy.cmd

@ -0,0 +1,7 @@
@echo off
set /p TMPUSERPASS=<userpass
set USERPASS=%TMPUSERPASS: =%
set /p PASSPHRASE=<passphrase
echo passphrase: "%PASSPHRASE%"
echo userpass: "%USERPASS%"
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"%USERPASS%\",\"method\":\"bot_buy\",\"base\":\"MNZ\",\"rel\":\"KMD\",\"maxprice\":0.20,\"relvolume\":10.0}"

7
iguana/dexscripts.win32/bot_list.cmd

@ -0,0 +1,7 @@
@echo off
set /p TMPUSERPASS=<userpass
set USERPASS=%TMPUSERPASS: =%
set /p PASSPHRASE=<passphrase
rem echo passphrase: "%PASSPHRASE%"
rem echo userpass: "%USERPASS%"
curl -s --url "http://127.0.0.1:7783" --data "{\"userpass\":\"%USERPASS%\",\"method\":\"bot_list\"}"

7
iguana/dexscripts.win32/bot_statuslist.cmd

@ -0,0 +1,7 @@
@echo off
set /p TMPUSERPASS=<userpass
set USERPASS=%TMPUSERPASS: =%
set /p PASSPHRASE=<passphrase
rem echo passphrase: "%PASSPHRASE%"
rem echo userpass: "%USERPASS%"
curl -s --url "http://127.0.0.1:7783" --data "{\"userpass\":\"%USERPASS%\",\"method\":\"bot_statuslist\"}"

7
iguana/dexscripts.win32/bot_stop.cmd

@ -0,0 +1,7 @@
@echo off
set /p TMPUSERPASS=<userpass
set USERPASS=%TMPUSERPASS: =%
set /p PASSPHRASE=<passphrase
rem echo passphrase: "%PASSPHRASE%"
rem echo userpass: "%USERPASS%"
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"%USERPASS%\",\"method\":\"bot_stop\",\"botid\":1376557535}"

9
iguana/dexscripts.win32/electrum.cmd

@ -0,0 +1,9 @@
@echo off
rem http://pad.supernet.org/electrum-servers
set /p TMPUSERPASS=<userpass
set USERPASS=%TMPUSERPASS: =%
set /p PASSPHRASE=<passphrase
echo passphrase: "%PASSPHRASE%"
echo userpass: "%USERPASS%"
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"%USERPASS%\",\"method\":\"electrum\",\"coin\":\"KMD\",\"ipaddr\":\"electrum.cipig.net\",\"port\":10001}"
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"%USERPASS%\",\"method\":\"electrum\",\"coin\":\"MNZ\",\"ipaddr\":\"electrum.cipig.net\",\"port\":10002}"

2
iguana/dexscripts.win32/help.cmd

@ -0,0 +1,2 @@
@echo off
curl --url "http://127.0.0.1:7783" --data "{\"method\":\"help\"}"

62
iguana/dexscripts.win32/how_to_use.md

@ -1,15 +1,15 @@
## DexScripts for Windows. How to use? ## ## DexScripts for Windows. How to use? ##
**1. ** Before start you should put scripts and following binaries into one folder: **1.** Before start you should put scripts and following binaries into one folder:
- curl.exe (required for all scripts) - curl.exe (required for all scripts)
- marketmaker.exe - marketmaker.exe
- libcurl.dll (required to run marketmaker) - libcurl.dll (required to run marketmaker)
- nanomsg.dll (required to run marketmaker) - nanomsg.dll (required to run marketmaker)
**2. ** Don't forget to put `coins.json` file into a same folder. This file is available it this repo. **2.** Don't forget to put `coins.json` file into a same folder. This file is available it this repo.
**3. ** Type your passphrase into passphrase file in this folder (you should create file with name `passphrase` and without extension) and run `1-client.cmd`. This will run marketmaker. Next step is to obtain userpass needed for other scripts, you can simply copy and paste it from marketmaker output on startup into userpass file. **3.** Type your passphrase into passphrase file in this folder (you should create file with name `passphrase` and without extension) and run `1-client.cmd`. This will run marketmaker. Next step is to obtain userpass needed for other scripts, you can simply copy and paste it from marketmaker output on startup into userpass file.
![](./images/userpass.png) ![](./images/userpass.png)
@ -23,9 +23,41 @@ You should see your userpass on screen, and after it will automatically copied i
**4.** For using other scripts please refer to barterDEX API. Or **barterDEX API Summary by Category** document by *shossain*. **4.** For using other scripts please refer to barterDEX API. Or **barterDEX API Summary by Category** document by *shossain*.
## Scripts List ##
**NB!** Before you use any script that do some actions with your coins (for example, withdraw and others) **edit it** and make sure that it have correct addresses, coin name and volumes inside. Don't run any scripts without looking on it's source and clearly understanding what it does.
* **1-client.cmd** - used to start Marketmaker. Make sure you already have filled a strong passphrase into `passphrase` file as described above.
* **2-getuserpass.cmd** - fills userpass in `userpass` file. this step needed to use any other scripts.
* **balance.cmd** - displays current balance of selected coin.
* **enable.cmd** - enables a selected coin for trading.
* **getcoin.cmd** - prints information about a selecting coin:
{"result":"success","enabled":2,"disabled":70,"coin":{"coin":"KMD","installed":true,"height":580716,"balance":72.68774305,"KMDvalue":72.68774305,"status":"active","electrum":"electrum.cipig.net:10001","smartaddress":"RTCVGuoSNehKG8YYxcoskC7LK1yZhgvQRV","rpc":"127.0.0.1:7771","pubtype":60,"p2shtype":85,"wiftype":188,"txfee":10000}}
* **getutxos.cmd** - seems alredy deprecated.
* **inventory.cmd** - prints your inventory.
* **listunspent.cmd** - prints your utxos.
* **orderbook.cmd** - prints base/rel orderbook.
* **portfolio.cmd** - prints porfolio information.
* **snapshot.cmd** - ...
* **electrum.cmd** - allows you to run coins in electum mode (!), example includes two coins - KMD and MNZ. if you need to run more coins in electrum mode, add needed electrum servers from here - [http://pad.supernet.org/electrum-servers](http://pad.supernet.org/electrum-servers).
* **help.cmd** - displays help about all available API commands.
* **bot_buy.cmd** - launches bot for buying. you'll need to set base and rel coin in script, and also maxprice and relvolume.
* **bot_list.cmd** - lists id of all running bots.
* **bot_statuslist.cmd** - list statuses of all running bots.
* **bot_stop.cmd** - stopt the bot with given bot_id.
* **withdraw.cmd** - example of withdraw method. you can send coins from your smartaddress to any other address using widthraw. as a result method generates signed raw tx in hex, which you can use with sendrawtransaction.cmd . remember, that withdraw only *prepares* transaction, but it doesn't broadcast (send) it to network. after tx is prepared we need to send it using sendrawtransaction method.
* **sendrawtransaction.cmd** - sends raw transaction. you'll need a signedtx in hex.
* **withdraw_send.cmd** - combines withdraw and send raw tx scripts. you can call it `send`, just specify coin, volume and addresses to which you wan send coins and it will prepare and broadcast transaction automatically.
* **withdraw_10_send.cmd** - example of inventory split: this split 10 KMD from your balance to Alice inventory in 10 utxos pairs (1.002, 0.00386871). Strongly recommended to read [http://pad.supernet.org/barterdex-readme](http://pad.supernet.org/barterdex-readme) -> UTXO PAIRS to understand the basics. This script is just for example how you can split your coins in (X, X/777) to start trading them.
## F.A.Q. ## ## F.A.Q. ##
**Q.** Is any simple way how i can display JSON results returned by all scripts, like orderbook and others, in human readable form? **Q.** Is any simple way how i can display JSON results returned by all scripts, like orderbook and others, in human readable form?
**A.** Yes, you can use this service [JSON Editor Online](http://jsoneditoronline.org/), just copy and paste output of script in left column and see structured output in right. **A.** Yes, you can use this service [JSON Editor Online](http://jsoneditoronline.org/), just copy and paste output of script in left column and see structured output in right.
**Q.** I see an output like this when i'm start `1-client.cmd` : **Q.** I see an output like this when i'm start `1-client.cmd` :
@ -42,3 +74,27 @@ And nothing works.
**A.** Before run `1-client.cmd` make sure in Task Manager that you haven't already running `marketmaker.exe`. If have - kill this process via Task Manager or via command line command `taskkill /f /im taskkill.exe` . **A.** Before run `1-client.cmd` make sure in Task Manager that you haven't already running `marketmaker.exe`. If have - kill this process via Task Manager or via command line command `taskkill /f /im taskkill.exe` .
**Q.** How can i pretty print JSON answers of marketmaker?
**A.** You can get best results with 2 tools - [conemu](https://conemu.github.io/) and [jq](https://stedolan.github.io/jq/), conemu supports ANSI X3.64 and Xterm 256 colors and jq allow you to pretty-print json output with colors, like this:
![](./images/conemu_jq.png)
Also i'm always recommend to install [Far Manager](https://www.farmanager.com/index.php?l=en) - this is powerful console file manager for Windows, like Midnight Commander in *nix.
**Q.** What additional dependencies required by marketmaker?
**A.** Currently marketmaker (Windows) used the following DLLs:
*32 bit:*
- libcrypto-1_1.dll
- libcurl.dll
- libssl-1_1.dll
- nanomsg.dll
- pthreadvc2.dll
*64-bit:*
- libcurl.dll
- nanomsg.dll
It already included in repo and in archive with release.

BIN
iguana/dexscripts.win32/images/conemu_jq.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

5
iguana/dexscripts.win32/sendrawtransaction.cmd

@ -0,0 +1,5 @@
@echo off
set /p TMPUSERPASS=<userpass
set USERPASS=%TMPUSERPASS: =%
set HEX=your_signed_raw_tx
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"%USERPASS%\",\"method\":\"sendrawtransaction\",\"coin\":\"KMD\",\"signedtx\":%HEX%"\"}"

8
iguana/dexscripts.win32/withdraw.cmd

@ -0,0 +1,8 @@
@echo off
set /p TMPUSERPASS=<userpass
set USERPASS=%TMPUSERPASS: =%
rem *** Change coin and outputs before use (!) ***
set COIN=KMD
set OUTPUTS=[{\"RDecker69MM5dhDBosUXPNTzfoGqxPQqHu\":0.00007777}]
curl -s --url "http://127.0.0.1:7783" --data "{\"userpass\":\"%USERPASS%\",\"method\":\"withdraw\",\"coin\":\"%COIN%\",\"outputs\":%OUTPUTS%}" > withdraw.txt
type withdraw.txt

14
iguana/dexscripts.win32/withdraw_10_send.cmd

@ -0,0 +1,14 @@
@echo off
set /p TMPUSERPASS=<userpass
set USERPASS=%TMPUSERPASS: =%
rem *** Change coin and outputs before use (!) ***
set COIN=KMD
set SMARTADDRESS=RDecker69MM5dhDBosUXPNTzfoGqxPQqHu
set OUTPUTS=[{\"%SMARTADDRESS%\":1.002},{\"%SMARTADDRESS%\":0.00386871},{\"%SMARTADDRESS%\":1.002},{\"%SMARTADDRESS%\":0.00386871},{\"%SMARTADDRESS%\":1.002},{\"%SMARTADDRESS%\":0.00386871},{\"%SMARTADDRESS%\":1.002},{\"%SMARTADDRESS%\":0.00386871},{\"%SMARTADDRESS%\":1.002},{\"%SMARTADDRESS%\":0.00386871},{\"%SMARTADDRESS%\":1.002},{\"%SMARTADDRESS%\":0.00386871},{\"%SMARTADDRESS%\":1.002},{\"%SMARTADDRESS%\":0.00386871},{\"%SMARTADDRESS%\":1.002},{\"%SMARTADDRESS%\":0.00386871},{\"%SMARTADDRESS%\":1.002},{\"%SMARTADDRESS%\":0.00386871},{\"%SMARTADDRESS%\":1.002},{\"%SMARTADDRESS%\":0.00386871}]
curl -s --url "http://127.0.0.1:7783" --data "{\"userpass\":\"%USERPASS%\",\"method\":\"withdraw\",\"coin\":\"%COIN%\",\"outputs\":%OUTPUTS%}" > withdraw.txt
type withdraw.txt
timeout /t 5 /nobreak
for /f "tokens=4 delims=:," %%a in (' find "hex" "withdraw.txt" ') do (
rem echo [%%~a]
curl -s --url "http://127.0.0.1:7783" --data "{\"userpass\":\"%USERPASS%\",\"method\":\"sendrawtransaction\",\"coin\":\"%COIN%\",\"signedtx\":\"%%~a\"}"
)

14
iguana/dexscripts.win32/withdraw_send.cmd

@ -0,0 +1,14 @@
@echo off
set /p TMPUSERPASS=<userpass
set USERPASS=%TMPUSERPASS: =%
rem *** Change coin and outputs before use (!) ***
set COIN=KMD
set OUTPUTS=[{\"RDecker69MM5dhDBosUXPNTzfoGqxPQqHu\":0.00007777}]
curl -s --url "http://127.0.0.1:7783" --data "{\"userpass\":\"%USERPASS%\",\"method\":\"withdraw\",\"coin\":\"%COIN%\",\"outputs\":%OUTPUTS%}" > withdraw.txt
type withdraw.txt
timeout /t 5 /nobreak
for /f "tokens=4 delims=:," %%a in (' find "hex" "withdraw.txt" ') do (
rem echo [%%~a]
curl -s --url "http://127.0.0.1:7783" --data "{\"userpass\":\"%USERPASS%\",\"method\":\"sendrawtransaction\",\"coin\":\"%COIN%\",\"signedtx\":\"%%~a\"}"
)

47
marketmaker_build_32_64.cmd

@ -0,0 +1,47 @@
@echo off
@REM Check for Visual Studio
call set "VSPATH="
if defined VS140COMNTOOLS ( if not defined VSPATH (
call set "VSPATH=%%VS140COMNTOOLS%%"
) )
@REM check if we already have the tools in the environment
if exist "%VCINSTALLDIR%" (
goto compile
)
if not defined VSPATH (
echo You need Microsoft Visual Studio 15 installed
pause
exit
)
@REM set up the environment
if exist "%VSPATH%..\..\vc\vcvarsall.bat" (
call "%%VSPATH%%..\..\vc\vcvarsall.bat" amd64
goto compile
)
echo Unable to set up the environment
pause
exit
:compile
rem MSBuild /help
MSBuild marketmaker.sln /t:Rebuild /p:Configuration=Release /p:Platform=x64
MSBuild marketmaker.sln /t:Rebuild /p:Configuration=Release /p:Platform=x86
rem Using to add in marketmaker_release.7z
set host=%COMPUTERNAME%
IF "%host%"=="VM-81" (
mkdir package_content\win32
mkdir package_content\win64
copy /y Release\marketmaker.exe package_content\win32
copy /y x64\Release\marketmaker.exe package_content\win64
cd package_content
"C:\Program Files\7-Zip\7z.exe" a C:\komodo\marketmaker_release\marketmaker_release.7z win32\marketmaker.exe
"C:\Program Files\7-Zip\7z.exe" a C:\komodo\marketmaker_release\marketmaker_release.7z win64\marketmaker.exe
cd ..
rd package_content /s /q
)
Loading…
Cancel
Save