Browse Source

Merge pull request #13 from jl777/dev

update dev
pass-iguana-arg
ca333 7 years ago
committed by GitHub
parent
commit
c884a55cbe
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 267
      .gitignore
  2. 4
      .gitmodules
  3. 30
      .travis.yml
  4. 33
      CMakeLists.txt
  5. 7
      Dockerfile
  6. 20
      Jenkinsfile
  7. 2
      LEGAL/LICENSE
  8. BIN
      OSlibs/android/lib/libcrypto.so
  9. BIN
      OSlibs/android/lib/libcurl.a
  10. BIN
      OSlibs/android/lib/libssl.so
  11. BIN
      OSlibs/ios/lib/libcrypto.a
  12. BIN
      OSlibs/ios/lib/libcurl.a
  13. BIN
      OSlibs/ios/lib/libssl.a
  14. BIN
      OSlibs/js/libnanomsg.a
  15. BIN
      OSlibs/js/libnanomsg.so
  16. BIN
      OSlibs/linux/x86_64/libnanomsg-static.a
  17. BIN
      OSlibs/osx/libcrypto.a
  18. BIN
      OSlibs/osx/libcurl.a
  19. BIN
      OSlibs/osx/libgmp.a
  20. BIN
      OSlibs/osx/libsecp256k1.a
  21. BIN
      OSlibs/osx/libssl.a
  22. BIN
      OSlibs/win/libcrypto-1_1.dll
  23. BIN
      OSlibs/win/libcrypto.a
  24. BIN
      OSlibs/win/libcurl.a
  25. BIN
      OSlibs/win/libcurl.dll
  26. BIN
      OSlibs/win/libcurldll.a
  27. BIN
      OSlibs/win/libpthreadGC2.a
  28. BIN
      OSlibs/win/libpthreadGC2_64.a
  29. BIN
      OSlibs/win/libsecp256k1.a
  30. BIN
      OSlibs/win/libssl-1_1.dll
  31. BIN
      OSlibs/win/libssl.a
  32. BIN
      OSlibs/win/nanomsg.dll
  33. BIN
      OSlibs/win/pthreadGC2.dll
  34. BIN
      OSlibs/win/pthreadGC2_64.dll
  35. BIN
      OSlibs/win/release/nanomsg.dll
  36. BIN
      OSlibs/win/release/pthreadvc2.dll
  37. BIN
      OSlibs/win/x64/libcurl.dll
  38. BIN
      OSlibs/win/x64/libpthreadGC2.a
  39. BIN
      OSlibs/win/x64/nanomsg.dll
  40. BIN
      OSlibs/win/x64/release/libcurl.dll
  41. BIN
      OSlibs/win/x64/release/nanomsg.dll
  42. 31
      README.md
  43. 6
      appveyor.yml
  44. 12
      basilisk/basilisk.c
  45. 2
      basilisk/basilisk.h
  46. 2
      basilisk/basilisk_DEX.c
  47. 2
      basilisk/basilisk_MSG.c
  48. 14
      basilisk/basilisk_bitcoin.c
  49. 2
      basilisk/basilisk_swap.c
  50. 2
      basilisk/basilisk_tradebot.c
  51. 2
      basilisk/jumblr.c
  52. 2
      basilisk/smartaddress.c
  53. 2
      basilisk/tradebots_liquidity.c
  54. 2
      basilisk/tradebots_marketmaker.c
  55. 15
      cmake/DownloadProject.CMakeLists.cmake.in
  56. 182
      cmake/DownloadProject.cmake
  57. 18
      cmake/Hunter/config.cmake
  58. 529
      cmake/HunterGate.cmake
  59. 4
      cmake/toolchain.cmake
  60. 1
      cpp-ethereum
  61. 11
      crypto777/CMakeLists.txt
  62. 2
      crypto777/OS_nonportable.c
  63. 2
      crypto777/OS_portable.c
  64. 5
      crypto777/OS_portable.h
  65. 2
      crypto777/OS_time.c
  66. 2
      crypto777/SaM.c
  67. 19
      crypto777/bitcoind_RPC.c
  68. 2
      crypto777/cJSON.c
  69. 2
      crypto777/curve25519.c
  70. 2
      crypto777/iguana_OS.c
  71. 2
      crypto777/iguana_serdes.c
  72. 43
      crypto777/iguana_utils.c
  73. 4
      crypto777/jpeg/CMakeLists.txt
  74. BIN
      crypto777/pnacl_libs/libcrypto.a
  75. BIN
      crypto777/pnacl_libs/libcurl.a
  76. BIN
      crypto777/pnacl_libs/libnanomsg.a
  77. BIN
      crypto777/pnacl_libs/libssl.a
  78. BIN
      crypto777/pnacl_libs/libz.a
  79. 2
      crypto777/ramcoder.c
  80. 4
      datachain/datachain.c
  81. 1279
      deprecated/iguana_notary.c
  82. 20490
      deprecated/obsolete.h
  83. 3
      etomic_build/autoprice
  84. 3
      etomic_build/buy
  85. 5
      etomic_build/client
  86. 3
      etomic_build/coins
  87. 5
      etomic_build/enable
  88. 3
      etomic_build/orderbook
  89. 1
      etomic_build/passphrase
  90. 5
      etomic_build/run
  91. 4
      etomic_build/setpassphrase
  92. 3
      etomic_build/stop
  93. 2
      etomic_build/userpass
  94. 2
      gecko/gecko.c
  95. 2
      gecko/gecko_miner.c
  96. BIN
      iguana/Kashi/json_extracta
  97. 11
      iguana/Readme.md
  98. 65
      iguana/SuperNET_keys.c
  99. 1
      iguana/acsplit
  100. 45
      iguana/build_static_nanomsg.sh

267
.gitignore

@ -3,6 +3,11 @@ x64
agents/iguana.exe
Debug/*
iguana/nanomsglib
iguana/nanomsgsrc
OSlibs/linux
OSlibs/osx
iguana/pnacl/Release/iguana_unstripped.pexe
iguana/pnacl/Release/iguana.pexe
@ -48,7 +53,6 @@ iguana/help.json
iguana/autoAPI.md
iguana/basilisk.o-2ad8cb38
=======
*.pbxproj
iguana/tmp/.tmpmarker
@ -229,259 +233,10 @@ iguana/confs/630929d976025fafde221c7358eb5805f4359bad3c6b8bd50ad3f6e0a9b5ce78
iguana/confs/5f3283a017c31e52443d61cb43944e2157f7c03eb12d701ebf4a35a695688e1f
iguana/DB/SWAPS/1313603851-3952777544
iguana/DB/SWAPS/1923456555-3815385469
iguana/DB/SWAPS/897416195-4050269921
iguana/DB/SWAPS/2465996447-4202128826
iguana/DB/SWAPS/3078036996-3700749298
iguana/DB/SWAPS/1061498231-3266306388
iguana/DB/SWAPS/1060082251-3390546616
iguana/SVM/rawfeatures/BTCD_BTC
iguana/DB/SWAPS/1032184933-1028220623
iguana/DB/SWAPS/771249356-2746947221
iguana/DB/SWAPS/2311778512-3235676199
iguana/DB/SWAPS/3385048746-2109923340
iguana/DB/SWAPS/1739581643-2099619754
iguana/DB/SWAPS/2247429570-1367058185
iguana/DB/SWAPS/3178831915-912907861
iguana/DB/SWAPS/445514331-1083446761
iguana/DB/SWAPS/2510768478-2766365035
iguana/DB/SWAPS/2072817844-2263105627
iguana/DB/SWAPS/230888617-1894645930
iguana/DB/SWAPS/3606847984-2574036327
iguana/DB/SWAPS/2384443255-1263480722
iguana/DB/SWAPS/845549832-3630913950
iguana/DB/SWAPS/2050938501-203733478
iguana/DB/SWAPS/3434672913-3981690962
iguana/DB/SWAPS/2840127595-1174059534
iguana/DB/SWAPS/2448551545-1211445977
*.alicepayment
*.myfee
iguana/DB/SWAPS/1313312572-123661666
iguana/DB/SWAPS/3408402932-4088991610
iguana/DB/SWAPS/3772541120-2007204891
iguana/DB/SWAPS/784303571-1929722462
iguana/DB/SWAPS/3221116355-3522779294
iguana/DB/SWAPS/1703578312-1139459191
iguana/DB/SWAPS/1192374491-1050242469
iguana/DB/SWAPS/4244307493-1619487751
iguana/DB/SWAPS/3213119432-553439289
iguana/DB/SWAPS/3854521391-612984356
iguana/DB/SWAPS/3611231334-1171171579
iguana/DB/SWAPS/1505015888-2633757068
iguana/DB/SWAPS/3430299677-3087427598
iguana/DB/SWAPS/2275651697-591036515
iguana/DB/SWAPS/2180638961-896149751
iguana/DB/SWAPS/2349180798-2344225091
iguana/DB/SWAPS/1395238080-4120976642
iguana/DB/SWAPS/1914406677-1452353494
iguana/DB/SWAPS/3193054754-2514575257
iguana/DB/SWAPS/3004995589-1950720855
iguana/3193054754-2514575257
iguana/DB/SWAPS/2912654530-2125064238
iguana/DB/SWAPS/3448271011-3628813832
iguana/DB/SWAPS/3448271011-3628813832
iguana/DB/SWAPS/403615495-1237768524
iguana/DB/SWAPS/3448271011-3628813832
iguana/DB/SWAPS/403615495-1237768524
iguana/DB/SWAPS/3448271011-3628813832
iguana/DB/SWAPS/246664144-1570119145
iguana/DB/SWAPS/171316098-410428064
iguana/DB/SWAPS/178665381-1950467641
iguana/DB/SWAPS/4126499968-376410338
iguana/DB/SWAPS/1518259123-2214130634
iguana/DB/SWAPS/152114847-907489057
iguana/DB/SWAPS/61119357-1960547076
iguana/DB/SWAPS/26534791-3105729230
*.finished
iguana/DB/SWAPS/2279906047-2580050792
iguana/DB/SWAPS/1672096208-4211948211
iguana/DB/SWAPS/3062665554-3128383014
iguana/DB/SWAPS/2668150969-2698996317
iguana/DB/SWAPS/3462690702-2419919594
iguana/DB/SWAPS/543051861-1532200070
iguana/DB/SWAPS/442294237-2721246052
iguana/DB/SWAPS/1247864366-3828803132
iguana/DB/SWAPS/2910626293-1439062588
iguana/DB/SWAPS/3893087081-2278083649
iguana/DB/SWAPS/2990527454-48620696
iguana/DB/SWAPS/217534954-2300638414
iguana/DB/SWAPS/2780026367-3028893038
iguana/DB/SWAPS/467080987-1442519493
iguana/DB/SWAPS/1504818827-1454232932
iguana/DB/SWAPS/4093850898-2949785771
iguana/DB/SWAPS.old/1247864366-3828803132
iguana/DB/SWAPS.old/.tmpmarker
iguana/DB/SWAPS/2723832060-1788071166
iguana/DB/SWAPS/3210648667-2626363704
iguana/DB/SWAPS/415703857-2769362858
iguana/3193054754-2514575257
iguana/DB/SWAPS/2723832060-1788071166
iguana/DB/SWAPS/3213598586-2281632307
iguana/DB/SWAPS/2686675855-3655454671
iguana/DB/SWAPS/1878868608-154367763
iguana/DB/SWAPS/1306454711-1938980379
iguana/DB/SWAPS/912783809-2523701920
iguana/DB/SWAPS/1238069553-2363573428
iguana/DB/SWAPS/2895470622-2170247626
iguana/confs/ed476386688e486f359ce67e44ce4268a875125527e122ea9126ebc54f473d31
iguana/confs/f6e8e8ab82ed33b2de063d6820dcaefb99b95cf1aef6527b8f27e1e5b1fe882d
iguana/e
iguana/a
iguana/t
iguana/stats
iguana/DEXstats
iguana/DEXstats.dSYM/Contents/Info.plist
iguana/DEXstats.dSYM/Contents/Resources/DWARF/DEXstats
iguana/confs/dc54d862abd6809d9fd200759538014248f18a5a69e7bc22c0a1f2111a896157
iguana/confs/589983f94d17d8e0dc6fbf3fce34b20efc81183c0ab0158cf81a60f03711e15c
iguana/confs/67201409eb7644e398c8090ac6e3ccf4b69d186b8478aa8488211e9b474dd245
iguana/confs/982dfa0e535a6e856cca3cd919af03f50050408fcfed1cd71bb4aa1e2e69070f
iguana/confs/aa45c35599c9c75a9788fa9740ce8713cc457919e6f6f7d8d8115da5193f5722
iguana/confs/ab828d4425655df6bf409f0e23be49ae4a19b2c974008385b18a7a9c79b0314c
iguana/confs/b29fa937dd00ed7dd73ff4eef8b49bd3103ebddaee9fae05f44ffed42c5a4611
iguana/confs/LTC_hdrs.txt
iguana/confs/LTC_oldhdrs.txt
iguana/DB/LTC_peers.dat
iguana/debug.log
iguana/DB/LTC/.tmpmarker
iguana/DB/purgeable/LTC/.tmpmarker
iguana/DB/SWAPS/654629381-1010651560
iguana/DB/SWAPS/1780095668-2225891679
iguana/DB/SWAPS/3085356347-2346291696
iguana/DB/SWAPS/1819165332-1507632737
iguana/DB/SWAPS/283982730-556239841
iguana/marketmaker.dSYM/Contents/Resources/DWARF/marketmaker
iguana/marketmaker.dSYM/Contents/Info.plist
iguana/client
iguana/marketmaker.dSYM/Contents/Resources/DWARF/marketmaker
iguana/confs/97f18454bb61e9eb7a827cfbefe42fbf7ae2832dc74c4812bdaef8bcf5c10474
iguana/DB/PRICES/.tmpmarker
@ -499,3 +254,13 @@ iguana/DB/UNSPENTS/.tmpmarker
iguana/DB/instantdex_RQ4z6KrMZeEnCSCsChv1ZoR9ExQitHjbpg_append.json
iguana/DB/instantdex_RQ4z6KrMZeEnCSCsChv1ZoR9ExQitHjbpg.json
build
.idea
Release/*
build_win64_release/*
DB/*
iguana/exchanges/manychains

4
.gitmodules

@ -0,0 +1,4 @@
[submodule "cpp-ethereum"]
path = cpp-ethereum
url = https://github.com/artemii235/cpp-ethereum.git
branch = develop

30
.travis.yml

@ -0,0 +1,30 @@
language: c
matrix:
include:
- os: linux
compiler: gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-7
env: OS_NAME=Linux MATRIX_EVAL="CC=gcc-7 && CXX=g++-7"
- os: osx
compiler: clang
env: OS_NAME=Darwin
osx_image: xcode9.2
before_install:
- git submodule update --init --recursive
script:
- mkdir build && cd build
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cmake -DCMAKE_C_COMPILER=/usr/bin/gcc-7 -DCMAKE_CXX_COMPILER=/usr/bin/g++-7 ..; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then cmake ..; fi
- cmake --build . --target marketmaker-mainnet
cache:
directories:
- $HOME/.hunter

33
CMakeLists.txt

@ -0,0 +1,33 @@
cmake_minimum_required(VERSION 3.9.2)
include("cmake/HunterGate.cmake")
HunterGate(
URL "https://github.com/ruslo/hunter/archive/v0.19.173.tar.gz"
SHA1 "750fb1d621af971fad6f303356b13017ad9f5e15"
LOCAL
)
project(SuperNET)
set(DEPS_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CXX_EXTENSIONS Off)
include(cmake/DownloadProject.cmake)
# Download and install nanomsg at CMake configure time
download_project(PROJ nanomsg
GIT_REPOSITORY https://github.com/nanomsg/nanomsg.git
GIT_TAG 1.1.2
GIT_SHALLOW 1
GIT_PROGRESS 1
CMAKE_ARGS "-DNN_STATIC_LIB=ON -DNN_ENABLE_GETADDRINFO_A=OFF -DNN_ENABLE_DOC=OFF -DNN_TESTS=OFF -DNN_TOOLS=OFF -DNN_ENABLE_NANOCAT=OFF -DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_PREFIX}"
UPDATE_DISCONNECTED 1
)
find_library(NANOMSG_LIBRARY NAMES nanomsg PATHS ${DEPS_INSTALL_PREFIX}/lib NO_DEFAULT_PATH)
include_directories("${CMAKE_SOURCE_DIR}")
add_subdirectory(cpp-ethereum)
add_subdirectory(iguana/exchanges)
add_subdirectory(iguana/exchanges/etomicswap)
add_subdirectory(iguana/secp256k1)
add_subdirectory(crypto777)
add_subdirectory(crypto777/jpeg)

7
Dockerfile

@ -0,0 +1,7 @@
FROM ubuntu:17.10
RUN apt-get update && apt-get install -y git libcurl4-openssl-dev build-essential wget pax libleveldb-dev && apt-get clean
RUN wget https://cmake.org/files/v3.10/cmake-3.10.3-Linux-x86_64.sh && \
chmod +x cmake-3.10.3-Linux-x86_64.sh && \
./cmake-3.10.3-Linux-x86_64.sh --skip-license --exclude-subdir --prefix=/usr && \
rm -rf cmake-3.10.3-Linux-x86_64.sh
CMD rm -rf build && mkdir build && cd build && cmake .. && cmake --build . --target marketmaker-testnet

20
Jenkinsfile

@ -0,0 +1,20 @@
pipeline {
agent {
docker {
image 'artempikulin/cmake-ubuntu'
}
}
stages {
stage('Build') {
steps {
sh '''git submodule update --init --recursive
rm -rf build
mkdir build
cd build
cmake ..
cmake --build . --target marketmaker-testnet'''
}
}
}
}

2
LEGAL/LICENSE

@ -1,4 +1,4 @@
Copyright © 2013-2015 The SuperNET Developers.
Copyright © 2013-2018 The SuperNET Developers.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 2,

BIN
OSlibs/android/lib/libcrypto.so

Binary file not shown.

BIN
OSlibs/android/lib/libcurl.a

Binary file not shown.

BIN
OSlibs/android/lib/libssl.so

Binary file not shown.

BIN
OSlibs/ios/lib/libcrypto.a

Binary file not shown.

BIN
OSlibs/ios/lib/libcurl.a

Binary file not shown.

BIN
OSlibs/ios/lib/libssl.a

Binary file not shown.

BIN
OSlibs/js/libnanomsg.a

Binary file not shown.

BIN
OSlibs/js/libnanomsg.so

Binary file not shown.

BIN
OSlibs/linux/x86_64/libnanomsg-static.a

Binary file not shown.

BIN
OSlibs/osx/libcrypto.a

Binary file not shown.

BIN
OSlibs/osx/libcurl.a

Binary file not shown.

BIN
OSlibs/osx/libgmp.a

Binary file not shown.

BIN
OSlibs/osx/libsecp256k1.a

Binary file not shown.

BIN
OSlibs/osx/libssl.a

Binary file not shown.

BIN
OSlibs/win/libcrypto-1_1.dll

Binary file not shown.

BIN
OSlibs/win/libcrypto.a

Binary file not shown.

BIN
OSlibs/win/libcurl.a

Binary file not shown.

BIN
OSlibs/win/libcurl.dll

Binary file not shown.

BIN
OSlibs/win/libcurldll.a

Binary file not shown.

BIN
OSlibs/win/libpthreadGC2.a

Binary file not shown.

BIN
OSlibs/win/libpthreadGC2_64.a

Binary file not shown.

BIN
OSlibs/win/libsecp256k1.a

Binary file not shown.

BIN
OSlibs/win/libssl-1_1.dll

Binary file not shown.

BIN
OSlibs/win/libssl.a

Binary file not shown.

BIN
OSlibs/win/nanomsg.dll

Binary file not shown.

BIN
OSlibs/win/pthreadGC2.dll

Binary file not shown.

BIN
OSlibs/win/pthreadGC2_64.dll

Binary file not shown.

BIN
OSlibs/win/release/nanomsg.dll

Binary file not shown.

BIN
OSlibs/win/release/pthreadvc2.dll

Binary file not shown.

BIN
OSlibs/win/x64/libcurl.dll

Binary file not shown.

BIN
OSlibs/win/x64/libpthreadGC2.a

Binary file not shown.

BIN
OSlibs/win/x64/nanomsg.dll

Binary file not shown.

BIN
OSlibs/win/x64/release/libcurl.dll

Binary file not shown.

BIN
OSlibs/win/x64/release/nanomsg.dll

Binary file not shown.

31
README.md

@ -22,7 +22,7 @@ iguana: most efficient bitcoin core implementation that can simultaneously be fu
komodo: this is the top secret project I cant talk about publicly yet
> #TL;DR#
> # TL;DR
>
> ```sudo apt-get update; sudo apt-get install git libcurl4-openssl-dev build-essential libnanomsg-dev; git clone https://github.com/jl777/SuperNET; cd SuperNET; ./m_onetime m_unix;```
>
@ -40,14 +40,14 @@ TOOL_DIR := /usr/local/gcc-4.8.0-qt-4.8.4-for-mingw32/win32-gcc/bin
MINGW := i586-mingw32
The above two definitions need to be changed to match the mingw install on your system. m_win32 and m_win64 just invokes the makefile in mingw32 and mingw64
##For chrome app##
## For chrome app
You need to make sure the nacl sdk is properly installed and you are able to build the examples.
Now you will need to get the external libs, which can be built from scratch using naclports or there use the reference builds of libcurl.a and libz.a in the SuperNET/crypto777/pnacl_libs. You can just copy those over into $(NACL_SDK_ROOT)/<pepper_dir>/lib/pnacl.
##For android##
## For android
You have to build a native libnanomsg for android. This section is work in progress. Contact ca333@protonmail.ch for assistance on building latest iguana for android.
#ONETIME#
# ONETIME
Now you are ready to build.
I try to make the build process as simple as possible, so there are no `autoconf`, `autoreconf`, `configure`, `cmake`, `make`, to get properly installed and running and run, etc. You do need a C compiler, like gcc.
@ -82,12 +82,12 @@ To build just iguana, you can ```cd``` into SuperNET/iguana and do ```./m_unix``
```./m_clean``` will remove the files created from the building
#RUNNING#
# RUNNING
The native versions are command line applications: agents/iguana {JSON}
The chrome app pexe requires that the chrome is launched with a command line parameter (tools/chrome.localhost) and then browse to *http://127.0.0.1:7777* to see the pexe
#SUPERUGLYGUI#
# SUPERUGLYGUI
Once iguana is running, you can see the superuglyGUI at *http://127.0.0.1:7778/?method*
by submitting API calls using the forms, you will see it go to some specific URL. You can also do a programmatic GET request to ```http://127.0.0.1:7778/api/<path to apicall>```
@ -134,9 +134,9 @@ on OSX mksquashfs is not native, you will need to install fuse: https://osxfuse.
A Note on Installation from pebwindkraft at bitco.in
=======================
Though I had xcode installed, aclocal didn’t work. I installed homebrew, and then:
# brew install autoconf
# brew install automake
# brew install gmp
`brew install autoconf`
`brew install automake`
`brew install gmp`
2.) libsecp256
it complained, that libsecp256 was not there in includes, so I linked it.
@ -255,3 +255,16 @@ Execute the OSX deploy script:
./osx_deploy.sh
```
The iguana binary and its linked libraries are in ```$HOME/tmp/iguana```.
# Cmake build of marketmaker with linked etomic lib for ETH/ERC20 atomic swaps:
1. `make sure g++-7 ln to /usr/bin/g++`
1. `cd ~/SuperNET`
1. `git checkout dev`
1. `git submodule update --init --recursive`
1. `mkdir build`
1. `cd build`
1. `cmake ..`
1. `cmake --build . --target marketmaker-testnet` for Ropsten Ethereum testnet.
1. `cmake --build . --target marketmaker-mainnet` for Ethereum mainnet.
1. `cd build/iguana/exchanges`
1. `./marketmaker-testnet` or `./marketmaker-mainnet`

6
appveyor.yml

@ -0,0 +1,6 @@
version: 1.0.{build}
branches:
only:
- etomic
build_script:
- cmd: marketmaker_build_etomic.cmd

12
basilisk/basilisk.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2017 The SuperNET Developers. *
* 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 *
@ -947,17 +947,17 @@ void basilisks_loop(void *arg)
//fprintf(stderr,"E ");
if ( myinfo->numdpows == 1 )
{
iguana_dPoWupdate(myinfo,&myinfo->DPOWS[0]);
iguana_dPoWupdate(myinfo,myinfo->DPOWS[0]);
endmilli = startmilli + 100;
}
else if ( myinfo->numdpows > 1 )
{
dp = &myinfo->DPOWS[counter % myinfo->numdpows];
dp = myinfo->DPOWS[counter % myinfo->numdpows];
iguana_dPoWupdate(myinfo,dp);
//if ( (counter % myinfo->numdpows) != 0 )
{
//fprintf(stderr,"F ");
iguana_dPoWupdate(myinfo,&myinfo->DPOWS[0]);
iguana_dPoWupdate(myinfo,myinfo->DPOWS[0]);
}
endmilli = startmilli + 30;
}
@ -1183,7 +1183,7 @@ HASH_ARRAY_STRING(basilisk,sendmessage,hash,vals,hexstr)
HASH_ARRAY_STRING(basilisk,value,hash,vals,hexstr)
{
char *retstr=0,*symbol,*coinaddr,*infostr; cJSON *retjson,*sobj,*info,*addrs,*txoutjson,*txjson,*array; uint32_t basilisktag,blocktime,numtx=0; bits256 txid,blockhash; struct basilisk_item *ptr,Lptr; uint64_t value; int32_t timeoutmillis,vout,height,n,m;
char *retstr=0,*symbol,*coinaddr,*infostr; cJSON *retjson,*sobj,*info,*addrs,*txoutjson,*txjson,*array; uint32_t basilisktag,blocktime,numtx=0; bits256 txid,blockhash,merkleroot; struct basilisk_item *ptr,Lptr; uint64_t value; int32_t timeoutmillis,vout,height,n,m;
if ( vals == 0 )
return(clonestr("{\"error\":\"null valsobj\"}"));
//if ( myinfo->IAMNOTARY != 0 || myinfo->NOTARY.RELAYID >= 0 )
@ -1219,7 +1219,7 @@ HASH_ARRAY_STRING(basilisk,value,hash,vals,hexstr)
jadd64bits(retjson,"satoshis",value);
jaddnum(retjson,"value",dstr(value));
jaddnum(retjson,"amount",dstr(value));
height = dpow_getchaintip(myinfo,&blockhash,&blocktime,0,&numtx,coin);
height = dpow_getchaintip(myinfo,&merkleroot,&blockhash,&blocktime,0,&numtx,coin);
jaddnum(retjson,"height",height);
jaddnum(retjson,"numconfirms",jint(txoutjson,"confirmations"));
jaddbits256(retjson,"txid",txid);

2
basilisk/basilisk.h

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2017 The SuperNET Developers. *
* 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 *

2
basilisk/basilisk_DEX.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2017 The SuperNET Developers. *
* 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 *

2
basilisk/basilisk_MSG.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2017 The SuperNET Developers. *
* 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 *

14
basilisk/basilisk_bitcoin.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2017 The SuperNET Developers. *
* 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 *
@ -26,7 +26,7 @@ char *bitcoin_balance(struct iguana_info *coin,char *coinaddr,int32_t lastheight
{
int32_t i,n,height,maxconf=1<<30; int64_t balance = 0; char params[512],*curlstr; cJSON *array,*retjson,*curljson;
retjson = cJSON_CreateObject();
if ( (curlstr= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"getinfo",params)) != 0 )
if ( (curlstr= bitcoind_getinfo(coin->symbol,coin->chain->serverport,coin->chain->userpass,coin->getinfostr)) != 0 )
{
if ( (curljson= cJSON_Parse(curlstr)) != 0 )
{
@ -181,7 +181,7 @@ int32_t basilisk_bitcoinscan(struct iguana_info *coin,uint8_t origblockspace[IGU
{
struct iguana_txblock txdata; struct iguana_block B; int32_t len,starti,h,num=0,loadheight,hexlen,datalen,n,i,numtxids,flag=0,j,height=-1; cJSON *curljson,*blockjson,*txids; char *bitstr,*curlstr,params[128],str[65]; struct iguana_msghdr H; struct iguana_msgblock *msg; uint8_t *blockspace,revbits[4],bitsbuf[4]; bits256 hash2,checkhash2;
strcpy(params,"[]");
if ( (curlstr= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"getinfo",params)) != 0 )
if ( (curlstr= bitcoind_getinfo(coin->symbol,coin->chain->serverport,coin->chain->userpass,coin->getinfostr)) != 0 )
{
if ( (curljson= cJSON_Parse(curlstr)) != 0 )
{
@ -585,7 +585,9 @@ char *iguana_utxoduplicates(struct supernet_info *myinfo,struct iguana_info *coi
if ( signedtxidp != 0 )
memset(signedtxidp,0,sizeof(*signedtxidp));
bitcoin_address(changeaddr,coin->chain->pubtype,myinfo->persistent_pubkey33,33);
txfee = (coin->txfee + duplicates*coin->txfee*2);
txfee = (coin->txfee + duplicates*coin->txfee/10);
if ( strcmp(coin->symbol,"GAME") == 0 )
printf("GAME txfee %.8f\n",dstr(txfee));
if ( (txobj= bitcoin_txcreate(coin->symbol,coin->chain->isPoS,0,1,0)) != 0 )
{
if ( duplicates <= 0 )
@ -602,14 +604,14 @@ char *iguana_utxoduplicates(struct supernet_info *myinfo,struct iguana_info *coi
free_json(vins);
return(rawtx);
}
printf("%s splitfunds tx.(%s) vins.(%s)\n",coin->symbol,rawtx,jprint(vins,0));
//printf("%s splitfunds tx.(%s) vins.(%s)\n",coin->symbol,rawtx,jprint(vins,0));
if ( signedtxidp != 0 )
{
if ( (signedtx= iguana_signrawtx(myinfo,coin,0,signedtxidp,completedp,vins,rawtx,0,0)) != 0 )
{
if ( *completedp != 0 )
{
printf("splitfunds signedtx.(%s)\n",signedtx);
printf("splitfunds %s signedtx.(%s)\n",coin->symbol,signedtx);
if ( sendflag != 0 )
iguana_sendrawtransaction(myinfo,coin,signedtx);
free(rawtx);

2
basilisk/basilisk_swap.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2017 The SuperNET Developers. *
* 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 *

2
basilisk/basilisk_tradebot.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2017 The SuperNET Developers. *
* 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 *

2
basilisk/jumblr.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2017 The SuperNET Developers. *
* 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 *

2
basilisk/smartaddress.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2017 The SuperNET Developers. *
* 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 *

2
basilisk/tradebots_liquidity.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2017 The SuperNET Developers. *
* 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 *

2
basilisk/tradebots_marketmaker.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2017 The SuperNET Developers. *
* 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 *

15
cmake/DownloadProject.CMakeLists.cmake.in

@ -0,0 +1,15 @@
# Distributed under the OSI-approved MIT License. See accompanying
# file LICENSE or https://github.com/Crascit/DownloadProject for details.
cmake_minimum_required(VERSION 2.8.2)
project(${DL_ARGS_PROJ}-download NONE)
include(ExternalProject)
ExternalProject_Add(${DL_ARGS_PROJ}-download
${DL_ARGS_UNPARSED_ARGUMENTS}
SOURCE_DIR "${DL_ARGS_SOURCE_DIR}"
BINARY_DIR "${DL_ARGS_BINARY_DIR}"
BUILD_COMMAND ""
TEST_COMMAND ""
)

182
cmake/DownloadProject.cmake

@ -0,0 +1,182 @@
# Distributed under the OSI-approved MIT License. See accompanying
# file LICENSE or https://github.com/Crascit/DownloadProject for details.
#
# MODULE: DownloadProject
#
# PROVIDES:
# download_project( PROJ projectName
# [PREFIX prefixDir]
# [DOWNLOAD_DIR downloadDir]
# [SOURCE_DIR srcDir]
# [BINARY_DIR binDir]
# [QUIET]
# ...
# )
#
# Provides the ability to download and unpack a tarball, zip file, git repository,
# etc. at configure time (i.e. when the cmake command is run). How the downloaded
# and unpacked contents are used is up to the caller, but the motivating case is
# to download source code which can then be included directly in the build with
# add_subdirectory() after the call to download_project(). Source and build
# directories are set up with this in mind.
#
# The PROJ argument is required. The projectName value will be used to construct
# the following variables upon exit (obviously replace projectName with its actual
# value):
#
# projectName_SOURCE_DIR
# projectName_BINARY_DIR
#
# The SOURCE_DIR and BINARY_DIR arguments are optional and would not typically
# need to be provided. They can be specified if you want the downloaded source
# and build directories to be located in a specific place. The contents of
# projectName_SOURCE_DIR and projectName_BINARY_DIR will be populated with the
# locations used whether you provide SOURCE_DIR/BINARY_DIR or not.
#
# The DOWNLOAD_DIR argument does not normally need to be set. It controls the
# location of the temporary CMake build used to perform the download.
#
# The PREFIX argument can be provided to change the base location of the default
# values of DOWNLOAD_DIR, SOURCE_DIR and BINARY_DIR. If all of those three arguments
# are provided, then PREFIX will have no effect. The default value for PREFIX is
# CMAKE_BINARY_DIR.
#
# The QUIET option can be given if you do not want to show the output associated
# with downloading the specified project.
#
# In addition to the above, any other options are passed through unmodified to
# ExternalProject_Add() to perform the actual download, patch and update steps.
# The following ExternalProject_Add() options are explicitly prohibited (they
# are reserved for use by the download_project() command):
#
# CONFIGURE_COMMAND
# BUILD_COMMAND
# INSTALL_COMMAND
# TEST_COMMAND
#
# Only those ExternalProject_Add() arguments which relate to downloading, patching
# and updating of the project sources are intended to be used. Also note that at
# least one set of download-related arguments are required.
#
# If using CMake 3.2 or later, the UPDATE_DISCONNECTED option can be used to
# prevent a check at the remote end for changes every time CMake is run
# after the first successful download. See the documentation of the ExternalProject
# module for more information. It is likely you will want to use this option if it
# is available to you. Note, however, that the ExternalProject implementation contains
# bugs which result in incorrect handling of the UPDATE_DISCONNECTED option when
# using the URL download method or when specifying a SOURCE_DIR with no download
# method. Fixes for these have been created, the last of which is scheduled for
# inclusion in CMake 3.8.0. Details can be found here:
#
# https://gitlab.kitware.com/cmake/cmake/commit/bdca68388bd57f8302d3c1d83d691034b7ffa70c
# https://gitlab.kitware.com/cmake/cmake/issues/16428
#
# If you experience build errors related to the update step, consider avoiding
# the use of UPDATE_DISCONNECTED.
#
# EXAMPLE USAGE:
#
# include(DownloadProject)
# download_project(PROJ googletest
# GIT_REPOSITORY https://github.com/google/googletest.git
# GIT_TAG master
# UPDATE_DISCONNECTED 1
# QUIET
# )
#
# add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})
#
#========================================================================================
set(_DownloadProjectDir "${CMAKE_CURRENT_LIST_DIR}")
include(CMakeParseArguments)
function(download_project)
set(options QUIET)
set(oneValueArgs
PROJ
PREFIX
DOWNLOAD_DIR
SOURCE_DIR
BINARY_DIR
# Prevent the following from being passed through
CONFIGURE_COMMAND
BUILD_COMMAND
INSTALL_COMMAND
TEST_COMMAND
)
set(multiValueArgs "")
cmake_parse_arguments(DL_ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
# Hide output if requested
if (DL_ARGS_QUIET)
set(OUTPUT_QUIET "OUTPUT_QUIET")
else()
unset(OUTPUT_QUIET)
message(STATUS "Downloading/updating ${DL_ARGS_PROJ}")
endif()
# Set up where we will put our temporary CMakeLists.txt file and also
# the base point below which the default source and binary dirs will be.
# The prefix must always be an absolute path.
if (NOT DL_ARGS_PREFIX)
set(DL_ARGS_PREFIX "${CMAKE_BINARY_DIR}")
else()
get_filename_component(DL_ARGS_PREFIX "${DL_ARGS_PREFIX}" ABSOLUTE
BASE_DIR "${CMAKE_CURRENT_BINARY_DIR}")
endif()
if (NOT DL_ARGS_DOWNLOAD_DIR)
set(DL_ARGS_DOWNLOAD_DIR "${DL_ARGS_PREFIX}/${DL_ARGS_PROJ}-download")
endif()
# Ensure the caller can know where to find the source and build directories
if (NOT DL_ARGS_SOURCE_DIR)
set(DL_ARGS_SOURCE_DIR "${DL_ARGS_PREFIX}/${DL_ARGS_PROJ}-src")
endif()
if (NOT DL_ARGS_BINARY_DIR)
set(DL_ARGS_BINARY_DIR "${DL_ARGS_PREFIX}/${DL_ARGS_PROJ}-build")
endif()
set(${DL_ARGS_PROJ}_SOURCE_DIR "${DL_ARGS_SOURCE_DIR}" PARENT_SCOPE)
set(${DL_ARGS_PROJ}_BINARY_DIR "${DL_ARGS_BINARY_DIR}" PARENT_SCOPE)
# The way that CLion manages multiple configurations, it causes a copy of
# the CMakeCache.txt to be copied across due to it not expecting there to
# be a project within a project. This causes the hard-coded paths in the
# cache to be copied and builds to fail. To mitigate this, we simply
# remove the cache if it exists before we configure the new project. It
# is safe to do so because it will be re-generated. Since this is only
# executed at the configure step, it should not cause additional builds or
# downloads.
file(REMOVE "${DL_ARGS_DOWNLOAD_DIR}/CMakeCache.txt")
# Create and build a separate CMake project to carry out the download.
# If we've already previously done these steps, they will not cause
# anything to be updated, so extra rebuilds of the project won't occur.
# Make sure to pass through CMAKE_MAKE_PROGRAM in case the main project
# has this set to something not findable on the PATH.
configure_file("${_DownloadProjectDir}/DownloadProject.CMakeLists.cmake.in"
"${DL_ARGS_DOWNLOAD_DIR}/CMakeLists.txt")
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}"
-D "CMAKE_MAKE_PROGRAM:FILE=${CMAKE_MAKE_PROGRAM}"
.
RESULT_VARIABLE result
${OUTPUT_QUIET}
WORKING_DIRECTORY "${DL_ARGS_DOWNLOAD_DIR}"
)
if(result)
message(FATAL_ERROR "CMake step for ${DL_ARGS_PROJ} failed: ${result}")
endif()
execute_process(COMMAND ${CMAKE_COMMAND} --build .
RESULT_VARIABLE result
${OUTPUT_QUIET}
WORKING_DIRECTORY "${DL_ARGS_DOWNLOAD_DIR}"
)
if(result)
message(FATAL_ERROR "Build step for ${DL_ARGS_PROJ} failed: ${result}")
endif()
endfunction()

18
cmake/Hunter/config.cmake

@ -0,0 +1,18 @@
# cryptopp has very bad CMakeLists.txt config.
# We have to enforce "cross compiling mode" there by setting CMAKE_SYSTEM_VERSION=NO
# to any "false" value.
hunter_config(cryptopp VERSION ${HUNTER_cryptopp_VERSION} CMAKE_ARGS CMAKE_SYSTEM_VERSION=NO)
hunter_config(
libjson-rpc-cpp
VERSION ${HUNTER_libjson-rpc-cpp_VERSION}
CMAKE_ARGS
UNIX_DOMAIN_SOCKET_SERVER=NO
UNIX_DOMAIN_SOCKET_CLIENT=NO
FILE_DESCRIPTOR_SERVER=NO
FILE_DESCRIPTOR_CLIENT=NO
TCP_SOCKET_SERVER=NO
TCP_SOCKET_CLIENT=NO
HTTP_SERVER=NO
HTTP_CLIENT=NO
)

529
cmake/HunterGate.cmake

@ -0,0 +1,529 @@
# Copyright (c) 2013-2017, Ruslan Baratov
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# This is a gate file to Hunter package manager.
# Include this file using `include` command and add package you need, example:
#
# cmake_minimum_required(VERSION 3.0)
#
# include("cmake/HunterGate.cmake")
# HunterGate(
# URL "https://github.com/path/to/hunter/archive.tar.gz"
# SHA1 "798501e983f14b28b10cda16afa4de69eee1da1d"
# )
#
# project(MyProject)
#
# hunter_add_package(Foo)
# hunter_add_package(Boo COMPONENTS Bar Baz)
#
# Projects:
# * https://github.com/hunter-packages/gate/
# * https://github.com/ruslo/hunter
option(HUNTER_ENABLED "Enable Hunter package manager support" ON)
if(HUNTER_ENABLED)
if(CMAKE_VERSION VERSION_LESS "3.0")
message(FATAL_ERROR "At least CMake version 3.0 required for hunter dependency management."
" Update CMake or set HUNTER_ENABLED to OFF.")
endif()
endif()
include(CMakeParseArguments) # cmake_parse_arguments
option(HUNTER_STATUS_PRINT "Print working status" ON)
option(HUNTER_STATUS_DEBUG "Print a lot info" OFF)
set(HUNTER_WIKI "https://github.com/ruslo/hunter/wiki")
function(hunter_gate_status_print)
foreach(print_message ${ARGV})
if(HUNTER_STATUS_PRINT OR HUNTER_STATUS_DEBUG)
message(STATUS "[hunter] ${print_message}")
endif()
endforeach()
endfunction()
function(hunter_gate_status_debug)
foreach(print_message ${ARGV})
if(HUNTER_STATUS_DEBUG)
string(TIMESTAMP timestamp)
message(STATUS "[hunter *** DEBUG *** ${timestamp}] ${print_message}")
endif()
endforeach()
endfunction()
function(hunter_gate_wiki wiki_page)
message("------------------------------ WIKI -------------------------------")
message(" ${HUNTER_WIKI}/${wiki_page}")
message("-------------------------------------------------------------------")
message("")
message(FATAL_ERROR "")
endfunction()
function(hunter_gate_internal_error)
message("")
foreach(print_message ${ARGV})
message("[hunter ** INTERNAL **] ${print_message}")
endforeach()
message("[hunter ** INTERNAL **] [Directory:${CMAKE_CURRENT_LIST_DIR}]")
message("")
hunter_gate_wiki("error.internal")
endfunction()
function(hunter_gate_fatal_error)
cmake_parse_arguments(hunter "" "WIKI" "" "${ARGV}")
string(COMPARE EQUAL "${hunter_WIKI}" "" have_no_wiki)
if(have_no_wiki)
hunter_gate_internal_error("Expected wiki")
endif()
message("")
foreach(x ${hunter_UNPARSED_ARGUMENTS})
message("[hunter ** FATAL ERROR **] ${x}")
endforeach()
message("[hunter ** FATAL ERROR **] [Directory:${CMAKE_CURRENT_LIST_DIR}]")
message("")
hunter_gate_wiki("${hunter_WIKI}")
endfunction()
function(hunter_gate_user_error)
hunter_gate_fatal_error(${ARGV} WIKI "error.incorrect.input.data")
endfunction()
function(hunter_gate_self root version sha1 result)
string(COMPARE EQUAL "${root}" "" is_bad)
if(is_bad)
hunter_gate_internal_error("root is empty")
endif()
string(COMPARE EQUAL "${version}" "" is_bad)
if(is_bad)
hunter_gate_internal_error("version is empty")
endif()
string(COMPARE EQUAL "${sha1}" "" is_bad)
if(is_bad)
hunter_gate_internal_error("sha1 is empty")
endif()
string(SUBSTRING "${sha1}" 0 7 archive_id)
if(EXISTS "${root}/cmake/Hunter")
set(hunter_self "${root}")
else()
set(
hunter_self
"${root}/_Base/Download/Hunter/${version}/${archive_id}/Unpacked"
)
endif()
set("${result}" "${hunter_self}" PARENT_SCOPE)
endfunction()
# Set HUNTER_GATE_ROOT cmake variable to suitable value.
function(hunter_gate_detect_root)
# Check CMake variable
string(COMPARE NOTEQUAL "${HUNTER_ROOT}" "" not_empty)
if(not_empty)
set(HUNTER_GATE_ROOT "${HUNTER_ROOT}" PARENT_SCOPE)
hunter_gate_status_debug("HUNTER_ROOT detected by cmake variable")
return()
endif()
# Check environment variable
string(COMPARE NOTEQUAL "$ENV{HUNTER_ROOT}" "" not_empty)
if(not_empty)
set(HUNTER_GATE_ROOT "$ENV{HUNTER_ROOT}" PARENT_SCOPE)
hunter_gate_status_debug("HUNTER_ROOT detected by environment variable")
return()
endif()
# Check HOME environment variable
string(COMPARE NOTEQUAL "$ENV{HOME}" "" result)
if(result)
set(HUNTER_GATE_ROOT "$ENV{HOME}/.hunter" PARENT_SCOPE)
hunter_gate_status_debug("HUNTER_ROOT set using HOME environment variable")
return()
endif()
# Check SYSTEMDRIVE and USERPROFILE environment variable (windows only)
if(WIN32)
string(COMPARE NOTEQUAL "$ENV{SYSTEMDRIVE}" "" result)
if(result)
set(HUNTER_GATE_ROOT "$ENV{SYSTEMDRIVE}/.hunter" PARENT_SCOPE)
hunter_gate_status_debug(
"HUNTER_ROOT set using SYSTEMDRIVE environment variable"
)
return()
endif()
string(COMPARE NOTEQUAL "$ENV{USERPROFILE}" "" result)
if(result)
set(HUNTER_GATE_ROOT "$ENV{USERPROFILE}/.hunter" PARENT_SCOPE)
hunter_gate_status_debug(
"HUNTER_ROOT set using USERPROFILE environment variable"
)
return()
endif()
endif()
hunter_gate_fatal_error(
"Can't detect HUNTER_ROOT"
WIKI "error.detect.hunter.root"
)
endfunction()
macro(hunter_gate_lock dir)
if(NOT HUNTER_SKIP_LOCK)
if("${CMAKE_VERSION}" VERSION_LESS "3.2")
hunter_gate_fatal_error(
"Can't lock, upgrade to CMake 3.2 or use HUNTER_SKIP_LOCK"
WIKI "error.can.not.lock"
)
endif()
hunter_gate_status_debug("Locking directory: ${dir}")
file(LOCK "${dir}" DIRECTORY GUARD FUNCTION)
hunter_gate_status_debug("Lock done")
endif()
endmacro()
function(hunter_gate_download dir)
string(
COMPARE
NOTEQUAL
"$ENV{HUNTER_DISABLE_AUTOINSTALL}"
""
disable_autoinstall
)
if(disable_autoinstall AND NOT HUNTER_RUN_INSTALL)
hunter_gate_fatal_error(
"Hunter not found in '${dir}'"
"Set HUNTER_RUN_INSTALL=ON to auto-install it from '${HUNTER_GATE_URL}'"
"Settings:"
" HUNTER_ROOT: ${HUNTER_GATE_ROOT}"
" HUNTER_SHA1: ${HUNTER_GATE_SHA1}"
WIKI "error.run.install"
)
endif()
string(COMPARE EQUAL "${dir}" "" is_bad)
if(is_bad)
hunter_gate_internal_error("Empty 'dir' argument")
endif()
string(COMPARE EQUAL "${HUNTER_GATE_SHA1}" "" is_bad)
if(is_bad)
hunter_gate_internal_error("HUNTER_GATE_SHA1 empty")
endif()
string(COMPARE EQUAL "${HUNTER_GATE_URL}" "" is_bad)
if(is_bad)
hunter_gate_internal_error("HUNTER_GATE_URL empty")
endif()
set(done_location "${dir}/DONE")
set(sha1_location "${dir}/SHA1")
set(build_dir "${dir}/Build")
set(cmakelists "${dir}/CMakeLists.txt")
hunter_gate_lock("${dir}")
if(EXISTS "${done_location}")
# while waiting for lock other instance can do all the job
hunter_gate_status_debug("File '${done_location}' found, skip install")
return()
endif()
file(REMOVE_RECURSE "${build_dir}")
file(REMOVE_RECURSE "${cmakelists}")
file(MAKE_DIRECTORY "${build_dir}") # check directory permissions
# Disabling languages speeds up a little bit, reduces noise in the output
# and avoids path too long windows error
file(
WRITE
"${cmakelists}"
"cmake_minimum_required(VERSION 3.0)\n"
"project(HunterDownload LANGUAGES NONE)\n"
"include(ExternalProject)\n"
"ExternalProject_Add(\n"
" Hunter\n"
" URL\n"
" \"${HUNTER_GATE_URL}\"\n"
" URL_HASH\n"
" SHA1=${HUNTER_GATE_SHA1}\n"
" DOWNLOAD_DIR\n"
" \"${dir}\"\n"
" SOURCE_DIR\n"
" \"${dir}/Unpacked\"\n"
" CONFIGURE_COMMAND\n"
" \"\"\n"
" BUILD_COMMAND\n"
" \"\"\n"
" INSTALL_COMMAND\n"
" \"\"\n"
")\n"
)
if(HUNTER_STATUS_DEBUG)
set(logging_params "")
else()
set(logging_params OUTPUT_QUIET)
endif()
hunter_gate_status_debug("Run generate")
# Need to add toolchain file too.
# Otherwise on Visual Studio + MDD this will fail with error:
# "Could not find an appropriate version of the Windows 10 SDK installed on this machine"
if(EXISTS "${CMAKE_TOOLCHAIN_FILE}")
get_filename_component(absolute_CMAKE_TOOLCHAIN_FILE "${CMAKE_TOOLCHAIN_FILE}" ABSOLUTE)
set(toolchain_arg "-DCMAKE_TOOLCHAIN_FILE=${absolute_CMAKE_TOOLCHAIN_FILE}")
else()
# 'toolchain_arg' can't be empty
set(toolchain_arg "-DCMAKE_TOOLCHAIN_FILE=")
endif()
string(COMPARE EQUAL "${CMAKE_MAKE_PROGRAM}" "" no_make)
if(no_make)
set(make_arg "")
else()
# Test case: remove Ninja from PATH but set it via CMAKE_MAKE_PROGRAM
set(make_arg "-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}")
endif()
execute_process(
COMMAND
"${CMAKE_COMMAND}"
"-H${dir}"
"-B${build_dir}"
"-G${CMAKE_GENERATOR}"
"${toolchain_arg}"
${make_arg}
WORKING_DIRECTORY "${dir}"
RESULT_VARIABLE download_result
${logging_params}
)
if(NOT download_result EQUAL 0)
hunter_gate_internal_error("Configure project failed")
endif()
hunter_gate_status_print(
"Initializing Hunter workspace (${HUNTER_GATE_SHA1})"
" ${HUNTER_GATE_URL}"
" -> ${dir}"
)
execute_process(
COMMAND "${CMAKE_COMMAND}" --build "${build_dir}"
WORKING_DIRECTORY "${dir}"
RESULT_VARIABLE download_result
${logging_params}
)
if(NOT download_result EQUAL 0)
hunter_gate_internal_error("Build project failed")
endif()
file(REMOVE_RECURSE "${build_dir}")
file(REMOVE_RECURSE "${cmakelists}")
file(WRITE "${sha1_location}" "${HUNTER_GATE_SHA1}")
file(WRITE "${done_location}" "DONE")
hunter_gate_status_debug("Finished")
endfunction()
# Must be a macro so master file 'cmake/Hunter' can
# apply all variables easily just by 'include' command
# (otherwise PARENT_SCOPE magic needed)
macro(HunterGate)
if(HUNTER_GATE_DONE)
# variable HUNTER_GATE_DONE set explicitly for external project
# (see `hunter_download`)
set_property(GLOBAL PROPERTY HUNTER_GATE_DONE YES)
endif()
# First HunterGate command will init Hunter, others will be ignored
get_property(_hunter_gate_done GLOBAL PROPERTY HUNTER_GATE_DONE SET)
if(NOT HUNTER_ENABLED)
# Empty function to avoid error "unknown function"
function(hunter_add_package)
endfunction()
elseif(_hunter_gate_done)
hunter_gate_status_debug("Secondary HunterGate (use old settings)")
hunter_gate_self(
"${HUNTER_CACHED_ROOT}"
"${HUNTER_VERSION}"
"${HUNTER_SHA1}"
_hunter_self
)
include("${_hunter_self}/cmake/Hunter")
else()
set(HUNTER_GATE_LOCATION "${CMAKE_CURRENT_LIST_DIR}")
string(COMPARE NOTEQUAL "${PROJECT_NAME}" "" _have_project_name)
if(_have_project_name)
hunter_gate_fatal_error(
"Please set HunterGate *before* 'project' command. "
"Detected project: ${PROJECT_NAME}"
WIKI "error.huntergate.before.project"
)
endif()
cmake_parse_arguments(
HUNTER_GATE "LOCAL" "URL;SHA1;GLOBAL;FILEPATH" "" ${ARGV}
)
string(COMPARE EQUAL "${HUNTER_GATE_SHA1}" "" _empty_sha1)
string(COMPARE EQUAL "${HUNTER_GATE_URL}" "" _empty_url)
string(
COMPARE
NOTEQUAL
"${HUNTER_GATE_UNPARSED_ARGUMENTS}"
""
_have_unparsed
)
string(COMPARE NOTEQUAL "${HUNTER_GATE_GLOBAL}" "" _have_global)
string(COMPARE NOTEQUAL "${HUNTER_GATE_FILEPATH}" "" _have_filepath)
if(_have_unparsed)
hunter_gate_user_error(
"HunterGate unparsed arguments: ${HUNTER_GATE_UNPARSED_ARGUMENTS}"
)
endif()
if(_empty_sha1)
hunter_gate_user_error("SHA1 suboption of HunterGate is mandatory")
endif()
if(_empty_url)
hunter_gate_user_error("URL suboption of HunterGate is mandatory")
endif()
if(_have_global)
if(HUNTER_GATE_LOCAL)
hunter_gate_user_error("Unexpected LOCAL (already has GLOBAL)")
endif()
if(_have_filepath)
hunter_gate_user_error("Unexpected FILEPATH (already has GLOBAL)")
endif()
endif()
if(HUNTER_GATE_LOCAL)
if(_have_global)
hunter_gate_user_error("Unexpected GLOBAL (already has LOCAL)")
endif()
if(_have_filepath)
hunter_gate_user_error("Unexpected FILEPATH (already has LOCAL)")
endif()
endif()
if(_have_filepath)
if(_have_global)
hunter_gate_user_error("Unexpected GLOBAL (already has FILEPATH)")
endif()
if(HUNTER_GATE_LOCAL)
hunter_gate_user_error("Unexpected LOCAL (already has FILEPATH)")
endif()
endif()
hunter_gate_detect_root() # set HUNTER_GATE_ROOT
# Beautify path, fix probable problems with windows path slashes
get_filename_component(
HUNTER_GATE_ROOT "${HUNTER_GATE_ROOT}" ABSOLUTE
)
hunter_gate_status_debug("HUNTER_ROOT: ${HUNTER_GATE_ROOT}")
if(NOT HUNTER_ALLOW_SPACES_IN_PATH)
string(FIND "${HUNTER_GATE_ROOT}" " " _contain_spaces)
if(NOT _contain_spaces EQUAL -1)
hunter_gate_fatal_error(
"HUNTER_ROOT (${HUNTER_GATE_ROOT}) contains spaces."
"Set HUNTER_ALLOW_SPACES_IN_PATH=ON to skip this error"
"(Use at your own risk!)"
WIKI "error.spaces.in.hunter.root"
)
endif()
endif()
string(
REGEX
MATCH
"[0-9]+\\.[0-9]+\\.[0-9]+[-_a-z0-9]*"
HUNTER_GATE_VERSION
"${HUNTER_GATE_URL}"
)
string(COMPARE EQUAL "${HUNTER_GATE_VERSION}" "" _is_empty)
if(_is_empty)
set(HUNTER_GATE_VERSION "unknown")
endif()
hunter_gate_self(
"${HUNTER_GATE_ROOT}"
"${HUNTER_GATE_VERSION}"
"${HUNTER_GATE_SHA1}"
_hunter_self
)
set(_master_location "${_hunter_self}/cmake/Hunter")
if(EXISTS "${HUNTER_GATE_ROOT}/cmake/Hunter")
# Hunter downloaded manually (e.g. by 'git clone')
set(_unused "xxxxxxxxxx")
set(HUNTER_GATE_SHA1 "${_unused}")
set(HUNTER_GATE_VERSION "${_unused}")
else()
get_filename_component(_archive_id_location "${_hunter_self}/.." ABSOLUTE)
set(_done_location "${_archive_id_location}/DONE")
set(_sha1_location "${_archive_id_location}/SHA1")
# Check Hunter already downloaded by HunterGate
if(NOT EXISTS "${_done_location}")
hunter_gate_download("${_archive_id_location}")
endif()
if(NOT EXISTS "${_done_location}")
hunter_gate_internal_error("hunter_gate_download failed")
endif()
if(NOT EXISTS "${_sha1_location}")
hunter_gate_internal_error("${_sha1_location} not found")
endif()
file(READ "${_sha1_location}" _sha1_value)
string(COMPARE EQUAL "${_sha1_value}" "${HUNTER_GATE_SHA1}" _is_equal)
if(NOT _is_equal)
hunter_gate_internal_error(
"Short SHA1 collision:"
" ${_sha1_value} (from ${_sha1_location})"
" ${HUNTER_GATE_SHA1} (HunterGate)"
)
endif()
if(NOT EXISTS "${_master_location}")
hunter_gate_user_error(
"Master file not found:"
" ${_master_location}"
"try to update Hunter/HunterGate"
)
endif()
endif()
include("${_master_location}")
set_property(GLOBAL PROPERTY HUNTER_GATE_DONE YES)
endif()
endmacro()

4
cmake/toolchain.cmake

@ -0,0 +1,4 @@
# Require C++11.
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CXX_EXTENSIONS Off)

1
cpp-ethereum

@ -0,0 +1 @@
Subproject commit 633c62c08bc73c7c3935c948a8d6c656a3659976

11
crypto777/CMakeLists.txt

@ -0,0 +1,11 @@
file(GLOB sources "*.c")
file(GLOB headers "*.h")
add_library(libcrypto777 ${sources} ${headers})
target_compile_definitions(libcrypto777 PRIVATE USE_STATIC_NANOMSG)
target_link_libraries(libcrypto777 PUBLIC curl ${NANOMSG_LIBRARY})
if(WIN32)
add_definitions(-DNATIVE_WINDOWS)
add_definitions(-DIGUANA_LOG2PACKETSIZE=20)
add_definitions(-DIGUANA_MAXPACKETSIZE=1572864)
include_directories("${CMAKE_SOURCE_DIR}/includes")
endif()

2
crypto777/OS_nonportable.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2017 The SuperNET Developers. *
* 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 *

2
crypto777/OS_portable.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2017 The SuperNET Developers. *
* 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 *

5
crypto777/OS_portable.h

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2017 The SuperNET Developers. *
* 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 *
@ -31,6 +31,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#define HAVE_STRUCT_TIMESPEC
#include <ctype.h>
#include <fcntl.h>
@ -285,6 +286,8 @@ void *iguana_memalloc(struct OS_memspace *mem,long size,int32_t clearflag);
int64_t iguana_memfree(struct OS_memspace *mem,void *ptr,int32_t size);
// generic functions
bits256 iguana_merkle(char *symbol,bits256 *tree,int32_t txn_count);
bits256 bits256_calctxid(char *symbol,uint8_t *serialized,int32_t len);
int32_t unhex(char c);
void touppercase(char *str);
uint32_t is_ipaddr(char *str);

2
crypto777/OS_time.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2017 The SuperNET Developers. *
* 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 *

2
crypto777/SaM.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2017 The SuperNET Developers. *
* 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 *

19
crypto777/bitcoind_RPC.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2017 The SuperNET Developers. *
* 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 *
@ -73,20 +73,20 @@ char *post_process_bitcoind_RPC(char *debugstr,char *command,char *rpcstr,char *
long i,j,len;
char *retstr = 0;
cJSON *json,*result,*error;
#ifdef FROM_MARKETMAKER
//usleep(500);
#ifndef FROM_MARKETMAKER
usleep(1000);
#endif
//printf("<<<<<<<<<<< bitcoind_RPC: %s post_process_bitcoind_RPC.%s.[%s]\n",debugstr,command,rpcstr);
if ( command == 0 || rpcstr == 0 || rpcstr[0] == 0 )
{
if ( strcmp(command,"signrawtransaction") != 0 && strcmp(command,"getrawtransaction") != 0 )
printf("<<<<<<<<<<< A bitcoind_RPC: %s post_process_bitcoind_RPC.%s.[%s]\n",debugstr,command,params);
printf("<<<<<<<<<<< A bitcoind_RPC: %s post_process_bitcoind_RPC.%s\n",debugstr,command);
return(rpcstr);
}
json = cJSON_Parse(rpcstr);
if ( json == 0 )
{
printf("<<<<<<<<<<< B bitcoind_RPC: %s post_process_bitcoind_RPC.%s can't parse.(%s) params.(%s)\n",debugstr,command,rpcstr,params);
printf("<<<<<<<<<<< B bitcoind_RPC: %s post_process_bitcoind_RPC.%s can't parse.(%s)\n",debugstr,command,rpcstr);
free(rpcstr);
return(0);
}
@ -143,14 +143,15 @@ char *Jay_NXTrequest(char *command,char *params)
char *bitcoind_RPC(char **retstrp,char *debugstr,char *url,char *userpass,char *command,char *params,int32_t timeout)
{
static int didinit,count,count2; static double elapsedsum,elapsedsum2; extern int32_t USE_JAY;
CURL *curl_handle; static int didinit,count,count2; static double elapsedsum,elapsedsum2; extern int32_t USE_JAY;
struct MemoryStruct chunk;
struct curl_slist *headers = NULL; struct return_string s; CURLcode res; CURL *curl_handle;
struct curl_slist *headers = NULL; struct return_string s; CURLcode res;
char *bracket0,*bracket1,*retstr,*databuf = 0; long len; int32_t specialcase,numretries; double starttime;
if ( didinit == 0 )
{
didinit = 1;
curl_global_init(CURL_GLOBAL_ALL); //init the curl session
//curl_handle = curl_easy_init();
}
if ( (0) && (USE_JAY != 0 && (strncmp(url,"http://127.0.0.1:7876/nxt",strlen("http://127.0.0.1:7876/nxt")) == 0 || strncmp(url,"https://127.0.0.1:7876/nxt",strlen("https://127.0.0.1:7876/nxt")) == 0)) )
{
@ -164,7 +165,11 @@ char *bitcoind_RPC(char **retstrp,char *debugstr,char *url,char *userpass,char *
if ( url[0] == 0 )
strcpy(url,"http://127.0.0.1:7776");
if ( specialcase != 0 && (0) )
{
//int32_t zeroval();
printf("<<<<<<<<<<< bitcoind_RPC: userpass.(%s) url.(%s) command.(%s) params.(%s)\n",userpass,url,command,params);
//printf("die.%d\n",1/zeroval());
}
try_again:
if ( retstrp != 0 )
*retstrp = 0;

2
crypto777/cJSON.c

@ -669,7 +669,7 @@ void cJSON_Minify(char *json)
// the following written by jl777
/******************************************************************************
* Copyright © 2014-2017 The SuperNET Developers. *
* 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 *

2
crypto777/curve25519.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2017 The SuperNET Developers. *
* 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 *

2
crypto777/iguana_OS.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2017 The SuperNET Developers. *
* 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 *

2
crypto777/iguana_serdes.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2017 The SuperNET Developers. *
* 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 *

43
crypto777/iguana_utils.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2017 The SuperNET Developers. *
* 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 *
@ -557,7 +557,7 @@ int _increasing_uint64(const void *a,const void *b)
#undef uint64_b
}
static int _decreasing_uint64(const void *a,const void *b)
int _decreasing_uint64(const void *a,const void *b)
{
#define uint64_a (*(uint64_t *)a)
#define uint64_b (*(uint64_t *)b)
@ -570,7 +570,7 @@ static int _decreasing_uint64(const void *a,const void *b)
#undef uint64_b
}
static int _decreasing_uint32(const void *a,const void *b)
int _decreasing_uint32(const void *a,const void *b)
{
#define uint32_a (*(uint32_t *)a)
#define uint32_b (*(uint32_t *)b)
@ -1285,3 +1285,40 @@ double get_theoretical(double *avebidp,double *aveaskp,double *highbidp,double *
return(theoretical);
}
bits256 bits256_calctxid(char *symbol,uint8_t *serialized,int32_t len)
{
bits256 txid,revtxid; int32_t i;
memset(txid.bytes,0,sizeof(txid));
if ( strcmp(symbol,"GRS") != 0 && strcmp(symbol,"SMART") != 0 )
txid = bits256_doublesha256(0,serialized,len);
else
{
vcalc_sha256(0,revtxid.bytes,serialized,len);
for (i=0; i<32; i++)
txid.bytes[i] = revtxid.bytes[31 - i];
}
return(txid);
}
bits256 iguana_merkle(char *symbol,bits256 *tree,int32_t txn_count)
{
int32_t i,n=0,prev; uint8_t serialized[sizeof(bits256) * 2];
if ( txn_count == 1 )
return(tree[0]);
prev = 0;
while ( txn_count > 1 )
{
if ( (txn_count & 1) != 0 )
tree[prev + txn_count] = tree[prev + txn_count-1], txn_count++;
n += txn_count;
for (i=0; i<txn_count; i+=2)
{
iguana_rwbignum(1,serialized,sizeof(*tree),tree[prev + i].bytes);
iguana_rwbignum(1,&serialized[sizeof(*tree)],sizeof(*tree),tree[prev + i + 1].bytes);
tree[n + (i >> 1)] = bits256_calctxid(symbol,serialized,sizeof(serialized));
}
prev = n;
txn_count >>= 1;
}
return(tree[n]);
}

4
crypto777/jpeg/CMakeLists.txt

@ -0,0 +1,4 @@
file(GLOB sources "*.c")
file(GLOB headers "*.h")
add_library(libjpeg ${sources} ${headers})
target_sources(libjpeg PRIVATE "unix/jmemname.c")

BIN
crypto777/pnacl_libs/libcrypto.a

Binary file not shown.

BIN
crypto777/pnacl_libs/libcurl.a

Binary file not shown.

BIN
crypto777/pnacl_libs/libnanomsg.a

Binary file not shown.

BIN
crypto777/pnacl_libs/libssl.a

Binary file not shown.

BIN
crypto777/pnacl_libs/libz.a

Binary file not shown.

2
crypto777/ramcoder.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2017 The SuperNET Developers. *
* 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 *

4
datachain/datachain.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2017 The SuperNET Developers. *
* 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 *
@ -88,7 +88,7 @@ int32_t datachain_checkpoint_update(struct supernet_info *myinfo,struct iguana_i
}
if ( n > 0 && lastheight >= 0 && bits256_nonz(lasthash2) != 0 )
{
merkle = iguana_merkle(tree,num);
merkle = iguana_merkle(coin->symbol,tree,num);
coin->lastcheckpoint = datachain_checkpoint(myinfo,coin,coin->lastcheckpoint,timestamp,merkle,lastheight,lasthash2);
}
}

1279
deprecated/iguana_notary.c

File diff suppressed because it is too large

20490
deprecated/obsolete.h

File diff suppressed because it is too large

3
etomic_build/autoprice

@ -0,0 +1,3 @@
#!/bin/bash
source userpass
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"ETH\",\"rel\":\"KMD\",\"margin\":0.05,\"refbase\":\"ethereum\",\"refrel\":\"coinmarketcap\"}"

3
etomic_build/buy

@ -0,0 +1,3 @@
#!/bin/bash
source userpass
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"buy\",\"base\":\"ETH\",\"rel\":\"KMD\",\"relvolume\":1,\"price\":300}"

5
etomic_build/client

@ -0,0 +1,5 @@
#!/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}" &

3
etomic_build/coins

File diff suppressed because one or more lines are too long

5
etomic_build/enable

@ -0,0 +1,5 @@
#!/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\"}"

3
etomic_build/orderbook

@ -0,0 +1,3 @@
#!/bin/bash
source userpass
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"orderbook\",\"base\":\"ETH\",\"rel\":\"KMD\"}"

1
etomic_build/passphrase

@ -0,0 +1 @@
export passphrase="<put a very strong passphrase here>"

5
etomic_build/run

@ -0,0 +1,5 @@
#!/bin/bash
source passphrase
source coins
./stop
$1 iguana/exchanges/marketmaker "{\"netid\":9999,\"gui\":\"nogui\", \"profitmargin\":0.01, \"userhome\":\"/${HOME#"/"}\", \"passphrase\":\"$passphrase\", \"coins\":$coins}" &

4
etomic_build/setpassphrase

@ -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\"}"

3
etomic_build/stop

@ -0,0 +1,3 @@
#!/bin/bash
source userpass
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"stop\"}"

2
etomic_build/userpass

@ -0,0 +1,2 @@
#export userpass="<put the userpass value from the first API call here>"
export userpass="c3d8c2a364b7d18c1f9d7321d017b92e9f9c791e4f5c741214fefdea8a071256"

2
gecko/gecko.c

@ -1,6 +1,6 @@
/******************************************************************************
* Copyright © 2014-2017 The SuperNET Developers. *
* 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 *

2
gecko/gecko_miner.c

@ -204,7 +204,7 @@ char *gecko_blockconstruct(struct supernet_info *myinfo,struct iguana_info *virt
}
if ( (coinbasestr= gecko_coinbasestr(myinfo,virt,&txids[0],newblock->RO.timestamp,minerpubkey,blockreward,coinbase,coinbaselen,coinbasespend)) != 0 )
{
newblock->RO.merkle_root = iguana_merkle(txids,txn_count + 1);
newblock->RO.merkle_root = iguana_merkle("GECKO",txids,txn_count + 1);
newblock->RO.txn_count = (txn_count + 1);
if ( txn_count > 0 )
{

BIN
iguana/Kashi/json_extracta

Binary file not shown.

11
iguana/Readme.md

@ -191,3 +191,14 @@ struct iguana_account // 12 bytes
uint64_t balance; uint32_t lastunspentind;
} __attribute__((packed)); // pkind
# Cmake build of marketmaker with linked etomic lib for ETH/ERC20 atomic swaps:
1. Clone this repository.
1. `git checkout etomic`
1. `git submodule update --init --recursive`
1. `mkdir build`
1. `cd build`
1. `cmake ..`
1. `cmake --build . --target marketmaker`
1. `cd exchanges/iguana`
1. `export BOB_PK=YOUR_PRIVATE_KEY`
1. `./marketmaker`

65
iguana/SuperNET_keys.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2017 The SuperNET Developers. *
* 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 *
@ -310,13 +310,70 @@ int32_t _SuperNET_encryptjson(struct supernet_info *myinfo,char *destfname,char
return(0);
}
int32_t curve25519_donna(uint8_t *mypublic,const uint8_t *secret,const uint8_t *basepoint);
static const char base58_chars[] = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
int32_t iguana_wifstr_valid(char *wifstr)
{
bits256 privkey,cmpkey; uint8_t wiftype; char cmpstr[128],cmpstr2[128]; int32_t i,len,n,a,A;
if ( (len= (int32_t)strlen(wifstr)) < 50 || len > 54 )
{
//printf("len.%d is wrong for wif %s\n",len,wifstr);
return(0);
}
memset(privkey.bytes,0,sizeof(privkey));
memset(cmpkey.bytes,0,sizeof(cmpkey));
for (i=n=a=A=0; wifstr[i]!=0; i++)
{
if ( strchr(base58_chars,wifstr[i]) == 0 )
return(0);
if ( wifstr[i] >= '1' && wifstr[i] <= '9' )
n++;
else if ( wifstr[i] >= 'A' && wifstr[i] <= 'Z' )
A++;
else if ( wifstr[i] >= 'a' && wifstr[i] <= 'z' )
a++;
}
if ( n == 0 || A == 0 || a == 0 )
return(0);
if ( A > 5*a || a > 5*A || a > n*20 || A > n*20 ) // unlikely it is a real wif
{
//printf("reject wif %s due to n.%d a.%d A.%d (%d %d %d %d)\n",wifstr,n,a,A,A > 5*a,a < 5*A,a > n*20,A > n*20);
return(0);
}
bitcoin_wif2priv(&wiftype,&privkey,wifstr);
bitcoin_priv2wif(cmpstr,privkey,wiftype);
if ( strcmp(cmpstr,wifstr) == 0 )
{
//printf("%s is valid wif\n",wifstr);
return(1);
}
else if ( bits256_nonz(privkey) != 0 )
{
bitcoin_wif2priv(&wiftype,&cmpkey,cmpstr);
bitcoin_priv2wiflong(cmpstr2,privkey,wiftype);
if ( bits256_cmp(privkey,cmpkey) == 0 )
return(1);
// char str[65],str2[65]; printf("mismatched wifstr %s -> %s -> %s %s %s\n",wifstr,bits256_str(str,privkey),cmpstr,bits256_str(str2,cmpkey),cmpstr2);
}
//char str[65]; printf("%s is not a wif, privkey.%s\n",wifstr,bits256_str(str,privkey));
return(0);
}
void SuperNET_setkeys(struct supernet_info *myinfo,void *pass,int32_t passlen,int32_t dosha256)
{
bits256 hash;
static uint8_t basepoint[32] = {9}; bits256 hash; uint8_t addrtype,usedwif = 0;
if ( dosha256 != 0 )
{
memcpy(myinfo->secret,pass,passlen+1);
myinfo->myaddr.nxt64bits = conv_NXTpassword(myinfo->persistent_priv.bytes,myinfo->myaddr.persistent.bytes,pass,passlen);
if ( iguana_wifstr_valid((char *)pass) > 0 )
{
usedwif = 1;
bitcoin_wif2priv(&addrtype,&myinfo->persistent_priv,(char *)pass);
curve25519_donna(myinfo->myaddr.persistent.bytes,myinfo->persistent_priv.bytes,basepoint);
}
else myinfo->myaddr.nxt64bits = conv_NXTpassword(myinfo->persistent_priv.bytes,myinfo->myaddr.persistent.bytes,pass,passlen);
}
else
{
@ -329,6 +386,8 @@ void SuperNET_setkeys(struct supernet_info *myinfo,void *pass,int32_t passlen,in
bitcoin_pubkey33(myinfo->ctx,myinfo->persistent_pubkey33,myinfo->persistent_priv);
bitcoin_address(myinfo->myaddr.BTC,0,myinfo->persistent_pubkey33,33);
bitcoin_address(myinfo->myaddr.BTCD,60,myinfo->persistent_pubkey33,33);
if ( (0) && usedwif != 0 )
printf("usedwif for %s %s\n",myinfo->myaddr.BTCD,myinfo->myaddr.BTC);
}
void SuperNET_parsemyinfo(struct supernet_info *myinfo,cJSON *msgjson)

1
iguana/acsplit

@ -0,0 +1 @@
curl --url "http://127.0.0.1:7776" --data "{\"coin\":\""${1}"\",\"agent\":\"iguana\",\"method\":\"splitfunds\",\"satoshis\":\"10000\",\"sendflag\":1,\"duplicates\":"${2}"}"

45
iguana/build_static_nanomsg.sh

@ -0,0 +1,45 @@
#!/bin/bash
#Check if libnanomsg-static.a file is already exists or not
if [[ "$OSTYPE" == "linux-gnu" ]]; then
echo "Linux"
file="../OSlibs/linux/$(uname -m)/libnanomsg-static.a"
makedir="../OSlibs/linux/$(uname -m)/"
copytarget="../OSlibs/linux/$(uname -m)/libnanomsg-static.a"
elif [[ "$OSTYPE" == "darwin"* ]]; then
# Mac OSX
echo "Mac OSX"
file="../OSlibs/osx/$(uname -m)/libnanomsg-static.a"
makedir="../OSlibs/osx/$(uname -m)/"
copytarget="../OSlibs/osx/$(uname -m)/libnanomsg-static.a"
fi
if [ ! -f "$file" ]
then
echo "$0: File '${file}' not found."
#Download nanomsg library 1.0 stable
rm -rf nanomsgsrc
git clone https://github.com/nanomsg/nanomsg.git nanomsgsrc
#Create destination folder
mkdir nanomsglib
#Switch into nanomsgsrc folder
cd nanomsgsrc
#Create build directory and switch into it
mkdir build && cd build
#Compile
cmake .. -DCMAKE_INSTALL_PREFIX=../../nanomsglib/ -DCMAKE_BUILD_TYPE=Debug -DNN_STATIC_LIB=1
cmake --build .
ctest -C Debug .
cmake --build . --target install
cd ../..
pwd
mkdir -p $makedir
cp -av nanomsglib/lib/libnanomsg.a $copytarget
fi

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save