From 41008d7385f9b12a5215bbc4a50e5534018d91a2 Mon Sep 17 00:00:00 2001 From: ca333 Date: Fri, 27 Jan 2017 01:22:56 +0100 Subject: [PATCH 1/6] OSX release build instructions --- README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/README.md b/README.md index 02e8c4218..5d987b574 100755 --- a/README.md +++ b/README.md @@ -222,3 +222,33 @@ sudo service ntp start Now things should be ready. To update and run notary node: pkill iguana; ./m_LP; tests/notaryinit + +##Building for OSX distribution## +Get OSX SDK 10.6 from https://github.com/ca333/MacOSX-SDKs/releases/tag/10.6 + +Unpack & move the .sdk folder to Xcodes SDK folder: + +```cd DownloadDirectory``` + +```mv MacOSX10.6.sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/.``` + +If you are using Xcode > 7.3 add the new SDK to XCode by changing MinimumSDKVersion in your Info.plist: + +```vi /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Info.plist``` + +Change the value to: + +``` +MinimumSDKVersion +10.6 +``` +Build crypto777 library and agents with OSX release makefile: + +```./m_onetime m_osx_release``` + +Execute the OSX deploy script: + +``` +./osx_deploy.sh +``` +The iguana binary and its linked libraries are in ```/tmp/iguana```. From 32f7758570344251fda8d7e3bd8a9465e2e937d6 Mon Sep 17 00:00:00 2001 From: ca333 Date: Fri, 27 Jan 2017 01:28:59 +0100 Subject: [PATCH 2/6] OSX release build instructions update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5d987b574..e0b8c4163 100755 --- a/README.md +++ b/README.md @@ -223,7 +223,7 @@ Now things should be ready. To update and run notary node: pkill iguana; ./m_LP; tests/notaryinit -##Building for OSX distribution## +##Build for OSX distribution## Get OSX SDK 10.6 from https://github.com/ca333/MacOSX-SDKs/releases/tag/10.6 Unpack & move the .sdk folder to Xcodes SDK folder: From df485aca3ae9fc2d36f6ffa84b635d720726667a Mon Sep 17 00:00:00 2001 From: ca333 Date: Fri, 27 Jan 2017 02:19:55 +0100 Subject: [PATCH 3/6] updated iguana deploy path --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e0b8c4163..3aa7e99dd 100755 --- a/README.md +++ b/README.md @@ -251,4 +251,4 @@ Execute the OSX deploy script: ``` ./osx_deploy.sh ``` -The iguana binary and its linked libraries are in ```/tmp/iguana```. +The iguana binary and its linked libraries are in ```$HOME/tmp/iguana```. From f3f20f107a9ef18d7a8b1dcf1950cdda951bbb7a Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 29 Mar 2017 18:48:50 +0300 Subject: [PATCH 4/6] Remove single unused/skipped function --- .gitignore | 2 + iguana/iguana_secp.c | 89 -------------------------------------------- 2 files changed, 2 insertions(+), 89 deletions(-) diff --git a/.gitignore b/.gitignore index 1d70ba0e5..e689f7231 100755 --- a/.gitignore +++ b/.gitignore @@ -216,3 +216,5 @@ iguana/autoAPI.md iguana/confs/5228bcea7ae2515a29c3844673de6ee2acba53bf45724744a00ff4306f192912 iguana/confs/630929d976025fafde221c7358eb5805f4359bad3c6b8bd50ad3f6e0a9b5ce78 + +iguana/confs/5f3283a017c31e52443d61cb43944e2157f7c03eb12d701ebf4a35a695688e1f diff --git a/iguana/iguana_secp.c b/iguana/iguana_secp.c index 614f970e4..c53170908 100755 --- a/iguana/iguana_secp.c +++ b/iguana/iguana_secp.c @@ -451,95 +451,6 @@ int32_t bitcoin_rangeproof(void *ctx,uint8_t *proof,uint8_t *commit,bits256 blin return(retval); } -/* - * The intended procedure for creating a multiparty signature is: - * - Each signer S[i] with private key x[i] and public key Q[i] runs - * secp256k1_schnorr_generate_nonce_pair to produce a pair (k[i],R[i]) of private/public nonces. - * - All signers communicate their public nonces to each other (revealing your - * private nonce can lead to discovery of your private key, so it should be considered secret). - * - All signers combine all the public nonces they received (excluding their - * own) using secp256k1_ec_pubkey_combine to obtain an Rall[i] = sum(R[0..i-1,i+1..n]). - * - All signers produce a partial signature using - * secp256k1_schnorr_partial_sign, passing in their own private key x[i], - * their own private nonce k[i], and the sum of the others' public nonces Rall[i]. - * - All signers communicate their partial signatures to each other. - * - Someone combines all partial signatures using secp256k1_schnorr_partial_combine, to obtain a full signature. - * - The resulting signature is validatable using secp256k1_schnorr_verify, with - * public key equal to the result of secp256k1_ec_pubkey_combine of the signers' public keys (sum(Q[0..n])). - * - * Note that secp256k1_schnorr_partial_combine and secp256k1_ec_pubkey_combine - * function take their arguments in any order, and it is possible to - * pre-combine several inputs already with one call, and add more inputs later - * by calling the function again (they are commutative and associative). - */ - -#ifdef test_schnorr -#include "secp256k1/src/util.h" -#include "secp256k1/src/hash_impl.h" -#include "secp256k1/src/testrand_impl.h" - -void test_schnorr_threshold(void *ctx) { - unsigned char msg[32]; - unsigned char sec[5][32]; - secp256k1_pubkey pub[5]; - unsigned char nonce[5][32]; - secp256k1_pubkey pubnonce[5]; - unsigned char sig[5][64]; - const unsigned char* sigs[5]; - unsigned char allsig[64]; - const secp256k1_pubkey* pubs[5]; - secp256k1_pubkey allpub; - int n, i; - int damage; - int ret = 0; - - damage = secp256k1_rand_bits(1) ? (1 + secp256k1_rand_int(4)) : 0; - secp256k1_rand256_test(msg); - n = 2 + secp256k1_rand_int(4); - for (i = 0; i < n; i++) { - do { - secp256k1_rand256_test(sec[i]); - } while (!secp256k1_ec_seckey_verify(ctx, sec[i])); - CHECK(secp256k1_ec_pubkey_create(ctx, &pub[i], sec[i])); - CHECK(secp256k1_schnorr_generate_nonce_pair(ctx, &pubnonce[i], nonce[i], msg, sec[i], NULL, NULL)); - pubs[i] = &pub[i]; - } - if (damage == 1) { - nonce[secp256k1_rand_int(n)][secp256k1_rand_int(32)] ^= 1 + secp256k1_rand_int(255); - } else if (damage == 2) { - sec[secp256k1_rand_int(n)][secp256k1_rand_int(32)] ^= 1 + secp256k1_rand_int(255); - } - for (i = 0; i < n; i++) { - secp256k1_pubkey allpubnonce; - const secp256k1_pubkey *pubnonces[4]; - int j; - for (j = 0; j < i; j++) { - pubnonces[j] = &pubnonce[j]; - } - for (j = i + 1; j < n; j++) { - pubnonces[j - 1] = &pubnonce[j]; - } - CHECK(secp256k1_ec_pubkey_combine(ctx, &allpubnonce, pubnonces, n - 1)); - ret |= (secp256k1_schnorr_partial_sign(ctx, sig[i], msg, sec[i], &allpubnonce, nonce[i]) != 1) * 1; - sigs[i] = sig[i]; - } - if (damage == 3) { - sig[secp256k1_rand_int(n)][secp256k1_rand_bits(6)] ^= 1 + secp256k1_rand_int(255); - } - ret |= (secp256k1_ec_pubkey_combine(ctx, &allpub, pubs, n) != 1) * 2; - if ((ret & 1) == 0) { - ret |= (secp256k1_schnorr_partial_combine(ctx, allsig, sigs, n) != 1) * 4; - } - if (damage == 4) { - allsig[secp256k1_rand_int(32)] ^= 1 + secp256k1_rand_int(255); - } - if ((ret & 7) == 0) { - ret |= (secp256k1_schnorr_verify(ctx, allsig, msg, &allpub) != 1) * 8; - } - CHECK((ret == 0) == (damage == 0)); -} -#endif - int32_t iguana_pederson_test(void *ctx) { uint8_t commits[100][33],*commitptrs[100],proofs[100][5138]; uint16_t vouts[100]; int64_t min_value,values[100],totalpos,totalneg; bits256 txids[100],nonces[100],blinds[100],*blindptrs[100],blindsum; int32_t prooflens[100],i,r,pos,neg,numpos,exponent,min_bits,n,N = 100; From 304f05a02ad39b9374cc39227f39510746099117 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 29 Mar 2017 18:56:18 +0300 Subject: [PATCH 5/6] Remove single unused function out of 24 --- .gitignore | 10 +++++ .vscode/launch.json | 22 +++++++++++ README.md | 49 +++++------------------- iguana/iguana_secp.c | 89 -------------------------------------------- 4 files changed, 42 insertions(+), 128 deletions(-) create mode 100644 .vscode/launch.json diff --git a/.gitignore b/.gitignore index d7f6bfab7..1ae724886 100755 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,13 @@ iguana/confs/BTC_hdrs.txt deprecated/.DS_Store .DS_Store + +iguana/help/.tmpmarker + +iguana/genesis/.tmpmarker + +iguana/help.json + +iguana/autoAPI.md + +iguana/basilisk.o-2ad8cb38 diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 000000000..20c9e805a --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,22 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "C++ Launch (Windows)", + "type": "cppvsdbg", + "request": "launch", + "program": "enter program name, for example ${workspaceRoot}/a.exe", + "args": [], + "stopAtEntry": false, + "cwd": "${workspaceRoot}", + "environment": [], + "externalConsole": false + }, + { + "name": "C++ Attach (Windows)", + "type": "cppvsdbg", + "request": "attach", + "processId": "${command:pickProcess}" + } + ] +} \ No newline at end of file diff --git a/README.md b/README.md index 3aa7e99dd..2d49a0b55 100755 --- a/README.md +++ b/README.md @@ -23,11 +23,11 @@ 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# -> -> ```sudo apt-get update; sudo apt-get install git libcurl4-openssl-dev build-essential; git clone https://github.com/jl777/SuperNET; cd SuperNET; ./m_onetime m_unix;``` -> -> The above one line gets SuperNET installed, built and launched for unix. -> +> +> ```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;``` +> +> The above one line gets SuperNET installed, built and launched for unix. +> > After that ```./m_unix``` updates to latest. > *Continue below at "Running".* @@ -44,6 +44,8 @@ The above two definitions need to be changed to match the mingw install on your 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)//lib/pnacl. +##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# Now you are ready to build. @@ -103,14 +105,14 @@ Internally, all paths convert the request into a standard SuperNET JSON request. Another approach is to use the bitcoin RPC syntax via: curl --url "http://127.0.0.1:7778" --data "{\"coin\":\"BTCD\",\"method\":\"getinfo\",\"params\":[]}" the params:[] array is where the standard bitcoin parameters go, the only change that is needed is to specify the coin -alternatively {"agent":"SuperNET","method":"bitcoinrpc","coin":"BTCD"} will set the coin +alternatively {"agent":"SuperNET","method":"bitcoinrpc","coin":"BTCD"} will set the coin to use for bitcoin RPC calls. this will suffice in single coin environments curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"iguana",\"method\":\"test\"}" curl --url "http://127.0.0.1:7778/iguana/test" -> html page with results curl --url "http://127.0.0.1:7778/api/iguana/test" -> just json text http://127.0.0.1:7778 -> superugly GUI -http://127.0.0.1:7778/iguana/test +http://127.0.0.1:7778/iguana/test http://127.0.0.1:7778/api/iguana/test postCall('{"agent":"iguana","method":"test"}'} iguana_JSON("{\"agent\":\"iguana",\"method\":\"test\"}"); -> direct C function call @@ -124,7 +126,7 @@ iguana can be invoked with a command line argument. if it is a name of a file, i "exchanges" -> { "name":"", ... } "apikey", "apisecret", "userid", "tradepassword" these are as expected "pollgap" -> gap between each access to exchange for getting prices - + on OSX mksquashfs is not native, you will need to install fuse: https://osxfuse.github.io/ and a squashfs for mac: https://github.com/vasi/squashfuse ********** @@ -221,34 +223,3 @@ sudo service ntp start Now things should be ready. To update and run notary node: pkill iguana; ./m_LP; tests/notaryinit - - -##Build for OSX distribution## -Get OSX SDK 10.6 from https://github.com/ca333/MacOSX-SDKs/releases/tag/10.6 - -Unpack & move the .sdk folder to Xcodes SDK folder: - -```cd DownloadDirectory``` - -```mv MacOSX10.6.sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/.``` - -If you are using Xcode > 7.3 add the new SDK to XCode by changing MinimumSDKVersion in your Info.plist: - -```vi /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Info.plist``` - -Change the value to: - -``` -MinimumSDKVersion -10.6 -``` -Build crypto777 library and agents with OSX release makefile: - -```./m_onetime m_osx_release``` - -Execute the OSX deploy script: - -``` -./osx_deploy.sh -``` -The iguana binary and its linked libraries are in ```$HOME/tmp/iguana```. diff --git a/iguana/iguana_secp.c b/iguana/iguana_secp.c index f7a51164a..acc345d17 100755 --- a/iguana/iguana_secp.c +++ b/iguana/iguana_secp.c @@ -451,95 +451,6 @@ int32_t bitcoin_rangeproof(void *ctx,uint8_t *proof,uint8_t *commit,bits256 blin return(retval); } -/* - * The intended procedure for creating a multiparty signature is: - * - Each signer S[i] with private key x[i] and public key Q[i] runs - * secp256k1_schnorr_generate_nonce_pair to produce a pair (k[i],R[i]) of private/public nonces. - * - All signers communicate their public nonces to each other (revealing your - * private nonce can lead to discovery of your private key, so it should be considered secret). - * - All signers combine all the public nonces they received (excluding their - * own) using secp256k1_ec_pubkey_combine to obtain an Rall[i] = sum(R[0..i-1,i+1..n]). - * - All signers produce a partial signature using - * secp256k1_schnorr_partial_sign, passing in their own private key x[i], - * their own private nonce k[i], and the sum of the others' public nonces Rall[i]. - * - All signers communicate their partial signatures to each other. - * - Someone combines all partial signatures using secp256k1_schnorr_partial_combine, to obtain a full signature. - * - The resulting signature is validatable using secp256k1_schnorr_verify, with - * public key equal to the result of secp256k1_ec_pubkey_combine of the signers' public keys (sum(Q[0..n])). - * - * Note that secp256k1_schnorr_partial_combine and secp256k1_ec_pubkey_combine - * function take their arguments in any order, and it is possible to - * pre-combine several inputs already with one call, and add more inputs later - * by calling the function again (they are commutative and associative). - */ - -#ifdef test_schnorr -#include "secp256k1/src/util.h" -#include "secp256k1/src/hash_impl.h" -#include "secp256k1/src/testrand_impl.h" - -void test_schnorr_threshold(void *ctx) { - unsigned char msg[32]; - unsigned char sec[5][32]; - secp256k1_pubkey pub[5]; - unsigned char nonce[5][32]; - secp256k1_pubkey pubnonce[5]; - unsigned char sig[5][64]; - const unsigned char* sigs[5]; - unsigned char allsig[64]; - const secp256k1_pubkey* pubs[5]; - secp256k1_pubkey allpub; - int n, i; - int damage; - int ret = 0; - - damage = secp256k1_rand_bits(1) ? (1 + secp256k1_rand_int(4)) : 0; - secp256k1_rand256_test(msg); - n = 2 + secp256k1_rand_int(4); - for (i = 0; i < n; i++) { - do { - secp256k1_rand256_test(sec[i]); - } while (!secp256k1_ec_seckey_verify(ctx, sec[i])); - CHECK(secp256k1_ec_pubkey_create(ctx, &pub[i], sec[i])); - CHECK(secp256k1_schnorr_generate_nonce_pair(ctx, &pubnonce[i], nonce[i], msg, sec[i], NULL, NULL)); - pubs[i] = &pub[i]; - } - if (damage == 1) { - nonce[secp256k1_rand_int(n)][secp256k1_rand_int(32)] ^= 1 + secp256k1_rand_int(255); - } else if (damage == 2) { - sec[secp256k1_rand_int(n)][secp256k1_rand_int(32)] ^= 1 + secp256k1_rand_int(255); - } - for (i = 0; i < n; i++) { - secp256k1_pubkey allpubnonce; - const secp256k1_pubkey *pubnonces[4]; - int j; - for (j = 0; j < i; j++) { - pubnonces[j] = &pubnonce[j]; - } - for (j = i + 1; j < n; j++) { - pubnonces[j - 1] = &pubnonce[j]; - } - CHECK(secp256k1_ec_pubkey_combine(ctx, &allpubnonce, pubnonces, n - 1)); - ret |= (secp256k1_schnorr_partial_sign(ctx, sig[i], msg, sec[i], &allpubnonce, nonce[i]) != 1) * 1; - sigs[i] = sig[i]; - } - if (damage == 3) { - sig[secp256k1_rand_int(n)][secp256k1_rand_bits(6)] ^= 1 + secp256k1_rand_int(255); - } - ret |= (secp256k1_ec_pubkey_combine(ctx, &allpub, pubs, n) != 1) * 2; - if ((ret & 1) == 0) { - ret |= (secp256k1_schnorr_partial_combine(ctx, allsig, sigs, n) != 1) * 4; - } - if (damage == 4) { - allsig[secp256k1_rand_int(32)] ^= 1 + secp256k1_rand_int(255); - } - if ((ret & 7) == 0) { - ret |= (secp256k1_schnorr_verify(ctx, allsig, msg, &allpub) != 1) * 8; - } - CHECK((ret == 0) == (damage == 0)); -} -#endif - int32_t iguana_pederson_test(void *ctx) { uint8_t commits[100][33],*commitptrs[100],proofs[100][5138]; uint16_t vouts[100]; int64_t min_value,values[100],totalpos,totalneg; bits256 txids[100],nonces[100],blinds[100],*blindptrs[100],blindsum; int32_t prooflens[100],i,r,pos,neg,numpos,exponent,min_bits,n,N = 100; From d467826d637832e6d403c3daa1b1f84165fe1c83 Mon Sep 17 00:00:00 2001 From: Satinder Grewal Date: Mon, 31 Jul 2017 23:08:23 +1200 Subject: [PATCH 6/6] updated deplay script to make static marketmaker --- osx_deploy.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/osx_deploy.sh b/osx_deploy.sh index 4a7efa802..9fa0f5733 100755 --- a/osx_deploy.sh +++ b/osx_deploy.sh @@ -6,13 +6,21 @@ TMP_DIR=~/tmp/iguana mkdir -p $TMP_DIR echo "making $TMP_DIR" -binaries=("iguana") +binaries=("iguana" "marketmaker") for binary in "${binaries[@]}"; do echo "copying $binary to $TMP_DIR" - cp agents/$binary $TMP_DIR + if [ "$binary" = "iguana" ] + then + cp agents/$binary $TMP_DIR + fi + + if [ "$binary" = "marketmaker" ] + then + cp iguana/$binary $TMP_DIR + fi # find the dylibs to copy for iguana DYLIBS=`otool -L $TMP_DIR/$binary | grep "/usr/local" | awk -F' ' '{ print $1 }'`