blackjok3rtt
6 years ago
committed by
GitHub
96 changed files with 2745 additions and 641 deletions
@ -0,0 +1,3 @@ |
|||
.git |
|||
.vscode |
|||
cmake-build-debug |
@ -0,0 +1,18 @@ |
|||
--- |
|||
name: Bug report |
|||
about: Marketmaker 1.0 bug report |
|||
|
|||
--- |
|||
|
|||
**Describe the bug** |
|||
A clear and concise description of what the bug is. |
|||
|
|||
**Please answer following questions and attach requested info - it'll help to solve issue faster** |
|||
- What OS do you use? |
|||
- What marketmaker version do you run? |
|||
- Attach your coins.json config. |
|||
- Provide your enable script with response. |
|||
- Provide other curl scripts (with responses) which were executed prior to error. |
|||
- Attach full marketmaker console logs (start collecting right after marketmaker execution). |
|||
- ***Make sure that you don't send your passphrase, userpass and privkeys. Your funds might be stolen if you reveal this info publicly!*** |
|||
- Provide info for all nodes involved (e.g. if error occurs during atomic swap you should provide info for both Bob and Alice). |
@ -0,0 +1,9 @@ |
|||
FROM ubuntu:17.10 |
|||
USER root |
|||
RUN apt-get update && apt-get install -y rinetd curl libcurl3-gnutls |
|||
RUN echo "0.0.0.0 10271 10.100.0.1 10271" >> /etc/rinetd.conf |
|||
RUN echo "0.0.0.0 8923 10.100.0.1 8923" >> /etc/rinetd.conf |
|||
RUN useradd -u 111 jenkins |
|||
USER jenkins |
|||
WORKDIR /usr/mm/etomic_build/client |
|||
CMD /usr/sbin/rinetd && rm -rf DB && ./client |
@ -0,0 +1,9 @@ |
|||
FROM ubuntu:17.10 |
|||
USER root |
|||
RUN apt-get update && apt-get install -y rinetd curl libcurl3-gnutls |
|||
RUN echo "0.0.0.0 10271 10.100.0.1 10271" >> /etc/rinetd.conf |
|||
RUN echo "0.0.0.0 8923 10.100.0.1 8923" >> /etc/rinetd.conf |
|||
RUN useradd -u 111 jenkins |
|||
USER jenkins |
|||
WORKDIR /usr/mm/etomic_build/seed |
|||
CMD /usr/sbin/rinetd && rm -rf DB && ./run |
@ -1,6 +1,30 @@ |
|||
version: 1.0.{build} |
|||
branches: |
|||
only: |
|||
- etomic |
|||
build_script: |
|||
- cmd: marketmaker_build_etomic.cmd |
|||
cache: |
|||
- C:\.hunter |
|||
- marketmaker_depends |
|||
|
|||
after_build: |
|||
- '7z a mm-win.zip |
|||
.\build_win64_release\iguana\exchanges\Release\marketmaker-mainnet.exe |
|||
.\marketmaker_depends\curl\build_msvc_2015_win64\lib\Release\libcurl.dll |
|||
.\marketmaker_depends\nanomsg\build_msvc_2015_win64\Release\nanomsg.dll |
|||
"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\redist\\x64\\Microsoft.VC140.CRT\\msvcp140.dll" |
|||
"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\redist\\x64\\Microsoft.VC140.CRT\\vcruntime140.dll"' |
|||
|
|||
artifacts: |
|||
- path: mm-win.zip |
|||
name: marketmaker-mainnet |
|||
|
|||
deploy: |
|||
release: v$(appveyor_build_version) |
|||
provider: GitHub |
|||
auth_token: |
|||
secure: iabzoz73JgtOIyE/Nmz4a4XefmK+7pIeup+1Hunj4hGKrdfesFN+176DMApgfu8t |
|||
artifact: marketmaker-mainnet |
|||
draft: false |
|||
prerelease: false |
|||
on: |
|||
branch: master |
|||
appveyor_repo_tag: false |
@ -1 +1 @@ |
|||
Subproject commit 633c62c08bc73c7c3935c948a8d6c656a3659976 |
|||
Subproject commit e804e95d9a71e87fc5e3e69a2888448f23bc724f |
@ -0,0 +1,41 @@ |
|||
version: '2' |
|||
services: |
|||
seednode: |
|||
build: |
|||
context: ./ |
|||
dockerfile: Dockerfile.seednode |
|||
volumes: |
|||
- ~/.zcash-params:/home/jenkins/.zcash-params |
|||
- ~/.komodo:/home/jenkins/.komodo |
|||
- .:/usr/mm |
|||
env_file: |
|||
- .env.seed |
|||
tty: true |
|||
networks: |
|||
default: |
|||
ipv4_address: 10.100.0.2 |
|||
|
|||
clientnode: |
|||
build: |
|||
context: ./ |
|||
dockerfile: Dockerfile.clientnode |
|||
volumes: |
|||
- ~/.zcash-params:/home/jenkins/.zcash-params |
|||
- ~/.komodo:/home/jenkins/.komodo |
|||
- .:/usr/mm |
|||
links: |
|||
- seednode |
|||
tty: true |
|||
env_file: |
|||
- .env.client |
|||
networks: |
|||
default: |
|||
ipv4_address: 10.100.0.3 |
|||
|
|||
networks: |
|||
default: |
|||
driver: bridge |
|||
ipam: |
|||
config: |
|||
- subnet: 10.100.0.0/16 |
|||
gateway: 10.100.0.1 |
@ -1,5 +0,0 @@ |
|||
#!/bin/bash |
|||
source passphrase |
|||
source coins |
|||
./stop |
|||
iguana/exchanges/marketmaker "{\"netid\":9999,\"seednode\":\"5.9.253.204\",\"gui\":\"nogui\",\"client\":1, \"userhome\":\"/${HOME#"/"}\", \"passphrase\":\"$passphrase\", \"coins\":$coins}" & |
@ -0,0 +1,4 @@ |
|||
#!/bin/bash |
|||
source userpass |
|||
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"setprice\",\"base\":\"$1\",\"rel\":\"BEER\",\"price\":1}" |
|||
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"buy\",\"base\":\"BEER\",\"rel\":\"$1\",\"relvolume\":0.1,\"price\":1}" |
@ -0,0 +1,4 @@ |
|||
#!/bin/bash |
|||
source passphrase |
|||
source ../coins |
|||
../../build/iguana/exchanges/marketmaker-testnet "{\"netid\":9999,\"seednode\":\"10.100.0.2\",\"gui\":\"nogui\",\"client\":1, \"userhome\":\"/${HOME#"/"}\", \"passphrase\":\"$passphrase\", \"coins\":$coins}" |
@ -0,0 +1,7 @@ |
|||
#!/bin/bash |
|||
source userpass |
|||
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"enable\",\"coin\":\"ETOMIC\"}" |
|||
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"enable\",\"coin\":\"ETH\"}" |
|||
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"enable\",\"coin\":\"NODEC\"}" |
|||
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"enable\",\"coin\":\"JST\"}" |
|||
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"enable\",\"coin\":\"BEER\"}" |
@ -0,0 +1 @@ |
|||
10.100.0.3 |
@ -0,0 +1 @@ |
|||
export passphrase="$PASSPHRASE" |
@ -0,0 +1,4 @@ |
|||
#!/bin/bash |
|||
source userpass |
|||
source passphrase |
|||
curl --url "http://127.0.0.1:7783" --data "{\"netid\":9999,\"seednode\":\"10.100.0.2\",\"userpass\":\"1d8b27b21efabcd96571cd56f91a40fb9aa4cc623d273c63bf9223dc6f8cd81f\",\"method\":\"passphrase\",\"passphrase\":\"$passphrase\",\"gui\":\"nogui\"}" |
@ -0,0 +1,2 @@ |
|||
#export userpass="<put the userpass value from the first API call here>" |
|||
export userpass="$USERPASS" |
File diff suppressed because one or more lines are too long
@ -1,5 +1,4 @@ |
|||
#!/bin/bash |
|||
source userpass |
|||
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"enable\",\"coin\":\"ETH\"}" |
|||
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"enable\",\"coin\":\"KMD\"}" |
|||
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"enable\",\"coin\":\"ETOMIC\"}" |
|||
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"enable\",\"coin\":\"ETH\"}" |
|||
|
@ -1 +0,0 @@ |
|||
export passphrase="<put a very strong passphrase here>" |
@ -1,5 +0,0 @@ |
|||
#!/bin/bash |
|||
source passphrase |
|||
source coins |
|||
./stop |
|||
$1 iguana/exchanges/marketmaker "{\"netid\":9999,\"gui\":\"nogui\", \"profitmargin\":0.01, \"userhome\":\"/${HOME#"/"}\", \"passphrase\":\"$passphrase\", \"coins\":$coins}" & |
@ -0,0 +1,7 @@ |
|||
#!/bin/bash |
|||
source userpass |
|||
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"enable\",\"coin\":\"ETOMIC\"}" |
|||
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"enable\",\"coin\":\"ETH\"}" |
|||
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"enable\",\"coin\":\"NODEC\"}" |
|||
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"enable\",\"coin\":\"JST\"}" |
|||
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"enable\",\"coin\":\"BEER\"}" |
@ -0,0 +1 @@ |
|||
10.100.0.2 |
@ -0,0 +1 @@ |
|||
export passphrase="$PASSPHRASE" |
@ -0,0 +1,4 @@ |
|||
#!/bin/bash |
|||
source passphrase |
|||
source ../coins |
|||
../../build/iguana/exchanges/marketmaker-testnet "{\"netid\":9999,\"gui\":\"nogui\", \"profitmargin\":0.01, \"userhome\":\"/${HOME#"/"}\", \"passphrase\":\"$passphrase\", \"coins\":$coins}" |
@ -0,0 +1,4 @@ |
|||
#!/bin/bash |
|||
source userpass |
|||
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"setprice\",\"base\":\"BEER\",\"rel\":\"$1\",\"price\":0.9}" |
|||
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"sell\",\"base\":\"BEER\",\"rel\":\"$1\",\"basevolume\":0.1,\"price\":0.9}" |
@ -0,0 +1,4 @@ |
|||
#!/bin/bash |
|||
source userpass |
|||
source passphrase |
|||
curl --url "http://127.0.0.1:7783" --data "{\"netid\":9999,\"seednode\":\"5.9.253.204\",\"userpass\":\"1d8b27b21efabcd96571cd56f91a40fb9aa4cc623d273c63bf9223dc6f8cd81f\",\"method\":\"passphrase\",\"passphrase\":\"$passphrase\",\"gui\":\"nogui\"}" |
@ -0,0 +1,2 @@ |
|||
#export userpass="<put the userpass value from the first API call here>" |
|||
export userpass="$USERPASS" |
@ -1,2 +1,2 @@ |
|||
#export userpass="<put the userpass value from the first API call here>" |
|||
export userpass="c3d8c2a364b7d18c1f9d7321d017b92e9f9c791e4f5c741214fefdea8a071256" |
|||
export userpass="$USERPASS" |
|||
|
@ -0,0 +1 @@ |
|||
curl --url "http://127.0.0.1:7776" --data "{\"conf\":\"CCL.conf\",\"path\":\"${HOME#"/"}/.komodo/CCL\",\"unitval\":\"20\",\"zcash\":1,\"RELAY\":-1,\"VALIDATE\":0,\"prefetchlag\":-1,\"poll\":100,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":4,\"endpend\":4,\"services\":129,\"maxpeers\":8,\"newcoin\":\"CCL\",\"name\":\"CCL\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"5c31ff66\",\"p2p\":20848,\"rpc\":20849,\"pubval\":60,\"p2shval\":85,\"wifval\":188,\"txfee_satoshis\":\"10000\",\"isPoS\":0,\"minoutput\":10000,\"minconfirms\":2,\"genesishash\":\"027e3758c3a65b12aa1046462b486d0a63bfa1beae327897f56c5cfb7daaae71\",\"protover\":170002,\"genesisblock\":\"0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000000000000000000000000000000000000000000000000000000000000029ab5f490f0f0f200b00000000000000000000000000000000000000000000000000000000000000fd4005000d5ba7cda5d473947263bf194285317179d2b0d307119c2e7cc4bd8ac456f0774bd52b0cd9249be9d40718b6397a4c7bbd8f2b3272fed2823cd2af4bd1632200ba4bf796727d6347b225f670f292343274cc35099466f5fb5f0cd1c105121b28213d15db2ed7bdba490b4cedc69742a57b7c25af24485e523aadbb77a0144fc76f79ef73bd8530d42b9f3b9bed1c135ad1fe152923fafe98f95f76f1615e64c4abb1137f4c31b218ba2782bc15534788dda2cc08a0ee2987c8b27ff41bd4e31cd5fb5643dfe862c9a02ca9f90c8c51a6671d681d04ad47e4b53b1518d4befafefe8cadfb912f3d03051b1efbf1dfe37b56e93a741d8dfd80d576ca250bee55fab1311fc7b3255977558cdda6f7d6f875306e43a14413facdaed2f46093e0ef1e8f8a963e1632dcbeebd8e49fd16b57d49b08f9762de89157c65233f60c8e38a1f503a48c555f8ec45dedecd574a37601323c27be597b956343107f8bd80f3a925afaf30811df83c402116bb9c1e5231c70fff899a7c82f73c902ba54da53cc459b7bf1113db65cc8f6914d3618560ea69abd13658fa7b6af92d374d6eca9529f8bd565166e4fcbf2a8dfb3c9b69539d4d2ee2e9321b85b331925df195915f2757637c2805e1d4131e1ad9ef9bc1bb1c732d8dba4738716d351ab30c996c8657bab39567ee3b29c6d054b711495c0d52e1cd5d8e55b4f0f0325b97369280755b46a02afd54be4ddd9f77c22272b8bbb17ff5118fedbae2564524e797bd28b5f74f7079d532ccc059807989f94d267f47e724b3f1ecfe00ec9e6541c961080d8891251b84b4480bc292f6a180bea089fef5bbda56e1e41390d7c0e85ba0ef530f7177413481a226465a36ef6afe1e2bca69d2078712b3912bba1a99b1fbff0d355d6ffe726d2bb6fbc103c4ac5756e5bee6e47e17424ebcbf1b63d8cb90ce2e40198b4f4198689daea254307e52a25562f4c1455340f0ffeb10f9d8e914775e37d0edca019fb1b9c6ef81255ed86bc51c5391e0591480f66e2d88c5f4fd7277697968656a9b113ab97f874fdd5f2465e5559533e01ba13ef4a8f7a21d02c30c8ded68e8c54603ab9c8084ef6d9eb4e92c75b078539e2ae786ebab6dab73a09e0aa9ac575bcefb29e930ae656e58bcb513f7e3c17e079dce4f05b5dbc18c2a872b22509740ebe6a3903e00ad1abc55076441862643f93606e3dc35e8d9f2caef3ee6be14d513b2e062b21d0061de3bd56881713a1a5c17f5ace05e1ec09da53f99442df175a49bd154aa96e4949decd52fed79ccf7ccbce32941419c314e374e4a396ac553e17b5340336a1a25c22f9e42a243ba5404450b650acfc826a6e432971ace776e15719515e1634ceb9a4a35061b668c74998d3dfb5827f6238ec015377e6f9c94f38108768cf6e5c8b132e0303fb5a200368f845ad9d46343035a6ff94031df8d8309415bb3f6cd5ede9c135fdabcc030599858d803c0f85be7661c88984d88faa3d26fb0e9aac0056a53f1b5d0baed713c853c4a2726869a0a124a8a5bbc0fc0ef80c8ae4cb53636aa02503b86a1eb9836fcc259823e2692d921d88e1ffc1e6cb2bde43939ceb3f32a611686f539f8f7c9f0bf00381f743607d40960f06d347d1cd8ac8a51969c25e37150efdf7aa4c2037a2fd0516fb444525ab157a0ed0a7412b2fa69b217fe397263153782c0f64351fbdf2678fa0dc8569912dcd8e3ccad38f34f23bbbce14c6a26ac24911b308b82c7e43062d180baeac4ba7153858365c72c63dcf5f6a5b08070b730adb017aeae925b7d0439979e2679f45ed2f25a7edcfd2fb77a8794630285ccb0a071f5cce410b46dbf9750b0354aae8b65574501cc69efb5b6a43444074fee116641bb29da56c2b4a7f456991fc92b2\",\"debug\":0,\"seedipaddr\":\"78.47.196.146\"}" |
@ -0,0 +1,2 @@ |
|||
curl --url "http://127.0.0.1:7776" --data "{\"conf\":\"RFOX.conf\",\"path\":\"${HOME#"/"}/.komodo/RFOX\",\"unitval\":\"20\",\"zcash\":1,\"RELAY\":-1,\"VALIDATE\":0,\"prefetchlag\":-1,\"poll\":100,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":4,\"endpend\":4,\"services\":129,\"maxpeers\":8,\"newcoin\":\"RFOX\",\"name\":\"RFOX\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"4cad0644\",\"p2p\":32268,\"rpc\":32269,\"pubval\":60,\"p2shval\":85,\"wifval\":188,\"txfee_satoshis\":\"10000\",\"isPoS\":0,\"minoutput\":10000,\"minconfirms\":2,\"genesishash\":\"027e3758c3a65b12aa1046462b486d0a63bfa1beae327897f56c5cfb7daaae71\",\"protover\":170002,\"genesisblock\":\"0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000000000000000000000000000000000000000000000000000000000000029ab5f490f0f0f200b00000000000000000000000000000000000000000000000000000000000000fd4005000d5ba7cda5d473947263bf194285317179d2b0d307119c2e7cc4bd8ac456f0774bd52b0cd9249be9d40718b6397a4c7bbd8f2b3272fed2823cd2af4bd1632200ba4bf796727d6347b225f670f292343274cc35099466f5fb5f0cd1c105121b28213d15db2ed7bdba490b4cedc69742a57b7c25af24485e523aadbb77a0144fc76f79ef73bd8530d42b9f3b9bed1c135ad1fe152923fafe98f95f76f1615e64c4abb1137f4c31b218ba2782bc15534788dda2cc08a0ee2987c8b27ff41bd4e31cd5fb5643dfe862c9a02ca9f90c8c51a6671d681d04ad47e4b53b1518d4befafefe8cadfb912f3d03051b1efbf1dfe37b56e93a741d8dfd80d576ca250bee55fab1311fc7b3255977558cdda6f7d6f875306e43a14413facdaed2f46093e0ef1e8f8a963e1632dcbeebd8e49fd16b57d49b08f9762de89157c65233f60c8e38a1f503a48c555f8ec45dedecd574a37601323c27be597b956343107f8bd80f3a925afaf30811df83c402116bb9c1e5231c70fff899a7c82f73c902ba54da53cc459b7bf1113db65cc8f6914d3618560ea69abd13658fa7b6af92d374d6eca9529f8bd565166e4fcbf2a8dfb3c9b69539d4d2ee2e9321b85b331925df195915f2757637c2805e1d4131e1ad9ef9bc1bb1c732d8dba4738716d351ab30c996c8657bab39567ee3b29c6d054b711495c0d52e1cd5d8e55b4f0f0325b97369280755b46a02afd54be4ddd9f77c22272b8bbb17ff5118fedbae2564524e797bd28b5f74f7079d532ccc059807989f94d267f47e724b3f1ecfe00ec9e6541c961080d8891251b84b4480bc292f6a180bea089fef5bbda56e1e41390d7c0e85ba0ef530f7177413481a226465a36ef6afe1e2bca69d2078712b3912bba1a99b1fbff0d355d6ffe726d2bb6fbc103c4ac5756e5bee6e47e17424ebcbf1b63d8cb90ce2e40198b4f4198689daea254307e52a25562f4c1455340f0ffeb10f9d8e914775e37d0edca019fb1b9c6ef81255ed86bc51c5391e0591480f66e2d88c5f4fd7277697968656a9b113ab97f874fdd5f2465e5559533e01ba13ef4a8f7a21d02c30c8ded68e8c54603ab9c8084ef6d9eb4e92c75b078539e2ae786ebab6dab73a09e0aa9ac575bcefb29e930ae656e58bcb513f7e3c17e079dce4f05b5dbc18c2a872b22509740ebe6a3903e00ad1abc55076441862643f93606e3dc35e8d9f2caef3ee6be14d513b2e062b21d0061de3bd56881713a1a5c17f5ace05e1ec09da53f99442df175a49bd154aa96e4949decd52fed79ccf7ccbce32941419c314e374e4a396ac553e17b5340336a1a25c22f9e42a243ba5404450b650acfc826a6e432971ace776e15719515e1634ceb9a4a35061b668c74998d3dfb5827f6238ec015377e6f9c94f38108768cf6e5c8b132e0303fb5a200368f845ad9d46343035a6ff94031df8d8309415bb3f6cd5ede9c135fdabcc030599858d803c0f85be7661c88984d88faa3d26fb0e9aac0056a53f1b5d0baed713c853c4a2726869a0a124a8a5bbc0fc0ef80c8ae4cb53636aa02503b86a1eb9836fcc259823e2692d921d88e1ffc1e6cb2bde43939ceb3f32a611686f539f8f7c9f0bf00381f743607d40960f06d347d1cd8ac8a51969c25e37150efdf7aa4c2037a2fd0516fb444525ab157a0ed0a7412b2fa69b217fe397263153782c0f64351fbdf2678fa0dc8569912dcd8e3ccad38f34f23bbbce14c6a26ac24911b308b82c7e43062d180baeac4ba7153858365c72c63dcf5f6a5b08070b730adb017aeae925b7d0439979e2679f45ed2f25a7edcfd2fb77a8794630285ccb0a071f5cce410b46dbf9750b0354aae8b65574501cc69efb5b6a43444074fee116641bb29da56c2b4a7f456991fc92b2\",\"debug\":0,\"seedipaddr\":\"78.47.196.146\"}" |
|||
|
@ -0,0 +1,2 @@ |
|||
curl --url "http://127.0.0.1:7776" --data "{\"conf\":\"SEC.conf\",\"path\":\"${HOME#"/"}/.komodo/SEC\",\"unitval\":\"20\",\"zcash\":1,\"RELAY\":-1,\"VALIDATE\":0,\"prefetchlag\":-1,\"poll\":100,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":4,\"endpend\":4,\"services\":129,\"maxpeers\":8,\"newcoin\":\"SEC\",\"name\":\"SEC\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"8f27938c\",\"p2p\":11539,\"rpc\":11540,\"pubval\":60,\"p2shval\":85,\"wifval\":188,\"txfee_satoshis\":\"10000\",\"isPoS\":0,\"minoutput\":10000,\"minconfirms\":2,\"genesishash\":\"027e3758c3a65b12aa1046462b486d0a63bfa1beae327897f56c5cfb7daaae71\",\"protover\":170002,\"genesisblock\":\"0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000000000000000000000000000000000000000000000000000000000000029ab5f490f0f0f200b00000000000000000000000000000000000000000000000000000000000000fd4005000d5ba7cda5d473947263bf194285317179d2b0d307119c2e7cc4bd8ac456f0774bd52b0cd9249be9d40718b6397a4c7bbd8f2b3272fed2823cd2af4bd1632200ba4bf796727d6347b225f670f292343274cc35099466f5fb5f0cd1c105121b28213d15db2ed7bdba490b4cedc69742a57b7c25af24485e523aadbb77a0144fc76f79ef73bd8530d42b9f3b9bed1c135ad1fe152923fafe98f95f76f1615e64c4abb1137f4c31b218ba2782bc15534788dda2cc08a0ee2987c8b27ff41bd4e31cd5fb5643dfe862c9a02ca9f90c8c51a6671d681d04ad47e4b53b1518d4befafefe8cadfb912f3d03051b1efbf1dfe37b56e93a741d8dfd80d576ca250bee55fab1311fc7b3255977558cdda6f7d6f875306e43a14413facdaed2f46093e0ef1e8f8a963e1632dcbeebd8e49fd16b57d49b08f9762de89157c65233f60c8e38a1f503a48c555f8ec45dedecd574a37601323c27be597b956343107f8bd80f3a925afaf30811df83c402116bb9c1e5231c70fff899a7c82f73c902ba54da53cc459b7bf1113db65cc8f6914d3618560ea69abd13658fa7b6af92d374d6eca9529f8bd565166e4fcbf2a8dfb3c9b69539d4d2ee2e9321b85b331925df195915f2757637c2805e1d4131e1ad9ef9bc1bb1c732d8dba4738716d351ab30c996c8657bab39567ee3b29c6d054b711495c0d52e1cd5d8e55b4f0f0325b97369280755b46a02afd54be4ddd9f77c22272b8bbb17ff5118fedbae2564524e797bd28b5f74f7079d532ccc059807989f94d267f47e724b3f1ecfe00ec9e6541c961080d8891251b84b4480bc292f6a180bea089fef5bbda56e1e41390d7c0e85ba0ef530f7177413481a226465a36ef6afe1e2bca69d2078712b3912bba1a99b1fbff0d355d6ffe726d2bb6fbc103c4ac5756e5bee6e47e17424ebcbf1b63d8cb90ce2e40198b4f4198689daea254307e52a25562f4c1455340f0ffeb10f9d8e914775e37d0edca019fb1b9c6ef81255ed86bc51c5391e0591480f66e2d88c5f4fd7277697968656a9b113ab97f874fdd5f2465e5559533e01ba13ef4a8f7a21d02c30c8ded68e8c54603ab9c8084ef6d9eb4e92c75b078539e2ae786ebab6dab73a09e0aa9ac575bcefb29e930ae656e58bcb513f7e3c17e079dce4f05b5dbc18c2a872b22509740ebe6a3903e00ad1abc55076441862643f93606e3dc35e8d9f2caef3ee6be14d513b2e062b21d0061de3bd56881713a1a5c17f5ace05e1ec09da53f99442df175a49bd154aa96e4949decd52fed79ccf7ccbce32941419c314e374e4a396ac553e17b5340336a1a25c22f9e42a243ba5404450b650acfc826a6e432971ace776e15719515e1634ceb9a4a35061b668c74998d3dfb5827f6238ec015377e6f9c94f38108768cf6e5c8b132e0303fb5a200368f845ad9d46343035a6ff94031df8d8309415bb3f6cd5ede9c135fdabcc030599858d803c0f85be7661c88984d88faa3d26fb0e9aac0056a53f1b5d0baed713c853c4a2726869a0a124a8a5bbc0fc0ef80c8ae4cb53636aa02503b86a1eb9836fcc259823e2692d921d88e1ffc1e6cb2bde43939ceb3f32a611686f539f8f7c9f0bf00381f743607d40960f06d347d1cd8ac8a51969c25e37150efdf7aa4c2037a2fd0516fb444525ab157a0ed0a7412b2fa69b217fe397263153782c0f64351fbdf2678fa0dc8569912dcd8e3ccad38f34f23bbbce14c6a26ac24911b308b82c7e43062d180baeac4ba7153858365c72c63dcf5f6a5b08070b730adb017aeae925b7d0439979e2679f45ed2f25a7edcfd2fb77a8794630285ccb0a071f5cce410b46dbf9750b0354aae8b65574501cc69efb5b6a43444074fee116641bb29da56c2b4a7f456991fc92b2\",\"debug\":0,\"seedipaddr\":\"185.148.145.43\"}" |
|||
|
@ -0,0 +1,2 @@ |
|||
|
|||
curl --url "http://127.0.0.1:7776" --data "{\"conf\":\"VRSC.conf\",\"path\":\"${HOME#"/"}/.komodo/VRSC\",\"unitval\":\"20\",\"zcash\":1,\"RELAY\":-1,\"VALIDATE\":0,\"prefetchlag\":-1,\"poll\":100,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":4,\"endpend\":4,\"services\":129,\"maxpeers\":8,\"newcoin\":\"VRSC\",\"name\":\"Verus\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"91db4d20\",\"p2p\":27485,\"rpc\":27486,\"pubval\":60,\"p2shval\":85,\"wifval\":188,\"txfee_satoshis\":\"10000\",\"isPoS\":0,\"minoutput\":10000,\"minconfirms\":2,\"genesishash\":\"027e3758c3a65b12aa1046462b486d0a63bfa1beae327897f56c5cfb7daaae71\",\"protover\":170002,\"genesisblock\":\"0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000000000000000000000000000000000000000000000000000000000000029ab5f490f0f0f200b00000000000000000000000000000000000000000000000000000000000000fd4005000d5ba7cda5d473947263bf194285317179d2b0d307119c2e7cc4bd8ac456f0774bd52b0cd9249be9d40718b6397a4c7bbd8f2b3272fed2823cd2af4bd1632200ba4bf796727d6347b225f670f292343274cc35099466f5fb5f0cd1c105121b28213d15db2ed7bdba490b4cedc69742a57b7c25af24485e523aadbb77a0144fc76f79ef73bd8530d42b9f3b9bed1c135ad1fe152923fafe98f95f76f1615e64c4abb1137f4c31b218ba2782bc15534788dda2cc08a0ee2987c8b27ff41bd4e31cd5fb5643dfe862c9a02ca9f90c8c51a6671d681d04ad47e4b53b1518d4befafefe8cadfb912f3d03051b1efbf1dfe37b56e93a741d8dfd80d576ca250bee55fab1311fc7b3255977558cdda6f7d6f875306e43a14413facdaed2f46093e0ef1e8f8a963e1632dcbeebd8e49fd16b57d49b08f9762de89157c65233f60c8e38a1f503a48c555f8ec45dedecd574a37601323c27be597b956343107f8bd80f3a925afaf30811df83c402116bb9c1e5231c70fff899a7c82f73c902ba54da53cc459b7bf1113db65cc8f6914d3618560ea69abd13658fa7b6af92d374d6eca9529f8bd565166e4fcbf2a8dfb3c9b69539d4d2ee2e9321b85b331925df195915f2757637c2805e1d4131e1ad9ef9bc1bb1c732d8dba4738716d351ab30c996c8657bab39567ee3b29c6d054b711495c0d52e1cd5d8e55b4f0f0325b97369280755b46a02afd54be4ddd9f77c22272b8bbb17ff5118fedbae2564524e797bd28b5f74f7079d532ccc059807989f94d267f47e724b3f1ecfe00ec9e6541c961080d8891251b84b4480bc292f6a180bea089fef5bbda56e1e41390d7c0e85ba0ef530f7177413481a226465a36ef6afe1e2bca69d2078712b3912bba1a99b1fbff0d355d6ffe726d2bb6fbc103c4ac5756e5bee6e47e17424ebcbf1b63d8cb90ce2e40198b4f4198689daea254307e52a25562f4c1455340f0ffeb10f9d8e914775e37d0edca019fb1b9c6ef81255ed86bc51c5391e0591480f66e2d88c5f4fd7277697968656a9b113ab97f874fdd5f2465e5559533e01ba13ef4a8f7a21d02c30c8ded68e8c54603ab9c8084ef6d9eb4e92c75b078539e2ae786ebab6dab73a09e0aa9ac575bcefb29e930ae656e58bcb513f7e3c17e079dce4f05b5dbc18c2a872b22509740ebe6a3903e00ad1abc55076441862643f93606e3dc35e8d9f2caef3ee6be14d513b2e062b21d0061de3bd56881713a1a5c17f5ace05e1ec09da53f99442df175a49bd154aa96e4949decd52fed79ccf7ccbce32941419c314e374e4a396ac553e17b5340336a1a25c22f9e42a243ba5404450b650acfc826a6e432971ace776e15719515e1634ceb9a4a35061b668c74998d3dfb5827f6238ec015377e6f9c94f38108768cf6e5c8b132e0303fb5a200368f845ad9d46343035a6ff94031df8d8309415bb3f6cd5ede9c135fdabcc030599858d803c0f85be7661c88984d88faa3d26fb0e9aac0056a53f1b5d0baed713c853c4a2726869a0a124a8a5bbc0fc0ef80c8ae4cb53636aa02503b86a1eb9836fcc259823e2692d921d88e1ffc1e6cb2bde43939ceb3f32a611686f539f8f7c9f0bf00381f743607d40960f06d347d1cd8ac8a51969c25e37150efdf7aa4c2037a2fd0516fb444525ab157a0ed0a7412b2fa69b217fe397263153782c0f64351fbdf2678fa0dc8569912dcd8e3ccad38f34f23bbbce14c6a26ac24911b308b82c7e43062d180baeac4ba7153858365c72c63dcf5f6a5b08070b730adb017aeae925b7d0439979e2679f45ed2f25a7edcfd2fb77a8794630285ccb0a071f5cce410b46dbf9750b0354aae8b65574501cc69efb5b6a43444074fee116641bb29da56c2b4a7f456991fc92b2\",\"debug\":0,\"seedipaddr\":\"54.39.23.248\"}" |
@ -0,0 +1 @@ |
|||
curl --url "http://127.0.0.1:7776" --data "{\"conf\":\"ZILLA.conf\",\"path\":\"${HOME#"/"}/.komodo/ZILLA\",\"unitval\":\"20\",\"zcash\":1,\"RELAY\":-1,\"VALIDATE\":0,\"prefetchlag\":-1,\"poll\":100,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":4,\"endpend\":4,\"services\":129,\"maxpeers\":8,\"newcoin\":\"ZILLA\",\"name\":\"ZILLA\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"91db4d20\",\"p2p\":10040,\"rpc\":10041,\"pubval\":60,\"p2shval\":85,\"wifval\":188,\"txfee_satoshis\":\"10000\",\"isPoS\":0,\"minoutput\":10000,\"minconfirms\":2,\"genesishash\":\"027e3758c3a65b12aa1046462b486d0a63bfa1beae327897f56c5cfb7daaae71\",\"protover\":170002,\"genesisblock\":\"0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000000000000000000000000000000000000000000000000000000000000029ab5f490f0f0f200b00000000000000000000000000000000000000000000000000000000000000fd4005000d5ba7cda5d473947263bf194285317179d2b0d307119c2e7cc4bd8ac456f0774bd52b0cd9249be9d40718b6397a4c7bbd8f2b3272fed2823cd2af4bd1632200ba4bf796727d6347b225f670f292343274cc35099466f5fb5f0cd1c105121b28213d15db2ed7bdba490b4cedc69742a57b7c25af24485e523aadbb77a0144fc76f79ef73bd8530d42b9f3b9bed1c135ad1fe152923fafe98f95f76f1615e64c4abb1137f4c31b218ba2782bc15534788dda2cc08a0ee2987c8b27ff41bd4e31cd5fb5643dfe862c9a02ca9f90c8c51a6671d681d04ad47e4b53b1518d4befafefe8cadfb912f3d03051b1efbf1dfe37b56e93a741d8dfd80d576ca250bee55fab1311fc7b3255977558cdda6f7d6f875306e43a14413facdaed2f46093e0ef1e8f8a963e1632dcbeebd8e49fd16b57d49b08f9762de89157c65233f60c8e38a1f503a48c555f8ec45dedecd574a37601323c27be597b956343107f8bd80f3a925afaf30811df83c402116bb9c1e5231c70fff899a7c82f73c902ba54da53cc459b7bf1113db65cc8f6914d3618560ea69abd13658fa7b6af92d374d6eca9529f8bd565166e4fcbf2a8dfb3c9b69539d4d2ee2e9321b85b331925df195915f2757637c2805e1d4131e1ad9ef9bc1bb1c732d8dba4738716d351ab30c996c8657bab39567ee3b29c6d054b711495c0d52e1cd5d8e55b4f0f0325b97369280755b46a02afd54be4ddd9f77c22272b8bbb17ff5118fedbae2564524e797bd28b5f74f7079d532ccc059807989f94d267f47e724b3f1ecfe00ec9e6541c961080d8891251b84b4480bc292f6a180bea089fef5bbda56e1e41390d7c0e85ba0ef530f7177413481a226465a36ef6afe1e2bca69d2078712b3912bba1a99b1fbff0d355d6ffe726d2bb6fbc103c4ac5756e5bee6e47e17424ebcbf1b63d8cb90ce2e40198b4f4198689daea254307e52a25562f4c1455340f0ffeb10f9d8e914775e37d0edca019fb1b9c6ef81255ed86bc51c5391e0591480f66e2d88c5f4fd7277697968656a9b113ab97f874fdd5f2465e5559533e01ba13ef4a8f7a21d02c30c8ded68e8c54603ab9c8084ef6d9eb4e92c75b078539e2ae786ebab6dab73a09e0aa9ac575bcefb29e930ae656e58bcb513f7e3c17e079dce4f05b5dbc18c2a872b22509740ebe6a3903e00ad1abc55076441862643f93606e3dc35e8d9f2caef3ee6be14d513b2e062b21d0061de3bd56881713a1a5c17f5ace05e1ec09da53f99442df175a49bd154aa96e4949decd52fed79ccf7ccbce32941419c314e374e4a396ac553e17b5340336a1a25c22f9e42a243ba5404450b650acfc826a6e432971ace776e15719515e1634ceb9a4a35061b668c74998d3dfb5827f6238ec015377e6f9c94f38108768cf6e5c8b132e0303fb5a200368f845ad9d46343035a6ff94031df8d8309415bb3f6cd5ede9c135fdabcc030599858d803c0f85be7661c88984d88faa3d26fb0e9aac0056a53f1b5d0baed713c853c4a2726869a0a124a8a5bbc0fc0ef80c8ae4cb53636aa02503b86a1eb9836fcc259823e2692d921d88e1ffc1e6cb2bde43939ceb3f32a611686f539f8f7c9f0bf00381f743607d40960f06d347d1cd8ac8a51969c25e37150efdf7aa4c2037a2fd0516fb444525ab157a0ed0a7412b2fa69b217fe397263153782c0f64351fbdf2678fa0dc8569912dcd8e3ccad38f34f23bbbce14c6a26ac24911b308b82c7e43062d180baeac4ba7153858365c72c63dcf5f6a5b08070b730adb017aeae925b7d0439979e2679f45ed2f25a7edcfd2fb77a8794630285ccb0a071f5cce410b46dbf9750b0354aae8b65574501cc69efb5b6a43444074fee116641bb29da56c2b4a7f456991fc92b2\",\"debug\":0,\"seedipaddr\":\"54.39.23.248\"}" |
@ -0,0 +1,254 @@ |
|||
|
|||
/******************************************************************************
|
|||
* Copyright © 2014-2018 The SuperNET Developers. * |
|||
* * |
|||
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * |
|||
* the top-level directory of this distribution for the individual copyright * |
|||
* holder information and the developer policies on copyright and licensing. * |
|||
* * |
|||
* Unless otherwise agreed in a custom licensing agreement, no part of the * |
|||
* SuperNET software, including this file may be copied, modified, propagated * |
|||
* or distributed except according to the terms contained in the LICENSE file * |
|||
* * |
|||
* Removal or modification of this copyright notice is prohibited. * |
|||
* * |
|||
******************************************************************************/ |
|||
//
|
|||
// LP_mpnet.c
|
|||
// marketmaker
|
|||
//
|
|||
|
|||
bits256 MPNET_txids[1024]; |
|||
int32_t num_MPNET_txids; |
|||
|
|||
int32_t LP_tradecommand(int32_t from_mpnet,void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,uint8_t *data,int32_t datalen); |
|||
int32_t LP_quoteparse(struct LP_quoteinfo *qp,cJSON *argjson); |
|||
void LP_gtc_addorder(struct LP_quoteinfo *qp); |
|||
char *LP_withdraw(struct iguana_info *coin,cJSON *argjson); |
|||
|
|||
int32_t LP_mpnet_find(bits256 txid) |
|||
{ |
|||
int32_t i; |
|||
for (i=0; i<num_MPNET_txids; i++) |
|||
if ( bits256_cmp(txid,MPNET_txids[i]) == 0 ) |
|||
return(i); |
|||
return(-1); |
|||
} |
|||
|
|||
int32_t LP_mpnet_add(bits256 txid) |
|||
{ |
|||
if ( num_MPNET_txids < sizeof(MPNET_txids)/sizeof(*MPNET_txids) ) |
|||
{ |
|||
MPNET_txids[num_MPNET_txids++] = txid; |
|||
return(num_MPNET_txids); |
|||
} |
|||
printf("MPNET_txids[] overflow\n"); |
|||
return(-1); |
|||
} |
|||
|
|||
int32_t LP_mpnet_remove(bits256 txid) |
|||
{ |
|||
int32_t i; |
|||
if ( (i= LP_mpnet_find(txid)) >= 0 ) |
|||
{ |
|||
MPNET_txids[i] = MPNET_txids[--num_MPNET_txids]; |
|||
return(i); |
|||
} |
|||
return(-1); |
|||
} |
|||
|
|||
int32_t LP_mpnet_addorder(struct LP_quoteinfo *qp) |
|||
{ |
|||
uint64_t destvalue,destvalue2; |
|||
if ( LP_iseligible(&destvalue,&destvalue2,0,qp->destcoin,qp->desttxid,qp->destvout,qp->destsatoshis,qp->feetxid,qp->feevout) > 0 ) |
|||
{ |
|||
LP_gtc_addorder(qp); |
|||
return(0); |
|||
} |
|||
return(-1); |
|||
} |
|||
|
|||
void LP_mpnet_init() // problem is coins not enabled yet
|
|||
{ |
|||
char fname[1024],line[8192]; FILE *fp; struct LP_quoteinfo Q; cJSON *argjson; |
|||
sprintf(fname,"%s/GTC/orders",GLOBAL_DBDIR), OS_compatible_path(fname); |
|||
if ( (fp= fopen(fname,"rb+")) != 0 ) |
|||
{ |
|||
while ( fgets(line,sizeof(line),fp) > 0 ) |
|||
{ |
|||
if ( (argjson= cJSON_Parse(line)) != 0 ) |
|||
{ |
|||
if ( LP_quoteparse(&Q,argjson) == 0 ) |
|||
{ |
|||
if ( LP_mpnet_addorder(&Q) == 0 ) |
|||
printf("GTC %s",line); |
|||
} |
|||
free_json(argjson); |
|||
} |
|||
} |
|||
fclose(fp); |
|||
} |
|||
} |
|||
|
|||
void LP_mpnet_send(int32_t localcopy,char *msg,int32_t sendflag,char *otheraddr) |
|||
{ |
|||
char fname[1024]; int32_t len; FILE *fp; char *hexstr,*retstr; cJSON *argjson,*outputs,*item; struct iguana_info *coin; uint8_t linebuf[8192]; |
|||
if ( localcopy != 0 ) |
|||
{ |
|||
sprintf(fname,"%s/GTC/orders",GLOBAL_DBDIR), OS_compatible_path(fname); |
|||
if ( (fp= fopen(fname,"rb+")) == 0 ) |
|||
fp = fopen(fname,"wb+"); |
|||
else fseek(fp,0,SEEK_END); |
|||
fprintf(fp,"%s\n",msg); |
|||
fclose(fp); |
|||
} |
|||
if ( G.mpnet != 0 && sendflag != 0 && (coin= LP_coinfind("CHIPS")) != 0 && coin->inactive == 0 ) |
|||
{ |
|||
len = MMJSON_encode(linebuf,msg); |
|||
//curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"withdraw\",\"coin\":\"CHIPS\",\"outputs\":[{\"RHV2As4rox97BuE3LK96vMeNY8VsGRTmBj\":0.0001}],\"opreturn\":\"deadbeef\"}"
|
|||
if ( len > 0 ) |
|||
{ |
|||
argjson = cJSON_CreateObject(); |
|||
outputs = cJSON_CreateArray(); |
|||
if ( otheraddr != 0 && otheraddr[0] != 0 ) |
|||
{ |
|||
item = cJSON_CreateObject(); |
|||
jaddnum(item,otheraddr,dstr(10000)); |
|||
jaddi(outputs,item); |
|||
} |
|||
item = cJSON_CreateObject(); |
|||
jaddnum(item,coin->smartaddr,dstr(10000)); |
|||
jaddi(outputs,item); |
|||
jadd(argjson,"outputs",outputs); |
|||
jaddnum(argjson,"broadcast",1); |
|||
jaddstr(argjson,"coin",coin->symbol); |
|||
hexstr = calloc(1,len*2 + 1); |
|||
init_hexbytes_noT(hexstr,linebuf,len); |
|||
jaddstr(argjson,"opreturn",hexstr); |
|||
free(hexstr); |
|||
retstr = LP_withdraw(coin,argjson); |
|||
free_json(argjson); |
|||
if ( retstr != 0 ) |
|||
{ |
|||
//printf("mpnet.%s\n",retstr);
|
|||
free(retstr); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
cJSON *LP_mpnet_parse(struct iguana_info *coin,bits256 txid) |
|||
{ |
|||
cJSON *txobj,*vouts,*sobj,*argjson = 0; char *decodestr,*hexstr; uint8_t *buf,linebuf[8192]; int32_t len,n,hlen; |
|||
if ( (txobj= LP_gettx("mpnet",coin->symbol,txid,0)) != 0 ) |
|||
{ |
|||
if ( (vouts= jarray(&n,txobj,"vout")) != 0 ) |
|||
{ |
|||
if ( (sobj= jobj(jitem(vouts,n-1),"scriptPubKey")) != 0 && (hexstr= jstr(sobj,"hex")) != 0 && (hlen= strlen(hexstr)) < sizeof(linebuf)*2 ) |
|||
{ |
|||
len = (hlen >> 1); |
|||
decode_hex(linebuf,len,hexstr); |
|||
buf = linebuf; |
|||
//printf("hexstr.(%s)\n",hexstr);
|
|||
if ( *buf == 0x6a ) |
|||
{ |
|||
buf++, len--; |
|||
if ( *buf == 0x4d ) |
|||
{ |
|||
buf++, len--; |
|||
n = buf[0] + buf[1]*256; |
|||
buf += 2, len -= 2; |
|||
if ( n == len ) |
|||
{ |
|||
if ( (decodestr= MMJSON_decode(buf,len)) != 0 ) |
|||
argjson = cJSON_Parse(decodestr); |
|||
} |
|||
} |
|||
} |
|||
if ( 0 && argjson == 0 ) |
|||
printf("unhandled case.(%s)\n",hexstr); |
|||
} |
|||
} |
|||
if ( 0 && argjson == 0 ) |
|||
printf("unhandled tx.(%s)\n",jprint(txobj,0)); |
|||
free_json(txobj); |
|||
} |
|||
return(argjson); |
|||
} |
|||
|
|||
// 2151978
|
|||
// 404bc4ac452db07ed16376b3d7e77dbfc22b4a68f7243797125bd0d3bdddf8d1
|
|||
// 893b46634456034a6d5d73b67026aa157b5e2addbfc6344dfbea6bae85f7dde0
|
|||
// 717c7ef9de8504bd331f3ef52ed0a16ea0e070434e12cb4d63f5f081e999c43d dup
|
|||
|
|||
void LP_mpnet_process(void *ctx,char *myipaddr,int32_t pubsock,struct iguana_info *coin,bits256 txid) |
|||
{ |
|||
cJSON *argjson; char str[65]; |
|||
if ( LP_mpnet_find(txid) < 0 ) |
|||
{ |
|||
//printf("unique %s\n",bits256_str(str,txid));
|
|||
if ( (argjson= LP_mpnet_parse(coin,txid)) != 0 ) |
|||
{ |
|||
//printf("MPNET.(%s)\n",jprint(argjson,0));
|
|||
LP_tradecommand(1,ctx,myipaddr,pubsock,argjson,0,0); |
|||
free_json(argjson); |
|||
} |
|||
LP_mpnet_add(txid); |
|||
} |
|||
} |
|||
|
|||
cJSON *LP_mpnet_get(void *ctx,char *myipaddr,int32_t pubsock,struct iguana_info *coin) |
|||
{ |
|||
static int32_t lastheight; static bits256 lasthash; |
|||
int32_t i,n=0,numtx,checkht = 0,height = 0; bits256 latesthash,hash,txid,zero; char hashstr[65],str[65]; cJSON *txs,*blockjson; |
|||
memset(zero.bytes,0,sizeof(zero)); |
|||
latesthash = LP_getbestblockhash(coin); |
|||
bits256_str(hashstr,latesthash); |
|||
if ( (blockjson= LP_blockjson(&checkht,coin->symbol,hashstr,0)) != 0 ) |
|||
{ |
|||
hash = latesthash; |
|||
while ( bits256_cmp(lasthash,hash) != 0 && n++ < 3 ) |
|||
{ |
|||
if ( (txs= jarray(&numtx,blockjson,"tx")) != 0 ) |
|||
{ |
|||
for (i=0; i<numtx; i++) |
|||
{ |
|||
txid = jbits256i(txs,i); |
|||
LP_mpnet_process(ctx,myipaddr,pubsock,coin,txid); |
|||
LP_mpnet_remove(txid); |
|||
//printf("ht.%d n.%d i.%d %s\n",checkht,n,i,bits256_str(str,txid));
|
|||
} |
|||
} |
|||
hash = jbits256(blockjson,"previousblockhash"); |
|||
free_json(blockjson); |
|||
bits256_str(hashstr,hash); |
|||
if ( (blockjson= LP_blockjson(&checkht,coin->symbol,hashstr,0)) == 0 ) |
|||
break; |
|||
} |
|||
lasthash = latesthash; |
|||
if ( blockjson != 0 ) |
|||
free_json(blockjson); |
|||
if ( (txs= LP_getmempool(coin->symbol,coin->smartaddr,zero,zero)) != 0 ) |
|||
{ |
|||
numtx = cJSON_GetArraySize(txs); |
|||
for (i=0; i<numtx; i++) |
|||
{ |
|||
txid = jbits256i(txs,i); |
|||
LP_mpnet_process(ctx,myipaddr,pubsock,coin,txid); |
|||
//printf("mp i.%d %s\n",i,bits256_str(str,txid));
|
|||
} |
|||
} |
|||
} |
|||
return(0); |
|||
} |
|||
|
|||
void LP_mpnet_check(void *ctx,char *myipaddr,int32_t pubsock) |
|||
{ |
|||
static uint32_t lasttime; |
|||
struct iguana_info *coin = LP_coinfind("CHIPS"); |
|||
if ( coin != 0 && coin->inactive == 0 && time(NULL) > lasttime+5 ) |
|||
{ |
|||
LP_mpnet_get(ctx,myipaddr,pubsock,coin); |
|||
lasttime = (uint32_t)time(NULL); |
|||
} |
|||
} |
@ -1,2 +1,2 @@ |
|||
source userpass |
|||
curl --url "http://127.0.0.1:7783" --data "{\"minprice\":0.00006,\"maxprice\":0.0002,\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"CHIPS\",\"rel\":\"BTC\",\"margin\":0.05,\"refbase\":\"chips\",\"refrel\":\"coinmarketcap\"}" |
|||
curl --url "http://127.0.0.1:7783" --data "{\"minprice\":0.00002,\"maxprice\":0.0002,\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"CHIPS\",\"rel\":\"BTC\",\"margin\":0.05,\"refbase\":\"chips\",\"refrel\":\"coinmarketcap\"}" |
|||
|
@ -1,2 +1,2 @@ |
|||
source userpass |
|||
curl --url "http://127.0.0.1:7783" --data "{\"minprice\":0.15,\"maxprice\":0.4,\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"CHIPS\",\"rel\":\"KMD\",\"margin\":0.05,\"refbase\":\"chips\",\"refrel\":\"coinmarketcap\"}" |
|||
curl --url "http://127.0.0.1:7783" --data "{\"minprice\":0.05,\"maxprice\":0.4,\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"CHIPS\",\"rel\":\"KMD\",\"margin\":0.05,\"refbase\":\"chips\",\"refrel\":\"coinmarketcap\"}" |
|||
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,3 @@ |
|||
#!/bin/bash |
|||
source userpass |
|||
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"gen64addrs\",\"passphrase\":\"default\"}" |
@ -0,0 +1,102 @@ |
|||
# Market Maker 2 |
|||
|
|||
This document will help us track the information related to the MarketMaker Rust rewrite. |
|||
|
|||
## Rewrite goals |
|||
|
|||
Rewrites and ports |
|||
[are costly](http://nibblestew.blogspot.com/2017/04/why-dont-you-just-rewrite-it-in-x.html). |
|||
We tend to think that porting is simple, and on some level this intuition is true |
|||
because we can skip some high-level design decisions and focus on translating the existing logic, |
|||
but it still takes a lot of time |
|||
and though we don't need to make some of the new design decisions, |
|||
we might spend no less effort to reverse-engineer and understand the old ones. |
|||
|
|||
So why the rewrite then? |
|||
|
|||
Carol, in her talk about rewrites, offers some possible reasons: |
|||
|
|||
"*If* you have some code in C or another language, and need to change it, or it’s slow, or it crashes a |
|||
lot, or no one understands it anymore, THEN maybe a rewrite in Rust would be a good fit. |
|||
I would also posit that more people are *able* to write production Rust than production C, so if your |
|||
team *is* willing to learn Rust, it might actually expand the number of |
|||
maintainers." - https://github.com/carols10cents/rust-out-your-c-talk, https://www.youtube.com/watch?v=SKGVItFlK3w. |
|||
|
|||
And we have some of these: |
|||
|
|||
* We *need to change* the MarketMaker: |
|||
A more approachable and reliable API. |
|||
Ability to embed the MarketMaker in the GUI applications. |
|||
Ways to more easily deploy it at home by running it from small computers like on a spare mobile phone or on a Raspberry Pi 3. |
|||
Ability to process multiple API calls in parallel. |
|||
A faster version of the `swapstatus` API call. |
|||
|
|||
* The MarketMaker *crashes a lot*, |
|||
to quote hyperDEX: "The biggest issue with the MM right now, is bobs crash or does not have the orders in users orderbook, or when users try to do a order it doesnt work or goes unmatched or other random stuff" |
|||
and lukechilds: "We've frequently experienced crashes while querying all swaps with swapstatus". |
|||
We want it to be stable and reliable instead. |
|||
|
|||
## Purely functional core |
|||
|
|||
One of our goals is to make the MarketMaker 2 more |
|||
[stable and reliable](https://softwareengineering.stackexchange.com/questions/158054/stability-vs-reliability). |
|||
We want it to crash less often. |
|||
If there was a failure, we want to simplify and preferably automate recovery. |
|||
And we want to reduce the time between a failure and a fix. |
|||
|
|||
We'll make a big step towards these goals if the core of the MarketMaker is purely functional. |
|||
That is, if we can untangle the *state* of the MarketMaker from the code operating on that state. |
|||
|
|||
The benefits we want to reap from this are: |
|||
* Transparency. Some bugs are hard to fix because we don't have enough information about them. We might be lucky to have been running the program in a debugger or finding the necessary bits it verbose logs, but more often than not this is not the case: we know that a failure has happened, but have no idea where and on what input. Separating the state from the code allows the state to be easily shared with a developer, which means much faster roundtrips between discovering a failure and fixing it. |
|||
* Replayability. Having a separate state allows us to easily replay any operation. If a failure occured in the middle of a transaction, it should be possible to try a new version of the code without manually repeating all the steps that were necessary to initiate the transaction. And the updated code will run exactly on the failing transaction, not on some other transaction initiated at a later time, which means that users will benefit from less friction and developers will have a better chance to fix the hard-to-reproduce bugs. |
|||
* Testability. Stateless code is much easier to test and according to Kent Beck is often a natural result of a Test-Driven development process. |
|||
* Portability. Separating the state from the code allows us to more easily use the stateless parts from the sandboxed environments, such as when running under the Web Assembly (WASM). We only need to port the state-managing layer, fully reusing the stateless code. |
|||
* Hot reloading. When the code is separated from state, it's trivial to reload it, both with the shared libraries in CPU-native environments (dlopen) and with WASM in GUI environments. This might positively affect the development cycle, reducing the round-trip time from a failure to a fix. |
|||
* Concurrency. MarketMaker can currently only perform a single API operation at the time. The more stateless code we have the easier it should be to introduce the parallel execution of API requests in the future. |
|||
|
|||
Implementation might consist of two layers. |
|||
A layer that is ported to the host environment (native, JS, Java, Objective-C, cross-compiled Raspberry Pi 3, etc) and implements the TCP/IP communication, state management, hot reloading, all things that won't fit into the WASM sandbox. |
|||
And a layer that implements the core logic in a stateless manner and which is compiled into a native shared library or, in the future, to WASM. |
|||
|
|||
Parts of the state might be marked as sensitive. |
|||
This will give the users an option to share only the information that can be freely shared, |
|||
without a risk of loosing money that is. |
|||
Even without the sensitive information a state snapshot might provide the developer with enough data to quickly triage and/or fix the failure, therefore improving the roundtrip time before a failure and a fix. |
|||
Plus users will more easily share their problems when it's quick, automatic and doesn't pose a monetary risk. |
|||
|
|||
The feasibility of this approach is yet to be evaluated, but we can move gradually towards it |
|||
by separating the code into the stateful and stateless layers while working on the basic Rust port. |
|||
|
|||
During the initial Rust port we're going to |
|||
a) Mark the ported functions as purely functional or stateful, allowing us to more easily focus on the state management code in the future. |
|||
b) Where possible, take a low-hanging fruit and try to refactor the functions towards being stateless. |
|||
c) Probably mark as stateful the `sleep`ing functions, because `sleep` can be seen as changing the global state (moving the time forwards) and might negatively affect Transparency (we have no idea what's going on while a function is sleeping), Testability (sleeping tests might kill the TDD development cycle), Portability (sleeps are not compatible with WASM), Hot reloading and Concurrency (let's say we want to load new version of the code, but the old version is still sleeping somewhere). |
|||
|
|||
## Gradual rewrite |
|||
|
|||
Above in the [Rewrite goals](#rewrite-goals) section we have identified some of the goals that we pursue with this rewrite. |
|||
These goals constitute the Value (in the Lean Production terms) that we are going to create. |
|||
|
|||
For a project to suceed it is usually important to make shorter the path the Value takes to the users. |
|||
(Inventory is waste. If we have created the Value but the users can't get their hands on it, we're wasting that Value). |
|||
|
|||
Hence we're going to start with a gradual rewrite. Keeping the version under rewrite immediately avaliable to the users willing to experiment with it. |
|||
|
|||
Let's list the good things that should come out of the gradual rewrite: |
|||
* Transparency. With the second version of the MarketMaker being immediately available we can always check the Value we're getting. Is it more stable? Does it have new functions? Or did we hit the wall? What's going on with the code and how can we help? Gradual rewrite is critical for transparency because the change is available in small increments. We can more easily see what function has changed or what new functionality was added when we aren't being uprooted from the familiar context. |
|||
* Risk reduction. It comes with transparency, as we can now more easily measure the progress, identify the roadblocks as they occur, see certain problems when they occur and not months after. Plus a gradual rewrite will by default follow the outline of the original project. We have a working system and we're improving it piece by piece, having the original design to fall back to. This makes it less likely for the rewrite to suffer from far-reaching redesign flaws (cf. [Second-system effect](https://en.wikipedia.org/wiki/Second-system_effect)) and creative blocks (cf. [Pantsing](https://www.wikiwrimo.org/wiki/Pantsing)). |
|||
* Feedback. Incorporating user feedback is critical for most projects out there, allowing us to iteratively improve the functionality in the right direction (cf. [Fail faster](https://www.youtube.com/watch?v=rDjrOaoHz9s), [PDIA](https://www.youtube.com/watch?v=ZKdjBbiGjao)). The more early we get the feedback, the more time we have to react, and at a lesser cost. |
|||
* Motivation. Feedback is not only important to guide us, but also to show us that our work is meaningful and changes lives to the better. It is the cornerstone of Agile (["Build projects around motivated individuals"](https://www.agilealliance.org/agile101/12-principles-behind-the-agile-manifesto/)) and affects our performance on all levels, down to the physical health. |
|||
|
|||
The plan so far is to by default use the C functions as the atomic units of rewrite. |
|||
Rust FFI allows us to swap any C function with a similar Rust function. |
|||
Porting on this level we |
|||
* reuse the function-level modularity of the C language; |
|||
* preserve the code meta-data (Git history will show a nice diff between the C and Rust functions, we'll be able to easily investigate the evolution of the code back to its roots); |
|||
* avoid the complexity and slow-downs associated with adding RPC/networking layers or drawing new lines of abstraction; |
|||
* have a good indicator of the porting progress (how many functions were ported, how many remains). |
|||
|
|||
Focusing on the function call chains that are a common part of a failure/crash or touch on the new functionality |
|||
will allow us to leverage the [Pareto principle](https://en.wikipedia.org/wiki/Pareto_principle), |
|||
advancing on 80% of desired Value (stability, functionality) with 20% of initial effort. |
@ -1,4 +1,4 @@ |
|||
#!/bin/bash |
|||
source userpass |
|||
# this will only work for watchonly addresses that have been rescanned and with active coins |
|||
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"fundvalue\",\"address\":\"RTu3JZZKLJTcfNwBa19dWRagEfQq49STqC\",\"holdings\":[{\"coin\":\"iota\",\"balance\":1500000}, {\"coin\":\"bitcoin-cash\",\"balance\":1200}, {\"coin\":\"bitcoin\",\"balance\":100}, {\"coin\":\"komodo\",\"balance\":100000}, {\"coin\":\"chips\",\"balance\":100000}],\"divisor\":1400000}" |
|||
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"fundvalue\",\"address\":\"RTu3JZZKLJTcfNwBa19dWRagEfQq49STqC\",\"holdings\":[{\"coin\":\"iota\",\"balance\":1500000}, {\"coin\":\"bitcoin-cash\",\"balance\":1200}, {\"coin\":\"bitcoin\",\"balance\":25}],\"divisor\":1400000}" |
|||
|
@ -0,0 +1,8 @@ |
|||
#!/bin/bash |
|||
docker-compose exec -T clientnode ./enable |
|||
sleep 3 |
|||
docker-compose exec -T seednode ./enable |
|||
sleep 3 |
|||
docker-compose exec -T seednode ./sell_BEER_OTHER $1 |
|||
sleep 3 |
|||
docker-compose exec -T clientnode ./buy_BEER_OTHER $1 |
@ -0,0 +1,8 @@ |
|||
#!/bin/bash |
|||
docker-compose exec -T clientnode ./enable |
|||
sleep 3 |
|||
docker-compose exec -T seednode ./enable |
|||
sleep 3 |
|||
docker-compose exec -T clientnode ./buy_BEER_OTHER $1 |
|||
sleep 3 |
|||
docker-compose exec -T seednode ./sell_BEER_OTHER $1 |
@ -0,0 +1,5 @@ |
|||
#!/bin/bash |
|||
sudo rm -rf /usr/local/cmake-3.9.2 && sudo rm -rf /usr/local/cmake |
|||
wget https://cmake.org/files/v3.12/cmake-3.12.0-rc2-Linux-x86_64.sh |
|||
chmod +x cmake-3.12.0-rc2-Linux-x86_64.sh |
|||
sudo ./cmake-3.12.0-rc2-Linux-x86_64.sh --skip-license --exclude-subdir --prefix=/usr/local |
@ -0,0 +1,6 @@ |
|||
#!/bin/bash |
|||
brew uninstall cmake --force |
|||
wget https://cmake.org/files/v3.12/cmake-3.12.0-rc2-Darwin-x86_64.tar.gz |
|||
tar -xzf cmake-3.12.0-rc2-Darwin-x86_64.tar.gz |
|||
cp -r cmake-3.12.0-rc2-Darwin-x86_64/CMake.app/Contents/bin/* /usr/local/bin/ |
|||
cp -r cmake-3.12.0-rc2-Darwin-x86_64/CMake.app/Contents/share/* /usr/local/share/ |
Loading…
Reference in new issue