diff --git a/crypto777/OS_portable.h b/crypto777/OS_portable.h index 06a06116c..9da753811 100755 --- a/crypto777/OS_portable.h +++ b/crypto777/OS_portable.h @@ -425,6 +425,7 @@ bits256 bits256_sha256(bits256 data); void bits256_rmd160(uint8_t rmd160[20],bits256 data); void bits256_rmd160_sha256(uint8_t rmd160[20],bits256 data); double get_theoretical(double *avebidp,double *aveaskp,double *highbidp,double *lowaskp,double *CMC_averagep,double changes[3],char *name,char *base,char *rel,double *USD_averagep); +char *bitcoind_RPCnew(void *curl_handle,char **retstrp,char *debugstr,char *url,char *userpass,char *command,char *params,int32_t timeout); extern char *Iguana_validcommands[]; extern bits256 GENESIS_PUBKEY,GENESIS_PRIVKEY; diff --git a/crypto777/bitcoind_RPC.c b/crypto777/bitcoind_RPC.c index 1ae71342e..78c874cbe 100755 --- a/crypto777/bitcoind_RPC.c +++ b/crypto777/bitcoind_RPC.c @@ -14,6 +14,7 @@ ******************************************************************************/ +//#define KEEPALIVE breaks marketmaker api #ifndef FROM_JS #include "OS_portable.h" @@ -74,7 +75,7 @@ char *post_process_bitcoind_RPC(char *debugstr,char *command,char *rpcstr,char * char *retstr = 0; cJSON *json,*result,*error; #ifndef FROM_MARKETMAKER - usleep(1000); + //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 ) @@ -131,7 +132,7 @@ char *post_process_bitcoind_RPC(char *debugstr,char *command,char *rpcstr,char * * ************************************************************************/ -static int32_t USE_JAY; +//static int32_t USE_JAY; char *Jay_NXTrequest(char *command,char *params) { @@ -141,23 +142,28 @@ char *Jay_NXTrequest(char *command,char *params) return(retstr); } -char *bitcoind_RPC(char **retstrp,char *debugstr,char *url,char *userpass,char *command,char *params,int32_t timeout) + +static void bitcoind_init() { - 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; - char *bracket0,*bracket1,*retstr,*databuf = 0; long len; int32_t specialcase,numretries; double starttime; + static int32_t didinit; 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)) ) - { - if ( (databuf= Jay_NXTrequest(command,params)) != 0 ) - return(databuf); } +} + +char *bitcoind_RPC(char **retstrp,char *debugstr,char *url,char *userpass,char *command,char *params,int32_t timeout) +{ +#ifdef KEEPALIVE + static +#endif + CURL *curl_handle = 0; + static int 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; + char *bracket0,*bracket1,*retstr,*databuf = 0; long len; int32_t specialcase,numretries; double starttime; + bitcoind_init(); numretries = 0; if ( debugstr != 0 && strcmp(debugstr,"BTCD") == 0 && command != 0 && strcmp(command,"SuperNET") == 0 ) specialcase = 1; @@ -174,7 +180,8 @@ try_again: if ( retstrp != 0 ) *retstrp = 0; starttime = OS_milliseconds(); - curl_handle = curl_easy_init(); + if ( curl_handle == 0 ) + curl_handle = curl_easy_init(); headers = curl_slist_append(0,"Expect:"); curl_easy_setopt(curl_handle,CURLOPT_USERAGENT,"mozilla/4.0");//"Mozilla/4.0 (compatible; )"); @@ -244,7 +251,10 @@ try_again: //laststart = milliseconds(); res = curl_easy_perform(curl_handle); curl_slist_free_all(headers); +#ifndef KEEPALIVE curl_easy_cleanup(curl_handle); + curl_handle = 0; +#endif if ( databuf != 0 ) // clean up temporary buffer { free(databuf); @@ -279,7 +289,7 @@ try_again: count++; elapsedsum += (OS_milliseconds() - starttime); if ( (count % 100000) == 0) - printf("%d: ave %9.6f | elapsed %.3f millis | bitcoind_RPC.(%s) url.(%s)\n",count,elapsedsum/count,(OS_milliseconds() - starttime),command,url); + printf("%d: %s ave %9.6f | elapsed %.3f millis | bitcoind_RPC.(%s) url.(%s)\n",count,debugstr,elapsedsum/count,(OS_milliseconds() - starttime),command,url); if ( retstrp != 0 ) { *retstrp = retstr; @@ -301,6 +311,153 @@ try_again: } } +char *bitcoind_RPCnew(void *curl_handle,char **retstrp,char *debugstr,char *url,char *userpass,char *command,char *params,int32_t timeout) +{ + static int 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; + char *bracket0,*bracket1,*retstr,*databuf = 0; long len; int32_t flag=0,specialcase,numretries; double starttime; + bitcoind_init(); + numretries = 0; + if ( url[0] == 0 ) + strcpy(url,"http://127.0.0.1:7776"); +try_again: + if ( curl_handle == 0 ) + { + curl_handle = curl_easy_init(); + flag = 1; + } + if ( retstrp != 0 ) + *retstrp = 0; + starttime = OS_milliseconds(); + headers = curl_slist_append(0,"Expect:"); + curl_easy_setopt(curl_handle,CURLOPT_USERAGENT,"mozilla/4.0");//"Mozilla/4.0 (compatible; )"); + curl_easy_setopt(curl_handle,CURLOPT_HTTPHEADER, headers); + curl_easy_setopt(curl_handle,CURLOPT_URL, url); + if ( (0) ) + { + init_string(&s); + curl_easy_setopt(curl_handle,CURLOPT_WRITEFUNCTION, (void *)accumulate); // send all data to this function + curl_easy_setopt(curl_handle,CURLOPT_WRITEDATA, &s); // we pass our 's' struct to the callback + } + else + { + memset(&chunk,0,sizeof(chunk)); + curl_easy_setopt(curl_handle,CURLOPT_WRITEFUNCTION,WriteMemoryCallback); + curl_easy_setopt(curl_handle,CURLOPT_WRITEDATA,(void *)&chunk); + + } + curl_easy_setopt(curl_handle,CURLOPT_NOSIGNAL, 1L); // supposed to fix "Alarm clock" and long jump crash + curl_easy_setopt(curl_handle,CURLOPT_NOPROGRESS, 1L); // no progress callback + if ( timeout > 0 ) + { + if ( bitcoind_RPC_inittime != 0 ) + { +#ifndef _WIN32 + curl_easy_setopt(curl_handle,CURLOPT_TIMEOUT,1); +#else + curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT_MS, timeout*100); +#endif + } else curl_easy_setopt(curl_handle,CURLOPT_TIMEOUT,timeout); // causes problems with iguana timeouts + } + if ( strncmp(url,"https",5) == 0 ) + { + curl_easy_setopt(curl_handle,CURLOPT_SSL_VERIFYPEER,0); + curl_easy_setopt(curl_handle,CURLOPT_SSL_VERIFYHOST,0); + } + if ( userpass != 0 ) + curl_easy_setopt(curl_handle,CURLOPT_USERPWD, userpass); + databuf = 0; + if ( params != 0 ) + { + if ( command != 0 ) + { + len = strlen(params); + if ( len > 0 && params[0] == '[' && params[len-1] == ']' ) { + bracket0 = bracket1 = (char *)""; + } + else + { + bracket0 = (char *)"["; + bracket1 = (char *)"]"; + } + char agentstr[64]; + databuf = (char *)malloc(256 + strlen(command) + strlen(params)); + if ( debugstr[0] != 0 ) + sprintf(agentstr,"\"agent\":\"%s\",",debugstr); + else agentstr[0] = 0; + sprintf(databuf,"{\"id\":\"jl777\",%s\"method\":\"%s\",\"params\":%s%s%s}",agentstr,command,bracket0,params,bracket1); + //printf("url.(%s) userpass.(%s) databuf.(%s)\n",url,userpass,databuf); + // + } //else if ( specialcase != 0 ) fprintf(stderr,"databuf.(%s)\n",params); + curl_easy_setopt(curl_handle,CURLOPT_POST,1L); + if ( databuf != 0 ) + curl_easy_setopt(curl_handle,CURLOPT_POSTFIELDS,databuf); + else curl_easy_setopt(curl_handle,CURLOPT_POSTFIELDS,params); + } + res = curl_easy_perform(curl_handle); + curl_slist_free_all(headers); + if ( databuf != 0 ) // clean up temporary buffer + { + free(databuf); + databuf = 0; + } + if ( flag != 0 ) + { + curl_easy_cleanup(curl_handle); + curl_handle = 0; + } + retstr = chunk.memory; // retstr = s.ptr; + if ( res != CURLE_OK ) + { + numretries++; + if ( timeout != 0 ) + { + //printf("<<<<<<<<<<< bitcoind_RPC.(%s): BTCD.%s timeout params.(%s) s.ptr.(%s) err.%d\n",url,command,params,retstr,res); + free(retstr); + return(0); + } + else if ( numretries >= 4 ) + { + printf( "curl_easy_perform() failed: %s %s.(%s %s), retries: %d\n",curl_easy_strerror(res),debugstr,url,command,numretries); + //printf("Maximum number of retries exceeded!\n"); + free(retstr); + return(0); + } + free(retstr); + sleep((1< (%s)\n",params,retstr); + count2++; + elapsedsum2 += (OS_milliseconds() - starttime); + if ( (count2 % 10000) == 0) + printf("%d: ave %9.6f | elapsed %.3f millis | NXT calls.(%s) cmd.(%s)\n",count2,elapsedsum2/count2,(double)(OS_milliseconds() - starttime),url,command); + return(retstr); + } + } +} + /************************************************************************ * * Initialize the string handler so that it is thread safe diff --git a/deprecated/iguana_notary.c b/deprecated/iguana_notary.c index 420166fba..3b497bcbe 100755 --- a/deprecated/iguana_notary.c +++ b/deprecated/iguana_notary.c @@ -516,7 +516,7 @@ STRING_ARG(iguana,addnotary,ipaddr) } char NOTARY_CURRENCIES[][65] = { - "REVS", "SUPERNET", "DEX", "PANGEA", "JUMBLR", "BET", "CRYPTO", "HODL", "BOTS", "MGW", "COQUI", "WLC", "KV", "CEAL", "MESH", "MNZ", "CHIPS", "MSHARK", "AXO", "ETOMIC", "BTCH", "VOTE2018", "NINJA", "OOT", "CHAIN", "BNTN", "PRLPAY" + "REVS", "SUPERNET", "DEX", "PANGEA", "JUMBLR", "BET", "CRYPTO", "HODL", "BOTS", "MGW", "COQUI", "WLC", "KV", "CEAL", "MESH", "MNZ", "CHIPS", "MSHARK", "AXO", "ETOMIC", "BTCH", "VOTE2018", "NINJA", "OOT", "CHAIN", "BNTN", "PRLPAY", "DSEC" }; // "LTC", "USD", "EUR", "JPY", "GBP", "AUD", "CAD", "CHF", "NZD", "CNY", "RUB", "MXN", "BRL", "INR", "HKD", "TRY", "ZAR", "PLN", "NOK", "SEK", "DKK", "CZK", "HUF", "ILS", "KRW", "MYR", "PHP", "RON", "SGD", "THB", "BGN", "IDR", "HRK", diff --git a/iguana/coins/dsec_7776 b/iguana/coins/dsec_7776 new file mode 100755 index 000000000..20da6a2d2 --- /dev/null +++ b/iguana/coins/dsec_7776 @@ -0,0 +1,2 @@ +curl --url "http://127.0.0.1:7776" --data "{\"conf\":\"DSEC.conf\",\"path\":\"${HOME#"/"}/.komodo/DSEC\",\"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\":\"DSEC\",\"name\":\"DSEC\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"c7b2a699\",\"p2p\":11556,\"rpc\":11557,\"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\"}" + diff --git a/iguana/coins/eql_7776 b/iguana/coins/eql_7776 new file mode 100755 index 000000000..47a370309 --- /dev/null +++ b/iguana/coins/eql_7776 @@ -0,0 +1 @@ +curl --url "http://127.0.0.1:7776" --data "{\"conf\":\"EQL.conf\",\"path\":\"${HOME#"/"}/.komodo/EQL\",\"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\":\"EQL\",\"name\":\"EQL\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"b890e458\",\"p2p\":10305,\"rpc\":10306,\"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\"}" diff --git a/iguana/coins/glxt_7776 b/iguana/coins/glxt_7776 new file mode 100755 index 000000000..7041688a5 --- /dev/null +++ b/iguana/coins/glxt_7776 @@ -0,0 +1 @@ +curl --url "http://127.0.0.1:7776" --data "{\"conf\":\"GLXT.conf\",\"path\":\"${HOME#"/"}/.komodo/GLXT\",\"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\":\"GLXT\",\"name\":\"GLXT\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"0beebb40\",\"p2p\":15722,\"rpc\":15723,\"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\"}" diff --git a/iguana/coins/rfox_7776 b/iguana/coins/rfox_7776 new file mode 100755 index 000000000..a3f269f1a --- /dev/null +++ b/iguana/coins/rfox_7776 @@ -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\"}" + diff --git a/iguana/coins/vrsc_7776 b/iguana/coins/vrsc_7776 new file mode 100755 index 000000000..bdbc4f58e --- /dev/null +++ b/iguana/coins/vrsc_7776 @@ -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\"}" diff --git a/iguana/coins/zilla_7776 b/iguana/coins/zilla_7776 new file mode 100755 index 000000000..8652fb357 --- /dev/null +++ b/iguana/coins/zilla_7776 @@ -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\"}" diff --git a/iguana/dPoW.h b/iguana/dPoW.h index 11a4fd1fa..f4cb5ebed 100755 --- a/iguana/dPoW.h +++ b/iguana/dPoW.h @@ -27,7 +27,7 @@ //#define DPOW_M(bp) ((bp)->minsigs) // (((bp)->numnotaries >> 1) + 1) #define DPOW_MODIND(bp,offset) (((((bp)->height / DPOW_CHECKPOINTFREQ) % (bp)->numnotaries) + (offset)) % (bp)->numnotaries) #define DPOW_VERSION 0x1782 -#define DPOW_UTXOSIZE 10000//50000 +#define DPOW_UTXOSIZE dpow_utxosize(coin->symbol) //10000 #define DPOW_MINOUTPUT 6000 #define DPOW_DURATION 1200 #define DPOW_RATIFYDURATION (3600 * 24) @@ -119,6 +119,7 @@ struct dpow_block int32_t rawratifiedlens[2],height,numnotaries,numerrors,completed,minsigs,duration,numratified,isratify,require0,scores[DPOW_MAXRELAYS]; int8_t myind,bestk,ratifybestk,pendingbestk,pendingratifybestk,matches,bestmatches; cJSON *ratified; + uint16_t CCid; uint8_t ratified_pubkeys[DPOW_MAXRELAYS][33],ratifysigs[2][DPOW_MAXSIGLEN],ratifysiglens[2]; char handles[DPOW_MAXRELAYS][32]; char signedtx[32768]; uint8_t ratifyrawtx[2][32768]; uint32_t pendingcrcs[2]; @@ -143,6 +144,7 @@ struct dpow_info uint32_t SRCREALTIME,lastsrcupdate,destupdated,srcconfirms,numdesttx,numsrctx,lastsplit,cancelratify; int32_t lastheight,maxblocks,SRCHEIGHT,DESTHEIGHT,prevDESTHEIGHT,SHORTFLAG,ratifying,minsigs,freq; struct pax_transaction *PAX; + uint32_t fullCCid; portable_mutex_t paxmutex,dexmutex; uint32_t ipbits[128],numipbits; struct dpow_block **blocks,*currentbp; @@ -158,7 +160,7 @@ struct komodo_ccdataMoMoM }; uint64_t dpow_notarybestk(uint64_t refmask,struct dpow_block *bp,int8_t *lastkp); -int32_t dpow_paxpending(uint8_t *hex,int32_t hexsize,uint32_t *paxwdcrcp,bits256 MoM,uint32_t MoMdepth,int32_t src_or_dest,struct dpow_block *bp); +int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsize,uint32_t *paxwdcrcp,bits256 MoM,uint32_t MoMdepth,uint16_t CCid,int32_t src_or_dest,struct dpow_block *bp); void dex_updateclient(struct supernet_info *myinfo); char *dex_reqsend(struct supernet_info *myinfo,char *handler,uint8_t *data,int32_t datalen,int32_t M,char *field); char *basilisk_respond_addmessage(struct supernet_info *myinfo,uint8_t *key,int32_t keylen,uint8_t *data,int32_t datalen,int32_t sendping,uint32_t duration); diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 66fab06f8..4301f8c3a 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -143,7 +143,7 @@ int32_t dpow_checkutxo(struct supernet_info *myinfo,struct dpow_info *dp,struct { addresses = cJSON_CreateArray(); jaddistr(addresses,coinaddr); - if ( (rawtx= iguana_utxoduplicates(myinfo,coin,dp->minerkey33,DPOW_UTXOSIZE,n,&completed,&signedtxid,0,addresses)) != 0 ) + if ( myinfo->nosplit == 0 && (rawtx= iguana_utxoduplicates(myinfo,coin,dp->minerkey33,DPOW_UTXOSIZE,n,&completed,&signedtxid,0,addresses)) != 0 ) { if ( (sendtx= dpow_sendrawtransaction(myinfo,coin,rawtx)) != 0 ) { @@ -235,6 +235,8 @@ bits256 dpow_calcMoM(uint32_t *MoMdepthp,struct supernet_info *myinfo,struct igu bits256 MoM; cJSON *MoMjson,*infojson; int32_t prevMoMheight; *MoMdepthp = 0; memset(MoM.bytes,0,sizeof(MoM)); + if ( strcmp(coin->symbol,"GAME") == 0 || strcmp(coin->symbol,"HUSH") == 0 ) // 80 byte OP_RETURN limit + return(MoM); if ( (infojson= dpow_getinfo(myinfo,coin)) != 0 ) { if ( (prevMoMheight= jint(infojson,"prevMoMheight")) >= 0 ) @@ -300,6 +302,7 @@ void dpow_statemachinestart(void *ptr) Numallocated++; bp->MoM = MoM; bp->MoMdepth = MoMdepth; + bp->CCid = dp->fullCCid & 0xffff; bp->minsigs = minsigs; bp->duration = duration; bp->srccoin = src; @@ -436,7 +439,7 @@ void dpow_statemachinestart(void *ptr) return; } bp->myind = myind; - printf("[%d] notarize %s->%s %s ht.%d minsigs.%d duration.%d start.%u MoM[%d] %s\n",bp->myind,dp->symbol,dp->dest,bits256_str(str,checkpoint.blockhash.hash),checkpoint.blockhash.height,minsigs,duration,checkpoint.timestamp,bp->MoMdepth,bits256_str(str2,bp->MoM)); + printf("[%d] notarize %s->%s %s ht.%d minsigs.%d duration.%d start.%u MoM[%d] %s CCid.%u\n",bp->myind,dp->symbol,dp->dest,bits256_str(str,checkpoint.blockhash.hash),checkpoint.blockhash.height,minsigs,duration,checkpoint.timestamp,bp->MoMdepth,bits256_str(str2,bp->MoM),bp->CCid); if ( bp->isratify != 0 && memcmp(bp->notaries[0].pubkey,bp->ratified_pubkeys[0],33) != 0 ) { for (i=0; i<33; i++) @@ -518,7 +521,7 @@ void dpow_statemachinestart(void *ptr) if ( strcmp(bp->destcoin->symbol,"KMD") == 0 ) src_or_dest = 0; else src_or_dest = 1; - extralen = dpow_paxpending(extras,sizeof(extras),&bp->paxwdcrc,bp->MoM,bp->MoMdepth,src_or_dest,bp); + extralen = dpow_paxpending(myinfo,extras,sizeof(extras),&bp->paxwdcrc,bp->MoM,bp->MoMdepth,bp->CCid,src_or_dest,bp); bp->notaries[bp->myind].paxwdcrc = bp->paxwdcrc; } printf("PAXWDCRC.%x myind.%d isratify.%d DPOW.%s statemachine checkpoint.%d %s start.%u+dur.%d vs %ld MoM[%d] %s\n",bp->paxwdcrc,bp->myind,bp->isratify,src->symbol,checkpoint.blockhash.height,bits256_str(str,checkpoint.blockhash.hash),starttime,bp->duration,time(NULL),bp->MoMdepth,bits256_str(str2,bp->MoM)); @@ -539,7 +542,7 @@ void dpow_statemachinestart(void *ptr) if ( strcmp(bp->destcoin->symbol,"KMD") == 0 ) src_or_dest = 0; else src_or_dest = 1; - extralen = dpow_paxpending(extras,sizeof(extras),&bp->paxwdcrc,bp->MoM,bp->MoMdepth,src_or_dest,bp); + extralen = dpow_paxpending(myinfo,extras,sizeof(extras),&bp->paxwdcrc,bp->MoM,bp->MoMdepth,bp->CCid,src_or_dest,bp); bp->notaries[bp->myind].paxwdcrc = bp->paxwdcrc; } if ( dp->checkpoint.blockhash.height > checkpoint.blockhash.height ) //(checkpoint.blockhash.height % 100) != 0 && diff --git a/iguana/dpow/dpow_network.c b/iguana/dpow/dpow_network.c index dcbe6688b..5343f33c6 100755 --- a/iguana/dpow/dpow_network.c +++ b/iguana/dpow/dpow_network.c @@ -1308,6 +1308,8 @@ int32_t dpow_addnotary(struct supernet_info *myinfo,struct dpow_info *dp,char *i char str[512]; uint32_t ipbits,*ptr; int32_t i,iter,n,retval = -1; if ( myinfo->IAMNOTARY == 0 ) return(-1); + if ( strcmp(ipaddr,"88.99.251.101") == 0 || strcmp(ipaddr,"82.202.193.100") == 0 ) + return(-1); portable_mutex_lock(&myinfo->notarymutex); if ( myinfo->dpowsock >= 0 )//&& myinfo->dexsock >= 0 ) { @@ -1462,9 +1464,33 @@ void dpow_nanomsginit(struct supernet_info *myinfo,char *ipaddr) dpow_addnotary(myinfo,0,ipaddr); } +int32_t dpow_crossconnected(uint64_t *badmaskp,struct dpow_block *bp,uint64_t bestmask) +{ + int32_t i,j,n,num = 0; uint64_t mask; + *badmaskp = 0; + for (i=0; inumnotaries; i++) + { + mask = ((1LL << i) & bestmask); + if ( mask != 0 ) + { + for (n=j=0; jnumnotaries; j++) + { + if ( ((1LL << j) & bestmask) != 0 && (mask & bp->notaries[j].recvmask) != 0 ) + n++; + } + //printf("%d ",n); + if ( n == bp->minsigs ) + num++; + else *badmaskp |= mask; + } + } + //printf("-> num.%d for bestmask.%llx\n",num,(long long)bestmask); + return(num); +} + void dpow_bestconsensus(struct dpow_info *dp,struct dpow_block *bp) { - int8_t bestks[64]; uint32_t sortbuf[64],wts[64],owts[64],counts[64]; int32_t i,j,median,numcrcs=0,numdiff,besti,bestmatches = 0,matches = 0; uint64_t masks[64],matchesmask,recvmask,topmask; uint32_t crcval=0; char srcaddr[64],destaddr[64]; + int8_t bestks[64]; uint32_t sortbuf[64],wts[64],owts[64],counts[64]; int32_t i,j,median,numcrcs=0,numdiff,besti,bestmatches = 0,matches = 0; uint64_t masks[64],badmask,matchesmask,recvmask,topmask; uint32_t crcval=0; char srcaddr[64],destaddr[64]; memset(wts,0,sizeof(wts)); memset(owts,0,sizeof(owts)); for (i=0; inumnotaries; i++) @@ -1519,8 +1545,11 @@ void dpow_bestconsensus(struct dpow_info *dp,struct dpow_block *bp) //printf("(%d %llx).%d ",bestks[i],(long long)masks[i],counts[i]); if ( counts[i] > matches && bitweight(masks[i]) == bp->minsigs ) { - matches = counts[i]; - besti = i; + if ( dpow_crossconnected(&badmask,bp,masks[i]) == bp->minsigs ) + { + matches = counts[i]; + besti = i; + } } } for (i=0; inumnotaries; i++) @@ -1537,6 +1566,8 @@ void dpow_bestconsensus(struct dpow_info *dp,struct dpow_block *bp) bp->bestmatches = bestmatches; bp->notaries[bp->myind].bestmask = bp->bestmask = masks[besti]; bp->notaries[bp->myind].bestk = bp->bestk = bestks[besti]; + if ( bp->myind == 0 ) + printf("matches.%d bestmatches.%d recv.%llx (%d %llx)\n",matches,bestmatches,(long long)bp->recvmask,bp->bestk,(long long)bp->bestmask); if ( 0 && bp->myind == 0 && strcmp("CHIPS",dp->symbol) == 0 ) { for (i=0; inumnotaries; i++) @@ -1924,8 +1955,8 @@ void dpow_notarize_update(struct supernet_info *myinfo,struct dpow_info *dp,stru dpow_send(myinfo,dp,bp,srchash,bp->hashmsg,0,bp->height,(void *)"ping",0); bp->lastnanosend = now; } - if ( 0 && strcmp("CHIPS",dp->symbol) == 0 && bp->myind == 0 ) - printf("%s recv.%llx best.(%d %llx) m.%d p.%d:%d b.%d state.%d minsigs.%d\n",dp->symbol,(long long)bp->recvmask,bp->bestk,(long long)bp->bestmask,matches,paxmatches,paxbestmatches,bestmatches,bp->state,bp->minsigs); + if ( 1 && strcmp("KMD",dp->symbol) == 0 && bp->myind == 0 ) + printf("%s recv.%llx best.(%d %llx) m.%d p.%d:%d b.%d state.%d minsigs.%d pend.%d\n",dp->symbol,(long long)bp->recvmask,bp->bestk,(long long)bp->bestmask,matches,paxmatches,paxbestmatches,bestmatches,bp->state,bp->minsigs,bp->pendingbestk); if ( bestmatches == bp->minsigs && paxbestmatches == bp->minsigs && bp->bestk >= 0 && bp->bestmask != 0 ) { if ( bp->pendingbestk < 0 )//bp->pendingbestk != bp->bestk || bp->pendingbestmask != bp->bestmask ) @@ -1967,7 +1998,7 @@ void dpow_notarize_update(struct supernet_info *myinfo,struct dpow_info *dp,stru printf("mypaxcrc.%x\n",bp->paxwdcrc); } char str[65]; - if ( (rand() % 1024) == 0 || (bp->myind == 0 && (rand() % 50) == 0 && (strcmp(dp->symbol,"CHIPS") == 0 || strcmp(dp->symbol,"GAME") == 0)) ) + if ( (rand() % 130) == 0 ) printf("%x ht.%d [%d] ips.%d %s NOTARIZE.%d matches.%d paxmatches.%d bestmatches.%d bestk.%d:%d %llx recv.%llx sigmasks.(%llx %llx) senderind.%d state.%x (%x %x %x) MoM.%s [%d]\n",bp->paxwdcrc,bp->height,bp->myind,dp->numipbits,dp->symbol,bp->minsigs,matches,paxmatches,bestmatches,bp->bestk,bp->pendingbestk,(long long)bp->bestmask,(long long)bp->recvmask,(long long)(bp->bestk>=0?bp->destsigsmasks[bp->bestk]:0),(long long)(bp->bestk>=0?bp->srcsigsmasks[bp->bestk]:0),senderind,bp->state,bp->hashmsg.uints[0],bp->desttxid.uints[0],bp->srctxid.uints[0],bits256_str(str,bp->MoM),bp->MoMdepth); } } @@ -2039,7 +2070,7 @@ void dpow_send(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_blo if ( strcmp(bp->destcoin->symbol,"KMD") == 0 ) src_or_dest = 0; else src_or_dest = 1; - extralen = dpow_paxpending(extras,sizeof(extras),&paxwdcrc,bp->MoM,bp->MoMdepth,src_or_dest,bp); + extralen = dpow_paxpending(myinfo,extras,sizeof(extras),&paxwdcrc,bp->MoM,bp->MoMdepth,bp->CCid,src_or_dest,bp); bp->paxwdcrc = bp->notaries[bp->myind].paxwdcrc = np->notarize.paxwdcrc = paxwdcrc; //dpow_bestconsensus(dp,bp); dpow_nanoutxoset(myinfo,dp,&np->notarize,bp,0); diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 2b46b86b3..edcd687d3 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -15,6 +15,13 @@ #define issue_curl(cmdstr) bitcoind_RPC(0,"curl",cmdstr,0,0,0,0) +uint64_t dpow_utxosize(char *symbol) +{ + if ( strcmp(symbol,"GAME") == 0 ) + return(100000); + else return(10000); +} + char *bitcoind_getinfo(char *symbol,char *serverport,char *userpass,char *getinfostr) { char buf[1],*retstr; cJSON *retjson; @@ -71,6 +78,17 @@ cJSON *dpow_getinfo(struct supernet_info *myinfo,struct iguana_info *coin) return(json); } +uint32_t dpow_CCid(struct supernet_info *myinfo,struct iguana_info *coin) +{ + uint32_t CCid = 0; cJSON *retjson; + if ( (retjson= dpow_getinfo(myinfo,coin)) != 0 ) + { + CCid = juint(retjson,"CCid"); + free_json(retjson); + } + return(CCid); +} + char *Notaries_elected[65][2]; //char *seeds[] = { "78.47.196.146", "5.9.102.210", "149.56.29.163", "191.235.80.138", "88.198.65.74", "94.102.63.226", "129.232.225.202", "104.255.64.3", "52.72.135.200", "149.56.28.84", "103.18.58.150", "221.121.144.140", "123.249.79.12", "103.18.58.146", "27.50.93.252", "176.9.0.233", "94.102.63.227", "167.114.227.223", "27.50.68.219", "192.99.233.217", "94.102.63.217", "45.64.168.216" }; int32_t Notaries_numseeds;// = (int32_t)(sizeof(seeds)/sizeof(*seeds)) @@ -92,8 +110,7 @@ int32_t komodo_initjson(char *fname) Notaries_port = port; if ( (num= juint(argjson,"BTCminsigs")) > Notaries_BTCminsigs ) Notaries_BTCminsigs = num; - if ( (num= juint(argjson,"minsigs")) > Notaries_minsigs ) - Notaries_minsigs = num; + Notaries_minsigs = juint(argjson,"minsigs"); if ( (array= jarray(&n,argjson,"seeds")) != 0 && n <= 64 ) { for (i=0; iFULLNODE < 0 && strcmp(coin->symbol,"KMD") == 0 && (src= iguana_coinfind(symbol)) != 0 ) { - sprintf(buf,"[\"%s\", \"%d\", \"%d\"]",symbol,kmdheight,src->MoMoMheight); + sprintf(buf,"[\"%s\", \"%d\", \"%d\"]",symbol,kmdheight,CCid); if ( (retstr= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"MoMoMdata",buf)) != 0 ) { retjson = cJSON_Parse(retstr); - printf("MoMoM.%s -> %s\n",buf,retstr); + printf("%s kmdheight.%d CCid.%u MoMoM.%s -> %s\n",symbol,kmdheight,CCid,buf,retstr); free(retstr); } usleep(10000); @@ -262,22 +279,29 @@ cJSON *dpow_MoMoMdata(struct iguana_info *coin,char *symbol,int32_t kmdheight) return(retjson); } -int32_t dpow_paxpending(uint8_t *hex,int32_t hexsize,uint32_t *paxwdcrcp,bits256 MoM,uint32_t MoMdepth,int32_t src_or_dest,struct dpow_block *bp) +int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsize,uint32_t *paxwdcrcp,bits256 MoM,uint32_t MoMdepth,uint16_t CCid,int32_t src_or_dest,struct dpow_block *bp) { - struct iguana_info *coin,*kmdcoin=0; char *retstr,*hexstr; cJSON *retjson; int32_t hexlen=0,n=0; uint32_t paxwdcrc; + struct iguana_info *coin,*kmdcoin=0; char *retstr,*hexstr; cJSON *retjson,*infojson; int32_t kmdheight=0,hexlen=0,n=0; uint32_t paxwdcrc; paxwdcrc = 0; - //if ( Notaries_port != DPOW_SOCKPORT ) + if ( strcmp(bp->srccoin->symbol,"GAME") != 0 || src_or_dest != 0 ) { n += iguana_rwbignum(1,&hex[n],sizeof(MoM),MoM.bytes); + MoMdepth = (MoMdepth & 0xffff) | ((uint32_t)CCid<<16); n += iguana_rwnum(1,&hex[n],sizeof(MoMdepth),(uint32_t *)&MoMdepth); - if ( strcmp(bp->srccoin->symbol,"PIZZA") == 0 && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) + if ( strncmp(bp->srccoin->symbol,"TXSCL",5) == 0 && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) { kmdcoin = bp->destcoin; - if ( (bp->height % 10) == 0 && kmdcoin->lastbestheight > 100 && (retjson= dpow_MoMoMdata(kmdcoin,bp->srccoin->symbol,(kmdcoin->lastbestheight/10)*10 - 5)) != 0 ) + if ( (infojson= dpow_getinfo(myinfo,kmdcoin)) != 0 ) + { + kmdheight = jint(infojson,"blocks"); + free_json(infojson); + } + if ( (retjson= dpow_MoMoMdata(kmdcoin,bp->srccoin->symbol,kmdheight,bp->CCid)) != 0 ) { if ( (hexstr= jstr(retjson,"data")) != 0 && (hexlen= (int32_t)strlen(hexstr)) > 0 && n+hexlen/2 <= hexsize ) { hexlen >>= 1; + printf("add MoMoMdata.(%s)\n",hexstr); decode_hex(&hex[n],hexlen,hexstr), n += hexlen; } free_json(retjson); @@ -373,6 +397,13 @@ cJSON *dpow_getblock(struct supernet_info *myinfo,struct iguana_info *coin,bits2 return(json); } +int32_t dpow_is015(char *symbol) +{ + if ( strcmp("CHIPS",symbol) == 0 || strcmp("GAME",symbol) == 0 ) //strcmp("BTC",symbol) == 0 || + return(1); + else return(0); +} + char *dpow_validateaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *address) { char buf[128],*retstr=0; cJSON *retjson; @@ -384,7 +415,7 @@ char *dpow_validateaddress(struct supernet_info *myinfo,struct iguana_info *coin //printf("%s -> (%s)\n",buf,retstr!=0?retstr:"null"); if ( (retjson= cJSON_Parse(retstr)) != 0 ) { - if ( strcmp(coin->symbol,"BTC") == 0 && jobj(retjson,"error") == 0 && jobj(retjson,"ismine") == 0 && strcmp(coin->validateaddress,"validateaddress") == 0 ) + if ( dpow_is015(coin->symbol) != 0 && jobj(retjson,"error") == 0 && jobj(retjson,"ismine") == 0 && strcmp(coin->validateaddress,"validateaddress") == 0 ) { printf("autochange %s validateaddress -> getaddressinfo\n",coin->symbol); strcpy(coin->validateaddress,"getaddressinfo"); @@ -574,7 +605,7 @@ char *dpow_signrawtransaction(struct supernet_info *myinfo,struct iguana_info *c retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,coin->signtxstr,paramstr); if ( strcmp(coin->signtxstr,"signrawtransaction") == 0 && (retjson= cJSON_Parse(retstr)) != 0 ) { - if ( jobj(retjson,"error") != 0 ) + if ( jobj(retjson,"error") != 0 && dpow_is015(coin->symbol) != 0 ) { strcpy(coin->signtxstr,"signrawtransactionwithwallet"); free(retstr); diff --git a/iguana/dpow/dpow_tx.c b/iguana/dpow/dpow_tx.c index 99dcf8863..a1b10d9df 100755 --- a/iguana/dpow/dpow_tx.c +++ b/iguana/dpow/dpow_tx.c @@ -101,7 +101,7 @@ uint64_t dpow_ratifybest(uint64_t refmask,struct dpow_block *bp,int8_t *lastkp) uint64_t dpow_notarybestk(uint64_t refmask,struct dpow_block *bp,int8_t *lastkp) { - int32_t m,j,k; int8_t bestk = -1; uint64_t bestmask,mask = 0;//bp->require0; + int32_t m,j,k,z,n; int8_t bestk = -1; uint64_t bestmask,mask = 0;//bp->require0; bestmask = 0; for (m=j=0; jnumnotaries; j++) { @@ -111,12 +111,18 @@ uint64_t dpow_notarybestk(uint64_t refmask,struct dpow_block *bp,int8_t *lastkp) // continue; if ( bits256_nonz(bp->notaries[k].src.prev_hash) != 0 && bits256_nonz(bp->notaries[k].dest.prev_hash) != 0 && bp->paxwdcrc == bp->notaries[k].paxwdcrc ) { - mask |= (1LL << k); - if ( ++m == bp->minsigs )//-bp->require0 ) + for (z=n=0; znumnotaries; z++) + if ( (bp->notaries[z].recvmask & (1LL << k)) != 0 ) + n++; + if ( n >= bp->numnotaries/2 ) { - bestk = k; - bestmask = mask;// | bp->require0; - //printf("m.%d == minsigs.%d (%d %llx)\n",m,bp->minsigs,k,(long long)bestmask); + mask |= (1LL << k); + if ( ++m == bp->minsigs )//-bp->require0 ) + { + bestk = k; + bestmask = mask;// | bp->require0; + //printf("m.%d == minsigs.%d (%d %llx)\n",m,bp->minsigs,k,(long long)bestmask); + } } } } @@ -193,12 +199,15 @@ struct dpow_block *dpow_heightfind(struct supernet_info *myinfo,struct dpow_info return(bp); } -int32_t dpow_voutstandard(struct dpow_block *bp,uint8_t *serialized,int32_t m,int32_t src_or_dest,uint8_t pubkeys[][33],int32_t numratified) +int32_t dpow_voutstandard(struct supernet_info *myinfo,struct dpow_block *bp,uint8_t *serialized,int32_t m,int32_t src_or_dest,uint8_t pubkeys[][33],int32_t numratified) { - uint32_t paxwdcrc=0,locktime=0,numvouts; uint64_t satoshis,satoshisB; int32_t i,n=0,opretlen,len=0; uint8_t opret[16384],data[16384],extras[16384]; + uint32_t paxwdcrc=0,locktime=0,numvouts; struct iguana_info *coin; uint64_t satoshis,satoshisB; int32_t i,n=0,opretlen,len=0; uint8_t opret[16384],data[16384],extras[16384]; numvouts = 2; if ( pubkeys == 0 || numratified <= 0 ) { + if ( src_or_dest != 0 ) + coin = bp->destcoin; + else coin = bp->srccoin; satoshis = DPOW_UTXOSIZE * m * .76; if ( (satoshisB= DPOW_UTXOSIZE * m - 10000) < satoshis ) satoshis = satoshisB; @@ -229,7 +238,7 @@ int32_t dpow_voutstandard(struct dpow_block *bp,uint8_t *serialized,int32_t m,in } if ( bp->MoMdepth > 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) // || strcmp(bp->srccoin->symbol,"KMD") == 0) ) { - n = dpow_paxpending(extras,sizeof(extras),&paxwdcrc,bp->MoM,bp->MoMdepth,src_or_dest,bp); + n = dpow_paxpending(myinfo,extras,sizeof(extras),&paxwdcrc,bp->MoM,bp->MoMdepth,bp->CCid,src_or_dest,bp); } satoshis = 0; len += iguana_rwnum(1,&serialized[len],sizeof(satoshis),&satoshis); @@ -255,7 +264,7 @@ int32_t dpow_voutstandard(struct dpow_block *bp,uint8_t *serialized,int32_t m,in return(len); } -bits256 dpow_notarytx(char *signedtx,int32_t *numsigsp,int32_t isPoS,struct dpow_block *bp,int8_t bestk,uint64_t bestmask,int32_t usesigs,int32_t src_or_dest,uint8_t pubkeys[][33],int32_t numratified) +bits256 dpow_notarytx(struct supernet_info *myinfo,char *signedtx,int32_t *numsigsp,int32_t isPoS,struct dpow_block *bp,int8_t bestk,uint64_t bestmask,int32_t usesigs,int32_t src_or_dest,uint8_t pubkeys[][33],int32_t numratified) { uint32_t k,m,numsigs,version,vout,crcval,sequenceid = 0xffffffff; bits256 zero; int32_t n,siglen,len; uint8_t serialized[32768],*sig; bits256 txid; struct dpow_entry *ep; struct dpow_coinentry *cp; signedtx[0] = 0; @@ -320,7 +329,7 @@ bits256 dpow_notarytx(char *signedtx,int32_t *numsigsp,int32_t isPoS,struct dpow memcpy(&serialized[len],sig,siglen); len += siglen; numsigs++; - } else printf("Missing sig from k.%d\n",k); + } else printf("%s -> %s src_or_dest.%d Missing sig from k.%d\n",bp->srccoin->symbol,bp->destcoin->symbol,src_or_dest,k); } else serialized[len++] = 0; len += iguana_rwnum(1,&serialized[len],sizeof(sequenceid),&sequenceid); //printf("height.%d mod.%d VINI.%d <- i.%d j.%d\n",height,height % numnotaries,m,i,j); @@ -329,7 +338,7 @@ bits256 dpow_notarytx(char *signedtx,int32_t *numsigsp,int32_t isPoS,struct dpow break; } } - if ( (n= dpow_voutstandard(bp,&serialized[len],m,src_or_dest,pubkeys,numratified)) < 0 ) + if ( (n= dpow_voutstandard(myinfo,bp,&serialized[len],m,src_or_dest,pubkeys,numratified)) < 0 ) { printf("error dpow_voutstandard m.%d src_or_dest.%d\n",m,src_or_dest); return(zero); @@ -507,7 +516,7 @@ int32_t dpow_signedtxgen(struct supernet_info *myinfo,struct dpow_info *dp,struc srchash.bytes[j] = dp->minerkey33[j+1]; if ( (vins= dpow_vins(coin,bp,bestk,bestmask,1,src_or_dest,useratified)) != 0 ) { - txid = dpow_notarytx(rawtx,&numsigs,coin->chain->isPoS,bp,bestk,bestmask,0,src_or_dest,bp->numratified!=0?bp->ratified_pubkeys:0,useratified*bp->numratified); + txid = dpow_notarytx(myinfo,rawtx,&numsigs,coin->chain->isPoS,bp,bestk,bestmask,0,src_or_dest,bp->numratified!=0?bp->ratified_pubkeys:0,useratified*bp->numratified); //char str[65]; printf("%s signedtxgen %s src_or_dest.%d (%d %llx) useratified.%d raw.(%s)\n",dp->symbol,bits256_str(str,txid),src_or_dest,bestk,(long long)bestmask,useratified,rawtx); if ( bits256_nonz(txid) != 0 && rawtx[0] != 0 ) // send tx to share utxo set { @@ -570,9 +579,9 @@ void dpow_sigscheck(struct supernet_info *myinfo,struct dpow_info *dp,struct dpo channel = (src_or_dest != 0) ? DPOW_SIGBTCCHANNEL : DPOW_SIGCHANNEL; if ( bestk >= 0 && bp->state != 0xffffffff && coin != 0 ) { - dpow_notarytx(bp->signedtx,&numsigs,coin->chain->isPoS,bp,bestk,bestmask,0,src_or_dest,pubkeys,numratified); // setcrcval - signedtxid = dpow_notarytx(bp->signedtx,&numsigs,coin->chain->isPoS,bp,bestk,bestmask,1,src_or_dest,pubkeys,numratified); - if ( strcmp("CHIPS",coin->symbol) == 0 ) + dpow_notarytx(myinfo,bp->signedtx,&numsigs,coin->chain->isPoS,bp,bestk,bestmask,0,src_or_dest,pubkeys,numratified); // setcrcval + signedtxid = dpow_notarytx(myinfo,bp->signedtx,&numsigs,coin->chain->isPoS,bp,bestk,bestmask,1,src_or_dest,pubkeys,numratified); + if ( strcmp("GAME",coin->symbol) == 0 ) printf("src_or_dest.%d bestk.%d %llx %s numsigs.%d signedtx.(%s)\n",src_or_dest,bestk,(long long)bestmask,bits256_str(str,signedtxid),numsigs,bp->signedtx); bp->state = 1; if ( bits256_nonz(signedtxid) != 0 && numsigs == bp->minsigs ) diff --git a/iguana/exchanges/LP_bitcoin.c b/iguana/exchanges/LP_bitcoin.c index 2201d67d7..c083d6afe 100644 --- a/iguana/exchanges/LP_bitcoin.c +++ b/iguana/exchanges/LP_bitcoin.c @@ -2011,16 +2011,25 @@ int32_t bitcoin_p2shscript(uint8_t *script,int32_t n,const uint8_t *p2shscript,c return(n); } -char *bitcoind_passthru(char *coinstr,char *serverport,char *userpass,char *method,char *params) +char *bitcoind_passthrut(char *coinstr,char *serverport,char *userpass,char *method,char *params,int32_t timeout) { - if ( userpass[0] == 0 ) - return(clonestr("{\"error\":\"no rpcusername rpcpassword in coin.conf\"}")); - return(bitcoind_RPC(0,coinstr,serverport,userpass,method,params,4)); + /*struct iguana_info *coin; char *retstr; + if ( (coin= LP_coinfind(coinstr)) != 0 ) + { + portable_mutex_lock(&coin->curl_mutex); + retstr = bitcoind_RPCnew(coin->curl_handle,0,coinstr,serverport,userpass,method,params,timeout); + portable_mutex_unlock(&coin->curl_mutex); + return(retstr); + }*/ + return(bitcoind_RPC(0,coinstr,serverport,userpass,method,params,timeout)); } -char *bitcoind_passthrut(char *coinstr,char *serverport,char *userpass,char *method,char *params,int32_t timeout) +char *bitcoind_passthru(char *coinstr,char *serverport,char *userpass,char *method,char *params) { - return(bitcoind_RPC(0,coinstr,serverport,userpass,method,params,timeout)); + if ( userpass[0] == 0 ) + return(clonestr("{\"error\":\"no rpcusername rpcpassword in coin.conf\"}")); + return(bitcoind_passthrut(coinstr,serverport,userpass,method,params,4)); + //return(bitcoind_RPC(0,coinstr,serverport,userpass,method,params,4)); } bits256 bits256_calcaddrhash(char *symbol,uint8_t *serialized,int32_t len) @@ -2093,7 +2102,7 @@ int32_t bitcoin_addr2rmd160(char *symbol,uint8_t taddr,uint8_t *addrtypep,uint8_ } else if ( (strcmp(symbol,"GRS") == 0 || strcmp(symbol,"SMART") == 0) && (buf[20+offset]&0xff) == hash.bytes[0] && (buf[21+offset]&0xff) == hash.bytes[1] && (buf[22+offset]&0xff) == hash.bytes[2] && (buf[23+offset]&0xff) == hash.bytes[3] ) return(20); - else + else if ( strcmp(symbol,"BTC") != 0 || *addrtypep == 0 || *addrtypep == 5 ) { int32_t i; //if ( len > 20 ) diff --git a/iguana/exchanges/LP_coins.c b/iguana/exchanges/LP_coins.c index 3722ad819..5176b8f47 100644 --- a/iguana/exchanges/LP_coins.c +++ b/iguana/exchanges/LP_coins.c @@ -373,6 +373,7 @@ struct iguana_info *LP_coinadd(struct iguana_info *cdata) return(coin); } +void *curl_easy_init(); uint16_t LP_coininit(struct iguana_info *coin,char *symbol,char *name,char *assetname,int32_t isPoS,uint16_t port,uint8_t pubtype,uint8_t p2shtype,uint8_t wiftype,uint64_t txfee,double estimatedrate,int32_t longestchain,uint8_t wiftaddr,uint8_t taddr,uint16_t busport,char *confpath) { static void *ctx; @@ -429,6 +430,13 @@ uint16_t LP_coininit(struct iguana_info *coin,char *symbol,char *name,char *asse coin->zcash = LP_IS_BITCOINGOLD; printf("set coin.%s <- LP_IS_BITCOINGOLD %d\n",symbol,coin->zcash); } + else if ( strcmp(symbol,"CMM") == 0 ) + { + coin->zcash = LP_IS_BITCOINCASH; + //printf("set coin.%s <- LP_IS_BITCOINCASH %d\n",symbol,coin->zcash); + } + coin->curl_handle = curl_easy_init(); + portable_mutex_init(&coin->curl_mutex); return(port); } diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index a8f169b6b..302db7006 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -144,6 +144,7 @@ fundvalue(address="", holdings=[], divisor=0)\n\ orderbook(base, rel, duration=3600)\n\ getprices()\n\ inuse()\n\ +movecoinbases(coin)\n\ getmyprice(base, rel)\n\ getprice(base, rel)\n\ //sendmessage(base=coin, rel="", pubkey=zero, )\n\ @@ -172,6 +173,7 @@ unlockedspend(coin, txid)\n\ opreturndecrypt(coin, txid, passphrase)\n\ getendpoint(port=5555)\n\ getfee(coin)\n\ +mpnet(onoff)\n\ sleep(seconds=60)\n\ listtransactions(coin, address, count=10, skip=0)\n\ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\ @@ -237,6 +239,12 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\ } return(clonestr("{\"error\":\"cant find KMD\"}")); } + else if ( strcmp(method,"mpnet") == 0 ) + { + G.mpnet = jint(argjson,"onoff"); + printf("MPNET onoff.%d\n",G.mpnet); + return(clonestr("{\"status\":\"success\"}")); + } else if ( strcmp(method,"getendpoint") == 0 ) { int32_t err,mode; uint16_t wsport = 5555; char endpoint[64],bindpoint[64]; @@ -276,6 +284,10 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\ } return(jprint(retjson,1)); } + else if ( strcmp(method,"verus") == 0 ) + { + return(verusblocks()); + } else if ( strcmp(method,"instantdex_claim") == 0 ) { if ( (ptr= LP_coinsearch("KMD")) != 0 ) @@ -476,24 +488,50 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\ { return(jprint(LP_tradesarray(base,rel,juint(argjson,"starttime"),juint(argjson,"endtime"),jint(argjson,"timescale")),1)); } + else if ( strcmp(method,"getprice") == 0 || strcmp(method,"getmyprice") == 0 ) + { + double price,bid,ask; + if ( strcmp(method,"getprice") == 0 ) + { + ask = LP_price(1,base,rel); + if ( (bid= LP_price(1,rel,base)) > SMALLVAL ) + bid = 1./bid; + } + else + { + ask = LP_getmyprice(1,base,rel); + if ( (bid= LP_getmyprice(1,rel,base)) > SMALLVAL ) + bid = 1./bid; + } + price = _pairaved(bid,ask); + retjson = cJSON_CreateObject(); + jaddstr(retjson,"result","success"); + jaddstr(retjson,"base",base); + jaddstr(retjson,"rel",rel); + jaddnum(retjson,"timestamp",time(NULL)); + jaddnum(retjson,"bid",bid); + jaddnum(retjson,"ask",ask); + jaddnum(retjson,"price",price); + return(jprint(retjson,1)); + } + else if ( strcmp(method,"orderbook") == 0 ) + return(LP_orderbook(base,rel,jint(argjson,"duration"))); if ( IAMLP == 0 && LP_isdisabled(base,rel) != 0 ) return(clonestr("{\"error\":\"at least one of coins disabled\"}")); price = jdouble(argjson,"price"); if ( strcmp(method,"setprice") == 0 ) { - if ( LP_mypriceset(&changed,base,rel,price) < 0 ) + if ( LP_mypriceset(1,&changed,base,rel,price) < 0 ) return(clonestr("{\"error\":\"couldnt set price\"}")); - //else if ( LP_mypriceset(&changed,rel,base,1./price) < 0 ) + //else if ( LP_mypriceset(1,&changed,rel,base,1./price) < 0 ) // return(clonestr("{\"error\":\"couldnt set price\"}")); else if ( price == 0. || jobj(argjson,"broadcast") == 0 || jint(argjson,"broadcast") != 0 ) return(LP_pricepings(ctx,myipaddr,LP_mypubsock,base,rel,price * LP_profitratio)); else return(clonestr("{\"result\":\"success\"}")); } - else if ( strcmp(method,"orderbook") == 0 ) - return(LP_orderbook(base,rel,jint(argjson,"duration"))); else if ( strcmp(method,"myprice") == 0 ) { - if ( LP_myprice(&bid,&ask,base,rel) > SMALLVAL ) + if ( LP_myprice(1,&bid,&ask,base,rel) > SMALLVAL ) { retjson = cJSON_CreateObject(); jaddstr(retjson,"base",base); @@ -514,7 +552,7 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\ } else vol = jdouble(argjson,"relvolume"); if ( price > SMALLVAL ) { - return(LP_autobuy(ctx,fomo,myipaddr,pubsock,base,rel,price,vol,jint(argjson,"timeout"),jint(argjson,"duration"),jstr(argjson,"gui"),juint(argjson,"nonce"),jbits256(argjson,"destpubkey"),0,jstr(argjson,"uuid"))); + return(LP_autobuy(ctx,fomo,myipaddr,pubsock,base,rel,price,vol,jint(argjson,"timeout"),jint(argjson,"duration"),jstr(argjson,"gui"),juint(argjson,"nonce"),jbits256(argjson,"destpubkey"),0,jstr(argjson,"uuid"),jint(argjson,"fill"),jint(argjson,"gtc"))); } else return(clonestr("{\"error\":\"no price set\"}")); } else if ( strcmp(method,"sell") == 0 ) @@ -528,7 +566,7 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\ } else vol = jdouble(argjson,"basevolume"); if ( price > SMALLVAL ) { - return(LP_autobuy(ctx,fomo,myipaddr,pubsock,rel,base,1./price,vol,jint(argjson,"timeout"),jint(argjson,"duration"),jstr(argjson,"gui"),juint(argjson,"nonce"),jbits256(argjson,"destpubkey"),0,jstr(argjson,"uuid"))); + return(LP_autobuy(ctx,fomo,myipaddr,pubsock,rel,base,1./price,vol,jint(argjson,"timeout"),jint(argjson,"duration"),jstr(argjson,"gui"),juint(argjson,"nonce"),jbits256(argjson,"destpubkey"),0,jstr(argjson,"uuid"),jint(argjson,"fill"),jint(argjson,"gtc"))); } else return(clonestr("{\"error\":\"no price set\"}")); } } @@ -630,7 +668,7 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\ } else if ( strcmp(method,"sendrawtransaction") == 0 ) { - return(LP_sendrawtransaction(coin,jstr(argjson,"signedtx"))); + return(LP_sendrawtransaction(coin,jstr(argjson,"signedtx"),jint(argjson,"needjson"))); } else if ( strcmp(method,"convaddress") == 0 ) { @@ -664,6 +702,10 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\ return(LP_txblast(ptr,argjson)); else return(clonestr("{\"error\":\"cant find coind\"}")); } + else if ( strcmp(method,"movecoinbases") == 0 ) + { + return(LP_movecoinbases(coin)); + } else if ( strcmp(method,"withdraw") == 0 ) { if ( (ptr= LP_coinsearch(coin)) != 0 ) @@ -766,7 +808,7 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\ return(jprint(retjson,1)); } else if ( strcmp(method,"myprices") == 0 ) - return(LP_myprices()); + return(LP_myprices(1)); else if ( strcmp(method,"trust") == 0 ) return(LP_pubkey_trustset(jbits256(argjson,"pubkey"),jint(argjson,"trust"))); else if ( strcmp(method,"trusted") == 0 ) @@ -827,14 +869,14 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\ double price,bid,ask; if ( strcmp(method,"getprice") == 0 ) { - ask = LP_price(base,rel); - if ( (bid= LP_price(rel,base)) > SMALLVAL ) + ask = LP_price(1,base,rel); + if ( (bid= LP_price(1,rel,base)) > SMALLVAL ) bid = 1./bid; } else { - ask = LP_getmyprice(base,rel); - if ( (bid= LP_getmyprice(rel,base)) > SMALLVAL ) + ask = LP_getmyprice(1,base,rel); + if ( (bid= LP_getmyprice(1,rel,base)) > SMALLVAL ) bid = 1./bid; } price = _pairaved(bid,ask); diff --git a/iguana/exchanges/LP_include.h b/iguana/exchanges/LP_include.h index 4080ba31c..f95b98c61 100644 --- a/iguana/exchanges/LP_include.h +++ b/iguana/exchanges/LP_include.h @@ -59,7 +59,7 @@ void emscripten_usleep(int32_t x); // returns immediate, no sense for sleeping //#define LP_DISABLE_DISTCOMBINE #define LP_MAXVINS 64 -#define LP_HTTP_TIMEOUT 3 // 1 is too small due to edge cases of time(NULL) +#define LP_HTTP_TIMEOUT 10 // 1 is too small due to edge cases of time(NULL) #define LP_AUTOTRADE_TIMEOUT 30 #define LP_RESERVETIME (LP_AUTOTRADE_TIMEOUT * 3) #define ELECTRUM_TIMEOUT 13 @@ -220,7 +220,7 @@ struct basilisk_request bits256 desthash; char src[68],dest[68]; uint64_t destamount; - int32_t optionhours,DEXselector; + uint32_t optionhours,DEXselector; }; struct basilisk_rawtx @@ -303,7 +303,7 @@ struct iguana_info { UT_hash_handle hh; portable_mutex_t txmutex,addrmutex,addressutxo_mutex; struct LP_transaction *transactions; struct LP_address *addresses; - uint64_t txfee; + uint64_t txfee,do_autofill_merge; int32_t numutxos,notarized,longestchain,firstrefht,firstscanht,lastscanht,height; uint16_t busport,did_addrutxo_reset; uint32_t txversion,dPoWtime,lastautosplit,lastresetutxo,loadedcache,electrumlist,lastunspent,importedprivkey,lastpushtime,lastutxosync,addr_listunspent_requested,lastutxos,updaterate,counter,inactive,lastmempool,lastgetinfo,ratetime,heighttime,lastmonitor,obooktime; uint8_t pubtype,p2shtype,isPoS,wiftype,wiftaddr,taddr,noimportprivkey_flag,userconfirms,isassetchain,maxconfirms; @@ -311,9 +311,10 @@ struct iguana_info // portfolio double price_kmd,force,perc,goal,goalperc,relvolume,rate; void *electrum; void *ctx; - uint64_t maxamount,kmd_equiv,balanceA,balanceB,valuesumA,valuesumB; + uint64_t maxamount,kmd_equiv,balanceA,balanceB,valuesumA,valuesumB,fillsatoshis; uint8_t pubkey33[33],zcash; - int32_t privkeydepth; + int32_t privkeydepth,bobfillheight; + void *curl_handle; portable_mutex_t curl_mutex; bits256 cachedtxid,notarizationtxid; uint8_t *cachedtxiddata; int32_t cachedtxidlen; bits256 cachedmerkle,notarizedhash; int32_t cachedmerkleheight; }; @@ -377,9 +378,10 @@ struct LP_quoteinfo { struct basilisk_request R; bits256 srchash,desthash,txid,txid2,desttxid,feetxid,privkey; + double maxprice; int64_t othercredits; uint64_t satoshis,txfee,destsatoshis,desttxfee,aliceid; - uint32_t timestamp,quotetime,tradeid; + uint32_t timestamp,quotetime,tradeid,gtc,fill,mpnet; int32_t vout,vout2,destvout,feevout,pair; char srccoin[65],coinaddr[64],destcoin[65],destaddr[64],gui[64],etomicsrc[65],etomicdest[65],uuidstr[65]; }; @@ -427,7 +429,7 @@ struct LP_swapstats struct LP_pubswap { struct LP_pubswap *next,*prev; struct LP_swapstats *swap; }; -#define LP_MAXPRICEINFOS 256 +#define LP_MAXPRICEINFOS 255 struct LP_pubkey_info { UT_hash_handle hh; @@ -531,6 +533,7 @@ void HashKeccak(uint8_t *hash,void *data,size_t len); void test_validate(struct iguana_info *coin,char *signedtx); void LP_instantdex_depositadd(char *coinaddr,bits256 txid); int64_t LP_instantdex_creditcalc(struct iguana_info *coin,int32_t dispflag,bits256 txid,char *refaddr,char *origcoinaddr); +char *LP_autofillbob(struct iguana_info *coin,uint64_t satoshis); void LP_ports(uint16_t *pullportp,uint16_t *pubportp,uint16_t *busportp,uint16_t netid); int32_t LP_destaddr(char *destaddr,cJSON *item); int32_t LP_waitmempool(char *symbol,char *coinaddr,bits256 txid,int32_t vout,int32_t duration); @@ -580,6 +583,7 @@ int32_t LP_trades_canceluuid(char *uuidstr); int _decreasing_uint64(const void *a,const void *b); int32_t LP_alice_eligible(uint32_t quotetime); int32_t LP_is_slowcoin(char *symbol); +void LP_alicequery_clear(); void LP_listunspent_query(char *symbol,char *coinaddr); int32_t bitcoin_priv2wif(char *symbol,uint8_t wiftaddr,char *wifstr,bits256 privkey,uint8_t addrtype); diff --git a/iguana/exchanges/LP_mpnet.c b/iguana/exchanges/LP_mpnet.c new file mode 100644 index 000000000..ca1e7ea1c --- /dev/null +++ b/iguana/exchanges/LP_mpnet.c @@ -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= 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; isymbol,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; iinactive == 0 && time(NULL) > lasttime+5 ) + { + LP_mpnet_get(ctx,myipaddr,pubsock,coin); + lasttime = (uint32_t)time(NULL); + } +} diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 7270ca787..a4fa473b4 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -90,7 +90,7 @@ void LP_millistats_update(struct LP_millistats *mp) #include "LP_etomic.h" #endif -portable_mutex_t LP_peermutex,LP_UTXOmutex,LP_utxomutex,LP_commandmutex,LP_cachemutex,LP_swaplistmutex,LP_forwardmutex,LP_pubkeymutex,LP_networkmutex,LP_psockmutex,LP_coinmutex,LP_messagemutex,LP_portfoliomutex,LP_electrummutex,LP_butxomutex,LP_reservedmutex,LP_nanorecvsmutex,LP_tradebotsmutex,LP_gcmutex,LP_inusemutex,LP_cJSONmutex,LP_logmutex,LP_statslogmutex,LP_tradesmutex,LP_commandQmutex,LP_blockinit_mutex,LP_pendswap_mutex,LP_listmutex; +portable_mutex_t LP_peermutex,LP_UTXOmutex,LP_utxomutex,LP_commandmutex,LP_cachemutex,LP_swaplistmutex,LP_forwardmutex,LP_pubkeymutex,LP_networkmutex,LP_psockmutex,LP_coinmutex,LP_messagemutex,LP_portfoliomutex,LP_electrummutex,LP_butxomutex,LP_reservedmutex,LP_nanorecvsmutex,LP_tradebotsmutex,LP_gcmutex,LP_inusemutex,LP_cJSONmutex,LP_logmutex,LP_statslogmutex,LP_tradesmutex,LP_commandQmutex,LP_blockinit_mutex,LP_pendswap_mutex,LP_listmutex,LP_gtcmutex; int32_t LP_canbind; char *Broadcaststr,*Reserved_msgs[2][1000]; int32_t num_Reserved_msgs[2],max_Reserved_msgs[2]; @@ -120,7 +120,7 @@ struct LP_globals uint64_t LP_skipstatus[10000]; uint16_t netid; uint8_t LP_myrmd160[20],LP_pubsecp[33]; - uint32_t LP_sessionid,counter; + uint32_t LP_sessionid,counter,mpnet; int32_t LP_IAMLP,LP_pendingswaps,USERPASS_COUNTER,LP_numprivkeys,initializing,waiting,LP_numskips; char seednode[64],USERPASS[65],USERPASS_WIFSTR[64],LP_myrmd160str[41],gui[65],LP_NXTaddr[64]; struct LP_privkey LP_privkeys[100]; @@ -176,6 +176,7 @@ char *blocktrail_listtransactions(char *symbol,char *coinaddr,int32_t num,int32_ #include "LP_bitcoin.c" #include "LP_coins.c" #include "LP_rpc.c" +#include "LP_mpnet.c" #include "LP_NXT.c" #include "LP_cache.c" #include "LP_RTmetrics.c" @@ -202,7 +203,7 @@ char *LP_command_process(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson char *retstr=0; cJSON *retjson; bits256 zero; if ( jobj(argjson,"result") != 0 || jobj(argjson,"error") != 0 ) return(0); - if ( stats_JSONonly != 0 || LP_tradecommand(ctx,myipaddr,pubsock,argjson,data,datalen) <= 0 ) + if ( stats_JSONonly != 0 || LP_tradecommand(0,ctx,myipaddr,pubsock,argjson,data,datalen) <= 0 ) { if ( (retstr= stats_JSON(ctx,0,myipaddr,pubsock,argjson,"127.0.0.1",stats_JSONonly)) != 0 ) { @@ -423,7 +424,7 @@ int32_t LP_sock_check(char *typestr,void *ctx,char *myipaddr,int32_t pubsock,int /*if ( (argjson= cJSON_Parse(str)) != 0 ) { //portable_mutex_lock(&LP_commandmutex); - if ( LP_tradecommand(ctx,myipaddr,pubsock,argjson,0,0) <= 0 ) + if ( LP_tradecommand(0,ctx,myipaddr,pubsock,argjson,0,0) <= 0 ) { if ( (retstr= stats_JSON(ctx,0,myipaddr,pubsock,argjson,remoteaddr,0)) != 0 ) free(retstr); @@ -480,6 +481,8 @@ int32_t LP_nanomsg_recvs(void *ctx) nonz += LP_sock_check("PULL",ctx,origipaddr,-1,LP_mypullsock,"127.0.0.1",1); } portable_mutex_unlock(&LP_nanorecvsmutex); + //if ( G.mpnet != 0 ) + LP_mpnet_check(ctx,origipaddr,LP_mypubsock); return(nonz); } @@ -513,21 +516,21 @@ void command_rpcloop(void *ctx) void LP_coinsloop(void *_coins) { static int32_t didfilescreate; - struct LP_address *ap=0; struct LP_transaction *tx; cJSON *retjson; struct LP_address_utxo *up,*tmp; struct iguana_info *coin,*ctmp; char str[65]; struct electrum_info *ep,*backupep=0; bits256 zero; int32_t notarized,oldht,j,nonz; char *coins = _coins; + struct LP_address *ap=0; struct LP_transaction *tx; cJSON *retjson; struct LP_address_utxo *up,*tmp; struct iguana_info *coin,*ctmp; char str[65],*retstr,*hexstr,*txidstr; struct electrum_info *ep,*backupep=0; bits256 zero; int32_t notarized,oldht,j,nonz; char *coins = _coins; if ( strcmp("BTC",coins) == 0 ) { strcpy(LP_coinsloopBTC_stats.name,"BTC coin loop"); - LP_coinsloopBTC_stats.threshold = 20000.; + LP_coinsloopBTC_stats.threshold = 200000.; } else if ( strcmp("KMD",coins) == 0 ) { strcpy(LP_coinsloopKMD_stats.name,"KMD coin loop"); - LP_coinsloopKMD_stats.threshold = 10000.; + LP_coinsloopKMD_stats.threshold = 100000.; } else { strcpy(LP_coinsloop_stats.name,"other coins loop"); - LP_coinsloop_stats.threshold = 5000.; + LP_coinsloop_stats.threshold = 50000.; } while ( LP_STOP_RECEIVED == 0 ) { @@ -576,6 +579,29 @@ void LP_coinsloop(void *_coins) LP_address_utxo_reset(&num,coin); coin->did_addrutxo_reset = 1; } + //free_json(LP_address_balance(coin,coin->smartaddr,1)); expensive invoking gettxout + if ( coin->do_autofill_merge != 0 ) + { + if ( (retstr= LP_autofillbob(coin,coin->do_autofill_merge*1.02)) != 0 ) + { + if ( (retjson= cJSON_Parse(retstr)) != 0 ) + { + if ( (hexstr= jstr(retjson,"hex")) != 0 ) + { + if ( (txidstr= LP_sendrawtransaction(coin->symbol,hexstr,0)) != 0 ) + { + printf("autofill created %s\n",txidstr); + free(txidstr); + coin->fillsatoshis = coin->do_autofill_merge; + coin->do_autofill_merge = 0; + coin->bobfillheight = LP_getheight(¬arized,coin); + } + } + free_json(retjson); + } + free(retstr); + } + } if ( coin->longestchain == 1 ) // special init value coin->longestchain = LP_getheight(¬arized,coin); if ( (ep= coin->electrum) != 0 ) @@ -656,6 +682,7 @@ void LP_coinsloop(void *_coins) continue; } //if ( strcmp(coin->symbol,"BTC") != 0 && strcmp(coin->symbol,"KMD") != 0 ) // SPV as backup + if ( coin->lastscanht < coin->longestchain ) { nonz++; if ( strcmp("BTC",coins) == 0 )//&& coin->lastscanht < coin->longestchain-3 ) @@ -664,7 +691,7 @@ void LP_coinsloop(void *_coins) { if ( LP_blockinit(coin,coin->lastscanht) < 0 ) { - printf("blockinit.%s %d error\n",coin->symbol,coin->lastscanht); + printf("please ignore this blockinit.%s %d error\n",coin->symbol,coin->lastscanht); sleep(10); break; } @@ -805,6 +832,92 @@ void bech32_tests() printf("end of bech32 tests\n"); } +char *Notaries_elected1[][4] = +{ + {"0dev1_jl777", "03b7621b44118017a16043f19b30cc8a4cfe068ac4e42417bae16ba460c80f3828", "RNJmgYaFF5DbnrNUX6pMYz9rcnDKC2tuAc", "GWsW2A1ud72KoKJZysVLtEAYmgYZZzbMxG" }, + {"0dev2_kolo", "030f34af4b908fb8eb2099accb56b8d157d49f6cfb691baa80fdd34f385efed961" }, + {"0dev3_kolo", "025af9d2b2a05338478159e9ac84543968fd18c45fd9307866b56f33898653b014" }, + {"0dev4_decker", "028eea44a09674dda00d88ffd199a09c9b75ba9782382cc8f1e97c0fd565fe5707" }, + {"a-team_SH", "03b59ad322b17cb94080dc8e6dc10a0a865de6d47c16fb5b1a0b5f77f9507f3cce" }, + {"artik_AR", "029acf1dcd9f5ff9c455f8bb717d4ae0c703e089d16cf8424619c491dff5994c90" }, + {"artik_EU", "03f54b2c24f82632e3cdebe4568ba0acf487a80f8a89779173cdb78f74514847ce" }, + {"artik_NA", "0224e31f93eff0cc30eaf0b2389fbc591085c0e122c4d11862c1729d090106c842" }, + {"artik_SH", "02bdd8840a34486f38305f311c0e2ae73e84046f6e9c3dd3571e32e58339d20937" }, + {"badass_EU", "0209d48554768dd8dada988b98aca23405057ac4b5b46838a9378b95c3e79b9b9e" }, + {"badass_NA", "02afa1a9f948e1634a29dc718d218e9d150c531cfa852843a1643a02184a63c1a7" }, // 10 + {"batman_AR", "033ecb640ec5852f42be24c3bf33ca123fb32ced134bed6aa2ba249cf31b0f2563" }, + {"batman_SH", "02ca5898931181d0b8aafc75ef56fce9c43656c0b6c9f64306e7c8542f6207018c" }, + {"ca333_EU", "03fc87b8c804f12a6bd18efd43b0ba2828e4e38834f6b44c0bfee19f966a12ba99" }, + {"chainmakers_EU", "02f3b08938a7f8d2609d567aebc4989eeded6e2e880c058fdf092c5da82c3bc5ee" }, + {"chainmakers_NA", "0276c6d1c65abc64c8559710b8aff4b9e33787072d3dda4ec9a47b30da0725f57a" }, + {"chainstrike_SH", "0370bcf10575d8fb0291afad7bf3a76929734f888228bc49e35c5c49b336002153" }, + {"cipi_AR", "02c4f89a5b382750836cb787880d30e23502265054e1c327a5bfce67116d757ce8" }, + {"cipi_NA", "02858904a2a1a0b44df4c937b65ee1f5b66186ab87a751858cf270dee1d5031f18" }, + {"crackers_EU", "03bc819982d3c6feb801ec3b720425b017d9b6ee9a40746b84422cbbf929dc73c3" }, + {"crackers_NA", "03205049103113d48c7c7af811b4c8f194dafc43a50d5313e61a22900fc1805b45" }, // 20 + {"dwy_EU", "0259c646288580221fdf0e92dbeecaee214504fdc8bbdf4a3019d6ec18b7540424" }, + {"emmanux_SH", "033f316114d950497fc1d9348f03770cd420f14f662ab2db6172df44c389a2667a" }, + {"etszombi_EU", "0281b1ad28d238a2b217e0af123ce020b79e91b9b10ad65a7917216eda6fe64bf7" }, + {"fullmoon_AR", "03380314c4f42fa854df8c471618751879f9e8f0ff5dbabda2bd77d0f96cb35676" }, + {"fullmoon_NA", "030216211d8e2a48bae9e5d7eb3a42ca2b7aae8770979a791f883869aea2fa6eef" }, + {"fullmoon_SH", "03f34282fa57ecc7aba8afaf66c30099b5601e98dcbfd0d8a58c86c20d8b692c64" }, + {"goldenman_EU", "02d6f13a8f745921cdb811e32237bb98950af1a5952be7b3d429abd9152f8e388d" }, + {"indenodes_AR", "02ec0fa5a40f47fd4a38ea5c89e375ad0b6ddf4807c99733c9c3dc15fb978ee147" }, + {"indenodes_EU", "0221387ff95c44cb52b86552e3ec118a3c311ca65b75bf807c6c07eaeb1be8303c" }, + {"indenodes_NA", "02698c6f1c9e43b66e82dbb163e8df0e5a2f62f3a7a882ca387d82f86e0b3fa988" }, // 30 + {"indenodes_SH", "0334e6e1ec8285c4b85bd6dae67e17d67d1f20e7328efad17ce6fd24ae97cdd65e" }, + {"jackson_AR", "038ff7cfe34cb13b524e0941d5cf710beca2ffb7e05ddf15ced7d4f14fbb0a6f69" }, + {"jeezy_EU", "023cb3e593fb85c5659688528e9a4f1c4c7f19206edc7e517d20f794ba686fd6d6" }, + {"karasugoi_NA", "02a348b03b9c1a8eac1b56f85c402b041c9bce918833f2ea16d13452309052a982" }, + {"komodoninja_EU", "038e567b99806b200b267b27bbca2abf6a3e8576406df5f872e3b38d30843cd5ba" }, + {"komodoninja_SH", "033178586896915e8456ebf407b1915351a617f46984001790f0cce3d6f3ada5c2" }, + {"komodopioneers_SH", "033ace50aedf8df70035b962a805431363a61cc4e69d99d90726a2d48fb195f68c" }, + {"libscott_SH", "03301a8248d41bc5dc926088a8cf31b65e2daf49eed7eb26af4fb03aae19682b95" }, + {"lukechilds_AR", "031aa66313ee024bbee8c17915cf7d105656d0ace5b4a43a3ab5eae1e14ec02696" }, + {"madmax_AR", "03891555b4a4393d655bf76f0ad0fb74e5159a615b6925907678edc2aac5e06a75" }, // 40 + {"meshbits_AR", "02957fd48ae6cb361b8a28cdb1b8ccf5067ff68eb1f90cba7df5f7934ed8eb4b2c" }, + {"meshbits_SH", "025c6e94877515dfd7b05682b9cc2fe4a49e076efe291e54fcec3add78183c1edb" }, + {"metaphilibert_AR", "02adad675fae12b25fdd0f57250b0caf7f795c43f346153a31fe3e72e7db1d6ac6" }, + {"metaphilibert_SH", "0284af1a5ef01503e6316a2ca4abf8423a794e9fc17ac6846f042b6f4adedc3309" }, + {"patchkez_SH", "0296270f394140640f8fa15684fc11255371abb6b9f253416ea2734e34607799c4" }, + {"pbca26_NA", "0276aca53a058556c485bbb60bdc54b600efe402a8b97f0341a7c04803ce204cb5" }, + {"peer2cloud_AR", "034e5563cb885999ae1530bd66fab728e580016629e8377579493b386bf6cebb15" }, + {"peer2cloud_SH", "03396ac453b3f23e20f30d4793c5b8ab6ded6993242df4f09fd91eb9a4f8aede84" }, + {"polycryptoblog_NA", "02708dcda7c45fb54b78469673c2587bfdd126e381654819c4c23df0e00b679622" }, + {"hyper_AR", "020f2f984d522051bd5247b61b080b4374a7ab389d959408313e8062acad3266b4" }, // 50 + {"hyper_EU", "03d00cf9ceace209c59fb013e112a786ad583d7de5ca45b1e0df3b4023bb14bf51" }, + {"hyper_SH", "0383d0b37f59f4ee5e3e98a47e461c861d49d0d90c80e9e16f7e63686a2dc071f3" }, + {"hyper_NA", "03d91c43230336c0d4b769c9c940145a8c53168bf62e34d1bccd7f6cfc7e5592de" }, + {"popcornbag_AR", "02761f106fb34fbfc5ddcc0c0aa831ed98e462a908550b280a1f7bd32c060c6fa3" }, + {"popcornbag_NA", "03c6085c7fdfff70988fda9b197371f1caf8397f1729a844790e421ee07b3a93e8" }, + {"alien_AR", "0348d9b1fc6acf81290405580f525ee49b4749ed4637b51a28b18caa26543b20f0" }, + {"alien_EU", "020aab8308d4df375a846a9e3b1c7e99597b90497efa021d50bcf1bbba23246527" }, + {"thegaltmines_NA", "031bea28bec98b6380958a493a703ddc3353d7b05eb452109a773eefd15a32e421" }, + {"titomane_AR", "029d19215440d8cb9cc6c6b7a4744ae7fb9fb18d986e371b06aeb34b64845f9325" }, + {"titomane_EU", "0360b4805d885ff596f94312eed3e4e17cb56aa8077c6dd78d905f8de89da9499f" }, // 60 + {"titomane_SH", "03573713c5b20c1e682a2e8c0f8437625b3530f278e705af9b6614de29277a435b" }, + {"webworker01_NA", "03bb7d005e052779b1586f071834c5facbb83470094cff5112f0072b64989f97d7" }, + {"xrobesx_NA", "03f0cc6d142d14a40937f12dbd99dbd9021328f45759e26f1877f2a838876709e1" }, +}; + +void gameaddrs() +{ + struct iguana_info *gamecoin,*kmdcoin; int32_t i; uint8_t pubkey33[33]; char gameaddr[64],kmdaddr[64]; + gamecoin = LP_coinfind("GAME"); + kmdcoin = LP_coinfind("KMD"); + if ( gamecoin != 0 && kmdcoin != 0 ) + { + for (i=0; i<64; i++) + { + decode_hex(pubkey33,33,Notaries_elected1[i][1]); + bitcoin_address(gamecoin->symbol,gameaddr,gamecoin->taddr,gamecoin->pubtype,pubkey33,33); + bitcoin_address(kmdcoin->symbol,kmdaddr,kmdcoin->taddr,kmdcoin->pubtype,pubkey33,33); + printf("{\"%s\", \"%s\", \"%s\", \"%s\"},\n",Notaries_elected1[i][0],Notaries_elected1[i][1],kmdaddr,gameaddr); + } + } +} + + void LP_initcoins(void *ctx,int32_t pubsock,cJSON *coins) { int32_t i,n,notarized; cJSON *item; char *symbol,*etomic; struct iguana_info *coin; @@ -856,6 +969,10 @@ void LP_initcoins(void *ctx,int32_t pubsock,cJSON *coins) { bech32_tests(); } + else if ( 0 && strcmp(coin->symbol,"GAME") == 0 ) + { + gameaddrs(); + } else if ( 0 && strcmp(coin->symbol,"SMART") == 0 ) { uint8_t txdata[8129]; int32_t len; bits256 txid,txid2,ktxid; char str[65]; @@ -1020,6 +1137,7 @@ void LP_swapsloop(void *ctx) sleep(6); } } + LP_gtc_iteration(ctx,LP_myipaddr,LP_mypubsock); } } @@ -1383,6 +1501,7 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu portable_mutex_init(&LP_blockinit_mutex); portable_mutex_init(&LP_pendswap_mutex); portable_mutex_init(&LP_listmutex); + portable_mutex_init(&LP_gtcmutex); myipaddr = clonestr("127.0.0.1"); #ifndef _WIN32 #ifndef FROM_JS @@ -1531,6 +1650,7 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu int32_t nonz,didremote=0; LP_statslog_parse(); bitcoind_RPC_inittime = 0; + //LP_mpnet_init(); seems better to have the GUI send in persistent orders, exit mm is a cancel all while ( LP_STOP_RECEIVED == 0 ) { nonz = 0; diff --git a/iguana/exchanges/LP_network.c b/iguana/exchanges/LP_network.c index 263618c39..32b47a8f2 100644 --- a/iguana/exchanges/LP_network.c +++ b/iguana/exchanges/LP_network.c @@ -27,6 +27,7 @@ struct psock } *PSOCKS; uint16_t Numpsocks,Psockport = MIN_PSOCK_PORT,Pcmdport = MAX_PSOCK_PORT; +extern portable_mutex_t LP_commandQmutex; #ifdef FROM_JS @@ -879,8 +880,16 @@ char *LP_psock(int32_t *pullsockp,char *ipaddr,int32_t ispaired,int32_t cmdchann char *issue_LP_psock(char *destip,uint16_t destport,int32_t ispaired,int32_t cmdchannel) { - char str[65],url[512],*retstr; - sprintf(url,"http://%s:%u/api/stats/psock?ispaired=%d&cmdchannel=%d&pubkey=%s&netid=%d",destip,destport-1,ispaired,cmdchannel,bits256_str(str,G.LP_mypub25519),G.netid); + char str[65],url[512],*retstr; bits256 pub25519; int32_t netid; +#ifdef FROM_MARKETMAKER + pub25519 = G.LP_mypub25519; + netid = G.netid; +#else + extern bits256 BET_mypub25519; + pub25519 = BET_mypub25519; + netid = 0; +#endif + sprintf(url,"http://%s:%u/api/stats/psock?ispaired=%d&cmdchannel=%d&pubkey=%s&netid=%d",destip,destport-1,ispaired,cmdchannel,bits256_str(str,pub25519),netid); //return(LP_issue_curl("psock",destip,destport,url)); retstr = issue_curlt(url,LP_HTTP_TIMEOUT*10); printf("issue_LP_psock got (%s) from %s\n",retstr,url); // this is needed?! diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index b35d17a61..2362f9e90 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -18,6 +18,14 @@ // LP_ordermatch.c // marketmaker // + +struct LP_gtcorder +{ + struct LP_gtcorder *next,*prev; + struct LP_quoteinfo Q; + uint32_t cancelled,pending; +} *GTCorders; + struct LP_quoteinfo LP_Alicequery,LP_Alicereserved; double LP_Alicemaxprice; bits256 LP_Alicedestpubkey,LP_bobs_reserved; @@ -494,7 +502,7 @@ int32_t LP_connectstartbob(void *ctx,int32_t pubsock,char *base,char *rel,double } if ( bits256_nonz(privkey) != 0 && bits256_cmp(G.LP_mypub25519,qp->srchash) == 0 ) { - LP_requestinit(&qp->R,qp->srchash,qp->desthash,base,qp->satoshis-qp->txfee,rel,qp->destsatoshis-qp->desttxfee,qp->timestamp,qp->quotetime,DEXselector); + LP_requestinit(&qp->R,qp->srchash,qp->desthash,base,qp->satoshis-qp->txfee,rel,qp->destsatoshis-qp->desttxfee,qp->timestamp,qp->quotetime,DEXselector,qp->fill,qp->gtc); dtrust = LP_dynamictrust(qp->othercredits,qp->desthash,LP_kmdvalue(qp->destcoin,qp->destsatoshis)); if ( (swap= LP_swapinit(1,0,privkey,&qp->R,qp,dtrust > 0)) == 0 ) { @@ -517,27 +525,35 @@ int32_t LP_connectstartbob(void *ctx,int32_t pubsock,char *base,char *rel,double LP_importaddress(qp->destcoin,qp->destaddr); LP_otheraddress(qp->srccoin,otheraddr,qp->destcoin,qp->destaddr); LP_importaddress(qp->srccoin,otheraddr); - bits256 zero; - memset(zero.bytes,0,sizeof(zero)); - for (i=0; i<1; i++) { - LP_reserved_msg(1,qp->srccoin,qp->destcoin,qp->desthash,jprint(reqjson,0)); - break; - sleep(10); - if ( swap->received != 0 ) + bits256 zero; + memset(zero.bytes,0,sizeof(zero)); + for (i=0; i<1; i++) { - printf("swap %u-%u has started t%u\n",swap->I.req.requestid,swap->I.req.quoteid,swap->received); + LP_reserved_msg(1,qp->srccoin,qp->destcoin,qp->desthash,jprint(reqjson,0)); break; + sleep(10); + if ( swap->received != 0 ) + { + printf("swap %u-%u has started t%u\n",swap->I.req.requestid,swap->I.req.quoteid,swap->received); + break; + } + printf("bob tries %u-%u again i.%d\n",swap->I.req.requestid,swap->I.req.quoteid,i); + LP_reserved_msg(1,qp->srccoin,qp->destcoin,zero,jprint(reqjson,0)); } - printf("bob tries %u-%u again i.%d\n",swap->I.req.requestid,swap->I.req.quoteid,i); + sleep(1); + printf("send CONNECT for %u-%u\n",qp->R.requestid,qp->R.quoteid); LP_reserved_msg(1,qp->srccoin,qp->destcoin,zero,jprint(reqjson,0)); + if ( IPC_ENDPOINT >= 0 ) + LP_queuecommand(0,jprint(reqjson,0),IPC_ENDPOINT,-1,0); } - sleep(1); - printf("send CONNECT for %u-%u\n",qp->R.requestid,qp->R.quoteid); - LP_reserved_msg(1,qp->srccoin,qp->destcoin,zero,jprint(reqjson,0)); - if ( IPC_ENDPOINT >= 0 ) - LP_queuecommand(0,jprint(reqjson,1),IPC_ENDPOINT,-1,0); - else free_json(reqjson); + if ( qp->mpnet != 0 && qp->gtc == 0 ) + { + char *msg = jprint(reqjson,0); + LP_mpnet_send(0,msg,1,qp->destaddr); + free(msg); + } + free_json(reqjson); retval = 0; } else @@ -567,10 +583,60 @@ int32_t LP_connectstartbob(void *ctx,int32_t pubsock,char *base,char *rel,double return(retval); } +void LP_gtc_iteration(void *ctx,char *myipaddr,int32_t mypubsock) +{ + struct LP_gtcorder *gtc,*tmp; struct LP_quoteinfo *qp; uint64_t destvalue,destvalue2; uint32_t oldest = 0; + if ( Alice_expiration != 0 ) + return; + DL_FOREACH_SAFE(GTCorders,gtc,tmp) + { + qp = >c->Q; + if ( gtc->cancelled == 0 && (oldest == 0 || gtc->pending < oldest) ) + oldest = gtc->pending; + } + DL_FOREACH_SAFE(GTCorders,gtc,tmp) + { + qp = >c->Q; + if ( gtc->cancelled == 0 && LP_iseligible(&destvalue,&destvalue2,0,qp->destcoin,qp->desttxid,qp->destvout,qp->destsatoshis,qp->feetxid,qp->feevout) == 0 ) + { + gtc->cancelled = (uint32_t)time(NULL); + LP_failedmsg(qp->R.requestid,qp->R.quoteid,-9997,qp->uuidstr); + } + if ( gtc->cancelled != 0 ) + { + portable_mutex_lock(&LP_gtcmutex); + DL_DELETE(GTCorders,gtc); + free(gtc); + portable_mutex_unlock(&LP_gtcmutex); + } + else + { + if ( gtc->pending <= oldest+60 && time(NULL) > gtc->pending+LP_AUTOTRADE_TIMEOUT*10 ) + { + gtc->pending = qp->timestamp = (uint32_t)time(NULL); + LP_query(ctx,myipaddr,mypubsock,"request",qp); + LP_Alicequery = *qp, LP_Alicemaxprice = gtc->Q.maxprice, Alice_expiration = qp->timestamp + 2*LP_AUTOTRADE_TIMEOUT, LP_Alicedestpubkey = qp->srchash; + char str[65]; printf("LP_gtc fill.%d gtc.%d %s/%s %.8f vol %.8f dest.(%s) maxprice %.8f etomicdest.(%s) uuid.%s fill.%d gtc.%d\n",qp->fill,qp->gtc,qp->srccoin,qp->destcoin,dstr(qp->satoshis),dstr(qp->destsatoshis),bits256_str(str,LP_Alicedestpubkey),gtc->Q.maxprice,qp->etomicdest,qp->uuidstr,qp->fill,qp->gtc); + break; + } + } + } +} + +void LP_gtc_addorder(struct LP_quoteinfo *qp) +{ + struct LP_gtcorder *gtc; + gtc = calloc(1,sizeof(*gtc)); + gtc->Q = *qp; + gtc->pending = (uint32_t)time(NULL); + portable_mutex_lock(&LP_gtcmutex); + DL_APPEND(GTCorders,gtc); + portable_mutex_unlock(&LP_gtcmutex); +} + char *LP_trade(void *ctx,char *myipaddr,int32_t mypubsock,struct LP_quoteinfo *qp,double maxprice,int32_t timeout,int32_t duration,uint32_t tradeid,bits256 destpubkey,char *uuidstr) { - double price; - price = 0.; + struct LP_gtcorder *gtc; memset(qp->txid.bytes,0,sizeof(qp->txid)); qp->txid2 = qp->txid; qp->aliceid = LP_aliceid_calc(qp->desttxid,qp->destvout,qp->feetxid,qp->feevout); @@ -578,9 +644,25 @@ char *LP_trade(void *ctx,char *myipaddr,int32_t mypubsock,struct LP_quoteinfo *q qp->tradeid = LP_rand(); qp->srchash = destpubkey; strncpy(qp->uuidstr,uuidstr,sizeof(qp->uuidstr)-1); - LP_query(ctx,myipaddr,mypubsock,"request",qp); - LP_Alicequery = *qp, LP_Alicemaxprice = maxprice, Alice_expiration = qp->timestamp + timeout, LP_Alicedestpubkey = destpubkey; - char str[65]; printf("LP_trade %s/%s %.8f vol %.8f dest.(%s) maxprice %.8f etomicdest.(%s) uuid.%s\n",qp->srccoin,qp->destcoin,dstr(qp->satoshis),dstr(qp->destsatoshis),bits256_str(str,LP_Alicedestpubkey),maxprice,qp->etomicdest,qp->uuidstr); + qp->maxprice = maxprice; + qp->timestamp = (uint32_t)time(NULL); + if ( qp->gtc != 0 ) + { + strcpy(&qp->uuidstr[strlen(qp->uuidstr)-6],"cccccc"); + LP_gtc_addorder(qp); + } + { + LP_query(ctx,myipaddr,mypubsock,"request",qp); + LP_Alicequery = *qp, LP_Alicemaxprice = qp->maxprice, Alice_expiration = qp->timestamp + timeout, LP_Alicedestpubkey = qp->srchash; + } + if ( qp->gtc == 0 ) + { + cJSON *reqjson = LP_quotejson(qp); + char *msg = jprint(reqjson,1); + LP_mpnet_send(1,msg,1,0); + free(msg); + } + char str[65]; printf("LP_trade mpnet.%d fill.%d gtc.%d %s/%s %.8f vol %.8f dest.(%s) maxprice %.8f etomicdest.(%s) uuid.%s fill.%d gtc.%d\n",qp->mpnet,qp->fill,qp->gtc,qp->srccoin,qp->destcoin,dstr(qp->satoshis),dstr(qp->destsatoshis),bits256_str(str,LP_Alicedestpubkey),qp->maxprice,qp->etomicdest,qp->uuidstr,qp->fill,qp->gtc); return(LP_recent_swaps(0,uuidstr)); } @@ -628,16 +710,45 @@ char *LP_cancel_order(char *uuidstr) int32_t num = 0; cJSON *retjson; if ( uuidstr != 0 ) { - num = LP_trades_canceluuid(uuidstr); - retjson = cJSON_CreateObject(); - jaddstr(retjson,"result","success"); - jaddnum(retjson,"numentries",num); - if ( strcmp(LP_Alicequery.uuidstr,uuidstr) == 0 ) + if ( uuidstr[0] == 'G' ) { - LP_failedmsg(LP_Alicequery.R.requestid,LP_Alicequery.R.quoteid,-9998,LP_Alicequery.uuidstr); - LP_alicequery_clear(); - jaddstr(retjson,"status","uuid canceled"); - } else jaddstr(retjson,"status","will stop trade negotiation, but if swap started it wont cancel"); + struct LP_gtcorder *gtc,*tmp; + DL_FOREACH_SAFE(GTCorders,gtc,tmp) + { + if ( strcmp(gtc->Q.uuidstr,uuidstr) == 0 ) + { + retjson = cJSON_CreateObject(); + jaddstr(retjson,"result","success"); + jaddstr(retjson,"cancelled",uuidstr); + jaddnum(retjson,"pending",gtc->pending); + if ( gtc->cancelled == 0 ) + { + gtc->cancelled = (uint32_t)time(NULL); + jaddstr(retjson,"status","uuid canceled"); + LP_failedmsg(gtc->Q.R.requestid,gtc->Q.R.quoteid,-9997,gtc->Q.uuidstr); + } + else + { + jaddstr(retjson,"status","uuid already canceled"); + LP_failedmsg(gtc->Q.R.requestid,gtc->Q.R.quoteid,-9996,gtc->Q.uuidstr); + } + } + } + return(clonestr("{\"error\":\"gtc uuid not found\"}")); + } + else + { + num = LP_trades_canceluuid(uuidstr); + retjson = cJSON_CreateObject(); + jaddstr(retjson,"result","success"); + jaddnum(retjson,"numentries",num); + if ( strcmp(LP_Alicequery.uuidstr,uuidstr) == 0 ) + { + LP_failedmsg(LP_Alicequery.R.requestid,LP_Alicequery.R.quoteid,-9998,LP_Alicequery.uuidstr); + LP_alicequery_clear(); + jaddstr(retjson,"status","uuid canceled"); + } else jaddstr(retjson,"status","will stop trade negotiation, but if swap started it wont cancel"); + } return(jprint(retjson,1)); } return(clonestr("{\"error\":\"uuid not cancellable\"}")); @@ -645,16 +756,22 @@ char *LP_cancel_order(char *uuidstr) char *LP_connectedalice(struct LP_quoteinfo *qp,char *pairstr) // alice { - cJSON *retjson; char otheraddr[64],*msg; double bid,ask,price,qprice; int32_t pairsock = -1; int32_t DEXselector = 0; struct LP_utxoinfo *autxo,A,B,*butxo; struct basilisk_swap *swap; struct iguana_info *coin; + cJSON *retjson; char otheraddr[64],*msg; double bid,ask,price,qprice; int32_t changed,pairsock = -1; int32_t DEXselector = 0; struct LP_utxoinfo *autxo,A,B,*butxo; struct basilisk_swap *swap; struct iguana_info *coin; if ( bits256_cmp(qp->desthash,G.LP_mypub25519) != 0 ) { LP_aliceid(qp->tradeid,qp->aliceid,"error1",0,0); LP_failedmsg(qp->R.requestid,qp->R.quoteid,-4000,qp->uuidstr); return(clonestr("{\"result\",\"update stats\"}")); } - printf("CONNECTED numpending.%d tradeid.%u requestid.%u quoteid.%u pairstr.%s\n",G.LP_pendingswaps,qp->tradeid,qp->R.requestid,qp->R.quoteid,pairstr!=0?pairstr:""); - LP_requestinit(&qp->R,qp->srchash,qp->desthash,qp->srccoin,qp->satoshis-qp->txfee,qp->destcoin,qp->destsatoshis-qp->desttxfee,qp->timestamp,qp->quotetime,DEXselector); + printf("CONNECTED mpnet.%d fill.%d gtc.%d numpending.%d tradeid.%u requestid.%u quoteid.%u pairstr.%s\n",qp->mpnet,qp->fill,qp->gtc,G.LP_pendingswaps,qp->tradeid,qp->R.requestid,qp->R.quoteid,pairstr!=0?pairstr:""); + LP_requestinit(&qp->R,qp->srchash,qp->desthash,qp->srccoin,qp->satoshis-qp->txfee,qp->destcoin,qp->destsatoshis-qp->desttxfee,qp->timestamp,qp->quotetime,DEXselector,qp->fill,qp->gtc); //printf("calculated requestid.%u quoteid.%u\n",qp->R.requestid,qp->R.quoteid); + if ( LP_Alicequery.srccoin[0] != 0 && LP_Alicequery.destcoin[0] != 0 ) + { + LP_mypriceset(0,&changed,LP_Alicequery.destcoin,LP_Alicequery.srccoin,0.); + LP_mypriceset(0,&changed,LP_Alicequery.srccoin,LP_Alicequery.destcoin,0.); + } + LP_alicequery_clear(); memset(&LP_Alicereserved,0,sizeof(LP_Alicereserved)); LP_aliceid(qp->tradeid,qp->aliceid,"connected",qp->R.requestid,qp->R.quoteid); autxo = &A; @@ -671,7 +788,7 @@ char *LP_connectedalice(struct LP_quoteinfo *qp,char *pairstr) // alice printf("quote %s/%s validate error %.0f\n",qp->srccoin,qp->destcoin,qprice); return(clonestr("{\"error\":\"quote validation error\"}")); } - if ( LP_myprice(&bid,&ask,qp->srccoin,qp->destcoin) <= SMALLVAL || bid <= SMALLVAL ) + if ( LP_myprice(0,&bid,&ask,qp->srccoin,qp->destcoin) <= SMALLVAL || bid <= SMALLVAL ) { printf("this node has no price for %s/%s (%.8f %.8f)\n",qp->destcoin,qp->srccoin,bid,ask); LP_availableset(qp->desttxid,qp->vout); @@ -862,7 +979,7 @@ void LP_reserved(void *ctx,char *myipaddr,int32_t mypubsock,struct LP_quoteinfo double LP_trades_bobprice(double *bidp,double *askp,struct LP_quoteinfo *qp) { double price; struct iguana_info *coin; char str[65]; - price = LP_myprice(bidp,askp,qp->srccoin,qp->destcoin); + price = LP_myprice(1,bidp,askp,qp->srccoin,qp->destcoin); if ( (coin= LP_coinfind(qp->srccoin)) == 0 || price <= SMALLVAL || *askp <= SMALLVAL ) { //printf("this node has no price for %s/%s\n",qp->srccoin,qp->destcoin); @@ -916,10 +1033,11 @@ double LP_trades_pricevalidate(struct LP_quoteinfo *qp,struct iguana_info *coin, struct LP_quoteinfo *LP_trades_gotrequest(void *ctx,struct LP_quoteinfo *qp,struct LP_quoteinfo *newqp,char *pairstr) { - double price=0.,p=0.,qprice,myprice,bestprice,range,bid,ask; struct iguana_info *coin,*othercoin; struct LP_utxoinfo A,B,*autxo,*butxo; cJSON *reqjson; char str[65]; struct LP_address_utxo *utxos[4096]; int32_t i,r,counter,max = (int32_t)(sizeof(utxos)/sizeof(*utxos)); + int32_t voliters=10,priceiters=33; + double price=0.,p=0.,qprice,myprice,bestprice,range,bid,ask; uint64_t satoshis; struct iguana_info *coin,*othercoin; struct LP_utxoinfo A,B,*autxo,*butxo; cJSON *reqjson,*retjson; char str[65],*retstr,*txidstr,*hexstr; struct LP_address_utxo *utxos[4096]; int32_t i,j,notarized,r,num,counter,max = (int32_t)(sizeof(utxos)/sizeof(*utxos)); *newqp = *qp; qp = newqp; -//printf("bob %s received REQUEST.(%s)\n",bits256_str(str,G.LP_mypub25519),qp->uuidstr+32); +printf("bob %s received REQUEST.(%s) mpnet.%d fill.%d gtc.%d\n",bits256_str(str,G.LP_mypub25519),qp->uuidstr+32,qp->mpnet,qp->fill,qp->gtc); if ( (coin= LP_coinfind(qp->srccoin)) == 0 || (othercoin= LP_coinfind(qp->destcoin)) == 0 ) return(0); if ( (myprice= LP_trades_bobprice(&bid,&ask,qp)) == 0. ) @@ -970,7 +1088,7 @@ struct LP_quoteinfo *LP_trades_gotrequest(void *ctx,struct LP_quoteinfo *qp,stru } else { - //printf("ignore as qprice %.8f vs myprice %.8f\n",qprice,myprice); + printf("%s/%s ignore as qprice %.8f vs myprice %.8f\n",qp->srccoin,qp->destcoin,qprice,myprice); return(0); } //LP_RTmetrics_update(qp->srccoin,qp->destcoin); @@ -998,45 +1116,79 @@ struct LP_quoteinfo *LP_trades_gotrequest(void *ctx,struct LP_quoteinfo *qp,stru } } i = 0; - while ( i < 33 && price >= myprice ) - { - if ( (butxo= LP_address_myutxopair(butxo,1,utxos,max,LP_coinfind(qp->srccoin),qp->coinaddr,qp->txfee,dstr(qp->destsatoshis),price,qp->desttxfee)) != 0 ) - { - strcpy(qp->gui,G.gui); - strcpy(qp->coinaddr,coin->smartaddr); - qp->srchash = G.LP_mypub25519; - qp->txid = butxo->payment.txid; - qp->vout = butxo->payment.vout; - qp->txid2 = butxo->deposit.txid; - qp->vout2 = butxo->deposit.vout; - qp->satoshis = butxo->swap_satoshis;// + qp->txfee; - qp->quotetime = (uint32_t)time(NULL); + while ( i < priceiters && price >= myprice ) + { + for (j=0; jdestsatoshis)); + if ( (butxo= LP_address_myutxopair(&B,1,utxos,max,LP_coinfind(qp->srccoin),qp->coinaddr,qp->txfee,dstr(qp->destsatoshis),price,qp->desttxfee)) != 0 ) + { + strcpy(qp->gui,G.gui); + strcpy(qp->coinaddr,coin->smartaddr); + qp->srchash = G.LP_mypub25519; + qp->txid = butxo->payment.txid; + qp->vout = butxo->payment.vout; + qp->txid2 = butxo->deposit.txid; + qp->vout2 = butxo->deposit.vout; + qp->satoshis = butxo->swap_satoshis;// + qp->txfee; + qp->quotetime = (uint32_t)time(NULL); + break; + } + if ( qp->fill != 0 ) + break; + qp->destsatoshis = (qp->destsatoshis * 2) / 3; } - else + if ( butxo != 0 && j < voliters ) { - printf("i.%d cant find utxopair aliceid.%llu %s/%s %.8f -> relvol %.8f\n",i,(long long)qp->aliceid,qp->srccoin,qp->destcoin,dstr(LP_basesatoshis(dstr(qp->destsatoshis),price,qp->txfee,qp->desttxfee)),dstr(qp->destsatoshis)); - return(0); + if ( qp->satoshis <= qp->txfee ) + return(0); + p = (double)qp->destsatoshis / (qp->satoshis - qp->txfee); + if ( LP_trades_pricevalidate(qp,coin,p) < 0. ) + { + if ( qp->fill != 0 ) + return(0); + price *= 0.995; + i++; + continue; + } + if ( i == 0 && p < myprice ) + { + price = qprice; + printf("reset price <- qprice %.8f\n",qprice); + } + else + { + if ( qprice >= p || qp->fill != 0 ) + break; + price *= 0.995; + } + if ( qp->fill != 0 ) + break; + i++; } - if ( qp->satoshis <= qp->txfee ) - return(0); - p = (double)qp->destsatoshis / (qp->satoshis - qp->txfee); - if ( LP_trades_pricevalidate(qp,coin,p) < 0. ) - return(0); - if ( i == 0 && p < myprice ) + else if ( qp->fill != 0 || i == priceiters ) { - price = qprice; - printf("reset price <- qprice %.8f\n",qprice); + printf("i.%d cant find utxopair aliceid.%llu %s/%s %.8f -> relvol %.8f txfee %.8f\n",i,(long long)qp->aliceid,qp->srccoin,qp->destcoin,dstr(LP_basesatoshis(dstr(qp->destsatoshis),price,qp->txfee,qp->desttxfee)),dstr(qp->destsatoshis),dstr(qp->txfee)); + if ( qp->gtc != 0 && qp->fill != 0 && coin != 0 ) + { + LP_address_utxo_reset(&num,coin); + satoshis = LP_basesatoshis(dstr(qp->destsatoshis),price,qp->txfee,qp->desttxfee) + 3*qp->txfee; + if ( LP_getheight(¬arized,coin) > coin->bobfillheight+3 && fabs((double)coin->fillsatoshis - satoshis)/satoshis > 0.1 ) + { + printf("queue up do_autofill_merge %.8f\n",dstr(satoshis)); + coin->do_autofill_merge = satoshis; + } + } + return(0); } else { - if ( qprice >= p ) - break; price *= 0.995; + i++; } - i++; } - printf("%s/%s i.%d qprice %.8f myprice %.8f price %.8f [%.8f]\n",qp->srccoin,qp->destcoin,i,qprice,myprice,price,p); - if ( LP_allocated(qp->txid,qp->vout) == 0 && LP_allocated(qp->txid2,qp->vout2) == 0 ) + printf("%s/%s i.%d j.%d qprice %.8f myprice %.8f price %.8f [%.8f]\n",qp->srccoin,qp->destcoin,i,j,qprice,myprice,price,p); + if ( butxo != 0 && bits256_nonz(qp->txid) != 0 && bits256_nonz(qp->txid2) != 0 && LP_allocated(qp->txid,qp->vout) == 0 && LP_allocated(qp->txid2,qp->vout2) == 0 ) { //printf("found unallocated txids\n"); reqjson = LP_quotejson(qp); @@ -1047,10 +1199,18 @@ struct LP_quoteinfo *LP_trades_gotrequest(void *ctx,struct LP_quoteinfo *qp,stru jaddnum(reqjson,"quotetime",qp->quotetime); jaddnum(reqjson,"pending",qp->timestamp + LP_RESERVETIME); jaddstr(reqjson,"method","reserved"); - LP_reserved_msg(1,qp->srccoin,qp->destcoin,qp->desthash,jprint(reqjson,0)); - bits256 zero; - memset(zero.bytes,0,sizeof(zero)); - LP_reserved_msg(1,qp->srccoin,qp->destcoin,zero,jprint(reqjson,0)); + { + LP_reserved_msg(1,qp->srccoin,qp->destcoin,qp->desthash,jprint(reqjson,0)); + bits256 zero; + memset(zero.bytes,0,sizeof(zero)); + LP_reserved_msg(1,qp->srccoin,qp->destcoin,zero,jprint(reqjson,0)); + } + if ( qp->mpnet != 0 && qp->gtc == 0 ) + { + char *msg = jprint(reqjson,0); + LP_mpnet_send(0,msg,1,qp->destaddr); + free(msg); + } free_json(reqjson); //printf("Send RESERVED id.%llu\n",(long long)qp->aliceid); return(qp); @@ -1061,7 +1221,7 @@ struct LP_quoteinfo *LP_trades_gotrequest(void *ctx,struct LP_quoteinfo *qp,stru struct LP_quoteinfo *LP_trades_gotreserved(void *ctx,struct LP_quoteinfo *qp,struct LP_quoteinfo *newqp) { char *retstr; double qprice; - //char str[65]; printf("alice %s received RESERVED.(%s) %.8f\n",bits256_str(str,G.LP_mypub25519),qp->uuidstr+32,(double)qp->destsatoshis/(qp->satoshis+1)); + char str[65]; printf("alice %s received RESERVED.(%s) %.8f mpnet.%d fill.%d gtc.%d\n",bits256_str(str,G.LP_mypub25519),qp->uuidstr+32,(double)qp->destsatoshis/(qp->satoshis+1),qp->mpnet,qp->fill,qp->gtc); *newqp = *qp; qp = newqp; if ( (qprice= LP_trades_alicevalidate(ctx,qp)) > 0. ) @@ -1103,7 +1263,7 @@ struct LP_quoteinfo *LP_trades_gotconnect(void *ctx,struct LP_quoteinfo *qp,stru struct LP_quoteinfo *LP_trades_gotconnected(void *ctx,struct LP_quoteinfo *qp,struct LP_quoteinfo *newqp,char *pairstr) { char *retstr; int32_t changed; double val; - //char str[65]; printf("alice %s received CONNECTED.(%llu)\n",bits256_str(str,G.LP_mypub25519),(long long)qp->aliceid); + char str[65]; printf("alice %s received CONNECTED.(%llu) mpnet.%d fill.%d gtc.%d\n",bits256_str(str,G.LP_mypub25519),(long long)qp->aliceid,qp->mpnet,qp->fill,qp->gtc); *newqp = *qp; qp = newqp; if ( (val= LP_trades_alicevalidate(ctx,qp)) > 0. ) @@ -1112,7 +1272,7 @@ struct LP_quoteinfo *LP_trades_gotconnected(void *ctx,struct LP_quoteinfo *qp,st LP_aliceid(qp->tradeid,qp->aliceid,"connected",0,0); if ( (retstr= LP_connectedalice(qp,pairstr)) != 0 ) free(retstr); - LP_mypriceset(&changed,qp->destcoin,qp->srccoin,0.); + LP_mypriceset(0,&changed,qp->destcoin,qp->srccoin,0.); LP_alicequery_clear(); return(qp); } else LP_failedmsg(qp->R.requestid,qp->R.quoteid,val,qp->uuidstr); @@ -1367,7 +1527,7 @@ void LP_tradecommandQ(struct LP_quoteinfo *qp,char *pairstr,int32_t funcid) //printf("queue.%d uuid.(%s)\n",funcid,qtp->Q.uuidstr); } -int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,uint8_t *data,int32_t datalen) +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 Qtrades = 1; char *method,str[65]; int32_t i,num,DEXselector = 0; uint64_t aliceid; double qprice,bestprice,price,bid,ask; cJSON *proof; uint64_t rq; struct iguana_info *coin; struct LP_quoteinfo Q,Q2; int32_t counter,retval=-1; @@ -1380,7 +1540,7 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson, } if ( Q.satoshis < Q.txfee ) return(1); - LP_requestinit(&Q.R,Q.srchash,Q.desthash,Q.srccoin,Q.satoshis-Q.txfee,Q.destcoin,Q.destsatoshis-Q.desttxfee,Q.timestamp,Q.quotetime,DEXselector); + LP_requestinit(&Q.R,Q.srchash,Q.desthash,Q.srccoin,Q.satoshis-Q.txfee,Q.destcoin,Q.destsatoshis-Q.desttxfee,Q.timestamp,Q.quotetime,DEXselector,Q.fill,Q.gtc); rq = ((uint64_t)Q.R.requestid << 32) | Q.R.quoteid; if ( Q.uuidstr[0] == 0 || (Q.timestamp > 0 && time(NULL) > Q.timestamp + LP_AUTOTRADE_TIMEOUT*20) ) // eat expired packets, some old timestamps floating about? { @@ -1390,7 +1550,7 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson, LP_tradecommand_log(argjson); qprice = (double)Q.destsatoshis / (Q.satoshis - Q.txfee); //jdouble(argjson,"price"); //printf("%s\n",jprint(argjson,0)); - printf("%-4d uuid.%32s %12s %5s/%-5s %12.8f -> %12.8f (%11.8f) | RT.%d %d n%d\n",(uint32_t)time(NULL) % 3600,Q.uuidstr+32,method,Q.srccoin,Q.destcoin,dstr(Q.satoshis),dstr(Q.destsatoshis),qprice,LP_RTcount,LP_swapscount,G.netid); + printf("%-4d uuid.%32s M.%d g.%d f.%d %12s %5s/%-5s %12.8f -> %12.8f (%11.8f) | RT.%d %d n%d\n",(uint32_t)time(NULL) % 3600,Q.uuidstr+32,from_mpnet,Q.gtc,Q.fill,method,Q.srccoin,Q.destcoin,dstr(Q.satoshis),dstr(Q.destsatoshis),qprice,LP_RTcount,LP_swapscount,G.netid); retval = 1; aliceid = j64bits(argjson,"aliceid"); if ( strcmp(method,"reserved") == 0 ) @@ -1446,7 +1606,9 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson, else LP_tradecommandQ(&Q,jstr(argjson,"pair"),LP_CONNECTED); } } - price = LP_myprice(&bid,&ask,Q.srccoin,Q.destcoin); + if ( strcmp(method,"request") == 0 || strcmp(method,"connect") == 0 ) // bob + price = LP_myprice(1,&bid,&ask,Q.srccoin,Q.destcoin); + else price = LP_myprice(0,&bid,&ask,Q.srccoin,Q.destcoin); // alice if ( (coin= LP_coinfind(Q.srccoin)) == 0 || coin->inactive != 0 ) { //printf("%s is not active\n",Q.srccoin); @@ -1459,7 +1621,7 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson, } if ( LP_aliceonly(Q.srccoin) > 0 ) { - printf("{\"error\":\"GAME can only be alice coin\"}\n"); + printf("{\"error\":\"alice only coins can only be alice coin\"}\n"); return(retval); } if ( strcmp(method,"request") == 0 ) // bob @@ -1469,6 +1631,7 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson, if ( Q.destvout != Q.feevout || bits256_cmp(Q.desttxid,Q.feetxid) != 0 ) { bestprice = LP_bob_competition(&counter,aliceid,qprice,-1); + //printf("bestprice %.8f\n",bestprice); if ( Qtrades == 0 )//|| (bits256_cmp(Q.srchash,G.LP_mypub25519) == 0 && bits256_cmp(G.LP_mypub25519,Q.desthash) != 0) ) LP_trades_gotrequest(ctx,&Q,&Q2,jstr(argjson,"pair")); else LP_tradecommandQ(&Q,jstr(argjson,"pair"),LP_REQUEST); @@ -1502,7 +1665,7 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson, return(retval); } -char *LP_autobuy(void *ctx,int32_t fomoflag,char *myipaddr,int32_t mypubsock,char *base,char *rel,double maxprice,double relvolume,int32_t timeout,int32_t duration,char *gui,uint32_t nonce,bits256 destpubkey,uint32_t tradeid,char *uuidstr) +char *LP_autobuy(void *ctx,int32_t fomoflag,char *myipaddr,int32_t mypubsock,char *base,char *rel,double maxprice,double relvolume,int32_t timeout,int32_t duration,char *gui,uint32_t nonce,bits256 destpubkey,uint32_t tradeid,char *uuidstr,int32_t fillflag,int32_t gtcflag) { uint64_t desttxfee,txfee,balance; uint32_t lastnonce; int64_t bestsatoshis=0,destsatoshis; struct iguana_info *basecoin,*relcoin; struct LP_utxoinfo *autxo,B,A; struct LP_quoteinfo Q; bits256 pubkeys[100]; struct LP_address_utxo *utxos[4096]; int32_t num=0,maxiters=100,i,max=(int32_t)(sizeof(utxos)/sizeof(*utxos)); char _uuidstr[65]; basecoin = LP_coinfind(base); @@ -1589,6 +1752,10 @@ char *LP_autobuy(void *ctx,int32_t fomoflag,char *myipaddr,int32_t mypubsock,cha memset(&A,0,sizeof(A)); if ( (autxo= LP_address_myutxopair(&A,0,utxos,max,relcoin,relcoin->smartaddr,txfee,dstr(destsatoshis),maxprice,desttxfee)) != 0 ) break; + if ( fillflag != 0 ) + { + return(clonestr("{\"error\":\"cant find a deposit that is big enough in size. make another deposit that is just a bit larger than what you want to trade\"}")); + } destsatoshis *= 0.98; if ( destsatoshis < desttxfee*LP_MINSIZE_TXFEEMULT ) break; @@ -1640,8 +1807,11 @@ char *LP_autobuy(void *ctx,int32_t fomoflag,char *myipaddr,int32_t mypubsock,cha } } int32_t changed; - LP_mypriceset(&changed,rel,base,1. / maxprice); - LP_mypriceset(&changed,base,rel,0.); + Q.mpnet = G.mpnet; + Q.fill = fillflag; + Q.gtc = gtcflag; + LP_mypriceset(0,&changed,rel,base,1. / maxprice); + LP_mypriceset(0,&changed,base,rel,0.); if ( uuidstr == 0 || uuidstr[0] == 0 ) { uint8_t uuidhash[256]; bits256 hash; uint64_t millis; int32_t len = 0; diff --git a/iguana/exchanges/LP_portfolio.c b/iguana/exchanges/LP_portfolio.c index 29d54d1ee..dea9bce00 100644 --- a/iguana/exchanges/LP_portfolio.c +++ b/iguana/exchanges/LP_portfolio.c @@ -152,7 +152,7 @@ char *LP_portfolio() coin->balanceA = LP_balance(&coin->valuesumA,0,coin->symbol,coin->smartaddr); coin->balanceB = LP_balance(&coin->valuesumB,1,coin->symbol,coin->smartaddr); if ( strcmp(coin->symbol,"KMD") != 0 ) - coin->price_kmd = LP_price(coin->symbol,"KMD"); + coin->price_kmd = LP_price(1,coin->symbol,"KMD"); else coin->price_kmd = 1.; coin->maxamount = coin->valuesumA; if ( coin->valuesumB > coin->maxamount ) @@ -274,7 +274,7 @@ void LP_autopriceset(int32_t ind,void *ctx,int32_t dir,struct LP_priceinfo *base oppomargin = basepp->buymargins[relpp->ind]; if ( (fixedprice= basepp->fixedprices[relpp->ind]) > SMALLVAL ) { - LP_mypriceset(&changed,relpp->symbol,basepp->symbol,fixedprice); + LP_mypriceset(1,&changed,relpp->symbol,basepp->symbol,fixedprice); //printf("autoprice FIXED %s/%s <- %.8f\n",basepp->symbol,relpp->symbol,fixedprice); LP_pricepings(ctx,LP_myipaddr,LP_mypubsock,relpp->symbol,basepp->symbol,fixedprice); return; @@ -285,7 +285,7 @@ void LP_autopriceset(int32_t ind,void *ctx,int32_t dir,struct LP_priceinfo *base factor = basepp->factors[relpp->ind]; if ( fabs(price) < SMALLVAL && refbase != 0 && refrel != 0 ) { - price = LP_myprice(&bid,&ask,refbase,refrel); + price = LP_myprice(1,&bid,&ask,refbase,refrel); //printf("%s/%s USE ref %s/%s %.8f factor %.8f offset %.8f margin %.8f/%.8f\n",basepp->symbol,relpp->symbol,refbase,refrel,price,factor,offset,oppomargin,margin); } if ( LP_pricevalid(price) > 0 ) @@ -312,7 +312,7 @@ void LP_autopriceset(int32_t ind,void *ctx,int32_t dir,struct LP_priceinfo *base newprice = LP_autorefs[ind].lastask; //printf("autopriceset %s/%s <- %.8f %.8f (%.8f %.8f)\n",basepp->symbol,relpp->symbol,price,newprice,LP_autorefs[ind].lastbid,LP_autorefs[ind].lastask); } - LP_mypriceset(&changed,relpp->symbol,basepp->symbol,newprice); + LP_mypriceset(1,&changed,relpp->symbol,basepp->symbol,newprice); if ( changed != 0 || time(NULL) > lasttime+LP_ORDERBOOK_DURATION*.777) { lasttime = (uint32_t)time(NULL); @@ -582,9 +582,9 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp) LP_autorefs[i].lastask = askprice; else LP_autorefs[i].lastask = (LP_autorefs[i].lastask * 0.9) + (0.1 * askprice); askprice = LP_autorefs[i].lastask; - LP_mypriceset(&changed,rel,base,bidprice); + LP_mypriceset(1,&changed,rel,base,bidprice); LP_pricepings(ctx,LP_myipaddr,LP_mypubsock,rel,base,bidprice); - LP_mypriceset(&changed,base,rel,askprice); + LP_mypriceset(1,&changed,base,rel,askprice); LP_pricepings(ctx,LP_myipaddr,LP_mypubsock,base,rel,askprice); //printf("price %.8f -> %.8f %.8f\n",price,bidprice,askprice); } @@ -626,7 +626,7 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp) LP_autorefs[i].lastbid = newprice; else LP_autorefs[i].lastbid = (LP_autorefs[i].lastbid * 0.99) + (0.01 * newprice); newprice = LP_autorefs[i].lastbid; - LP_mypriceset(&changed,rel,base,newprice); + LP_mypriceset(1,&changed,rel,base,newprice); LP_pricepings(ctx,LP_myipaddr,LP_mypubsock,rel,base,newprice); //printf("%s/%s price %.8f margin %.8f/%.8f newprice %.8f %.8f\n",base,rel,price,buymargin,sellmargin,newprice,(1. / newprice) * (1. + sellmargin)); newprice = (1. / price) * (1. + sellmargin); @@ -634,7 +634,7 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp) LP_autorefs[i].lastask = newprice; else LP_autorefs[i].lastask = (LP_autorefs[i].lastask * 0.99) + (0.01 * newprice); newprice = LP_autorefs[i].lastask; - LP_mypriceset(&changed,base,rel,newprice); + LP_mypriceset(1,&changed,base,rel,newprice); LP_pricepings(ctx,LP_myipaddr,LP_mypubsock,base,rel,newprice); } //else printf("null return from CMC\n"); } @@ -782,7 +782,7 @@ int32_t LP_portfolio_trade(void *ctx,uint32_t *requestidp,uint32_t *quoteidp,str char *retstr2; uint64_t txfee,desttxfee; double bid,ask,maxprice; bits256 zero; uint32_t requestid,quoteid,iter,i; cJSON *retjson2; struct LP_utxoinfo A; struct LP_address_utxo *utxos[1000]; int32_t max=(int32_t)(sizeof(utxos)/sizeof(*utxos)); LP_txfees(&txfee,&desttxfee,buy->symbol,sell->symbol); requestid = quoteid = 0; - LP_myprice(&bid,&ask,buy->symbol,sell->symbol); + LP_myprice(1,&bid,&ask,buy->symbol,sell->symbol); maxprice = ask; if ( setbaserel != 0 ) { @@ -802,7 +802,7 @@ int32_t LP_portfolio_trade(void *ctx,uint32_t *requestidp,uint32_t *quoteidp,str //if ( LP_utxo_bestfit(sell->symbol,SATOSHIDEN * relvolume) != 0 ) { memset(zero.bytes,0,sizeof(zero)); - if ( (retstr2= LP_autobuy(ctx,0,"127.0.0.1",-1,buy->symbol,sell->symbol,maxprice,relvolume,60,24*3600,gui,LP_lastnonce+1,zero,1,0)) != 0 ) + if ( (retstr2= LP_autobuy(ctx,0,"127.0.0.1",-1,buy->symbol,sell->symbol,maxprice,relvolume,60,24*3600,gui,LP_lastnonce+1,zero,1,0,0,0)) != 0 ) { if ( (retjson2= cJSON_Parse(retstr2)) != 0 ) { diff --git a/iguana/exchanges/LP_prices.c b/iguana/exchanges/LP_prices.c index 0669b2c35..38d37c626 100644 --- a/iguana/exchanges/LP_prices.c +++ b/iguana/exchanges/LP_prices.c @@ -35,7 +35,7 @@ struct LP_priceinfo int32_t ind,pad; double diagval,high[2],low[2],last[2],bid[2],ask[2]; double relvals[LP_MAXPRICEINFOS]; - double myprices[LP_MAXPRICEINFOS]; + double myprices[2][LP_MAXPRICEINFOS]; double minprices[LP_MAXPRICEINFOS]; // autoprice double fixedprices[LP_MAXPRICEINFOS]; // fixedprices double buymargins[LP_MAXPRICEINFOS]; @@ -451,16 +451,16 @@ void LP_priceinfoupdate(char *base,char *rel,double price) } } -double LP_myprice(double *bidp,double *askp,char *base,char *rel) +double LP_myprice(int32_t iambob,double *bidp,double *askp,char *base,char *rel) { struct LP_priceinfo *basepp,*relpp; double val; *bidp = *askp = 0.; if ( (basepp= LP_priceinfofind(base)) != 0 && (relpp= LP_priceinfofind(rel)) != 0 ) { - *askp = basepp->myprices[relpp->ind]; + *askp = basepp->myprices[iambob][relpp->ind]; if ( LP_pricevalid(*askp) > 0 ) { - val = relpp->myprices[basepp->ind]; + val = relpp->myprices[iambob][basepp->ind]; if ( LP_pricevalid(val) > 0 ) { *bidp = 1. / val; @@ -474,7 +474,7 @@ double LP_myprice(double *bidp,double *askp,char *base,char *rel) } else { - val = relpp->myprices[basepp->ind]; + val = relpp->myprices[iambob][basepp->ind]; if ( LP_pricevalid(val) > 0 ) { *bidp = 1. / val; @@ -486,7 +486,7 @@ double LP_myprice(double *bidp,double *askp,char *base,char *rel) return(0.); } -char *LP_myprices() +char *LP_myprices(int32_t iambob) { int32_t baseid,relid; double bid,ask; char *base,*rel; cJSON *item,*array; array = cJSON_CreateArray(); @@ -496,7 +496,7 @@ char *LP_myprices() for (relid=0; relid SMALLVAL ) + if ( LP_myprice(iambob,&bid,&ask,base,rel) > SMALLVAL ) { item = cJSON_CreateObject(); jaddstr(item,"base",base); @@ -510,7 +510,7 @@ char *LP_myprices() return(jprint(array,1)); } -int32_t LP_mypriceset(int32_t *changedp,char *base,char *rel,double price) +int32_t LP_mypriceset(int32_t iambob,int32_t *changedp,char *base,char *rel,double price) { struct LP_priceinfo *basepp=0,*relpp=0; struct LP_pubkey_info *pubp; double minprice,maxprice,margin,buymargin,sellmargin; *changedp = 0; @@ -519,43 +519,46 @@ int32_t LP_mypriceset(int32_t *changedp,char *base,char *rel,double price) if ( base != 0 && rel != 0 && (basepp= LP_priceinfofind(base)) != 0 && (relpp= LP_priceinfofind(rel)) != 0 ) { - if ( price == 0. || fabs(basepp->myprices[relpp->ind] - price)/price > 0.001 ) + if ( price == 0. || fabs(basepp->myprices[iambob][relpp->ind] - price)/price > 0.001 ) *changedp = 1; - sellmargin = relpp->sellmargins[basepp->ind]; - buymargin = relpp->buymargins[basepp->ind]; - margin = (sellmargin + buymargin) * 0.5; - if ( price == 0. ) + if ( iambob != 0 ) { - relpp->minprices[basepp->ind] = 0.; - relpp->fixedprices[basepp->ind] = 0.; - relpp->buymargins[basepp->ind] = 0.; - relpp->sellmargins[basepp->ind] = 0.; - relpp->offsets[basepp->ind] = 0.; - relpp->factors[basepp->ind] = 0.; - LP_autoref_clear(base,rel); - margin = 0.; - } - else if ( (minprice= basepp->minprices[relpp->ind]) > SMALLVAL && price < minprice ) - { - //printf("%s/%s price %.8f less than minprice %.8f\n",base,rel,price,minprice); - price = minprice * (1. - margin); - } - else if ( (maxprice= relpp->minprices[basepp->ind]) > SMALLVAL ) - { - if ( price > (1. / maxprice) ) + sellmargin = relpp->sellmargins[basepp->ind]; + buymargin = relpp->buymargins[basepp->ind]; + margin = (sellmargin + buymargin) * 0.5; + if ( price == 0. ) + { + relpp->minprices[basepp->ind] = 0.; + relpp->fixedprices[basepp->ind] = 0.; + relpp->buymargins[basepp->ind] = 0.; + relpp->sellmargins[basepp->ind] = 0.; + relpp->offsets[basepp->ind] = 0.; + relpp->factors[basepp->ind] = 0.; + LP_autoref_clear(base,rel); + margin = 0.; + } + else if ( (minprice= basepp->minprices[relpp->ind]) > SMALLVAL && price < minprice ) + { + //printf("%s/%s price %.8f less than minprice %.8f\n",base,rel,price,minprice); + price = minprice * (1. - margin); + } + else if ( (maxprice= relpp->minprices[basepp->ind]) > SMALLVAL ) { - //printf("%s/%s price %.8f less than maxprice %.8f, more than %.8f\n",base,rel,price,maxprice,1./maxprice); - price = (1. / maxprice) * (1. + margin); + if ( price > (1. / maxprice) ) + { + //printf("%s/%s price %.8f less than maxprice %.8f, more than %.8f\n",base,rel,price,maxprice,1./maxprice); + price = (1. / maxprice) * (1. + margin); + } } } /*else if ( basepp->myprices[relpp->ind] > SMALLVAL ) { price = (basepp->myprices[relpp->ind] * 0.9) + (0.1 * price); }*/ - basepp->myprices[relpp->ind] = price; // ask + basepp->myprices[iambob][relpp->ind] = price; // ask //printf("LP_mypriceset base.%s rel.%s <- price %.8f\n",base,rel,price); //relpp->myprices[basepp->ind] = (1. / price); // bid, but best to do one dir at a time - if ( (pubp= LP_pubkeyadd(G.LP_mypub25519)) != 0 ) + if ( iambob != 0 && (pubp= LP_pubkeyadd(G.LP_mypub25519)) != 0 ) { pubp->timestamp = (uint32_t)time(NULL); LP_pubkey_update(pubp,basepp->ind,relpp->ind,price,0,0,0,0,0); @@ -569,12 +572,12 @@ int32_t LP_mypriceset(int32_t *changedp,char *base,char *rel,double price) return(-1); } -double LP_price(char *base,char *rel) +double LP_price(int32_t iambob,char *base,char *rel) { struct LP_priceinfo *basepp; int32_t relind; double price = 0.; if ( (basepp= LP_priceinfoptr(&relind,base,rel)) != 0 ) { - if ( (price= basepp->myprices[relind]) == 0. ) + if ( (price= basepp->myprices[iambob][relind]) == 0. ) { price = basepp->relvals[relind]; } @@ -582,19 +585,19 @@ double LP_price(char *base,char *rel) return(price); } -double LP_getmyprice(char *base,char *rel) +double LP_getmyprice(int32_t iambob,char *base,char *rel) { struct LP_priceinfo *basepp; int32_t relind; double price = 0.; if ( (basepp= LP_priceinfoptr(&relind,base,rel)) != 0 ) { - if ( (price= basepp->myprices[relind]) == 0. ) + if ( (price= basepp->myprices[iambob][relind]) == 0. ) { } } return(price); } -cJSON *LP_priceinfomatrix(int32_t usemyprices) +cJSON *LP_priceinfomatrix(int32_t iambob,int32_t usemyprices) { int32_t i,j,n,m; double total,sum,val; struct LP_priceinfo *pp; uint32_t now; struct LP_cacheinfo *ptr,*tmp; cJSON *vectorjson = cJSON_CreateObject(); now = (uint32_t)time(NULL); @@ -611,7 +614,7 @@ cJSON *LP_priceinfomatrix(int32_t usemyprices) pp->diagval = sum = n = 0; for (j=0; jmyprices[j]) == 0. ) + if ( usemyprices == 0 || (val= pp->myprices[iambob][j]) == 0. ) val = pp->relvals[j]; if ( val > SMALLVAL ) { @@ -661,7 +664,7 @@ struct LP_priceinfo *LP_priceinfoadd(char *symbol) pp->coinbits = stringbits(symbol); pp->ind = LP_numpriceinfos++; //LP_numpriceinfos++; - if ( (retjson= LP_priceinfomatrix(0)) != 0 ) + if ( (retjson= LP_priceinfomatrix(1,0)) != 0 ) free_json(retjson); return(pp); } @@ -1016,7 +1019,7 @@ int64_t LP_KMDvalue(struct iguana_info *coin,int64_t balance) KMDvalue = balance; else { - if ( (price= LP_price(coin->symbol,"KMD")) > SMALLVAL ) + if ( (price= LP_price(1,coin->symbol,"KMD")) > SMALLVAL ) KMDvalue = price * balance; } } diff --git a/iguana/exchanges/LP_privkey.c b/iguana/exchanges/LP_privkey.c index 7d5403810..95fd9b60e 100644 --- a/iguana/exchanges/LP_privkey.c +++ b/iguana/exchanges/LP_privkey.c @@ -415,6 +415,201 @@ bits256 LP_privkeycalc(void *ctx,uint8_t *pubkey33,bits256 *pubkeyp,struct iguan return(privkey); } +void verus_utxos(struct iguana_info *coin,char *coinaddr) +{ + cJSON *array,*item; char buf[64],str[65]; int32_t i,m,vout,n=0; bits256 txid; + sprintf(buf,"[%d, 99999999, [\"%s\"]]",1,coinaddr); + array = bitcoin_json(coin,"listunspent",buf); + if ( array != 0 ) + { + if ( (n= cJSON_GetArraySize(array)) > 0 ) + { + for (i=m=0; ismartaddr) != 0 ) + return(clonestr("{\"error\":\"mismatched smartaddr\"}")); + //verus_utxos(coin,coin->smartaddr); + hash = LP_getbestblockhash(coin); + memset(histo,0,sizeof(histo)); + memset(myhisto,0,sizeof(myhisto)); + num23000 = num16 = num17 = num10 = num20 = numstaked = 0; + avestakedsize = possum = powsum = supply = RTu3sum = 0.; + numpow = numpos = num = npos = npow = 0; + if ( bits256_nonz(hash) != 0 ) + { + bits256_str(hashstr,hash); + height = -1; + while ( (blockjson= LP_blockjson(&height,coin->symbol,hashstr,0)) != 0 ) + { + num++; + stakedval = 0.; + height = juint(blockjson,"height"); + if ( (txs= jarray(&n,blockjson,"tx")) != 0 ) + { + txid = jbits256i(txs,0); + value = 0; + posflag = 0; + locked = 0; + lastaddr = addr0 = ""; + memset(script,0,sizeof(script)); + memset(firstaddr,0,sizeof(firstaddr)); + memset(stakingaddr,0,sizeof(stakingaddr)); + if ( (txobj= LP_gettx("verus",coin->symbol,txid,0)) != 0 ) + { + //printf("TX.(%s)\n",jprint(txobj,0)); + if ( (vouts= jarray(&m,txobj,"vout")) != 0 ) + { + if ( (vout= jitem(vouts,0)) != 0 ) + { + value = jdouble(vout,"value"); + supply += value; + hexstr = 0; + if ( m == 2 && (vout1= jitem(vouts,1)) != 0 ) + { + // 6a2001039bbc0bb17576a9149a3af738444dd86b55c86752247aec2e7deb842688ac + if ( jdouble(vout1,"value") == 0. && (sobj= jobj(vout1,"scriptPubKey")) != 0 && (hexstr= jstr(sobj,"hex")) != 0 && strlen(hexstr) <= 88 ) + { + if ( strlen(hexstr) == 68 ) + { + decode_hex(script,34,hexstr); + bitcoin_address(coin->symbol,firstaddr,coin->taddr,coin->pubtype,&script[12],20); + //printf("%s\n",&hexstr[24]); + } + else + { + decode_hex(script,44,hexstr); + bitcoin_address(coin->symbol,firstaddr,coin->taddr,coin->pubtype,&script[10],33); + } + locked = ((int32_t)script[6] << 16) + ((int32_t)script[5] << 8) + script[4]; + addr0 = firstaddr; + } else printf("unexpected vout1.(%s) (%s).%d %.8f\n",jprint(vout1,0),hexstr!=0?hexstr:"",(int32_t)strlen(hexstr),jdouble(vout1,"value")); + } else printf("coinbase without opret (%s)\n",jprint(vouts,0)); + } + } + free_json(txobj); + } + if ( n > 1 && (txobj= LP_gettx("verus",coin->symbol,jbits256i(txs,n-1),0)) != 0 ) + { + if ( (vouts= jarray(&m,txobj,"vout")) != 0 ) + { + if ( (vout= jitem(vouts,0)) != 0 && m == 1 ) + { + if ( (sobj= jobj(vout,"scriptPubKey")) != 0 && (addresses= jarray(&z,sobj,"addresses")) != 0 ) + { + lastaddr = jstri(addresses,0); + if ( lastaddr == 0 ) + lastaddr = ""; + else + { + strcpy(stakingaddr,lastaddr); + stakedval = jdouble(vout,"value"); + avestakedsize += stakedval; + numstaked++; + //printf("stakedval %f\n",stakedval); + posflag = 1; + //printf("ht.%d found staking address.(%s) %.8f (%s)\n",height,stakingaddr,stakedval,jprint(vout,0)); + } + } else printf("no addresses[0] in (%s) %s\n",jprint(vout,0),sobj!=0?jprint(sobj,0):""); + } //else printf("n.%d m.%d no first out in lastvout.(%s)\n",n,m,jprint(txobj,0)); + } // else printf("cant find vout.(%s)\n",jprint(txobj,0)); + free_json(txobj); + } + if ( posflag != 0 ) + { + numpos++; + if ( strcmp(coinaddr,stakingaddr) == 0 || strcmp("RTu3JZZKLJTcfNwBa19dWRagEfQq49STqC",stakingaddr) == 0 ) + { + if (strcmp("RTu3JZZKLJTcfNwBa19dWRagEfQq49STqC",stakingaddr) == 0 ) + RTu3sum += value; + possum += value, npos++; + if ( num < 1500 ) + printf("ht.%-5d lock.%-7d PoS cb.(%s) stake.(%s) %.8f %.8f\n",height,locked,addr0,stakingaddr,value,stakedval); + if ( height > 23000 ) + { + char strbuf[64]; + sprintf(strbuf,"%.0f",stakedval); + if ( strcmp(strbuf,"20") == 0 ) + num20++; + else if ( strcmp(strbuf,"17") == 0 ) + num17++; + else if ( strcmp(strbuf,"16") == 0 ) + num16++; + else if ( strcmp(strbuf,"10") == 0 ) + num10++; + else printf("got strbuf.(%s)\n",strbuf); + } + } + else if ( 0 && num < 100 ) + printf("ht.%-5d lock.%-7d PoS cb.(%s) stake.(%s) %.8f %.8f\n",height,locked,addr0,stakingaddr,value,stakedval); + } + else + { + numpow++; + if ( num < 100 && strcmp(coinaddr,addr0) == 0 ) + printf("ht.%-5d lock.%-7d PoW coinbase.(%s) %.8f\n",height,locked,addr0,value); + if ( strcmp(coinaddr,addr0) == 0 ) + powsum += value, npow++; + } + histo[locked/1000] += value; + if ( strcmp(coinaddr,addr0) == 0 || strcmp("RTu3JZZKLJTcfNwBa19dWRagEfQq49STqC",addr0) == 0 ) + myhisto[locked/1000] += value; + } + bits256_str(hashstr,jbits256(blockjson,"previousblockhash")); + free_json(blockjson); + if ( height == 5040 ) + break; + else if ( height == 23000 ) + { + num23000 = num; + printf("num10.%d num16.%d num17.%d num20.%d / num23000.%d -> %.2f%% %.2f%% %.2f%% %.2f%% [%.3f %.3f %.3f %.3f] %.3f ave %.8f\n",num10,num16,num17,num20,num23000,100.*(double)num10/num23000,100.*(double)num16/num23000,100.*(double)num17/num23000,100.*(double)num20/num23000,(100.*(double)num10/num23000)/2.87,(100.*(double)num16/num23000)/10.5,(100.*(double)num17/num23000)/4.88,(100.*(double)num20/num23000)/5.74,(100.*(double)(num10+num16+num17+num20)/num23000)/24,avestakedsize/numstaked); + } + else if ( (num % 1000) == 0 || (num < 1000 && (num % 100) == 0) ) + { + printf("num.%d PoW %.2f%% %.0f %d v %d PoS %.2f%% %.0f -> %.0f supply %.0f PoW %.1f%% PoS %.1f%% both %.1f%% RTu3 %.8f %.1f%%\n",num,100.*(double)numpow/num,powsum,npow,npos,100.*(double)numpos/num,possum,powsum+possum,supply,100.*powsum/supply,100.*possum/supply,100.*(powsum+possum)/supply,RTu3sum,100.*RTu3sum/supply); + } + } + } + if ( num > 0 ) + { + if ( 0 ) + { + for (i=0; i %.8f supply %.8f PoW %.1f%% PoS %.1f%% both %.1f%% RTu3sum %.8f %.1f%%\n",num,100.*(double)numpow/num,powsum,npow,npos,100.*(double)numpos/num,possum,powsum+possum,supply,100.*powsum/supply,100.*possum/supply,100.*(powsum+possum)/supply,RTu3sum,100.*RTu3sum/supply); + printf("num10.%d num16.%d num17.%d num20.%d / num23000.%d -> %.2f%% %.2f%% %.2f%% %.2f%% [%.3f %.3f %.3f %.3f] %.3f ave %.8f\n",num10,num16,num17,num20,num23000,100.*(double)num10/num23000,100.*(double)num16/num23000,100.*(double)num17/num23000,100.*(double)num20/num23000,(100.*(double)num10/num23000)/2.87,(100.*(double)num16/num23000)/10.5,(100.*(double)num17/num23000)/4.88,(100.*(double)num20/num23000)/5.74,(100.*(double)(num10+num16+num17+num20)/num23000)/24,avestakedsize/numstaked); + } + return(clonestr("{\"result\":\"success\"}")); +} + void LP_privkey_updates(void *ctx,int32_t pubsock,char *passphrase) { struct iguana_info *coin,*tmp; bits256 pubkey,privkey; uint8_t pubkey33[33]; int32_t initonly; @@ -431,7 +626,9 @@ void LP_privkey_updates(void *ctx,int32_t pubsock,char *passphrase) coin->counter = 0; memset(coin->smartaddr,0,sizeof(coin->smartaddr)); if ( bits256_nonz(privkey) == 0 || coin->smartaddr[0] == 0 ) + { privkey = LP_privkeycalc(ctx,pubkey33,&pubkey,coin,passphrase,""); + } } //printf("i.%d of %d\n",i,LP_numcoins); else if ( IAMLP == 0 || coin->inactive == 0 ) diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index 4680274ad..615942e0a 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -248,6 +248,12 @@ cJSON *LP_gettxout(char *symbol,char *coinaddr,bits256 txid,int32_t vout) return(cJSON_Parse("{\"error\":\"no coin\"}")); if ( bits256_nonz(txid) == 0 ) return(cJSON_Parse("{\"error\":\"null txid\"}")); + if ( (tx= LP_transactionfind(coin,txid)) != 0 && vout < tx->numvouts ) + { + if ( tx->outpoints[vout].spendheight > 0 ) + return(0); + //return(LP_gettxout_json(txid,vout,tx->height,tx->outpoints[vout].coinaddr,tx->outpoints[vout].value)); + } if ( coin->electrum == 0 ) { sprintf(buf,"[\"%s\", %d, true]",bits256_str(str,txid),vout); @@ -255,12 +261,6 @@ cJSON *LP_gettxout(char *symbol,char *coinaddr,bits256 txid,int32_t vout) } else { - if ( (tx= LP_transactionfind(coin,txid)) != 0 && vout < tx->numvouts ) - { - if ( tx->outpoints[vout].spendheight > 0 ) - return(0); - //return(LP_gettxout_json(txid,vout,tx->height,tx->outpoints[vout].coinaddr,tx->outpoints[vout].value)); - } if ( coinaddr[0] == 0 ) { if ( (txobj= electrum_transaction(&height,symbol,coin->electrum,&txobj,txid,0)) != 0 ) @@ -750,7 +750,9 @@ again: } if ( strcmp(coin->estimatefeestr,"estimatesmartfee") == 0 && (rate= jdouble(errjson,"feerate")) != 0 ) { - printf("extracted feerate %.8f from estimatesmartfee\n",rate); + static uint32_t counter; + if ( counter++ < 10 ) + printf("extracted feerate %.8f from estimatesmartfee\n",rate); rate /= 1024.; } free_json(errjson); @@ -791,19 +793,19 @@ double LP_getestimatedrate(struct iguana_info *coin) return(rate); } -char *LP_sendrawtransaction(char *symbol,char *signedtx) +char *LP_sendrawtransaction(char *symbol,char *signedtx,int32_t needjson) { cJSON *array,*errobj; char *paramstr,*tmpstr,*retstr=0; int32_t n,alreadyflag = 0; cJSON *retjson; struct iguana_info *coin; if ( symbol == 0 || symbol[0] == 0 || signedtx == 0 || signedtx[0] == 0 ) { printf("LP_sendrawtransaction null symbol %p or signedtx.%p\n",symbol,signedtx); - return(0); + return(clonestr("{\"error\":\"invalid param\"}")); } coin = LP_coinfind(symbol); if ( coin == 0 ) { printf("LP_sendrawtransaction null coin\n"); - return(0); + return(clonestr("{\"error\":\"invalid coin\"}")); } if ( coin->electrum == 0 ) { @@ -844,6 +846,14 @@ char *LP_sendrawtransaction(char *symbol,char *signedtx) } } } + if ( needjson != 0 && is_hexstr(retstr,0) > 0 ) + { + retjson = cJSON_CreateObject(); + jaddstr(retjson,"result","success"); + jaddstr(retjson,"txid",retstr); + free(retstr); + retstr = jprint(retjson,1); + } return(retstr); } @@ -1022,12 +1032,13 @@ uint32_t LP_heighttime(char *symbol,int32_t height) cJSON *LP_blockjson(int32_t *heightp,char *symbol,char *blockhashstr,int32_t height) { cJSON *json = 0; int32_t flag = 0; struct iguana_info *coin; + *heightp = 0; if ( symbol == 0 || symbol[0] == 0 ) return(cJSON_Parse("{\"error\":\"null symbol\"}")); coin = LP_coinfind(symbol); if ( coin == 0 || coin->electrum != 0 ) { - printf("unexpected electrum path for %s\n",symbol); + //printf("unexpected electrum path for %s\n",symbol); return(0); } if ( blockhashstr == 0 ) diff --git a/iguana/exchanges/LP_scan.c b/iguana/exchanges/LP_scan.c index 1229c2782..52edf5943 100644 --- a/iguana/exchanges/LP_scan.c +++ b/iguana/exchanges/LP_scan.c @@ -23,7 +23,7 @@ int32_t LP_blockinit(struct iguana_info *coin,int32_t height) { int32_t i,iter,numtx,checkht=-1; cJSON *blockobj,*txs,*txobj; bits256 txid; struct LP_transaction *tx; portable_mutex_lock(&LP_blockinit_mutex); - if ( (blockobj= LP_blockjson(&checkht,coin->symbol,0,height)) != 0 && checkht == height ) + if ( (blockobj= LP_blockjson(&checkht,coin->symbol,0,height)) != 0 && (checkht == 0 || checkht == height) ) { if ( (txs= jarray(&numtx,blockobj,"tx")) != 0 ) { @@ -54,9 +54,10 @@ int32_t LP_blockinit(struct iguana_info *coin,int32_t height) free_json(blockobj); } portable_mutex_unlock(&LP_blockinit_mutex); - if ( checkht == height ) + if ( checkht == 0 || checkht == height ) return(0); - else return(-1); + printf("%s blockinit error checkht.%d vs height.%d\n",ASSETCHAINS_SYMBOL,checkht,height); + return(-1); } int32_t LP_scanblockchain(struct iguana_info *coin,int32_t startheight,int32_t endheight) diff --git a/iguana/exchanges/LP_secp.c b/iguana/exchanges/LP_secp.c index edfdee35b..befe759d2 100644 --- a/iguana/exchanges/LP_secp.c +++ b/iguana/exchanges/LP_secp.c @@ -97,7 +97,7 @@ int32_t bitcoin_sign(void *ctx,char *symbol,uint8_t *sig,bits256 txhash2,bits256 printf("bitcoin_sign illegal privkey\n"); return(-1); } - if ( strcmp(symbol,"BCH") == 0 || strcmp(symbol,"BTG") == 0 ) + if ( strcmp(symbol,"BCH") == 0 || strcmp(symbol,"BTG") == 0 || strcmp(symbol,"CMM") == 0 ) { //char str[65]; printf("BCH/BTG deterministic signature %s\n",bits256_str(str,txhash2)); funcp = 0; diff --git a/iguana/exchanges/LP_signatures.c b/iguana/exchanges/LP_signatures.c index 2c45e53ce..40228f796 100644 --- a/iguana/exchanges/LP_signatures.c +++ b/iguana/exchanges/LP_signatures.c @@ -19,7 +19,7 @@ // marketmaker // -struct basilisk_request *LP_requestinit(struct basilisk_request *rp,bits256 srchash,bits256 desthash,char *src,uint64_t srcsatoshis,char *dest,uint64_t destsatoshis,uint32_t timestamp,uint32_t quotetime,int32_t DEXselector) +struct basilisk_request *LP_requestinit(struct basilisk_request *rp,bits256 srchash,bits256 desthash,char *src,uint64_t srcsatoshis,char *dest,uint64_t destsatoshis,uint32_t timestamp,uint32_t quotetime,int32_t DEXselector,int32_t fillflag,int32_t gtcflag) { struct basilisk_request R; memset(rp,0,sizeof(*rp)); @@ -45,6 +45,14 @@ cJSON *LP_quotejson(struct LP_quoteinfo *qp) if ( jobj(retjson,"gui") == 0 ) jaddstr(retjson,"gui",qp->gui[0] != 0 ? qp->gui : LP_gui); jaddstr(retjson,"uuid",qp->uuidstr); + if ( qp->maxprice != 0 ) + jaddnum(retjson,"maxprice",qp->maxprice); + if ( qp->mpnet != 0 ) + jaddnum(retjson,"mpnet",qp->mpnet); + if ( qp->gtc != 0 ) + jaddnum(retjson,"gtc",qp->gtc); + if ( qp->fill != 0 ) + jaddnum(retjson,"fill",qp->fill); jadd64bits(retjson,"aliceid",qp->aliceid); jaddnum(retjson,"tradeid",qp->tradeid); jaddstr(retjson,"base",qp->srccoin); @@ -113,6 +121,10 @@ int32_t LP_quoteparse(struct LP_quoteinfo *qp,cJSON *argjson) { uint32_t rid,qid; char etomic[64],activesymbol[65],*etomicstr; memset(qp,0,sizeof(*qp)); + qp->maxprice = jdouble(argjson,"maxprice"); + qp->mpnet = juint(argjson,"mpnet"); + qp->gtc = juint(argjson,"gtc"); + qp->fill = juint(argjson,"fill"); safecopy(qp->gui,LP_gui,sizeof(qp->gui)); safecopy(qp->srccoin,jstr(argjson,"base"),sizeof(qp->srccoin)); safecopy(qp->uuidstr,jstr(argjson,"uuid"),sizeof(qp->uuidstr)); @@ -152,9 +164,9 @@ int32_t LP_quoteparse(struct LP_quoteinfo *qp,cJSON *argjson) qp->destvout = jint(argjson,"destvout"); qp->desthash = jbits256(argjson,"desthash"); qp->txfee = j64bits(argjson,"txfee"); - if ( (qp->satoshis= j64bits(argjson,"satoshis")) > qp->txfee ) + if ( (qp->satoshis= j64bits(argjson,"satoshis")) > qp->txfee && fabs(qp->maxprice) < SMALLVAL ) { - //qp->price = (double)qp->destsatoshis / (qp->satoshis = qp->txfee); + qp->maxprice = (double)qp->destsatoshis / (qp->satoshis - qp->txfee); } qp->destsatoshis = j64bits(argjson,"destsatoshis"); qp->desttxfee = j64bits(argjson,"desttxfee"); @@ -717,13 +729,20 @@ void LP_query(void *ctx,char *myipaddr,int32_t mypubsock,char *method,struct LP_ jadd(reqjson,"proof",LP_instantdex_txids(0,coin->smartaddr)); } msg = jprint(reqjson,1); - //printf("QUERY.(%s)\n",msg); - if ( IPC_ENDPOINT >= 0 ) - LP_queuecommand(0,msg,IPC_ENDPOINT,-1,0); - memset(&zero,0,sizeof(zero)); - if ( bits256_nonz(qp->srchash) != 0 ) - LP_reserved_msg(1,qp->srccoin,qp->destcoin,qp->srchash,clonestr(msg)); - LP_reserved_msg(1,qp->srccoin,qp->destcoin,zero,clonestr(msg)); + { + //printf("QUERY.(%s)\n",msg); + if ( IPC_ENDPOINT >= 0 ) + LP_queuecommand(0,msg,IPC_ENDPOINT,-1,0); + memset(&zero,0,sizeof(zero)); + LP_reserved_msg(1,qp->srccoin,qp->destcoin,zero,clonestr(msg)); + //if ( bits256_nonz(qp->srchash) != 0 ) + { + sleep(1); + LP_reserved_msg(1,qp->srccoin,qp->destcoin,qp->srchash,clonestr(msg)); + } + } + if ( strcmp(method,"connect") == 0 && qp->mpnet != 0 && qp->gtc == 0 ) + LP_mpnet_send(0,msg,1,qp->coinaddr); free(msg); } diff --git a/iguana/exchanges/LP_socket.c b/iguana/exchanges/LP_socket.c index b8e74e84c..f7dcca929 100644 --- a/iguana/exchanges/LP_socket.c +++ b/iguana/exchanges/LP_socket.c @@ -25,6 +25,83 @@ #define WIN32_LEAN_AND_MEAN #include #endif +#ifdef _WIN32 +#include +#endif + +int32_t set_blocking_mode(int32_t sock,int32_t is_blocking) // from https://stackoverflow.com/questions/2149798/how-to-reset-a-socket-back-to-blocking-mode-after-i-set-it-to-nonblocking-mode?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa +{ + int32_t ret; +#ifdef _WIN32 + /// @note windows sockets are created in blocking mode by default + // currently on windows, there is no easy way to obtain the socket's current blocking mode since WSAIsBlocking was deprecated + u_long non_blocking = is_blocking ? 0 : 1; + ret = (NO_ERROR == ioctlsocket(sock,FIONBIO,&non_blocking)); +#else + const int flags = fcntl(sock, F_GETFL, 0); + if ((flags & O_NONBLOCK) && !is_blocking) { fprintf(stderr,"set_blocking_mode(): socket was already in non-blocking mode\n"); return ret; } + if (!(flags & O_NONBLOCK) && is_blocking) { fprintf(stderr,"set_blocking_mode(): socket was already in blocking mode\n"); return ret; } + ret = (0 == fcntl(sock, F_SETFL, is_blocking ? (flags ^ O_NONBLOCK) : (flags | O_NONBLOCK))); +#endif + if ( ret == 0 ) + return(-1); + else return(0); +} + +int32_t komodo_connect(int32_t sock,struct sockaddr *saddr,socklen_t addrlen) +{ + struct timeval tv; fd_set wfd,efd; int32_t res,so_error; socklen_t len; +#ifdef _WIN32 + set_blocking_mode(sock, 0); +#else + fcntl(sock, F_SETFL, O_NONBLOCK); +#endif // _WIN32 + res = connect(sock,saddr,addrlen); + + if ( res == -1 ) + { +#ifdef _WIN32 + // https://msdn.microsoft.com/en-us/library/windows/desktop/ms737625%28v=vs.85%29.aspx - read about WSAEWOULDBLOCK return + errno = WSAGetLastError(); + printf("[Decker] errno.%d --> ", errno); + if ( errno != EINPROGRESS && errno != WSAEWOULDBLOCK ) // connect failed, do something... +#else + if ( errno != EINPROGRESS ) // connect failed, do something... +#endif + { + printf("close socket ...\n"); + closesocket(sock); + return(-1); + } + //printf("continue with select ...\n"); + FD_ZERO(&wfd); + FD_SET(sock,&wfd); + FD_ZERO(&efd); + FD_SET(sock,&efd); + tv.tv_sec = 10; + tv.tv_usec = 0; + res = select(sock+1,NULL,&wfd,&efd,&tv); + if ( res == -1 ) // select failed, do something... + { + closesocket(sock); + return(-1); + } + if ( res == 0 ) // connect timed out... + { + closesocket(sock); + return(-1); + } + if ( FD_ISSET(sock,&efd) ) + { + // connect failed, do something... + getsockopt(sock,SOL_SOCKET,SO_ERROR,&so_error,&len); + closesocket(sock); + return(-1); + } + } + set_blocking_mode(sock,1); + return(0); +} int32_t LP_socket(int32_t bindflag,char *hostname,uint16_t port) { @@ -124,25 +201,35 @@ int32_t LP_socket(int32_t bindflag,char *hostname,uint16_t port) #endif if ( bindflag == 0 ) { - //printf("call connect sock.%d\n",sock); - result = connect(sock,(struct sockaddr *)&saddr,addrlen); - //printf("called connect result.%d\n",result); - timeout.tv_sec = 2; - timeout.tv_usec = 0; - setsockopt(sock,SOL_SOCKET,SO_RCVTIMEO,(void *)&timeout,sizeof(timeout)); - if ( result != 0 ) +//#ifdef _WIN32 + if ( 1 ) // connect using async to allow timeout, then switch to sync { - if ( errno != ECONNRESET && errno != ENOTCONN && errno != ECONNREFUSED && errno != ETIMEDOUT && errno != EHOSTUNREACH ) + uint32_t starttime = (uint32_t)time(NULL); + //printf("call connect sock.%d\n",sock); + result = komodo_connect(sock,(struct sockaddr *)&saddr,addrlen); + //printf("called connect result.%d lag.%d\n",result,(int32_t)(time(NULL) - starttime)); + if ( result < 0 ) + return(-1); + timeout.tv_sec = 10; + timeout.tv_usec = 0; + setsockopt(sock,SOL_SOCKET,SO_RCVTIMEO,(void *)&timeout,sizeof(timeout)); + } +//#else + else + { + result = connect(sock,(struct sockaddr *)&saddr,addrlen); + if ( result != 0 ) { - //printf("%s(%s) port.%d failed: %s sock.%d. errno.%d\n",bindflag!=0?"bind":"connect",hostname,port,strerror(errno),sock,errno); + if ( errno != ECONNRESET && errno != ENOTCONN && errno != ECONNREFUSED && errno != ETIMEDOUT && errno != EHOSTUNREACH ) + { + //printf("%s(%s) port.%d failed: %s sock.%d. errno.%d\n",bindflag!=0?"bind":"connect",hostname,port,strerror(errno),sock,errno); + } + if ( sock >= 0 ) + closesocket(sock); + return(-1); } - if ( sock >= 0 ) - closesocket(sock); - return(-1); } - timeout.tv_sec = 10; - timeout.tv_usec = 0; - setsockopt(sock,SOL_SOCKET,SO_RCVTIMEO,(void *)&timeout,sizeof(timeout)); +//#endif } else { @@ -422,7 +509,7 @@ cJSON *electrum_submit(char *symbol,struct electrum_info *ep,cJSON **retjsonp,ch { *retjsonp = 0; sprintf(stratumreq,"{ \"jsonrpc\":\"2.0\", \"id\": %u, \"method\":\"%s\", \"params\": %s }\n",ep->stratumid,method,params); -//printf("%s %s",symbol,stratumreq); +//printf("timeout.%d exp.%d %s %s",timeout,(int32_t)(expiration-time(NULL)),symbol,stratumreq); memset(ep->buf,0,ep->bufsize); sitem = electrum_sitem(ep,stratumreq,timeout,retjsonp); portable_mutex_lock(&ep->mutex); // this helps performance! @@ -489,7 +576,7 @@ cJSON *electrum_hasharg(char *symbol,struct electrum_info *ep,cJSON **retjsonp,c char params[128],str[65]; cJSON *retjson; if ( retjsonp == 0 ) retjsonp = &retjson; - sprintf(params,"[\"%s\"]",bits256_str(str,arg)); + sprintf(params,"[\"%s\", true]",bits256_str(str,arg)); return(electrum_submit(symbol,ep,retjsonp,method,params,timeout)); } diff --git a/iguana/exchanges/LP_statemachine.c b/iguana/exchanges/LP_statemachine.c index 9268e2674..8127a6b0b 100644 --- a/iguana/exchanges/LP_statemachine.c +++ b/iguana/exchanges/LP_statemachine.c @@ -3645,7 +3645,7 @@ if ( LP_pricevalid(price) > 0 ) { LP_query(ctx,myipaddr,mypubsock,"connect",qp); //price = LP_pricecache(qp,qp->srccoin,qp->destcoin,qp->txid,qp->vout); - LP_requestinit(&qp->R,qp->srchash,qp->desthash,qp->srccoin,qp->satoshis-2*qp->txfee,qp->destcoin,qp->destsatoshis-2*qp->desttxfee,qp->timestamp,qp->quotetime,DEXselector); + LP_requestinit(&qp->R,qp->srchash,qp->desthash,qp->srccoin,qp->satoshis-2*qp->txfee,qp->destcoin,qp->destsatoshis-2*qp->desttxfee,qp->timestamp,qp->quotetime,DEXselector,qp->fill,qp->gtc); while ( time(NULL) < expiration ) { if ( aliceutxo->S.swap != 0 ) diff --git a/iguana/exchanges/LP_swap.c b/iguana/exchanges/LP_swap.c index c28f06495..74316972b 100644 --- a/iguana/exchanges/LP_swap.c +++ b/iguana/exchanges/LP_swap.c @@ -888,7 +888,16 @@ void LP_bobloop(void *_swap) } } LP_unavailableset(swap->bobpayment.utxotxid,swap->bobpayment.utxovout,(uint32_t)time(NULL)+60,swap->I.otherhash); - if ( error == 0 && LP_waitfor(swap->N.pair,swap,alicewaittimeout,LP_verify_alicepayment) < 0 ) + m = swap->I.bobconfirms; + while ( (n= LP_numconfirms(bobstr,swap->bobdeposit.I.destaddr,swap->bobdeposit.I.signedtxid,0,1)) < m ) + { + LP_swap_critical = (uint32_t)time(NULL); + LP_unavailableset(swap->bobpayment.utxotxid,swap->bobpayment.utxovout,(uint32_t)time(NULL)+60,swap->I.otherhash); + char str[65];printf("%d wait for bobdeposit %s numconfs.%d %s %s\n",n,swap->bobdeposit.I.destaddr,m,bobstr,bits256_str(str,swap->bobdeposit.I.signedtxid)); + sleep(10); + } + printf("wait for alicepayment\n"); + if ( error == 0 && LP_waitfor(swap->N.pair,swap,bobwaittimeout + alicewaittimeout,LP_verify_alicepayment) < 0 ) { error = 1; err = -2006, printf("error waiting for alicepayment\n"); @@ -901,6 +910,7 @@ void LP_bobloop(void *_swap) else { m = swap->I.aliceconfirms; + LP_unavailableset(swap->bobpayment.utxotxid,swap->bobpayment.utxovout,(uint32_t)time(NULL)+60,swap->I.otherhash); while ( (n= LP_numconfirms(alicestr,swap->alicepayment.I.destaddr,swap->alicepayment.I.signedtxid,0,1)) < m ) // sync with alice { LP_unavailableset(swap->bobpayment.utxotxid,swap->bobpayment.utxovout,(uint32_t)time(NULL)+60,swap->I.otherhash); @@ -939,6 +949,7 @@ void LP_bobloop(void *_swap) void LP_aliceloop(void *_swap) { uint8_t *data; char bobstr[65],alicestr[65]; int32_t bobwaittimeout,alicewaittimeout,maxlen,n,m,err=0; uint32_t expiration; struct basilisk_swap *swap = _swap; + LP_alicequery_clear(); G.LP_pendingswaps++; LP_etomicsymbol(bobstr,swap->I.bobtomic,swap->I.bobstr); LP_etomicsymbol(alicestr,swap->I.alicetomic,swap->I.alicestr); @@ -973,6 +984,7 @@ void LP_aliceloop(void *_swap) while ( (n= LP_numconfirms(bobstr,swap->bobdeposit.I.destaddr,swap->bobdeposit.I.signedtxid,0,1)) < m ) { LP_swap_critical = (uint32_t)time(NULL); + LP_unavailableset(swap->alicepayment.utxotxid,swap->alicepayment.utxovout,(uint32_t)time(NULL)+60,swap->I.otherhash); char str[65];printf("%d wait for bobdeposit %s numconfs.%d %s %s\n",n,swap->bobdeposit.I.destaddr,m,bobstr,bits256_str(str,swap->bobdeposit.I.signedtxid)); sleep(10); } @@ -999,6 +1011,7 @@ void LP_aliceloop(void *_swap) char str[65];printf("%d wait for bobpayment %s numconfs.%d %s %s\n",n,swap->bobpayment.I.destaddr,swap->I.bobconfirms,bobstr,bits256_str(str,swap->bobpayment.I.signedtxid)); sleep(10); } + char str[65];printf("%d waited for bobpayment %s numconfs.%d %s %s\n",n,swap->bobpayment.I.destaddr,swap->I.bobconfirms,bobstr,bits256_str(str,swap->bobpayment.I.signedtxid)); if ( swap->N.pair >= 0 ) nn_close(swap->N.pair), swap->N.pair = -1; } diff --git a/iguana/exchanges/LP_tradebots.c b/iguana/exchanges/LP_tradebots.c index 3e14102ab..bf02fd44e 100644 --- a/iguana/exchanges/LP_tradebots.c +++ b/iguana/exchanges/LP_tradebots.c @@ -338,7 +338,7 @@ void LP_tradebot_timeslice(void *ctx,struct LP_tradebot *bot) { if ( remaining < 0.001 ) break; - if ( (retstr= LP_autobuy(ctx,0,LP_myipaddr,LP_mypubsock,bot->base,bot->rel,bot->maxprice,remaining/i,0,0,G.gui,0,destpubkey,tradeid,0)) != 0 ) + if ( (retstr= LP_autobuy(ctx,0,LP_myipaddr,LP_mypubsock,bot->base,bot->rel,bot->maxprice,remaining/i,0,0,G.gui,0,destpubkey,tradeid,0,0,0)) != 0 ) { if ( (retjson2= cJSON_Parse(retstr)) != 0 ) { diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 826a7f1e2..f7352fe36 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -122,7 +122,7 @@ bits256 LP_broadcast(char *txname,char *symbol,char *txbytes,bits256 expectedtxi //char str[65]; printf("LP_broadcast.%d %s (%s) %s i.%d sentflag.%d %s\n",i,txname,symbol,bits256_str(str,expectedtxid),i,sentflag,txbytes); if ( sentflag == 0 && LP_gettx_presence(0,symbol,expectedtxid,0) != 0 ) sentflag = 1; - if ( sentflag == 0 && (retstr= LP_sendrawtransaction(symbol,txbytes)) != 0 ) + if ( sentflag == 0 && (retstr= LP_sendrawtransaction(symbol,txbytes,0)) != 0 ) { if ( is_hexstr(retstr,0) == 64 ) { @@ -427,7 +427,7 @@ int32_t bitcoin_verifyvins(void *ctx,char *symbol,uint8_t taddr,uint8_t pubtype, vpnstr[0] = 0; *signedtx = 0; memset(signedtxidp,0,sizeof(*signedtxidp)); -//printf("bitcoin_verifyvins numvins.%d numvouts.%d signtx.%d privkey.%d M.%d N.%d\n",msgtx->tx_in,numvouts,signtx,bits256_nonz(V[0].signers[0].privkey),V[0].M,V[0].N); +//printf("bitcoin_verifyvins suppress.%d numvins.%d numvouts.%d signtx.%d privkey.%d M.%d N.%d\n",suppress_pubkeys,msgtx->tx_in,numvouts,signtx,bits256_nonz(V[0].signers[0].privkey),V[0].M,V[0].N); for (vini=0; vinitx_in; vini++) { if ( V->p2shscript[0] != 0 && V->p2shlen != 0 ) @@ -1073,7 +1073,7 @@ int32_t LP_vins_select(void *ctx,struct iguana_info *coin,int64_t *totalp,int64_ if ( utxovout == up->U.vout && bits256_cmp(utxotxid,up->U.txid) == 0 ) { preselected[numpre++] = up; - printf("found utxotxid in slot.%d\n",j); + //printf("found utxotxid in slot.%d\n",j); utxos[j] = 0; continue; } @@ -1117,7 +1117,7 @@ int32_t LP_vins_select(void *ctx,struct iguana_info *coin,int64_t *totalp,int64_ preselected[numpre++] = up; else { - printf("couldnt add address_utxo after not finding\n"); + printf("couldnt add address_utxo %s/v%d after not finding\n",bits256_str(str,utxotxid),utxovout); sleep(1); value = LP_txvalue(0,coin->symbol,utxotxid,utxovout); LP_address_utxoadd(0,(uint32_t)time(NULL),"withdraw",coin,coin->smartaddr,utxotxid,utxovout,value,1,-1); @@ -1205,7 +1205,7 @@ int32_t LP_vins_select(void *ctx,struct iguana_info *coin,int64_t *totalp,int64_ char str[65]; printf("%s/%d %.8f hodl interest %.8f -> sum %.8f\n",bits256_str(str,up->U.txid),up->U.vout,dstr(up->U.value),dstr(interest),dstr(interestsum)); } } - printf("numunspents.%d vini.%d value %.8f, total %.8f remains %.8f interest %.8f sum %.8f %s/v%d\n",numunspents,n,dstr(up->U.value),dstr(total),dstr(remains),dstr(interest),dstr(interestsum),bits256_str(str,up->U.txid),up->U.vout); + //printf("suppress.%d numunspents.%d vini.%d value %.8f, total %.8f remains %.8f interest %.8f sum %.8f %s/v%d\n",suppress_pubkeys,numunspents,n,dstr(up->U.value),dstr(total),dstr(remains),dstr(interest),dstr(interestsum),bits256_str(str,up->U.txid),up->U.vout); vp = &V[n++]; vp->N = vp->M = 1; vp->signers[0].privkey = privkey; @@ -1227,7 +1227,7 @@ int32_t LP_vins_select(void *ctx,struct iguana_info *coin,int64_t *totalp,int64_ return(n); } -char *LP_createrawtransaction(cJSON **txobjp,int32_t *numvinsp,struct iguana_info *coin,struct vin_info *V,int32_t max,bits256 privkey,cJSON *outputs,cJSON *vins,cJSON *privkeys,int64_t txfee,bits256 utxotxid,int32_t utxovout,uint32_t locktime,char *opretstr,char *passphrase) +char *LP_createrawtransaction(cJSON **txobjp,int32_t *numvinsp,struct iguana_info *coin,struct vin_info *V,int32_t max,bits256 privkey,cJSON *outputs,cJSON *vins,cJSON *privkeys,int64_t txfee,bits256 utxotxid,int32_t utxovout,int32_t onevin,uint32_t locktime,char *opretstr,char *passphrase) { static void *ctx; cJSON *txobj,*item; uint8_t addrtype,rmd160[20],data[8192+64],script[8192],spendscript[256]; char *coinaddr,*rawtxbytes,*scriptstr; bits256 txid; uint32_t crc32,timestamp; int64_t change=0,adjust=0,total,value,amount = 0; int32_t origspendlen=0,i,offset,len,dustcombine,scriptlen,spendlen,suppress_pubkeys,ignore_cltverr,numvouts=0,numvins=0,numutxos=0; struct LP_address_utxo *utxos[LP_MAXVINS*256]; struct LP_address *ap; @@ -1284,18 +1284,38 @@ char *LP_createrawtransaction(cJSON **txobjp,int32_t *numvinsp,struct iguana_inf return(0); } memset(utxos,0,sizeof(utxos)); - if ( (numutxos= LP_address_utxo_ptrs(coin,0,utxos,(int32_t)(sizeof(utxos)/sizeof(*utxos)),ap,coin->smartaddr)) <= 0 ) + //char str[65]; + if ( onevin != 0 ) { - if ( bits256_nonz(utxotxid) == 0 ) + if ( (txobj= LP_gettxout(coin->symbol,coin->smartaddr,utxotxid,utxovout)) != 0 ) + { + struct LP_address_utxo U; + memset(&U,0,sizeof(U)); + utxos[0] = &U; + utxos[0]->U.txid = utxotxid; + utxos[0]->U.vout = utxovout; + utxos[0]->U.value = LP_value_extract(txobj,0,utxotxid); + free_json(txobj); + //char str[65]; printf("add onevin %s/v%d %.8f\n",bits256_str(str,utxotxid),utxovout,dstr(utxos[0]->U.value)); + numutxos = 1; + } + else { - printf("LP_createrawtransaction: address_utxo_ptrs %d, error\n",numutxos); + printf("LP_createrawtransaction: onevin spent already\n"); return(0); } } - //char str[65]; - //for (i=0; iU.txid),utxos[i]->U.vout,dstr(utxos[i]->U.value)); - + else + { + if ( (numutxos= LP_address_utxo_ptrs(coin,0,utxos,(int32_t)(sizeof(utxos)/sizeof(*utxos)),ap,coin->smartaddr)) <= 0 ) + { + if ( bits256_nonz(utxotxid) == 0 ) + { + printf("LP_createrawtransaction: address_utxo_ptrs %d, error\n",numutxos); + return(0); + } + } + } ignore_cltverr = 0; suppress_pubkeys = 1; scriptlen = bitcoin_standardspend(script,0,G.LP_myrmd160); @@ -1717,7 +1737,7 @@ char *LP_txblast(struct iguana_info *coin,cJSON *argjson) { if ( broadcast != 0 ) { - if ( (signret= LP_sendrawtransaction(coin->symbol,signedtx)) != 0 ) + if ( (signret= LP_sendrawtransaction(coin->symbol,signedtx,0)) != 0 ) { printf("LP_txblast.%s broadcast (%s) vs %s\n",coin->symbol,bits256_str(str,signedtxid),signret); if ( is_hexstr(signret,0) == 64 ) @@ -1779,7 +1799,7 @@ char *LP_txblast(struct iguana_info *coin,cJSON *argjson) char *LP_withdraw(struct iguana_info *coin,cJSON *argjson) { static void *ctx; - int32_t broadcast,allocated_outputs=0,iter,i,num,utxovout,autofee,completed=0,maxV,numvins,numvouts,datalen,suppress_pubkeys; bits256 privkey; struct LP_address *ap; char changeaddr[64],vinaddr[64],str[65],*signret,*signedtx=0,*rawtx=0; struct vin_info *V; uint32_t locktime; cJSON *retjson,*item,*outputs,*vins=0,*txobj=0,*privkeys=0; struct iguana_msgtx msgtx; bits256 utxotxid,signedtxid; uint64_t txfee=0,newtxfee=10000; + int32_t broadcast,allocated_outputs=0,iter,i,num,utxovout,autofee,completed=0,maxV,numvins,numvouts,datalen,suppress_pubkeys; bits256 privkey; struct LP_address *ap; char changeaddr[64],vinaddr[64],str[65],wifstr[64],*signret,*signedtx=0,*rawtx=0; struct vin_info *V; uint32_t locktime; cJSON *retjson,*item,*outputs,*vins=0,*txobj=0,*privkeys=0; struct iguana_msgtx msgtx; bits256 utxotxid,signedtxid; uint64_t txfee=0,newtxfee=10000; //printf("withdraw.%s %s\n",coin->symbol,jprint(argjson,0)); if ( coin->etomic[0] != 0 ) { @@ -1811,6 +1831,7 @@ char *LP_withdraw(struct iguana_info *coin,cJSON *argjson) locktime = juint(argjson,"locktime"); txfee = juint(argjson,"txfee"); autofee = (strcmp(coin->symbol,"BTC") == 0); + //printf("LP_withdraw: %s/v%d %s\n",bits256_str(str,utxotxid),utxovout,jprint(outputs,0)); if ( txfee == 0 ) { autofee = 1; @@ -1832,18 +1853,33 @@ char *LP_withdraw(struct iguana_info *coin,cJSON *argjson) vins = cJSON_CreateArray(); memset(V,0,sizeof(*V) * maxV); numvins = 0; - if ( (rawtx= LP_createrawtransaction(&txobj,&numvins,coin,V,maxV,privkey,outputs,vins,privkeys,iter == 0 ? txfee : newtxfee,utxotxid,utxovout,locktime,jstr(argjson,"opreturn"),jstr(argjson,"passphrase"))) != 0 ) + if ( (rawtx= LP_createrawtransaction(&txobj,&numvins,coin,V,maxV,privkey,outputs,vins,privkeys,iter == 0 ? txfee : newtxfee,utxotxid,utxovout,jint(argjson,"onevin"),locktime,jstr(argjson,"opreturn"),jstr(argjson,"passphrase"))) != 0 ) { completed = 0; memset(&msgtx,0,sizeof(msgtx)); memset(signedtxid.bytes,0,sizeof(signedtxid)); - if ( (completed= iguana_signrawtransaction(ctx,coin->symbol,coin->wiftaddr,coin->taddr,coin->pubtype,coin->p2shtype,coin->isPoS,coin->longestchain,&msgtx,&signedtx,&signedtxid,V,numvins,rawtx,vins,privkeys,coin->zcash)) < 0 ) - printf("couldnt sign withdraw %s\n",bits256_str(str,signedtxid)); - else if ( completed == 0 ) + if ( jint(argjson,"onevin") != 0 ) { - printf("incomplete signing withdraw (%s)\n",jprint(vins,0)); - if ( signedtx != 0 ) - free(signedtx), signedtx = 0; + V[0].suppress_pubkeys = 1; + bitcoin_priv2wif(coin->symbol,coin->wiftaddr,wifstr,privkey,coin->wiftype); + if ( (signedtx= bitcoin_signrawtransaction(&completed,&signedtxid,coin,rawtx,wifstr)) != 0 && completed == 0 ) + { + printf("incomplete signing\n"); + free(signedtx); + signedtx = 0; + } + } + else + { + //printf("created V[0].suppress %d\n",V[0].suppress_pubkeys); + if ( (completed= iguana_signrawtransaction(ctx,coin->symbol,coin->wiftaddr,coin->taddr,coin->pubtype,coin->p2shtype,coin->isPoS,coin->longestchain,&msgtx,&signedtx,&signedtxid,V,numvins,rawtx,vins,privkeys,coin->zcash)) < 0 ) + printf("couldnt sign withdraw %s\n",bits256_str(str,signedtxid)); + else if ( completed == 0 ) + { + printf("incomplete signing withdraw (%s)\n",jprint(vins,0)); + if ( signedtx != 0 ) + free(signedtx), signedtx = 0; + } } if ( signedtx == 0 ) break; @@ -1851,7 +1887,7 @@ char *LP_withdraw(struct iguana_info *coin,cJSON *argjson) if ( autofee != 0 && iter == 0 && strcmp(coin->symbol,"BTC") == 0 ) { txfee = newtxfee = LP_txfeecalc(coin,0,datalen); - printf("txfee %.8f -> newtxfee %.8f, numvins.%d\n",dstr(txfee),dstr(newtxfee),numvins); + printf("txfee %.8f -> newtxfee %.8f, numvins.%d datalen.%d\n",dstr(txfee),dstr(newtxfee),numvins,datalen); for (i=0; isymbol,signedtx)) != 0 ) + if ( (signret= LP_sendrawtransaction(coin->symbol,signedtx,0)) != 0 ) { printf("LP_withdraw.%s %s -> %s (%s)\n",coin->symbol,jprint(argjson,0),bits256_str(str,signedtxid),signret); free(signret); @@ -1914,7 +1950,7 @@ char *LP_withdraw(struct iguana_info *coin,cJSON *argjson) char *LP_autosplit(struct iguana_info *coin) { - char *retstr; cJSON *argjson,*withdrawjson,*outputs,*item; int64_t total,balance,halfval,txfee; + char *retstr; cJSON *argjson,*withdrawjson,*outputs,*item; int64_t total,balance,txfee; if ( coin->etomic[0] == 0 ) { if ( coin->electrum != 0 ) @@ -1926,17 +1962,21 @@ char *LP_autosplit(struct iguana_info *coin) //printf("balance %.8f, txfee %.8f, threshold %.8f\n",dstr(balance),dstr(txfee),dstr((1000000 - (txfee + 100000)))); if ( balance > txfee && balance >= (1000000 - (txfee + 100000)) ) { - halfval = (balance / 100) * 45; + // .95 / .02 / .02 / 0.005 + //halfval = (balance / 100) * 45; argjson = cJSON_CreateObject(); outputs = cJSON_CreateArray(); item = cJSON_CreateObject(); - jaddnum(item,coin->smartaddr,dstr(halfval)); + jaddnum(item,coin->smartaddr,dstr(balance/100) * 95); jaddi(outputs,item); item = cJSON_CreateObject(); - jaddnum(item,coin->smartaddr,dstr(halfval)); + jaddnum(item,coin->smartaddr,dstr(balance/50)); jaddi(outputs,item); item = cJSON_CreateObject(); - jaddnum(item,coin->smartaddr,dstr(balance - 2*halfval)); + jaddnum(item,coin->smartaddr,dstr(balance/50)); + jaddi(outputs,item); + item = cJSON_CreateObject(); + jaddnum(item,coin->smartaddr,0.0001); jaddi(outputs,item); jadd(argjson,"outputs",outputs); jaddnum(argjson,"broadcast",1); @@ -1950,6 +1990,101 @@ char *LP_autosplit(struct iguana_info *coin) return(clonestr("{\"error\":\"couldnt autosplit\"}")); } +char *LP_autofillbob(struct iguana_info *coin,uint64_t satoshis) +{ + char *retstr; cJSON *argjson,*withdrawjson,*outputs,*item; int64_t total,balance,txfee; + if ( coin->etomic[0] == 0 ) + { + if ( coin->electrum != 0 ) + balance = LP_unspents_load(coin->symbol,coin->smartaddr); + else balance = LP_RTsmartbalance(coin); + if ( strcmp("BTC",coin->symbol) == 0 ) + txfee = LP_txfeecalc(coin,0,1000); + balance -= (txfee + 1000000); + if ( balance < (satoshis<<2) ) + return(clonestr("{\"error\":\"couldnt autofill balance too small\"}")); + if ( balance > satoshis+3*txfee && balance >= (txfee + 1000000) ) + { + argjson = cJSON_CreateObject(); + outputs = cJSON_CreateArray(); + item = cJSON_CreateObject(); + jaddnum(item,coin->smartaddr,dstr(satoshis + 3000000)); + jaddi(outputs,item); + item = cJSON_CreateObject(); + jaddnum(item,coin->smartaddr,dstr(LP_DEPOSITSATOSHIS(satoshis) + 3000000)); + jaddi(outputs,item); + item = cJSON_CreateObject(); + jaddnum(item,coin->smartaddr,0.0001); + jaddi(outputs,item); + jadd(argjson,"outputs",outputs); + jaddnum(argjson,"broadcast",0); + jaddstr(argjson,"coin",coin->symbol); + retstr = LP_withdraw(coin,argjson); + free_json(argjson); + return(retstr); + } else return(clonestr("{\"error\":\"balance too small to autosplit, please make more deposits\"}")); + } + return(clonestr("{\"error\":\"couldnt autofill etomic needs separate support\"}")); +} + +char *LP_movecoinbases(char *symbol) +{ + static bits256 zero; bits256 utxotxid,txid; struct iguana_info *coin; cJSON *retjson,*outputs,*argjson,*txids,*unspents,*item,*gen,*output; int32_t i,n,utxovout; char *retstr,*hexstr; + if ( (coin= LP_coinfind(symbol)) != 0 ) + { + if ( coin->electrum == 0 ) + { + txids = cJSON_CreateArray(); + if ( (unspents= LP_listunspent(symbol,coin->smartaddr,zero,zero)) != 0 ) + { + if ( (n= cJSON_GetArraySize(unspents)) > 0 ) + { + for (i=0; ismartaddr,0.0001); + jaddi(outputs,output); + jadd(argjson,"outputs",outputs); + jaddnum(argjson,"broadcast",1); + jaddstr(argjson,"coin",coin->symbol); + jaddbits256(argjson,"utxotxid",utxotxid); + jaddnum(argjson,"utxovout",utxovout); + jaddnum(argjson,"onevin",1); + if ( (retstr= LP_withdraw(coin,argjson)) != 0 ) + { + if ( (retjson= cJSON_Parse(retstr)) != 0 ) + { + txid = jbits256(retjson,"txid"); + hexstr = jstr(retjson,"hex"); + if ( bits256_nonz(txid) != 0 && hexstr != 0 ) + { + printf("%s -> %s\n",jprint(item,0),hexstr); + jaddibits256(txids,txid); + } + free_json(retjson); + } + free(retstr); + } + free_json(argjson); + } + } + } + free_json(unspents); + } + return(jprint(txids,1)); + } + return(clonestr("{\"error\":\"LP_movecoinbases cant be electrum\"}")); + } + return(clonestr("{\"error\":\"LP_movecoinbases couldnt find coin\"}")); +} + #ifndef NOTETOMIC char *LP_eth_withdraw(struct iguana_info *coin,cJSON *argjson) diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index eb4b37131..f00db34c0 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -724,7 +724,7 @@ cJSON *LP_address_balance(struct iguana_info *coin,char *coinaddr,int32_t electr } else { - if ( strcmp(coin->smartaddr,coinaddr) != 0 ) + //if ( strcmp(coin->smartaddr,coinaddr) != 0 ) { if ( (retjson= electrum_address_listunspent(coin->symbol,coin->electrum,&retjson,coinaddr,2,zero,zero)) != 0 ) free_json(retjson); diff --git a/iguana/exchanges/coins b/iguana/exchanges/coins index c13831b57..fc1e8e778 100644 --- a/iguana/exchanges/coins +++ b/iguana/exchanges/coins @@ -1,2 +1,2 @@ -export coins="[{\"coin\":\"PRL\",\"name\":\"oyster\",\"etomic\":\"0x1844b21593262668b7248d0f57a220caaba46ab9\",\"rpcport\":80}, {\"coin\":\"MGO\",\"name\":\"mobilego\",\"etomic\":\"0x40395044Ac3c0C57051906dA938B54BD6557F212\",\"rpcport\":80},{\"coin\":\"DRGN\",\"name\":\"dragonchain\",\"etomic\":\"0x419c4db4b9e25d6db2ad9691ccb832c8d9fda05e\",\"rpcport\":80}, {\"coin\":\"GLD\",\"name\":\"goldcoin\",\"rpcport\":9332,\"pubtype\":32,\"p2shtype\":5,\"wiftype\":160,\"txfee\":100000}, {\"coin\":\"BTK\",\"name\":\"bitcointoken\",\"etomic\":\"0xdb8646F5b487B5Dd979FAC618350e85018F557d4\",\"rpcport\":80},{\"coin\":\"DGPT\",\"name\":\"digipulse\",\"etomic\":\"0xf6cFe53d6FEbaEEA051f400ff5fc14F0cBBDacA1\",\"rpcport\":80}, {\"coin\":\"OCT\",\"name\":\"octus\",\"etomic\":\"0x7e9d365C0C97Fe5FcAdcc1B513Af974b768C5867\",\"rpcport\":80},{\"coin\":\"STWY\",\"name\":\"storweeytoken\",\"etomic\":\"0x8a8c71f032362fca2994f75d854f911ec381ac5a\",\"rpcport\":80}, {\"coin\":\"SPK\",\"name\":\"Sparks\",\"rpcport\":8892,\"pubtype\":38,\"p2shtype\":10,\"wiftype\":198,\"txfee\":10000}, {\"coin\":\"PCL\",\"name\":\"peculium\",\"etomic\":\"0x3618516f45cd3c913f81f9987af41077932bc40d\",\"rpcport\":80}, {\"coin\":\"RLTY\",\"name\":\"smartrealty\",\"etomic\":\"0xbe99b09709fc753b09bcf557a992f6605d5997b0\",\"rpcport\":80},{\"coin\":\"CIX\",\"name\":\"cryptonetix\",\"etomic\":\"0x1175a66a5c3343Bbf06AA818BB482DdEc30858E0\",\"rpcport\":80}, {\"coin\":\"GLXT\",\"asset\":\"GLXT\",\"rpcport\":15723}, {\"coin\":\"PYRO\",\"name\":\"pyro\",\"confpath\":\"${HOME#}/.pyrocore/pyro.conf\",\"rpcport\":9696,\"pubtype\":55,\"p2shtype\":10,\"wiftype\":198,\"txfee\":10000}, {\"coin\": \"BNTN\",\"asset\": \"BNTN\",\"rpcport\": 14358},{\"coin\":\"ORE\",\"name\":\"galactrum\",\"rpcport\":6269,\"pubtype\":38,\"p2shtype\":16,\"wiftype\":204,\"txfee\":10000}, {\"coin\":\"ELD\",\"name\":\"maker\",\"etomic\":\"0xaaf7d4cd097317d68174215395eb02c2cca81e31\",\"rpcport\":80}, {\"coin\":\"CENNZ\",\"name\":\"centrality\",\"etomic\":\"0x1122b6a0e00dce0563082b6e2953f3a943855c1f\",\"rpcport\":80}, {\"coin\":\"PGN\",\"name\":\"pigeon\",\"rpcport\":8756,\"pubtype\":55,\"p2shtype\":122,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"XCG\",\"name\":\"Xchange\",\"confpath\":\"${HOME#}/.Xchangecore/Xchange.conf\",\"rpcport\":9386,\"pubtype\":76,\"p2shtype\":16,\"wiftype\":204,\"txfee\":10000}, {\"coin\":\"AXE\",\"name\":\"axe\",\"confpath\":\"${HOME#}/.axecore/axe.conf\",\"rpcport\":9337,\"pubtype\":55,\"p2shtype\":16,\"wiftype\":204,\"txfee\":10000}, {\"coin\":\"PEW\",\"name\":\"brofist\",\"rpcport\":12454,\"pubtype\":55,\"p2shtype\":10,\"wiftype\":198,\"txfee\":10000,\"confpath\":\"${HOME#}/.brofistcore/brofist.conf\"}, {\"coin\":\"BCBC\",\"name\":\"bitcoin@cbc\",\"confpath\":\"${HOME#}/.bitcoin@cbc/bitcoin.conf\",\"rpcport\":8340,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"GRLC\",\"name\":\"garlicoin\",\"rpcport\":42068,\"pubtype\":38,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"EQL\",\"asset\":\"EQL\",\"rpcport\":10306}, {\"coin\":\"OCC\",\"name\":\"originalcryptocoin\",\"etomic\":\"0x0235fe624e044a05eed7a43e16e3083bc8a4287a\",\"rpcport\":80}, {\"coin\":\"DIN\",\"name\":\"dinero\",\"rpcport\":9998,\"pubtype\":30,\"p2shtype\":13,\"wiftype\":204,\"txfee\":10000,\"confpath\":\"${HOME#}/.dinerocore/dinero.conf\"}, {\"coin\":\"BUCK\",\"name\":\"buck\",\"rpcport\":5739,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"LYS\",\"name\":\"lightyears\",\"etomic\":\"0xdd41fbd1ae95c5d9b198174a28e04be6b3d1aa27\",\"rpcport\":80}, {\"coin\":\"RAP\",\"name\":\"rapture\",\"rpcport\":14776,\"pubtype\":60,\"p2shtype\":16,\"wiftype\":204,\"txfee\":10000,\"confpath\":\"${HOME#}/.rapturecore/rapture.conf\"}, {\"coin\":\"RADIUS\",\"name\":\"radius\",\"rpcport\":4089,\"pubtype\":60,\"p2shtype\":16,\"wiftype\":15,\"txfee\":10000,\"confpath\":\"${HOME#}/.radiuscore/radius.conf\"},{\"coin\":\"BTCL\",\"name\":\"btclite\",\"etomic\":\"0x5acd19b9c91e596b1f062f18e3d02da7ed8d1e50\",\"rpcport\":80}, {\"coin\":\"SEQ\",\"name\":\"sequence\",\"rpcport\":16663,\"isPoS\":1,\"pubtype\":63,\"p2shtype\":64,\"wiftype\":170,\"txfee\":10000}, {\"coin\":\"DYN\",\"name\":\"dynamic\",\"rpcport\":33350,\"pubtype\":30,\"p2shtype\":10,\"wiftype\":140,\"txfee\":10000}, {\"coin\":\"SBTC\",\"name\":\"SuperBitcoin\",\"rpcport\":28282,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":10000,\"confpath\":\"${HOME#}/.sbtc/sbtc.conf\"}, {\"coin\":\"FJC\",\"name\":\"fujicoin\",\"rpcport\":3776,\"pubtype\":36,\"p2shtype\":16,\"wiftype\":164,\"txfee\":100000}, {\"coin\":\"AIR\",\"name\":\"airtoken\",\"etomic\":\"0x27dce1ec4d3f72c3e457cc50354f1f975ddef488\",\"rpcport\":80}, {\"coin\":\"VRT\",\"name\":\"virtus\",\"confpath\":\"${HOME#}/.virtuscore/virtus.conf\",\"rpcport\":13880,\"pubtype\":70,\"p2shtype\":16,\"wiftype\":204,\"txfee\":10000}, {\"coin\":\"DRT\",\"name\":\"domraider\",\"etomic\":\"0x9af4f26941677c706cfecf6d3379ff01bb85d5ab\",\"rpcport\":80}, {\"coin\":\"BITS\",\"name\":\"bitstar\",\"rpcport\":15715,\"isPoS\":1,\"pubtype\":25,\"p2shtype\":8,\"wiftype\":153,\"txfee\":10000}, {\"coin\":\"FTC\",\"name\":\"feathercoin\",\"rpcport\":9337,\"pubtype\":14,\"p2shtype\":5,\"wiftype\":142,\"txfee\":1000000}, {\"coin\":\"PXT\",\"name\":\"populous-xbrl-token\",\"etomic\":\"0xc14830e53aa344e8c14603a91229a0b925b0b262\",\"rpcport\":80}, {\"coin\":\"USDT\",\"name\":\"tether\",\"etomic\":\"0xdac17f958d2ee523a2206206994597c13d831ec7\",\"rpcport\":80}, {\"coin\":\"ELI\",\"name\":\"elicoin\",\"rpcport\":9332,\"pubtype\":33,\"p2shtype\":102,\"wiftype\":205,\"txfee\":10000}, {\"coin\":\"SCRIV\",\"name\":\"scriv\",\"confpath\":\"${HOME#}/.scrivcore/scriv.conf\",\"rpcport\":7998,\"pubtype\":125,\"p2shtype\":16,\"wiftype\":204,\"txfee\":10000}, {\"coin\":\"ELP\",\"name\":\"ellerium\",\"rpcport\":61020,\"pubtype\":23,\"p2shtype\":13,\"wiftype\":212,\"txfee\":10000}, {\"coin\":\"ROI\",\"name\":\"ROIcoin\",\"rpcport\":3376,\"pubtype\":60,\"p2shtype\":122,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"XCOIN\",\"name\":\"xcoin\",\"rpcport\":22717,\"pubtype\":137,\"p2shtype\":15,\"wiftype\":75,\"txfee\":100000}, {\"coin\":\"BBT\",\"name\":\"bitboost\",\"etomic\":\"0x1500205f50bf3fd976466d0662905c9ff254fc9c\",\"rpcport\":80}, {\"coin\":\"TRX\",\"name\":\"tron\",\"etomic\":\"0xf230b790e05390fc8295f4d3f60332c93bed42e2\",\"rpcport\":80}, {\"coin\":\"OMG\",\"name\":\"omisego\",\"etomic\":\"0xd26114cd6EE289AccF82350c8d8487fedB8A0C07\",\"rpcport\":80}, {\"coin\":\"ICX\",\"name\":\"icon\",\"etomic\":\"0xb5a5f22694352c15b00323844ad545abb2b11028\",\"rpcport\":80}, {\"coin\":\"BNB\",\"name\":\"binance-coin\",\"etomic\":\"0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\"rpcport\":80}, {\"coin\":\"DGD\",\"name\":\"digixdao\",\"etomic\":\"0xE0B7927c4aF23765Cb51314A0E0521A9645F0E2A\",\"rpcport\":80}, {\"coin\":\"PPT\",\"name\":\"populous\",\"etomic\":\"0xd4fa1460F537bb9085d22C7bcCB5DD450Ef28e3a\",\"rpcport\":80}, {\"coin\":\"MKR\",\"name\":\"maker\",\"etomic\":\"0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2\",\"rpcport\":80}, {\"coin\":\"SNT\",\"name\":\"status\",\"etomic\":\"0x744d70FDBE2Ba4CF95131626614a1763DF805B9E\",\"rpcport\":80}, {\"coin\":\"REP\",\"name\":\"augur\",\"etomic\":\"0xE94327D07Fc17907b4DB788E5aDf2ed424adDff6\",\"rpcport\":80}, {\"coin\":\"ZRX\",\"name\":\"0x\",\"etomic\":\"0xE41d2489571d322189246DaFA5ebDe1F4699F498\",\"rpcport\":80}, {\"coin\":\"BAT\",\"name\":\"basic-attention-token\",\"etomic\":\"0x0D8775F648430679A709E98d2b0Cb6250d2887EF\",\"rpcport\":80}, {\"coin\":\"ETHOS\",\"name\":\"ethos\",\"etomic\":\"0x5Af2Be193a6ABCa9c8817001F45744777Db30756\",\"rpcport\":80}, {\"coin\":\"QASH\",\"name\":\"qash\",\"etomic\":\"0x618E75Ac90b12c6049Ba3b27f5d5F8651b0037F6\",\"rpcport\":80}, {\"coin\":\"FUN\",\"name\":\"funfair\",\"etomic\":\"0x419D0d8BdD9aF5e606Ae2232ed285Aff190E711b\",\"rpcport\":80}, {\"coin\":\"KNC\",\"name\":\"kyber-network\",\"etomic\":\"0xdd974D5C2e2928deA5F71b9825b8b646686BD200\",\"rpcport\":80}, {\"coin\":\"SALT\",\"name\":\"salt\",\"etomic\":\"0x4156D3342D5c385a87D264F90653733592000581\",\"rpcport\":80}, {\"coin\":\"BNT\",\"name\":\"bancor\",\"etomic\":\"0x1F573D6Fb3F13d689FF844B4cE37794d79a7FF1C\",\"rpcport\":80}, {\"coin\":\"ICN\",\"name\":\"iconomi\",\"etomic\":\"0x888666CA69E0f178DED6D75b5726Cee99A87D698\",\"rpcport\":80}, {\"coin\":\"PAY\",\"name\":\"tenx\",\"etomic\":\"0xB97048628DB6B661D4C2aA833e95Dbe1A905B280\",\"rpcport\":80}, {\"coin\":\"REQ\",\"name\":\"request-network\",\"etomic\":\"0x8f8221aFbB33998d8584A2B05749bA73c37a938a\",\"rpcport\":80}, {\"coin\":\"STORJ\",\"name\":\"storj\",\"etomic\":\"0xB64ef51C888972c908CFacf59B47C1AfBC0Ab8aC\",\"rpcport\":80}, {\"coin\":\"GNO\",\"name\":\"gnosis-gno\",\"etomic\":\"0x6810e776880C02933D47DB1b9fc05908e5386b96\",\"rpcport\":80}, {\"coin\":\"RLC\",\"name\":\"rlc\",\"etomic\":\"0x607F4C5BB672230e8672085532f7e901544a7375\",\"rpcport\":80}, {\"coin\":\"ENJ\",\"name\":\"enjin-coin\",\"etomic\":\"0xF629cBd94d3791C9250152BD8dfBDF380E2a3B9c\",\"rpcport\":80}, {\"coin\":\"QSP\",\"name\":\"quantstamp\",\"etomic\":\"0x99ea4dB9EE77ACD40B119BD1dC4E33e1C070b80d\",\"rpcport\":80}, {\"coin\":\"RDN\",\"name\":\"raiden-network-token\",\"etomic\":\"0x255Aa6DF07540Cb5d3d297f0D0D4D84cb52bc8e6\",\"rpcport\":80}, {\"coin\":\"CVC\",\"name\":\"civic\",\"etomic\":\"0x41e5560054824eA6B0732E656E3Ad64E20e94E45\",\"rpcport\":80}, {\"coin\":\"SAN\",\"name\":\"santiment\",\"etomic\":\"0x7C5A0CE9267ED19B22F8cae653F198e3E8daf098\",\"rpcport\":80}, {\"coin\":\"ANT\",\"name\":\"aragon\",\"etomic\":\"0x960b236A07cf122663c4303350609A66A7B288C0\",\"rpcport\":80}, {\"coin\":\"MANA\",\"name\":\"decentraland\",\"etomic\":\"0x0F5D2fB29fb7d3CFeE444a200298f468908cC942\",\"rpcport\":80}, {\"coin\":\"MCO\",\"name\":\"monaco\",\"etomic\":\"0xB63B606Ac810a52cCa15e44bB630fd42D8d1d83d\",\"rpcport\":80}, {\"coin\":\"MTL\",\"name\":\"metal\",\"etomic\":\"0xF433089366899D83a9f26A773D59ec7eCF30355e\",\"rpcport\":80}, {\"coin\":\"EDG\",\"name\":\"edgeless\",\"etomic\":\"0x08711D3B02C8758F2FB3ab4e80228418a7F8e39c\",\"rpcport\":80}, {\"coin\":\"MLN\",\"name\":\"melon\",\"etomic\":\"0xBEB9eF514a379B997e0798FDcC901Ee474B6D9A1\",\"rpcport\":80}, {\"coin\":\"AMB\",\"name\":\"amber\",\"etomic\":\"0x4DC3643DbC642b72C158E7F3d2ff232df61cb6CE\",\"rpcport\":80}, {\"coin\":\"WINGS\",\"name\":\"wings\",\"etomic\":\"0x667088b212ce3d06a1b553a7221E1fD19000d9aF\",\"rpcport\":80}, {\"coin\":\"RCN\",\"name\":\"ripio-credit-network\",\"etomic\":\"0xF970b8E36e23F7fC3FD752EeA86f8Be8D83375A6\",\"rpcport\":80}, {\"coin\":\"SNGLS\",\"name\":\"singulardtv\",\"etomic\":\"0xaeC2E87E0A235266D9C5ADc9DEb4b2E29b54D009\",\"rpcport\":80}, {\"coin\":\"TAAS\",\"name\":\"taas\",\"etomic\":\"0xE7775A6e9Bcf904eb39DA2b68c5efb4F9360e08C\",\"rpcport\":80}, {\"coin\":\"DNT\",\"name\":\"district0x\",\"etomic\":\"0x0AbdAce70D3790235af448C88547603b945604ea\",\"rpcport\":80}, {\"coin\":\"CFI\",\"name\":\"cofound-it\",\"etomic\":\"0x12FEF5e57bF45873Cd9B62E9DBd7BFb99e32D73e\",\"rpcport\":80}, {\"coin\":\"LUN\",\"name\":\"lunyr\",\"etomic\":\"0xfa05A73FfE78ef8f1a739473e462c54bae6567D9\",\"rpcport\":80}, {\"coin\":\"ADT\",\"name\":\"adtoken\",\"etomic\":\"0xD0D6D6C5Fe4a677D343cC433536BB717bAe167dD\",\"rpcport\":80}, {\"coin\":\"AST\",\"name\":\"airswap\",\"etomic\":\"0x27054b13b1B798B345b591a4d22e6562d47eA75a\",\"rpcport\":80}, {\"coin\":\"CDT\",\"name\":\"blox\",\"etomic\":\"0x177d39AC676ED1C67A2b268AD7F1E58826E5B0af\",\"rpcport\":80}, {\"coin\":\"TKN\",\"name\":\"tokencard\",\"etomic\":\"0xaAAf91D9b90dF800Df4F55c205fd6989c977E73a\",\"rpcport\":80}, {\"coin\":\"HMQ\",\"name\":\"humaniq\",\"etomic\":\"0xcbCC0F036ED4788F63FC0fEE32873d6A7487b908\",\"rpcport\":80}, {\"coin\":\"BCAP\",\"name\":\"bcap\",\"etomic\":\"0xFf3519eeeEA3e76F1F699CCcE5E23ee0bdDa41aC\",\"rpcport\":80}, {\"coin\":\"NMR\",\"name\":\"numeraire\",\"etomic\":\"0x1776e1F26f98b1A5dF9cD347953a26dd3Cb46671\",\"rpcport\":80}, {\"coin\":\"NET\",\"name\":\"nimiq\",\"etomic\":\"0xcfb98637bcae43C13323EAa1731cED2B716962fD\",\"rpcport\":80}, {\"coin\":\"TRST\",\"name\":\"trust\",\"etomic\":\"0xCb94be6f13A1182E4A4B6140cb7bf2025d28e41B\",\"rpcport\":80}, {\"coin\":\"GUP\",\"name\":\"guppy\",\"etomic\":\"0xf7B098298f7C69Fc14610bf71d5e02c60792894C\",\"rpcport\":80}, {\"coin\":\"1ST\",\"name\":\"firstblood\",\"etomic\":\"0xAf30D2a7E90d7DC361c8C4585e9BB7D2F6f15bc7\",\"rpcport\":80}, {\"coin\":\"TIME\",\"name\":\"chronobank\",\"etomic\":\"0x6531f133e6DeeBe7F2dcE5A0441aA7ef330B4e53\",\"rpcport\":80}, {\"coin\":\"SWT\",\"name\":\"swarm-city\",\"etomic\":\"0xB9e7F8568e08d5659f5D29C4997173d84CdF2607\",\"rpcport\":80}, {\"coin\":\"ROL\",\"name\":\"dice\",\"etomic\":\"0x2e071D2966Aa7D8dECB1005885bA1977D6038A65\",\"rpcport\":80}, {\"coin\":\"XAUR\",\"name\":\"xaurum\",\"etomic\":\"0x4DF812F6064def1e5e029f1ca858777CC98D2D81\",\"rpcport\":80}, {\"coin\":\"PLU\",\"name\":\"pluton\",\"etomic\":\"0xD8912C10681D8B21Fd3742244f44658dBA12264E\",\"rpcport\":80}, {\"coin\":\"HGT\",\"name\":\"hellogold\",\"etomic\":\"0xba2184520A1cC49a6159c57e61E1844E085615B6\",\"rpcport\":80}, {\"coin\":\"VSL\",\"name\":\"vslice\",\"etomic\":\"0x5c543e7AE0A1104f78406C340E9C64FD9fCE5170\",\"rpcport\":80}, {\"coin\":\"IND\",\"name\":\"indorse-token\",\"etomic\":\"0xf8e386EDa857484f5a12e4B5DAa9984E06E73705\",\"rpcport\":80}, {\"coin\":\"FYN\",\"name\":\"fundyourselfnow\",\"etomic\":\"0x88FCFBc22C6d3dBaa25aF478C578978339BDe77a\",\"rpcport\":80},{\"coin\":\"SMART\",\"name\":\"smartcash\",\"rpcport\":9679,\"pubtype\":63,\"p2shtype\":18,\"wiftype\":191,\"txfee\":200000}, {\"coin\":\"BTCP\",\"name\":\"btcprivate\",\"rpcport\":7932,\"taddr\":19,\"pubtype\":37,\"p2shtype\":175,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"DNR\",\"isPoS\":1,\"active\":1,\"name\":\"denarius\",\"rpcport\":32339,\"pubtype\":30,\"p2shtype\":90,\"wiftype\":158,\"txfee\":10000}, {\"coin\":\"RVN\",\"name\":\"raven\",\"rpcport\":8766,\"pubtype\":60,\"p2shtype\":122,\"wiftype\":128,\"txfee\":100000}, {\"coin\":\"VIVO\",\"name\":\"vivo\",\"confpath\":\"${HOME#}/.vivocore/vivo.conf\",\"rpcport\":9998,\"pubtype\":70,\"p2shtype\":10,\"wiftype\":198,\"txfee\":10000}, {\"coin\":\"KNG\",\"name\":\"kings\",\"rpcport\":44888,\"pubtype\":75,\"p2shtype\":125,\"wiftype\":203,\"txfee\":10000}, {\"coin\":\"UFO\",\"name\":\"ufocoin\",\"confpath\":\"${HOME#}/.ufo/ufocoin.conf\",\"rpcport\":9888,\"pubtype\":27,\"p2shtype\":5,\"wiftype\":155,\"txfee\":100000}, {\"coin\":\"ETH\",\"name\":\"ethereum\",\"etomic\":\"0x0000000000000000000000000000000000000000\",\"rpcport\":80}, {\"coin\":\"EOS\",\"name\":\"EOS\",\"etomic\":\"0x86fa049857e0209aa7d9e616f7eb3b3b78ecfdb0\",\"rpcport\":80}, {\"coin\":\"KREDS\",\"name\":\"kreds\",\"rpcport\":3850,\"pubtype\":45,\"p2shtype\":5,\"wiftype\":195,\"txfee\":10000}, {\"coin\":\"SNG\",\"name\":\"snowgem\",\"rpcport\":16112,\"taddr\":28,\"pubtype\":40,\"p2shtype\":45,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"ZEL\",\"name\":\"zelcash\",\"rpcport\":16124,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"PIVX\",\"name\":\"pivx\",\"rpcport\":51473,\"pubtype\":30,\"p2shtype\":13,\"wiftype\":212,\"txfee\":10000}, {\"coin\":\"HTML\",\"name\":\"htmlcoin\",\"rpcport\":4889,\"pubtype\":41,\"p2shtype\":100,\"wiftype\":169,\"txfee\":400000}, {\"coin\":\"MNX\",\"name\":\"Minexcoin\",\"rpcport\":17786,\"pubtype\":75,\"p2shtype\":5,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"LTZ\",\"name\":\"litecoinz\",\"rpcport\":29332,\"taddr\":10,\"pubtype\":179,\"p2shtype\":184,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"BAY\",\"name\":\"bitbay\",\"isPoS\":1,\"rpcport\":19915,\"pubtype\":25,\"p2shtype\":85,\"wiftype\":153,\"txfee\":10000}, {\"coin\":\"OOT\",\"asset\":\"OOT\",\"rpcport\":12467}, {\"coin\":\"ZOI\",\"name\":\"zoin\",\"rpcport\":8255,\"pubtype\":80,\"p2shtype\":7,\"wiftype\":208,\"txfee\":1000}, {\"coin\": \"PIZZA\",\"asset\": \"PIZZA\",\"rpcport\": 11116},{\"coin\": \"BEER\",\"asset\": \"BEER\",\"rpcport\": 8923}, {\"coin\":\"GRS\",\"name\":\"groestlcoin\",\"rpcport\":1441,\"pubtype\":36,\"p2shtype\":5,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"XMCC\",\"name\":\"monoeci\",\"confpath\":\"${HOME#}/.monoeciCore/monoeci.conf\",\"rpcport\":24156,\"pubtype\":50,\"p2shtype\":73,\"wiftype\":77,\"txfee\":10000}, {\"coin\":\"BTCH\",\"asset\":\"BTCH\",\"rpcport\":8800},{\"coin\":\"ETOMIC\",\"asset\":\"ETOMIC\",\"rpcport\":10271},{\"coin\":\"AXO\",\"asset\":\"AXO\",\"rpcport\":12927},{\"coin\":\"CRC\",\"name\":\"crowdcoin\",\"confpath\":\"${HOME#}/.crowdcoincore/crowdcoin.conf\",\"rpcport\":11998,\"pubtype\":28,\"p2shtype\":88,\"wiftype\":0,\"txfee\":10000}, {\"coin\":\"VOT\",\"name\":\"votecoin\",\"rpcport\":8232,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"INN\",\"name\":\"innova\",\"confpath\":\"${HOME#}/.innovacore/innova.conf\",\"rpcport\":8818,\"pubtype\":102,\"p2shtype\":20,\"wiftype\":195,\"txfee\":10000}, {\"coin\":\"MOON\",\"name\":\"mooncoin\",\"rpcport\":44663,\"pubtype\":3,\"p2shtype\":22,\"wiftype\":131,\"txfee\":100000}, {\"coin\":\"CRW\",\"name\":\"crown\",\"rpcport\":9341,\"pubtype\":0,\"p2shtype\":28,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"EFL\",\"name\":\"egulden\",\"confpath\":\"${HOME#}/.egulden/coin.conf\",\"rpcport\":21015,\"pubtype\":48,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"GBX\",\"name\":\"gobyte\",\"confpath\":\"${HOME#}/.gobytecore/gobyte.conf\",\"rpcport\":12454,\"pubtype\":38,\"p2shtype\":10,\"wiftype\":198,\"txfee\":10000}, {\"coin\":\"BCO\",\"name\":\"bridgecoin\",\"rpcport\":6332,\"pubtype\":27,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"BLK\",\"name\":\"blackcoin\",\"confpath\":\"${HOME#}/.lore/blackcoin.conf\",\"isPoS\":1,\"rpcport\":15715,\"pubtype\":25,\"p2shtype\":85,\"wiftype\":153,\"txfee\":100000}, {\"coin\":\"BTG\",\"name\":\"bitcoingold\",\"rpcport\":8332,\"pubtype\":38,\"p2shtype\":23,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"BCH\",\"name\":\"bch\",\"rpcport\":33333,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"ABY\",\"name\":\"applebyte\",\"rpcport\":8607,\"pubtype\":23,\"p2shtype\":5,\"wiftype\":151,\"txfee\":100000}, {\"coin\":\"STAK\",\"name\":\"straks\",\"rpcport\":7574,\"pubtype\":63,\"p2shtype\":5,\"wiftype\":204,\"txfee\":10000}, {\"coin\":\"XZC\",\"name\":\"zcoin\",\"rpcport\":8888,\"pubtype\":82,\"p2shtype\":7,\"wiftype\":210,\"txfee\":10000}, {\"coin\":\"QTUM\",\"name\":\"qtum\",\"rpcport\":3889,\"pubtype\":58,\"p2shtype\":50,\"wiftype\":128,\"txfee\":400000}, {\"coin\":\"PURA\",\"name\":\"pura\",\"rpcport\":55555,\"pubtype\":55,\"p2shtype\":16,\"wiftype\":150,\"txfee\":10000}, {\"coin\":\"DSR\",\"name\":\"desire\",\"confpath\":\"${HOME#}/.desirecore/desire.conf\",\"rpcport\":9918,\"pubtype\":30,\"p2shtype\":16,\"wiftype\":204,\"txfee\":10000}, {\"coin\":\"MNZ\",\"asset\":\"MNZ\",\"rpcport\":14337},{\"coin\":\"BTCZ\",\"name\":\"bitcoinz\",\"rpcport\":1979,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"MAGA\",\"name\":\"magacoin\",\"rpcport\":5332,\"pubtype\":23,\"p2shtype\":50,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"BSD\",\"name\":\"bitsend\",\"rpcport\":8800,\"pubtype\":102,\"p2shtype\":5,\"wiftype\":204,\"txfee\":10000}, {\"coin\":\"IOP\",\"name\":\"IoP\",\"rpcport\":8337,\"pubtype\":117,\"p2shtype\":174,\"wiftype\":49,\"txfee\":10000}, {\"coin\":\"BLOCK\",\"name\":\"blocknetdx\",\"rpcport\":41414,\"pubtype\":26,\"p2shtype\":28,\"wiftype\":154,\"txfee\":10000}, {\"coin\":\"CHIPS\", \"name\": \"chips\", \"rpcport\":57776,\"pubtype\":60, \"p2shtype\":85, \"wiftype\":188, \"txfee\":10000}, {\"coin\":\"888\",\"name\":\"octocoin\",\"rpcport\":22888,\"pubtype\":18,\"p2shtype\":5,\"wiftype\":176,\"txfee\":2000000}, {\"coin\":\"ARG\",\"name\":\"argentum\",\"rpcport\":13581,\"pubtype\":23,\"p2shtype\":5,\"wiftype\":151,\"txfee\":50000}, {\"coin\":\"GLT\",\"name\":\"globaltoken\",\"rpcport\":9320,\"pubtype\":38,\"p2shtype\":5,\"wiftype\":166,\"txfee\":10000}, {\"coin\":\"ZER\",\"name\":\"zero\",\"rpcport\":23801,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"HODLC\",\"name\":\"hodlcoin\",\"rpcport\":11989,\"pubtype\":40,\"p2shtype\":5,\"wiftype\":168,\"txfee\":5000}, {\"coin\":\"UIS\",\"name\":\"unitus\",\"rpcport\":50604,\"pubtype\":68,\"p2shtype\":10,\"wiftype\":132,\"txfee\":2000000}, {\"coin\":\"HUC\",\"name\":\"huntercoin\",\"rpcport\":8399,\"pubtype\":40,\"p2shtype\":13,\"wiftype\":168,\"txfee\":100000}, {\"coin\":\"BDL\",\"name\":\"bitdeal\",\"rpcport\":9332,\"pubtype\":38,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"ARC\",\"name\":\"arcticcoin\",\"confpath\":\"${HOME#}/.arcticcore/arcticcoin.conf\",\"rpcport\":7208,\"pubtype\":23,\"p2shtype\":8,\"wiftype\":176,\"txfee\":10000}, {\"coin\":\"ZCL\",\"name\":\"zclassic\",\"rpcport\":8023,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"VIA\",\"name\":\"viacoin\",\"rpcport\":5222,\"pubtype\":71,\"p2shtype\":33,\"wiftype\":199,\"txfee\":100000}, {\"coin\":\"ERC\",\"name\":\"europecoin\",\"rpcport\":11989,\"pubtype\":33,\"p2shtype\":5,\"wiftype\":168,\"txfee\":10000},{\"coin\":\"FAIR\",\"name\":\"faircoin\",\"confpath\":\"${HOME#}/.faircoin2/faircoin.conf\",\"rpcport\":40405,\"pubtype\":95,\"p2shtype\":36,\"wiftype\":223,\"txfee\":1000000}, {\"coin\":\"FLO\",\"name\":\"florincoin\",\"rpcport\":7313,\"pubtype\":35,\"p2shtype\":8,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"SXC\",\"name\":\"sexcoin\",\"rpcport\":9561,\"pubtype\":62,\"p2shtype\":5,\"wiftype\":190,\"txfee\":100000}, {\"coin\":\"CREA\",\"name\":\"creativecoin\",\"rpcport\":17711,\"pubtype\":28,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"TRC\",\"name\":\"terracoin\",\"confpath\":\"${HOME#}/.terracoincore/terracoin.conf\",\"rpcport\":13332,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"BTA\",\"name\":\"bata\",\"rpcport\":5493,\"pubtype\":25,\"p2shtype\":5,\"wiftype\":188,\"txfee\":100000}, {\"coin\":\"SMC\",\"name\":\"smartcoin\",\"rpcport\":58583,\"pubtype\":63,\"p2shtype\":5,\"wiftype\":191,\"txfee\":1000000}, {\"coin\":\"NMC\",\"name\":\"namecoin\",\"rpcport\":8336,\"pubtype\":52,\"p2shtype\":13,\"wiftype\":180,\"txfee\":100000}, {\"coin\":\"NAV\",\"name\":\"navcoin\",\"isPoS\":1,\"confpath\":\"${HOME#}/.navcoin4/navcoin.conf\",\"rpcport\":44444,\"pubtype\":53,\"p2shtype\":85,\"wiftype\":150,\"txfee\":10000}, {\"coin\":\"EMC2\",\"name\":\"einsteinium\",\"rpcport\":41879,\"pubtype\":33,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000},{\"coin\":\"SYS\",\"name\":\"syscoin\",\"rpcport\":8370,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"I0C\",\"name\":\"i0coin\",\"rpcport\":7332,\"pubtype\":105,\"p2shtype\":5,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"DASH\",\"confpath\":\"${HOME#}/.dashcore/dash.conf\",\"name\":\"dashcore\",\"rpcport\":9998,\"pubtype\":76,\"p2shtype\":16,\"wiftype\":204,\"txfee\":10000}, {\"coin\":\"STRAT\", \"name\": \"stratis\", \"active\":0, \"rpcport\":16174,\"pubtype\":63, \"p2shtype\":125, \"wiftype\":191, \"txfee\":10000}, {\"confpath\":\"${HOME#}/.muecore/mue.conf\",\"coin\":\"MUE\",\"name\":\"muecore\",\"rpcport\":29683,\"pubtype\":16,\"p2shtype\":76,\"wiftype\":126,\"txfee\":10000}, {\"coin\":\"MONA\",\"name\":\"monacoin\",\"rpcport\":9402,\"pubtype\":50,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000},{\"coin\":\"XMY\",\"name\":\"myriadcoin\",\"rpcport\":10889,\"pubtype\":50,\"p2shtype\":9,\"wiftype\":178,\"txfee\":5000}, {\"coin\":\"MAC\",\"name\":\"machinecoin\",\"rpcport\":40332,\"pubtype\":50,\"p2shtype\":5,\"wiftype\":178,\"txfee\":100000}, {\"coin\":\"BTX\",\"name\":\"bitcore\",\"rpcport\":8556,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":50000}, {\"coin\":\"XRE\",\"name\":\"revolvercoin\",\"rpcport\":8775,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"LBC\",\"name\":\"lbrycrd\",\"rpcport\":9245,\"pubtype\":85,\"p2shtype\":122,\"wiftype\":28,\"txfee\":10000}, {\"coin\":\"SIB\",\"name\":\"sibcoin\",\"rpcport\":1944,\"pubtype\":63,\"p2shtype\":40,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"VTC\", \"name\":\"vertcoin\", \"rpcport\":5888, \"pubtype\":71, \"p2shtype\":5, \"wiftype\":128, \"txfee\":100000 }, {\"coin\":\"REVS\",\"active\":0, \"asset\":\"REVS\",\"rpcport\":10196}, {\"coin\":\"JUMBLR\",\"active\":0, \"asset\":\"JUMBLR\",\"rpcport\":15106}, {\"coin\":\"DOGE\",\"name\":\"dogecoin\",\"rpcport\":22555,\"pubtype\":30,\"p2shtype\":22,\"wiftype\":158,\"txfee\":100000000}, {\"coin\":\"HUSH\",\"name\":\"hush\",\"rpcport\":8822,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":1000 }, {\"active\":0,\"coin\":\"ZEC\",\"name\":\"zcash\",\"rpcport\":8232,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":10000 }, {\"coin\":\"DGB\",\"name\":\"digibyte\",\"rpcport\":14022,\"pubtype\":30,\"p2shtype\":5,\"wiftype\":128,\"txfee\":100000}, {\"coin\":\"ZET\", \"name\":\"zetacoin\", \"pubtype\":80, \"p2shtype\":9,\"rpcport\":8332, \"wiftype\":224, \"txfee\":10000}, {\"coin\":\"GAME\", \"rpcport\":40001, \"name\":\"gamecredits\", \"pubtype\":38, \"p2shtype\":5, \"wiftype\":166, \"txfee\":100000}, {\"coin\":\"LTC\", \"name\":\"litecoin\", \"rpcport\":9332, \"pubtype\":48, \"p2shtype\":5, \"wiftype\":176, \"txfee\":100000 }, {\"coin\":\"SUPERNET\",\"asset\":\"SUPERNET\",\"rpcport\":11341}, {\"coin\":\"WLC\",\"asset\":\"WLC\",\"rpcport\":12167}, {\"coin\":\"PANGEA\",\"asset\":\"PANGEA\",\"rpcport\":14068}, {\"coin\":\"DEX\",\"asset\":\"DEX\",\"rpcport\":11890}, {\"coin\":\"BET\",\"asset\":\"BET\",\"rpcport\":14250}, {\"coin\":\"CRYPTO\",\"asset\":\"CRYPTO\",\"rpcport\":8516}, {\"coin\":\"HODL\",\"asset\":\"HODL\",\"rpcport\":14431}, {\"coin\":\"MSHARK\",\"asset\":\"MSHARK\",\"rpcport\":8846}, {\"coin\":\"BOTS\",\"asset\":\"BOTS\",\"rpcport\":11964}, {\"coin\":\"MGW\",\"asset\":\"MGW\",\"rpcport\":12386}, {\"coin\":\"COQUI\",\"asset\":\"COQUI\",\"rpcport\":14276}, {\"coin\":\"KV\",\"asset\":\"KV\",\"rpcport\":8299}, {\"coin\":\"CEAL\",\"asset\":\"CEAL\",\"rpcport\":11116}, {\"coin\":\"MESH\",\"asset\":\"MESH\",\"rpcport\":9455}]" -#, {\"coin\":\"AUD\",\"asset\":\"AUD\",\"rpcport\":8045}, {\"coin\":\"BGN\",\"asset\":\"BGN\",\"rpcport\":9110}, {\"coin\":\"CAD\",\"asset\":\"CAD\",\"rpcport\":8720}, {\"coin\":\"CHF\",\"asset\":\"CHF\",\"rpcport\":15312}, {\"coin\":\"CNY\",\"asset\":\"CNY\",\"rpcport\":10384}, {\"coin\":\"CZK\",\"asset\":\"CZK\",\"rpcport\":9482}, {\"coin\":\"DKK\",\"asset\":\"DKK\",\"rpcport\":13830}, {\"coin\":\"EUR\",\"asset\":\"EUR\",\"rpcport\":8065}, {\"coin\":\"GBP\",\"asset\":\"GBP\",\"rpcport\":11505}, {\"coin\":\"HKD\",\"asset\":\"HKD\",\"rpcport\":15409}, {\"coin\":\"HRK\",\"asset\":\"HRK\",\"rpcport\":12617}, {\"coin\":\"HUF\",\"asset\":\"HUF\",\"rpcport\":13699}, {\"coin\":\"IDR\",\"asset\":\"IDR\",\"rpcport\":14459}, {\"coin\":\"ILS\",\"asset\":\"ILS\",\"rpcport\":14638}, {\"coin\":\"INR\",\"asset\":\"INR\",\"rpcport\":10536}, {\"coin\":\"JPY\",\"asset\":\"JPY\",\"rpcport\":13145}, {\"coin\":\"KRW\",\"asset\":\"KRW\",\"rpcport\":14020}, {\"coin\":\"MXN\",\"asset\":\"MXN\",\"rpcport\":13970}, {\"coin\":\"MYR\",\"asset\":\"MYR\",\"rpcport\":10688}, {\"coin\":\"NOK\",\"asset\":\"NOK\",\"rpcport\":11588}, {\"coin\":\"NZD\",\"asset\":\"NZD\",\"rpcport\":10915}, {\"coin\":\"PHP\",\"asset\":\"PHP\",\"rpcport\":11181}, {\"coin\":\"PLN\",\"asset\":\"PLN\",\"rpcport\":13493}, {\"coin\":\"BRL\",\"asset\":\"BRL\",\"rpcport\":9914}, {\"coin\":\"RON\",\"asset\":\"RON\",\"rpcport\":8675}, {\"coin\":\"RUB\",\"asset\":\"RUB\",\"rpcport\":8199}, {\"coin\":\"SEK\",\"asset\":\"SEK\",\"rpcport\":11447}, {\"coin\":\"SGD\",\"asset\":\"SGD\",\"rpcport\":14475}, {\"coin\":\"THB\",\"asset\":\"THB\",\"rpcport\":11847}, {\"coin\":\"TRY\",\"asset\":\"TRY\",\"rpcport\":13924}, {\"coin\":\"USD\",\"asset\":\"USD\",\"rpcport\":13967}, {\"coin\":\"ZAR\",\"asset\":\"ZAR\",\"rpcport\":15160}]" +export coins="[{\"coin\":\"PAT\",\"name\":\"pat\",\"etomic\":\"0xBB1fA4FdEB3459733bF67EbC6f893003fA976a82\",\"rpcport\":80},{\"coin\":\"PRLPAY\",\"asset\":\"PRLPAY\",\"rpcport\":9679}, {\"coin\":\"MLM\",\"name\":\"mktcoin\",\"rpcport\":9276,\"pubtype\":110,\"p2shtype\":115,\"wiftype\":238,\"txfee\":10000}, {\"coin\":\"CRDS\",\"name\":\"credits\",\"rpcport\":31050,\"pubtype\":28,\"p2shtype\":10,\"wiftype\":140,\"txfee\":10000}, {\"coin\":\"UCASH\",\"name\":\"ucash\",\"etomic\":\"0x92e52a1a235d9a103d970901066ce910aacefd37\",\"rpcport\":80}, {\"coin\":\"RVT\",\"name\":\"rivetz\",\"etomic\":\"0x3d1ba9be9f66b8ee101911bc36d3fb562eac2244\",\"rpcport\":80}, {\"coin\":\"DCN\",\"name\":\"dentacoin\",\"etomic\":\"0x08d32b0da63e2C3bcF8019c9c5d849d7a9d791e6\",\"rpcport\":80}, {\"coin\":\"ATB\",\"name\":\"atbcoin\",\"confpath\":\"${HOME#}/.ATBCoinWallet/atbcoin.conf\",\"rpcport\":8332,\"pubtype\":23,\"p2shtype\":83,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"SRN\",\"name\":\"sirin-labs-token\",\"etomic\":\"0x68d57c9a1c35f63e2c83ee8e49a64e9d70528d25\",\"rpcport\":80},{\"coin\":\"ELF\",\"name\":\"aelf\",\"etomic\":\"0xbf2179859fc6D5BEE9Bf9158632Dc51678a4100e\",\"rpcport\":80}, {\"coin\":\"HXX\",\"name\":\"hexxcoin\",\"rpcport\":29200,\"pubtype\":40,\"p2shtype\":10,\"wiftype\":210,\"txfee\":100000}, {\"coin\":\"XSN\",\"name\":\"xsn\",\"confpath\":\"${HOME#}/.xsncore/xsn.conf\",\"rpcport\":51473,\"pubtype\":76,\"p2shtype\":16,\"wiftype\":204,\"txfee\":10000}, {\"coin\":\"DROP\",\"name\":\"dropil\",\"etomic\":\"0x4672bad527107471cb5067a887f4656d585a8a31\",\"rpcport\":80}, {\"coin\":\"GPN\",\"name\":\"gpncoin\",\"etomic\":\"0xE2b407160AAd5540eAc0e80338b9a5085C60F25B\",\"rpcport\":80}, {\"coin\":\"SANC\",\"name\":\"sancoj\",\"etomic\":\"0x03ec7bb59be036870ef696a2abf124f496d6735a\",\"rpcport\":80},{\"coin\":\"LRC\",\"name\":\"loopring\",\"etomic\":\"0xEF68e7C694F40c8202821eDF525dE3782458639f\",\"rpcport\":80,\"decimals\":18}, {\"coin\":\"IOST\",\"name\":\"iostoken\",\"etomic\":\"0xfa1a856cfa3409cfa145fa4e20eb270df3eb21ab\",\"rpcport\":80}, {\"coin\":\"WTC\",\"name\":\"waltonchain\",\"etomic\":\"0xb7cb1c96db6b22b0d3d9536e0108d062bd488f74\",\"rpcport\":80}, {\"coin\":\"XOV\",\"name\":\"xovbank\",\"etomic\":\"0x153eD9CC1b792979d2Bde0BBF45CC2A7e436a5F9\",\"rpcport\":80}, {\"coin\":\"FSN\",\"name\":\"fusion\",\"etomic\":\"0xd0352a019e9ab9d757776f532377aaebd36fd541\",\"rpcport\":80}, {\"coin\":\"AION\",\"name\":\"aion\",\"etomic\":\"0x4CEdA7906a5Ed2179785Cd3A40A69ee8bc99C466\",\"rpcport\":80}, {\"coin\":\"NAS\",\"name\":\"nebulas-token\",\"etomic\":\"0x5d65d971895edc438f465c17db6992698a52318d\",\"rpcport\":80}, {\"coin\":\"RHOC\",\"name\":\"rchain\",\"etomic\":\"0x168296bb09e24a88805cb9c33356536b980d3fc5\",\"rpcport\":80}, {\"coin\":\"BTM\",\"name\":\"bytom\",\"etomic\":\"0xcB97e65F07DA24D46BcDD078EBebd7C6E6E3d750\",\"rpcport\":80}, {\"coin\":\"AE\",\"name\":\"aeternity\",\"etomic\":\"0x5ca9a71b1d01849c0a95490cc00559717fcf0d1d\",\"rpcport\":80}, {\"coin\":\"ZIL\",\"name\":\"zilliqa\",\"etomic\":\"0x05f4a42e251f2d52b8ed15e9fedaacfcef1fad27\",\"rpcport\":80}, {\"coin\":\"FLLW\",\"name\":\"followcoin\",\"etomic\":\"0x0200412995f1bafef0d3f97c4e28ac2515ec1ece\",\"rpcport\":80}, {\"coin\":\"HYD\",\"name\":\"hydra\",\"etomic\":\"0xD233495C48EB0143661fFC8458EAfc21b633f97f\",\"rpcport\":80}, {\"coin\":\"VRSC\",\"asset\":\"VRSC\",\"rpcport\":27486}, {\"coin\":\"CHAIN\",\"asset\":\"CHAIN\",\"rpcport\":15587},{\"coin\":\"POWR\",\"name\":\"power-ledger\",\"etomic\":\"0x595832f8fc6bf59c85c527fec3740a1b7a361269\",\"rpcport\":80},{\"coin\":\"TUSD\",\"name\":\"trueusd\",\"etomic\":\"0x8dd5fbce2f6a956c3022ba3663759011dd51e73e\",\"rpcport\":80}, {\"coin\":\"VEN\",\"name\":\"vechain\",\"etomic\":\"0xd850942ef8811f2a866692a623011bde52a462c1\",\"rpcport\":80}, {\"coin\":\"DSEC\",\"asset\":\"DSEC\",\"rpcport\":11557},{\"coin\":\"LOOM\",\"name\":\"loom-network\",\"etomic\":\"0xa4e8c3ec456107ea67d3075bf9e3df3a75823db0\",\"rpcport\":80}, {\"coin\":\"ANN\",\"name\":\"agentnotneeded\",\"etomic\":\"0xe0e73E8fc3a0fA161695be1D75E1Bc3E558957c4\",\"rpcport\":80},{\"coin\":\"PRL\",\"name\":\"oyster\",\"etomic\":\"0x1844b21593262668b7248d0f57a220caaba46ab9\",\"rpcport\":80}, {\"coin\":\"MGO\",\"name\":\"mobilego\",\"etomic\":\"0x40395044Ac3c0C57051906dA938B54BD6557F212\",\"rpcport\":80},{\"coin\":\"DRGN\",\"name\":\"dragonchain\",\"etomic\":\"0x419c4db4b9e25d6db2ad9691ccb832c8d9fda05e\",\"rpcport\":80}, {\"coin\":\"GLD\",\"name\":\"goldcoin\",\"rpcport\":9332,\"pubtype\":32,\"p2shtype\":5,\"wiftype\":160,\"txfee\":100000}, {\"coin\":\"BTK\",\"name\":\"bitcointoken\",\"etomic\":\"0xdb8646F5b487B5Dd979FAC618350e85018F557d4\",\"rpcport\":80},{\"coin\":\"DGPT\",\"name\":\"digipulse\",\"etomic\":\"0xf6cFe53d6FEbaEEA051f400ff5fc14F0cBBDacA1\",\"rpcport\":80}, {\"coin\":\"OCT\",\"name\":\"octus\",\"etomic\":\"0x7e9d365C0C97Fe5FcAdcc1B513Af974b768C5867\",\"rpcport\":80},{\"coin\":\"STWY\",\"name\":\"storweeytoken\",\"etomic\":\"0x8a8c71f032362fca2994f75d854f911ec381ac5a\",\"rpcport\":80}, {\"coin\":\"SPK\",\"name\":\"Sparks\",\"rpcport\":8892,\"pubtype\":38,\"p2shtype\":10,\"wiftype\":198,\"txfee\":10000}, {\"coin\":\"PCL\",\"name\":\"peculium\",\"etomic\":\"0x3618516f45cd3c913f81f9987af41077932bc40d\",\"rpcport\":80}, {\"coin\":\"RLTY\",\"name\":\"smartrealty\",\"etomic\":\"0xbe99b09709fc753b09bcf557a992f6605d5997b0\",\"rpcport\":80},{\"coin\":\"CIX\",\"name\":\"cryptonetix\",\"etomic\":\"0x1175a66a5c3343Bbf06AA818BB482DdEc30858E0\",\"rpcport\":80}, {\"coin\":\"GLXT\",\"asset\":\"GLXT\",\"rpcport\":15723}, {\"coin\":\"PYRO\",\"name\":\"pyro\",\"confpath\":\"${HOME#}/.pyrocore/pyro.conf\",\"rpcport\":9696,\"pubtype\":55,\"p2shtype\":10,\"wiftype\":198,\"txfee\":10000}, {\"coin\": \"BNTN\",\"asset\": \"BNTN\",\"rpcport\": 14358},{\"coin\":\"ORE\",\"name\":\"galactrum\",\"rpcport\":6269,\"pubtype\":38,\"p2shtype\":16,\"wiftype\":204,\"txfee\":10000}, {\"coin\":\"ELD\",\"name\":\"maker\",\"etomic\":\"0xaaf7d4cd097317d68174215395eb02c2cca81e31\",\"rpcport\":80}, {\"coin\":\"CENNZ\",\"name\":\"centrality\",\"etomic\":\"0x1122b6a0e00dce0563082b6e2953f3a943855c1f\",\"rpcport\":80}, {\"coin\":\"PGN\",\"name\":\"pigeon\",\"rpcport\":8756,\"pubtype\":55,\"p2shtype\":122,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"XCG\",\"name\":\"Xchange\",\"confpath\":\"${HOME#}/.Xchangecore/Xchange.conf\",\"rpcport\":9386,\"pubtype\":76,\"p2shtype\":16,\"wiftype\":204,\"txfee\":10000}, {\"coin\":\"AXE\",\"name\":\"axe\",\"confpath\":\"${HOME#}/.axecore/axe.conf\",\"rpcport\":9337,\"pubtype\":55,\"p2shtype\":16,\"wiftype\":204,\"txfee\":10000}, {\"coin\":\"PEW\",\"name\":\"brofist\",\"rpcport\":12454,\"pubtype\":55,\"p2shtype\":10,\"wiftype\":198,\"txfee\":10000,\"confpath\":\"${HOME#}/.brofistcore/brofist.conf\"}, {\"coin\":\"BCBC\",\"name\":\"bitcoin@cbc\",\"confpath\":\"${HOME#}/.bitcoin@cbc/bitcoin.conf\",\"rpcport\":8340,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"GRLC\",\"name\":\"garlicoin\",\"rpcport\":42068,\"pubtype\":38,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"EQL\",\"asset\":\"EQL\",\"rpcport\":10306}, {\"coin\":\"OCC\",\"name\":\"originalcryptocoin\",\"etomic\":\"0x0235fe624e044a05eed7a43e16e3083bc8a4287a\",\"rpcport\":80}, {\"coin\":\"DIN\",\"name\":\"dinero\",\"rpcport\":9998,\"pubtype\":30,\"p2shtype\":13,\"wiftype\":204,\"txfee\":10000,\"confpath\":\"${HOME#}/.dinerocore/dinero.conf\"}, {\"coin\":\"BUCK\",\"name\":\"buck\",\"rpcport\":5739,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"LYS\",\"name\":\"lightyears\",\"etomic\":\"0xdd41fbd1ae95c5d9b198174a28e04be6b3d1aa27\",\"rpcport\":80}, {\"coin\":\"RAP\",\"name\":\"rapture\",\"rpcport\":14776,\"pubtype\":60,\"p2shtype\":16,\"wiftype\":204,\"txfee\":10000,\"confpath\":\"${HOME#}/.rapturecore/rapture.conf\"}, {\"coin\":\"RADIUS\",\"name\":\"radius\",\"rpcport\":4089,\"pubtype\":60,\"p2shtype\":16,\"wiftype\":15,\"txfee\":10000,\"confpath\":\"${HOME#}/.radiuscore/radius.conf\"},{\"coin\":\"BTCL\",\"name\":\"btclite\",\"etomic\":\"0x5acd19b9c91e596b1f062f18e3d02da7ed8d1e50\",\"rpcport\":80}, {\"coin\":\"SEQ\",\"name\":\"sequence\",\"rpcport\":16663,\"isPoS\":1,\"pubtype\":63,\"p2shtype\":64,\"wiftype\":170,\"txfee\":10000}, {\"coin\":\"DYN\",\"name\":\"dynamic\",\"rpcport\":33350,\"pubtype\":30,\"p2shtype\":10,\"wiftype\":140,\"txfee\":10000}, {\"coin\":\"SBTC\",\"name\":\"SuperBitcoin\",\"rpcport\":28282,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":10000,\"confpath\":\"${HOME#}/.sbtc/sbtc.conf\"}, {\"coin\":\"FJC\",\"name\":\"fujicoin\",\"rpcport\":3776,\"pubtype\":36,\"p2shtype\":16,\"wiftype\":164,\"txfee\":100000}, {\"coin\":\"AIR\",\"name\":\"airtoken\",\"etomic\":\"0x27dce1ec4d3f72c3e457cc50354f1f975ddef488\",\"rpcport\":80}, {\"coin\":\"VRT\",\"name\":\"virtus\",\"confpath\":\"${HOME#}/.virtuscore/virtus.conf\",\"rpcport\":13880,\"pubtype\":70,\"p2shtype\":16,\"wiftype\":204,\"txfee\":10000}, {\"coin\":\"DRT\",\"name\":\"domraider\",\"etomic\":\"0x9af4f26941677c706cfecf6d3379ff01bb85d5ab\",\"rpcport\":80}, {\"coin\":\"BITS\",\"name\":\"bitstar\",\"rpcport\":15715,\"isPoS\":1,\"pubtype\":25,\"p2shtype\":8,\"wiftype\":153,\"txfee\":10000}, {\"coin\":\"FTC\",\"name\":\"feathercoin\",\"rpcport\":9337,\"pubtype\":14,\"p2shtype\":5,\"wiftype\":142,\"txfee\":1000000}, {\"coin\":\"PXT\",\"name\":\"populous-xbrl-token\",\"etomic\":\"0xc14830e53aa344e8c14603a91229a0b925b0b262\",\"rpcport\":80}, {\"coin\":\"USDT\",\"name\":\"tether\",\"etomic\":\"0xdac17f958d2ee523a2206206994597c13d831ec7\",\"rpcport\":80}, {\"coin\":\"ELI\",\"name\":\"elicoin\",\"rpcport\":9332,\"pubtype\":33,\"p2shtype\":102,\"wiftype\":205,\"txfee\":10000}, {\"coin\":\"SCRIV\",\"name\":\"scriv\",\"confpath\":\"${HOME#}/.scrivcore/scriv.conf\",\"rpcport\":7998,\"pubtype\":125,\"p2shtype\":16,\"wiftype\":204,\"txfee\":10000}, {\"coin\":\"ELP\",\"name\":\"ellerium\",\"rpcport\":61020,\"pubtype\":23,\"p2shtype\":13,\"wiftype\":212,\"txfee\":10000}, {\"coin\":\"ROI\",\"name\":\"ROIcoin\",\"rpcport\":3376,\"pubtype\":60,\"p2shtype\":122,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"XCOIN\",\"name\":\"xcoin\",\"rpcport\":22717,\"pubtype\":137,\"p2shtype\":15,\"wiftype\":75,\"txfee\":100000}, {\"coin\":\"BBT\",\"name\":\"bitboost\",\"etomic\":\"0x1500205f50bf3fd976466d0662905c9ff254fc9c\",\"rpcport\":80}, {\"coin\":\"TRX\",\"name\":\"tron\",\"etomic\":\"0xf230b790e05390fc8295f4d3f60332c93bed42e2\",\"rpcport\":80}, {\"coin\":\"OMG\",\"name\":\"omisego\",\"etomic\":\"0xd26114cd6EE289AccF82350c8d8487fedB8A0C07\",\"rpcport\":80}, {\"coin\":\"ICX\",\"name\":\"icon\",\"etomic\":\"0xb5a5f22694352c15b00323844ad545abb2b11028\",\"rpcport\":80,\"decimals\":18}, {\"coin\":\"BNB\",\"name\":\"binance-coin\",\"etomic\":\"0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\"rpcport\":80}, {\"coin\":\"DGD\",\"name\":\"digixdao\",\"etomic\":\"0xE0B7927c4aF23765Cb51314A0E0521A9645F0E2A\",\"rpcport\":80,\"decimals\":9}, {\"coin\":\"PPT\",\"name\":\"populous\",\"etomic\":\"0xd4fa1460F537bb9085d22C7bcCB5DD450Ef28e3a\",\"rpcport\":80}, {\"coin\":\"MKR\",\"name\":\"maker\",\"etomic\":\"0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2\",\"rpcport\":80}, {\"coin\":\"SNT\",\"name\":\"status\",\"etomic\":\"0x744d70FDBE2Ba4CF95131626614a1763DF805B9E\",\"rpcport\":80}, {\"coin\":\"REP\",\"name\":\"augur\",\"etomic\":\"0xE94327D07Fc17907b4DB788E5aDf2ed424adDff6\",\"rpcport\":80}, {\"coin\":\"ZRX\",\"name\":\"0x\",\"etomic\":\"0xE41d2489571d322189246DaFA5ebDe1F4699F498\",\"rpcport\":80}, {\"coin\":\"BAT\",\"name\":\"basic-attention-token\",\"etomic\":\"0x0D8775F648430679A709E98d2b0Cb6250d2887EF\",\"rpcport\":80}, {\"coin\":\"ETHOS\",\"name\":\"ethos\",\"etomic\":\"0x5Af2Be193a6ABCa9c8817001F45744777Db30756\",\"rpcport\":80}, {\"coin\":\"QASH\",\"name\":\"qash\",\"etomic\":\"0x618E75Ac90b12c6049Ba3b27f5d5F8651b0037F6\",\"rpcport\":80}, {\"coin\":\"FUN\",\"name\":\"funfair\",\"etomic\":\"0x419D0d8BdD9aF5e606Ae2232ed285Aff190E711b\",\"rpcport\":80}, {\"coin\":\"KNC\",\"name\":\"kyber-network\",\"etomic\":\"0xdd974D5C2e2928deA5F71b9825b8b646686BD200\",\"rpcport\":80}, {\"coin\":\"SALT\",\"name\":\"salt\",\"etomic\":\"0x4156D3342D5c385a87D264F90653733592000581\",\"rpcport\":80}, {\"coin\":\"BNT\",\"name\":\"bancor\",\"etomic\":\"0x1F573D6Fb3F13d689FF844B4cE37794d79a7FF1C\",\"rpcport\":80}, {\"coin\":\"ICN\",\"name\":\"iconomi\",\"etomic\":\"0x888666CA69E0f178DED6D75b5726Cee99A87D698\",\"rpcport\":80}, {\"coin\":\"PAY\",\"name\":\"tenx\",\"etomic\":\"0xB97048628DB6B661D4C2aA833e95Dbe1A905B280\",\"rpcport\":80}, {\"coin\":\"REQ\",\"name\":\"request-network\",\"etomic\":\"0x8f8221aFbB33998d8584A2B05749bA73c37a938a\",\"rpcport\":80}, {\"coin\":\"STORJ\",\"name\":\"storj\",\"etomic\":\"0xB64ef51C888972c908CFacf59B47C1AfBC0Ab8aC\",\"rpcport\":80}, {\"coin\":\"GNO\",\"name\":\"gnosis-gno\",\"etomic\":\"0x6810e776880C02933D47DB1b9fc05908e5386b96\",\"rpcport\":80}, {\"coin\":\"RLC\",\"name\":\"rlc\",\"etomic\":\"0x607F4C5BB672230e8672085532f7e901544a7375\",\"rpcport\":80}, {\"coin\":\"ENJ\",\"name\":\"enjin-coin\",\"etomic\":\"0xF629cBd94d3791C9250152BD8dfBDF380E2a3B9c\",\"rpcport\":80}, {\"coin\":\"QSP\",\"name\":\"quantstamp\",\"etomic\":\"0x99ea4dB9EE77ACD40B119BD1dC4E33e1C070b80d\",\"rpcport\":80}, {\"coin\":\"RDN\",\"name\":\"raiden-network-token\",\"etomic\":\"0x255Aa6DF07540Cb5d3d297f0D0D4D84cb52bc8e6\",\"rpcport\":80}, {\"coin\":\"CVC\",\"name\":\"civic\",\"etomic\":\"0x41e5560054824eA6B0732E656E3Ad64E20e94E45\",\"rpcport\":80}, {\"coin\":\"SAN\",\"name\":\"santiment\",\"etomic\":\"0x7C5A0CE9267ED19B22F8cae653F198e3E8daf098\",\"rpcport\":80}, {\"coin\":\"ANT\",\"name\":\"aragon\",\"etomic\":\"0x960b236A07cf122663c4303350609A66A7B288C0\",\"rpcport\":80}, {\"coin\":\"MANA\",\"name\":\"decentraland\",\"etomic\":\"0x0F5D2fB29fb7d3CFeE444a200298f468908cC942\",\"rpcport\":80}, {\"coin\":\"MCO\",\"name\":\"monaco\",\"etomic\":\"0xB63B606Ac810a52cCa15e44bB630fd42D8d1d83d\",\"rpcport\":80}, {\"coin\":\"MTL\",\"name\":\"metal\",\"etomic\":\"0xF433089366899D83a9f26A773D59ec7eCF30355e\",\"rpcport\":80}, {\"coin\":\"EDG\",\"name\":\"edgeless\",\"etomic\":\"0x08711D3B02C8758F2FB3ab4e80228418a7F8e39c\",\"rpcport\":80}, {\"coin\":\"MLN\",\"name\":\"melon\",\"etomic\":\"0xBEB9eF514a379B997e0798FDcC901Ee474B6D9A1\",\"rpcport\":80}, {\"coin\":\"AMB\",\"name\":\"amber\",\"etomic\":\"0x4DC3643DbC642b72C158E7F3d2ff232df61cb6CE\",\"rpcport\":80}, {\"coin\":\"WINGS\",\"name\":\"wings\",\"etomic\":\"0x667088b212ce3d06a1b553a7221E1fD19000d9aF\",\"rpcport\":80}, {\"coin\":\"RCN\",\"name\":\"ripio-credit-network\",\"etomic\":\"0xF970b8E36e23F7fC3FD752EeA86f8Be8D83375A6\",\"rpcport\":80}, {\"coin\":\"SNGLS\",\"name\":\"singulardtv\",\"etomic\":\"0xaeC2E87E0A235266D9C5ADc9DEb4b2E29b54D009\",\"rpcport\":80}, {\"coin\":\"TAAS\",\"name\":\"taas\",\"etomic\":\"0xE7775A6e9Bcf904eb39DA2b68c5efb4F9360e08C\",\"rpcport\":80}, {\"coin\":\"DNT\",\"name\":\"district0x\",\"etomic\":\"0x0AbdAce70D3790235af448C88547603b945604ea\",\"rpcport\":80}, {\"coin\":\"CFI\",\"name\":\"cofound-it\",\"etomic\":\"0x12FEF5e57bF45873Cd9B62E9DBd7BFb99e32D73e\",\"rpcport\":80}, {\"coin\":\"LUN\",\"name\":\"lunyr\",\"etomic\":\"0xfa05A73FfE78ef8f1a739473e462c54bae6567D9\",\"rpcport\":80}, {\"coin\":\"ADT\",\"name\":\"adtoken\",\"etomic\":\"0xD0D6D6C5Fe4a677D343cC433536BB717bAe167dD\",\"rpcport\":80}, {\"coin\":\"AST\",\"name\":\"airswap\",\"etomic\":\"0x27054b13b1B798B345b591a4d22e6562d47eA75a\",\"rpcport\":80}, {\"coin\":\"CDT\",\"name\":\"blox\",\"etomic\":\"0x177d39AC676ED1C67A2b268AD7F1E58826E5B0af\",\"rpcport\":80}, {\"coin\":\"TKN\",\"name\":\"tokencard\",\"etomic\":\"0xaAAf91D9b90dF800Df4F55c205fd6989c977E73a\",\"rpcport\":80}, {\"coin\":\"HMQ\",\"name\":\"humaniq\",\"etomic\":\"0xcbCC0F036ED4788F63FC0fEE32873d6A7487b908\",\"rpcport\":80}, {\"coin\":\"NMR\",\"name\":\"numeraire\",\"etomic\":\"0x1776e1F26f98b1A5dF9cD347953a26dd3Cb46671\",\"rpcport\":80}, {\"coin\":\"NET\",\"name\":\"nimiq\",\"etomic\":\"0xcfb98637bcae43C13323EAa1731cED2B716962fD\",\"rpcport\":80}, {\"coin\":\"TRST\",\"name\":\"trust\",\"etomic\":\"0xCb94be6f13A1182E4A4B6140cb7bf2025d28e41B\",\"rpcport\":80}, {\"coin\":\"GUP\",\"name\":\"guppy\",\"etomic\":\"0xf7B098298f7C69Fc14610bf71d5e02c60792894C\",\"rpcport\":80}, {\"coin\":\"1ST\",\"name\":\"firstblood\",\"etomic\":\"0xAf30D2a7E90d7DC361c8C4585e9BB7D2F6f15bc7\",\"rpcport\":80}, {\"coin\":\"TIME\",\"name\":\"chronobank\",\"etomic\":\"0x6531f133e6DeeBe7F2dcE5A0441aA7ef330B4e53\",\"rpcport\":80}, {\"coin\":\"SWT\",\"name\":\"swarm-city\",\"etomic\":\"0xB9e7F8568e08d5659f5D29C4997173d84CdF2607\",\"rpcport\":80}, {\"coin\":\"ROL\",\"name\":\"dice\",\"etomic\":\"0x2e071D2966Aa7D8dECB1005885bA1977D6038A65\",\"rpcport\":80}, {\"coin\":\"XAUR\",\"name\":\"xaurum\",\"etomic\":\"0x4DF812F6064def1e5e029f1ca858777CC98D2D81\",\"rpcport\":80}, {\"coin\":\"PLU\",\"name\":\"pluton\",\"etomic\":\"0xD8912C10681D8B21Fd3742244f44658dBA12264E\",\"rpcport\":80}, {\"coin\":\"HGT\",\"name\":\"hellogold\",\"etomic\":\"0xba2184520A1cC49a6159c57e61E1844E085615B6\",\"rpcport\":80}, {\"coin\":\"VSL\",\"name\":\"vslice\",\"etomic\":\"0x5c543e7AE0A1104f78406C340E9C64FD9fCE5170\",\"rpcport\":80,\"decimals\":18}, {\"coin\":\"IND\",\"name\":\"indorse-token\",\"etomic\":\"0xf8e386EDa857484f5a12e4B5DAa9984E06E73705\",\"rpcport\":80}, {\"coin\":\"FYN\",\"name\":\"fundyourselfnow\",\"etomic\":\"0x88FCFBc22C6d3dBaa25aF478C578978339BDe77a\",\"rpcport\":80},{\"coin\":\"SMART\",\"name\":\"smartcash\",\"rpcport\":9679,\"pubtype\":63,\"p2shtype\":18,\"wiftype\":191,\"txfee\":200000}, {\"coin\":\"BTCP\",\"name\":\"btcprivate\",\"rpcport\":7932,\"taddr\":19,\"pubtype\":37,\"p2shtype\":175,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"DNR\",\"isPoS\":1,\"active\":1,\"name\":\"denarius\",\"rpcport\":32339,\"pubtype\":30,\"p2shtype\":90,\"wiftype\":158,\"txfee\":10000}, {\"coin\":\"RVN\",\"name\":\"raven\",\"rpcport\":8766,\"pubtype\":60,\"p2shtype\":122,\"wiftype\":128,\"txfee\":100000}, {\"coin\":\"VIVO\",\"name\":\"vivo\",\"confpath\":\"${HOME#}/.vivocore/vivo.conf\",\"rpcport\":9998,\"pubtype\":70,\"p2shtype\":10,\"wiftype\":198,\"txfee\":10000}, {\"coin\":\"KNG\",\"name\":\"kings\",\"rpcport\":44888,\"pubtype\":75,\"p2shtype\":125,\"wiftype\":203,\"txfee\":10000}, {\"coin\":\"UFO\",\"name\":\"ufocoin\",\"confpath\":\"${HOME#}/.ufo/ufocoin.conf\",\"rpcport\":9888,\"pubtype\":27,\"p2shtype\":5,\"wiftype\":155,\"txfee\":100000}, {\"coin\":\"ETH\",\"name\":\"ethereum\",\"etomic\":\"0x0000000000000000000000000000000000000000\",\"rpcport\":80}, {\"coin\":\"EOS\",\"name\":\"EOS\",\"etomic\":\"0x86fa049857e0209aa7d9e616f7eb3b3b78ecfdb0\",\"rpcport\":80}, {\"coin\":\"KREDS\",\"name\":\"kreds\",\"rpcport\":3850,\"pubtype\":45,\"p2shtype\":5,\"wiftype\":195,\"txfee\":10000}, {\"coin\":\"SNG\",\"name\":\"snowgem\",\"rpcport\":16112,\"taddr\":28,\"pubtype\":40,\"p2shtype\":45,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"ZEL\",\"name\":\"zelcash\",\"rpcport\":16124,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"PIVX\",\"name\":\"pivx\",\"rpcport\":51473,\"pubtype\":30,\"p2shtype\":13,\"wiftype\":212,\"txfee\":10000}, {\"coin\":\"HTML\",\"name\":\"htmlcoin\",\"rpcport\":4889,\"pubtype\":41,\"p2shtype\":100,\"wiftype\":169,\"txfee\":400000}, {\"coin\":\"MNX\",\"name\":\"Minexcoin\",\"rpcport\":17786,\"pubtype\":75,\"p2shtype\":5,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"LTZ\",\"name\":\"litecoinz\",\"rpcport\":29332,\"taddr\":10,\"pubtype\":179,\"p2shtype\":184,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"BAY\",\"name\":\"bitbay\",\"isPoS\":1,\"rpcport\":19915,\"pubtype\":25,\"p2shtype\":85,\"wiftype\":153,\"txfee\":10000}, {\"coin\":\"OOT\",\"asset\":\"OOT\",\"rpcport\":12467}, {\"coin\":\"ZOI\",\"name\":\"zoin\",\"rpcport\":8255,\"pubtype\":80,\"p2shtype\":7,\"wiftype\":208,\"txfee\":1000}, {\"coin\": \"PIZZA\",\"asset\": \"PIZZA\",\"rpcport\": 11116},{\"coin\": \"BEER\",\"asset\": \"BEER\",\"rpcport\": 8923}, {\"coin\":\"GRS\",\"name\":\"groestlcoin\",\"rpcport\":1441,\"pubtype\":36,\"p2shtype\":5,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"XMCC\",\"name\":\"monoeci\",\"confpath\":\"${HOME#}/.monoeciCore/monoeci.conf\",\"rpcport\":24156,\"pubtype\":50,\"p2shtype\":73,\"wiftype\":77,\"txfee\":10000}, {\"coin\":\"BTCH\",\"asset\":\"BTCH\",\"rpcport\":8800},{\"coin\":\"ETOMIC\",\"asset\":\"ETOMIC\",\"rpcport\":10271},{\"coin\":\"AXO\",\"asset\":\"AXO\",\"rpcport\":12927},{\"coin\":\"CRC\",\"name\":\"crowdcoin\",\"confpath\":\"${HOME#}/.crowdcoincore/crowdcoin.conf\",\"rpcport\":11998,\"pubtype\":28,\"p2shtype\":88,\"wiftype\":0,\"txfee\":10000}, {\"coin\":\"VOT\",\"name\":\"votecoin\",\"rpcport\":8232,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"INN\",\"name\":\"innova\",\"confpath\":\"${HOME#}/.innovacore/innova.conf\",\"rpcport\":8818,\"pubtype\":102,\"p2shtype\":20,\"wiftype\":195,\"txfee\":10000}, {\"coin\":\"MOON\",\"name\":\"mooncoin\",\"rpcport\":44663,\"pubtype\":3,\"p2shtype\":22,\"wiftype\":131,\"txfee\":100000}, {\"coin\":\"CRW\",\"name\":\"crown\",\"rpcport\":9341,\"pubtype\":0,\"p2shtype\":28,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"EFL\",\"name\":\"egulden\",\"confpath\":\"${HOME#}/.egulden/coin.conf\",\"rpcport\":21015,\"pubtype\":48,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"GBX\",\"name\":\"gobyte\",\"confpath\":\"${HOME#}/.gobytecore/gobyte.conf\",\"rpcport\":12454,\"pubtype\":38,\"p2shtype\":10,\"wiftype\":198,\"txfee\":10000}, {\"coin\":\"BCO\",\"name\":\"bridgecoin\",\"rpcport\":6332,\"pubtype\":27,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"BLK\",\"name\":\"blackcoin\",\"confpath\":\"${HOME#}/.lore/blackcoin.conf\",\"isPoS\":1,\"rpcport\":15715,\"pubtype\":25,\"p2shtype\":85,\"wiftype\":153,\"txfee\":100000}, {\"coin\":\"BTG\",\"name\":\"bitcoingold\",\"rpcport\":8332,\"pubtype\":38,\"p2shtype\":23,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"BCH\",\"name\":\"bch\",\"rpcport\":33333,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"ABY\",\"name\":\"applebyte\",\"rpcport\":8607,\"pubtype\":23,\"p2shtype\":5,\"wiftype\":151,\"txfee\":100000}, {\"coin\":\"STAK\",\"name\":\"straks\",\"rpcport\":7574,\"pubtype\":63,\"p2shtype\":5,\"wiftype\":204,\"txfee\":10000}, {\"coin\":\"XZC\",\"name\":\"zcoin\",\"rpcport\":8888,\"pubtype\":82,\"p2shtype\":7,\"wiftype\":210,\"txfee\":10000}, {\"coin\":\"QTUM\",\"name\":\"qtum\",\"rpcport\":3889,\"pubtype\":58,\"p2shtype\":50,\"wiftype\":128,\"txfee\":400000}, {\"coin\":\"PURA\",\"name\":\"pura\",\"rpcport\":55555,\"pubtype\":55,\"p2shtype\":16,\"wiftype\":150,\"txfee\":10000}, {\"coin\":\"DSR\",\"name\":\"desire\",\"confpath\":\"${HOME#}/.desirecore/desire.conf\",\"rpcport\":9918,\"pubtype\":30,\"p2shtype\":16,\"wiftype\":204,\"txfee\":10000}, {\"coin\":\"MNZ\",\"asset\":\"MNZ\",\"rpcport\":14337},{\"coin\":\"BTCZ\",\"name\":\"bitcoinz\",\"rpcport\":1979,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"MAGA\",\"name\":\"magacoin\",\"rpcport\":5332,\"pubtype\":23,\"p2shtype\":50,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"BSD\",\"name\":\"bitsend\",\"rpcport\":8800,\"pubtype\":102,\"p2shtype\":5,\"wiftype\":204,\"txfee\":10000}, {\"coin\":\"IOP\",\"name\":\"IoP\",\"rpcport\":8337,\"pubtype\":117,\"p2shtype\":174,\"wiftype\":49,\"txfee\":10000}, {\"coin\":\"BLOCK\",\"name\":\"blocknetdx\",\"rpcport\":41414,\"pubtype\":26,\"p2shtype\":28,\"wiftype\":154,\"txfee\":10000}, {\"coin\":\"CHIPS\", \"name\": \"chips\", \"rpcport\":57776,\"pubtype\":60, \"p2shtype\":85, \"wiftype\":188, \"txfee\":10000}, {\"coin\":\"888\",\"name\":\"octocoin\",\"rpcport\":22888,\"pubtype\":18,\"p2shtype\":5,\"wiftype\":176,\"txfee\":2000000}, {\"coin\":\"ARG\",\"name\":\"argentum\",\"rpcport\":13581,\"pubtype\":23,\"p2shtype\":5,\"wiftype\":151,\"txfee\":50000}, {\"coin\":\"GLT\",\"name\":\"globaltoken\",\"rpcport\":9320,\"pubtype\":38,\"p2shtype\":5,\"wiftype\":166,\"txfee\":10000}, {\"coin\":\"ZER\",\"name\":\"zero\",\"rpcport\":23801,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"HODLC\",\"name\":\"hodlcoin\",\"rpcport\":11989,\"pubtype\":40,\"p2shtype\":5,\"wiftype\":168,\"txfee\":5000}, {\"coin\":\"UIS\",\"name\":\"unitus\",\"rpcport\":50604,\"pubtype\":68,\"p2shtype\":10,\"wiftype\":132,\"txfee\":2000000}, {\"coin\":\"HUC\",\"name\":\"huntercoin\",\"rpcport\":8399,\"pubtype\":40,\"p2shtype\":13,\"wiftype\":168,\"txfee\":100000}, {\"coin\":\"BDL\",\"name\":\"bitdeal\",\"rpcport\":9332,\"pubtype\":38,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"ARC\",\"name\":\"arcticcoin\",\"confpath\":\"${HOME#}/.arcticcore/arcticcoin.conf\",\"rpcport\":7208,\"pubtype\":23,\"p2shtype\":8,\"wiftype\":176,\"txfee\":10000}, {\"coin\":\"ZCL\",\"name\":\"zclassic\",\"rpcport\":8023,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":1000}, {\"coin\":\"VIA\",\"name\":\"viacoin\",\"rpcport\":5222,\"pubtype\":71,\"p2shtype\":33,\"wiftype\":199,\"txfee\":100000}, {\"coin\":\"ERC\",\"name\":\"europecoin\",\"rpcport\":11989,\"pubtype\":33,\"p2shtype\":5,\"wiftype\":168,\"txfee\":10000},{\"coin\":\"FAIR\",\"name\":\"faircoin\",\"confpath\":\"${HOME#}/.faircoin2/faircoin.conf\",\"rpcport\":40405,\"pubtype\":95,\"p2shtype\":36,\"wiftype\":223,\"txfee\":1000000}, {\"coin\":\"FLO\",\"name\":\"florincoin\",\"rpcport\":7313,\"pubtype\":35,\"p2shtype\":8,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"SXC\",\"name\":\"sexcoin\",\"rpcport\":9561,\"pubtype\":62,\"p2shtype\":5,\"wiftype\":190,\"txfee\":100000}, {\"coin\":\"CREA\",\"name\":\"creativecoin\",\"rpcport\":17711,\"pubtype\":28,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000}, {\"coin\":\"TRC\",\"name\":\"terracoin\",\"confpath\":\"${HOME#}/.terracoincore/terracoin.conf\",\"rpcport\":13332,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"BTA\",\"name\":\"bata\",\"rpcport\":5493,\"pubtype\":25,\"p2shtype\":5,\"wiftype\":188,\"txfee\":100000}, {\"coin\":\"SMC\",\"name\":\"smartcoin\",\"rpcport\":58583,\"pubtype\":63,\"p2shtype\":5,\"wiftype\":191,\"txfee\":1000000}, {\"coin\":\"NMC\",\"name\":\"namecoin\",\"rpcport\":8336,\"pubtype\":52,\"p2shtype\":13,\"wiftype\":180,\"txfee\":100000}, {\"coin\":\"NAV\",\"name\":\"navcoin\",\"isPoS\":1,\"confpath\":\"${HOME#}/.navcoin4/navcoin.conf\",\"rpcport\":44444,\"pubtype\":53,\"p2shtype\":85,\"wiftype\":150,\"txfee\":10000}, {\"coin\":\"EMC2\",\"name\":\"einsteinium\",\"rpcport\":41879,\"pubtype\":33,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000},{\"coin\":\"SYS\",\"name\":\"syscoin\",\"rpcport\":8370,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"I0C\",\"name\":\"i0coin\",\"rpcport\":7332,\"pubtype\":105,\"p2shtype\":5,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"DASH\",\"confpath\":\"${HOME#}/.dashcore/dash.conf\",\"name\":\"dashcore\",\"rpcport\":9998,\"pubtype\":76,\"p2shtype\":16,\"wiftype\":204,\"txfee\":10000}, {\"coin\":\"STRAT\", \"name\": \"stratis\", \"active\":0, \"rpcport\":16174,\"pubtype\":63, \"p2shtype\":125, \"wiftype\":191, \"txfee\":10000}, {\"confpath\":\"${HOME#}/.muecore/mue.conf\",\"coin\":\"MUE\",\"name\":\"muecore\",\"rpcport\":29683,\"pubtype\":16,\"p2shtype\":76,\"wiftype\":126,\"txfee\":10000}, {\"coin\":\"MONA\",\"name\":\"monacoin\",\"rpcport\":9402,\"pubtype\":50,\"p2shtype\":5,\"wiftype\":176,\"txfee\":100000},{\"coin\":\"XMY\",\"name\":\"myriadcoin\",\"rpcport\":10889,\"pubtype\":50,\"p2shtype\":9,\"wiftype\":178,\"txfee\":5000}, {\"coin\":\"MAC\",\"name\":\"machinecoin\",\"rpcport\":40332,\"pubtype\":50,\"p2shtype\":5,\"wiftype\":178,\"txfee\":100000}, {\"coin\":\"BTX\",\"name\":\"bitcore\",\"rpcport\":8556,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":50000}, {\"coin\":\"XRE\",\"name\":\"revolvercoin\",\"rpcport\":8775,\"pubtype\":0,\"p2shtype\":5,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"LBC\",\"name\":\"lbrycrd\",\"rpcport\":9245,\"pubtype\":85,\"p2shtype\":122,\"wiftype\":28,\"txfee\":10000}, {\"coin\":\"SIB\",\"name\":\"sibcoin\",\"rpcport\":1944,\"pubtype\":63,\"p2shtype\":40,\"wiftype\":128,\"txfee\":10000}, {\"coin\":\"VTC\", \"name\":\"vertcoin\", \"rpcport\":5888, \"pubtype\":71, \"p2shtype\":5, \"wiftype\":128, \"txfee\":100000 }, {\"coin\":\"REVS\",\"active\":0, \"asset\":\"REVS\",\"rpcport\":10196}, {\"coin\":\"JUMBLR\",\"active\":0, \"asset\":\"JUMBLR\",\"rpcport\":15106}, {\"coin\":\"DOGE\",\"name\":\"dogecoin\",\"rpcport\":22555,\"pubtype\":30,\"p2shtype\":22,\"wiftype\":158,\"txfee\":100000000}, {\"coin\":\"HUSH\",\"name\":\"hush\",\"rpcport\":8822,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":1000 }, {\"active\":0,\"coin\":\"ZEC\",\"name\":\"zcash\",\"rpcport\":8232,\"taddr\":28,\"pubtype\":184,\"p2shtype\":189,\"wiftype\":128,\"txfee\":10000 }, {\"coin\":\"DGB\",\"name\":\"digibyte\",\"rpcport\":14022,\"pubtype\":30,\"p2shtype\":5,\"wiftype\":128,\"txfee\":100000}, {\"coin\":\"ZET\", \"name\":\"zetacoin\", \"pubtype\":80, \"p2shtype\":9,\"rpcport\":8332, \"wiftype\":224, \"txfee\":10000}, {\"coin\":\"GAME\", \"rpcport\":40001, \"name\":\"gamecredits\", \"pubtype\":38, \"p2shtype\":5, \"wiftype\":166, \"txfee\":100000}, {\"coin\":\"LTC\", \"name\":\"litecoin\", \"rpcport\":9332, \"pubtype\":48, \"p2shtype\":5, \"wiftype\":176, \"txfee\":100000 }, {\"coin\":\"SUPERNET\",\"asset\":\"SUPERNET\",\"rpcport\":11341}, {\"coin\":\"WLC\",\"asset\":\"WLC\",\"rpcport\":12167}, {\"coin\":\"PANGEA\",\"asset\":\"PANGEA\",\"rpcport\":14068}, {\"coin\":\"DEX\",\"asset\":\"DEX\",\"rpcport\":11890}, {\"coin\":\"BET\",\"asset\":\"BET\",\"rpcport\":14250}, {\"coin\":\"CRYPTO\",\"asset\":\"CRYPTO\",\"rpcport\":8516}, {\"coin\":\"HODL\",\"asset\":\"HODL\",\"rpcport\":14431}, {\"coin\":\"MSHARK\",\"asset\":\"MSHARK\",\"rpcport\":8846}, {\"coin\":\"BOTS\",\"asset\":\"BOTS\",\"rpcport\":11964}, {\"coin\":\"MGW\",\"asset\":\"MGW\",\"rpcport\":12386}, {\"coin\":\"COQUI\",\"asset\":\"COQUI\",\"rpcport\":14276}, {\"coin\":\"KV\",\"asset\":\"KV\",\"rpcport\":8299}, {\"coin\":\"CEAL\",\"asset\":\"CEAL\",\"rpcport\":11116}, {\"coin\":\"MESH\",\"asset\":\"MESH\",\"rpcport\":9455}]" +#{\"coin\":\"CMM\",\"name\":\"commercium\",\"rpcport\":9657,\"pubtype\":28,\"p2shtype\":50,\"wiftype\":140,\"txfee\":10000}, diff --git a/iguana/exchanges/mm.c b/iguana/exchanges/mm.c index aa0866b07..5e17513d3 100644 --- a/iguana/exchanges/mm.c +++ b/iguana/exchanges/mm.c @@ -346,6 +346,12 @@ int main(int argc, const char * argv[]) printf("couldnt write to (%s)\n",dirname); exit(0); } + sprintf(dirname,"%s/GTC",GLOBAL_DBDIR), OS_ensure_directory(dirname); + if ( ensure_writable(dirname) < 0 ) + { + printf("couldnt write to (%s)\n",dirname); + exit(0); + } sprintf(dirname,"%s/PRICES",GLOBAL_DBDIR), OS_ensure_directory(dirname); if ( ensure_writable(dirname) < 0 ) { diff --git a/iguana/exchanges/movecoinbases b/iguana/exchanges/movecoinbases new file mode 100755 index 000000000..fee7ba0d2 --- /dev/null +++ b/iguana/exchanges/movecoinbases @@ -0,0 +1,3 @@ +#!/bin/bash +source userpass +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"movecoinbases\",\"coin\":\"VRSC\"}" diff --git a/iguana/exchanges/prices/autoprice b/iguana/exchanges/prices/autoprice index 2e4b5dadb..d58c337e7 100755 --- a/iguana/exchanges/prices/autoprice +++ b/iguana/exchanges/prices/autoprice @@ -39,7 +39,7 @@ sharkholdings="{\"coin\":\"iota\",\"balance\":1500000}, {\"coin\":\"komodo\",\"b curl --url "http://127.0.0.1:7783" --data "{\"base\":\"MSHARK\",\"rel\":\"KMD\",\"fundvalue_bid\":\"NAV_KMD\",\"fundvalue_ask\":\"assetNAV_KMD\",\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"margin\":$margin,\"address\":\"RTu3JZZKLJTcfNwBa19dWRagEfQq49STqC\",\"holdings\":[$sharkholdings],\"divisor\":1400000}" -curl --url "http://127.0.0.1:7783" --data "{\"margin\":$margin,\"base\":\"SUPERNET\",\"rel\":\"KMD\",\"fundvalue_bid\":\"NAV_KMD\",\"fundvalue_ask\":\"NAV_KMD\",\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"address\":\"RRyyejME7LRTuvdziWsXkAbSW1fdiohGwK\",\"holdings\":[{\"coin\":\"iota\",\"balance\":11000000}, {\"coin\":\"stratis\",\"balance\":1300000}, {\"coin\":\"zcash\",\"balance\":0.10000}, {\"coin\":\"syscoin\",\"balance\":20000000}, {\"coin\":\"waves\",\"balance\":700000}, {\"coin\":\"bitcoin\",\"balance\":570}, {\"coin\":\"bitcoin-cash\",\"balance\":1500}, {\"coin\":\"heat-ledger\",\"balance\":2323851 }, {\"coin\":\"decred\",\"balance\":0.20000}, {\"coin\":\"vericoin\",\"balance\":2199368 }, {\"coin\":\"byteball\",\"balance\":4238}, {\"coin\":\"iocoin\",\"balance\":0.150000}, {\"coin\":\"quantum-resistant-ledger\",\"balance\":0.375000}, {\"coin\":\"chips\",\"balance\":2577006 }, {\"coin\":\"hush\",\"balance\":100000 }, {\"coin\":\"mobilego\",\"balance\":100000 }, {\"coin\":\"utrum\",\"balance\":2100000}],\"divisor\":612529}" +curl --url "http://127.0.0.1:7783" --data "{\"margin\":$margin,\"base\":\"SUPERNET\",\"rel\":\"KMD\",\"fundvalue_bid\":\"NAV_KMD\",\"fundvalue_ask\":\"NAV_KMD\",\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"address\":\"RRyyejME7LRTuvdziWsXkAbSW1fdiohGwK\",\"holdings\":[{\"coin\":\"iota\",\"balance\":11000000}, {\"coin\":\"stratis\",\"balance\":1300000}, {\"coin\":\"zcash\",\"balance\":0.10000}, {\"coin\":\"syscoin\",\"balance\":20000000}, {\"coin\":\"waves\",\"balance\":700000}, {\"coin\":\"bitcoin\",\"balance\":570}, {\"coin\":\"bitcoin-cash\",\"balance\":1500}, {\"coin\":\"heat-ledger\",\"balance\":2323851 }, {\"coin\":\"decred\",\"balance\":0.20000}, {\"coin\":\"vericoin\",\"balance\":2199368 }, {\"coin\":\"byteball\",\"balance\":4238}, {\"coin\":\"iocoin\",\"balance\":0.150000}, {\"coin\":\"quantum-resistant-ledger\",\"balance\":0.375000}, {\"coin\":\"chips\",\"balance\":2577006 }, {\"coin\":\"hush\",\"balance\":100000 }, {\"coin\":\"mobilego\",\"balance\":100000 }, {\"coin\":\"utrum\",\"balance\":2100000}, {\"coin\":\"verus\",\"balance\":65000}],\"divisor\":612529}" curl --url "http://127.0.0.1:7783" --data "{\"margin\":$margin,\"base\":\"HODL\",\"rel\":\"KMD\",\"fundvalue_bid\":\"assetNAV_KMD\",\"fundvalue_ask\":\"assetNAV_KMD\",\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"address\":\"RNcUaMUEFLxVwtTo7rgruhwYanGk1jTkeU\",\"holdings\":[{\"coin\":\"siacoin\",\"balance\":185000000,\"comment\":\"using siafunds equal to million siacoin\"}],\"divisor\":10000000}" diff --git a/iguana/exchanges/stats.c b/iguana/exchanges/stats.c index c49729b3e..fe257cc98 100644 --- a/iguana/exchanges/stats.c +++ b/iguana/exchanges/stats.c @@ -33,6 +33,7 @@ char *stats_JSON(void *ctx,int32_t fastflag,char *myipaddr,int32_t mypubsock,cJSON *argjson,char *remoteaddr,uint16_t port); void LP_queuecommand(char **retstrp,char *buf,int32_t responsesock,int32_t stats_JSONonly,uint32_t queueid); extern uint32_t DOCKERFLAG; +extern char LP_myipaddr[]; char *stats_validmethods[] = { @@ -549,7 +550,7 @@ char *stats_rpcparse(char *retbuf,int32_t bufsize,int32_t *jsonflagp,int32_t *po //free(buf); //while ( retstr == 0 ) // usleep(10000); - if ( (retstr= stats_JSON(ctx,0,myipaddr,-1,argjson,remoteaddr,port)) != 0 ) + if ( (retstr= stats_JSON(ctx,0,LP_myipaddr,-1,argjson,remoteaddr,port)) != 0 ) { if ( (retitem= cJSON_Parse(retstr)) != 0 ) jaddi(retarray,retitem); @@ -598,7 +599,7 @@ char *stats_rpcparse(char *retbuf,int32_t bufsize,int32_t *jsonflagp,int32_t *po buf = jprint(arg,0); LP_queuecommand(&retstr,buf,IPC_ENDPOINT,1,queueid); free(buf); - } else retstr = stats_JSON(ctx,jint(arg,"fast"),myipaddr,-1,arg,remoteaddr,port); + } else retstr = stats_JSON(ctx,jint(arg,"fast"),LP_myipaddr,-1,arg,remoteaddr,port); #endif if ( fastflag == 0 ) portable_mutex_unlock(&LP_commandmutex); diff --git a/iguana/exchanges/supernet b/iguana/exchanges/supernet index 1b55eee6e..f7b09a20b 100755 --- a/iguana/exchanges/supernet +++ b/iguana/exchanges/supernet @@ -15,5 +15,5 @@ echo supernet curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"balances\",\"address\":\"RRyyejME7LRTuvdziWsXkAbSW1fdiohGwK\"}" echo supernet -curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"fundvalue\",\"address\":\"RRyyejME7LRTuvdziWsXkAbSW1fdiohGwK\",\"holdings\":[{\"coin\":\"iota\",\"balance\":11000000}, {\"coin\":\"stratis\",\"balance\":1300000}, {\"coin\":\"zcash\",\"balance\":0.10000}, {\"coin\":\"syscoin\",\"balance\":20000000}, {\"coin\":\"waves\",\"balance\":700000}, {\"coin\":\"bitcoin\",\"balance\":570}, {\"coin\":\"bitcoin-cash\",\"balance\":1500}, {\"coin\":\"heat-ledger\",\"balance\":2323851 }, {\"coin\":\"decred\",\"balance\":0.20000}, {\"coin\":\"vericoin\",\"balance\":2199368 }, {\"coin\":\"byteball\",\"balance\":4238}, {\"coin\":\"iocoin\",\"balance\":0.150000}, {\"coin\":\"quantum-resistant-ledger\",\"balance\":0.375000}, {\"coin\":\"hush\",\"balance\":100000 }, {\"coin\":\"mobilego\",\"balance\":100000 }, {\"coin\":\"utrum\",\"balance\":2100000}],\"divisor\":612529}" +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"fundvalue\",\"address\":\"RRyyejME7LRTuvdziWsXkAbSW1fdiohGwK\",\"holdings\":[{\"coin\":\"iota\",\"balance\":11000000}, {\"coin\":\"stratis\",\"balance\":1300000}, {\"coin\":\"zcash\",\"balance\":0.10000}, {\"coin\":\"syscoin\",\"balance\":20000000}, {\"coin\":\"waves\",\"balance\":700000}, {\"coin\":\"bitcoin\",\"balance\":570}, {\"coin\":\"bitcoin-cash\",\"balance\":1500}, {\"coin\":\"heat-ledger\",\"balance\":2323851 }, {\"coin\":\"decred\",\"balance\":0.20000}, {\"coin\":\"vericoin\",\"balance\":2199368 }, {\"coin\":\"byteball\",\"balance\":4238}, {\"coin\":\"iocoin\",\"balance\":0.150000}, {\"coin\":\"quantum-resistant-ledger\",\"balance\":0.375000}, {\"coin\":\"hush\",\"balance\":100000 }, {\"coin\":\"mobilego\",\"balance\":100000 }, {\"coin\":\"utrum\",\"balance\":2350000}, {\"coin\":\"verus\",\"balance\":65000}],\"divisor\":612529}" diff --git a/iguana/iguana777.c b/iguana/iguana777.c index 7e2906963..8c88ec624 100755 --- a/iguana/iguana777.c +++ b/iguana/iguana777.c @@ -1131,7 +1131,7 @@ struct iguana_info *iguana_setcoin(char *symbol,void *launched,int32_t maxpeers, if ( coin->MAXMEM == 0 ) coin->MAXMEM = IGUANA_DEFAULTRAM; coin->MAXMEM *= (1024L * 1024 * 1024); - coin->enableCACHE = 0;//(strcmp("BTCD",coin->symbol) == 0); + coin->enableCACHE = 1;//0;//(strcmp("BTCD",coin->symbol) == 0); if ( jobj(json,"cache") != 0 ) coin->enableCACHE = juint(json,"cache"); if ( (coin->polltimeout= juint(json,"poll")) <= 0 ) diff --git a/iguana/iguana777.h b/iguana/iguana777.h index bc4a45d60..d1e90d5db 100755 --- a/iguana/iguana777.h +++ b/iguana/iguana777.h @@ -193,6 +193,7 @@ struct supernet_info FILE *swapsfp; double DEXratio; struct smartaddress smartaddrs[64]; int32_t numsmartaddrs,cancelrefresh,runsilent,DEXtrades; + int32_t nosplit; }; struct basilisk_swapmessage diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index 89f39f504..425bc41ed 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -360,7 +360,9 @@ THREE_STRINGS_AND_DOUBLE(iguana,dpow,symbol,dest,pubkey,freq) dp->srcconfirms = DPOW_FIFOSIZE; if ( strcmp("BTC",dp->dest) == 0 ) { - dp->freq = DPOW_CHECKPOINTFREQ; + if ( freq == 0 ) + dp->freq = DPOW_CHECKPOINTFREQ; + else dp->freq = freq; dp->minsigs = Notaries_BTCminsigs; //DPOW_MINSIGS; } else @@ -428,13 +430,11 @@ THREE_STRINGS_AND_DOUBLE(iguana,dpow,symbol,dest,pubkey,freq) portable_mutex_init(&dp->paxmutex); portable_mutex_init(&dp->dexmutex); PAX_init(); - //printf(">>>>>>>>>>>>>>> call paxpending\n"); - //uint8_t buf[32768]; - //dpow_paxpending(buf); + dp->fullCCid = dpow_CCid(myinfo,src); myinfo->numdpows++; for (i=0; i<33; i++) printf("%02x",dp->minerkey33[i]); - printf(" DPOW with pubkey.(%s) %s.valid%d %s -> %s %s.valid%d, num.%d freq.%d minsigs.%d\n",tmp,srcaddr,srcvalid,dp->symbol,dp->dest,destaddr,destvalid,myinfo->numdpows,dp->freq,dp->minsigs); + printf(" DPOW with pubkey.(%s) %s.valid%d %s -> %s %s.valid%d, num.%d freq.%d minsigs.%d CCid.%u\n",tmp,srcaddr,srcvalid,dp->symbol,dp->dest,destaddr,destvalid,myinfo->numdpows,dp->freq,dp->minsigs,dp->fullCCid); return(clonestr("{\"result\":\"success\"}")); } @@ -535,7 +535,7 @@ STRING_ARG(iguana,addnotary,ipaddr) } char NOTARY_CURRENCIES[][65] = { - "REVS", "SUPERNET", "DEX", "PANGEA", "JUMBLR", "BET", "CRYPTO", "HODL", "BOTS", "MGW", "COQUI", "WLC", "KV", "CEAL", "MESH", "MNZ", "CHIPS", "MSHARK", "AXO", "ETOMIC", "BTCH", "VOTE2018", "NINJA", "OOT", "CHAIN", "BNTN", "PRLPAY" + "REVS", "SUPERNET", "DEX", "PANGEA", "JUMBLR", "BET", "CRYPTO", "HODL", "BOTS", "MGW", "COQUI", "WLC", "KV", "CEAL", "MESH", "MNZ", "CHIPS", "MSHARK", "AXO", "ETOMIC", "BTCH", "VOTE2018", "NINJA", "OOT", "CHAIN", "BNTN", "PRLPAY", "DSEC", "GLXT", "EQL" "ZILLA" }; // "LTC", "USD", "EUR", "JPY", "GBP", "AUD", "CAD", "CHF", "NZD", "CNY", "RUB", "MXN", "BRL", "INR", "HKD", "TRY", "ZAR", "PLN", "NOK", "SEK", "DKK", "CZK", "HUF", "ILS", "KRW", "MYR", "PHP", "RON", "SGD", "THB", "BGN", "IDR", "HRK", diff --git a/iguana/iguana_ramchain.c b/iguana/iguana_ramchain.c index a7b83cd45..0f1b9527e 100755 --- a/iguana/iguana_ramchain.c +++ b/iguana/iguana_ramchain.c @@ -1015,7 +1015,7 @@ int32_t iguana_ramchain_alloc(char *fname,struct iguana_info *coin,struct iguana char str[65],str2[65]; fprintf(stderr,"ht.%d wait for allocated %s < MAXMEM %s | elapsed %.2f minutes hashsize.%ld allocsize.%ld\n",height,mbstr(str,myallocated(0,-1)+hashsize+allocsize),mbstr(str2,coin->MAXMEM),(double)(time(NULL)-coin->startutc)/60.,(long)hashsize,(long)allocsize); sleep(13); } - iguana_meminit(hashmem,"ramhashmem",0,2*hashsize + 65536,0); + iguana_meminit(hashmem,"ramhashmem",0,3*hashsize + 65536,0); iguana_meminit(mem,"ramchain",0,allocsize + 65536,0); mem->alignflag = sizeof(uint32_t); hashmem->alignflag = sizeof(uint32_t); diff --git a/iguana/iguana_wallet.c b/iguana/iguana_wallet.c index 9caeac6d5..d633ff569 100755 --- a/iguana/iguana_wallet.c +++ b/iguana/iguana_wallet.c @@ -1402,7 +1402,7 @@ TWOSTRINGS_AND_INT(bitcoinrpc,walletpassphrase,password,permanentfile,timeout) THREE_STRINGS(bitcoinrpc,encryptwallet,passphrase,password,permanentfile) { - char *retstr,buf[128],wifstr[128]; cJSON *retjson; int32_t need_KMD = 0,need_BTC = 0,need_GAME = 0; + char *retstr,buf[128],wifstr[128]; cJSON *retjson; int32_t need_HUSH = 0,need_KMD = 0,need_BTC = 0,need_GAME = 0; if ( remoteaddr != 0 || coin == 0 ) return(clonestr("{\"error\":\"no remote encrypt or no coin\"}")); iguana_walletlock(myinfo,coin); @@ -1441,11 +1441,18 @@ THREE_STRINGS(bitcoinrpc,encryptwallet,passphrase,password,permanentfile) need_BTC = 1; if ( strcmp(coin->symbol,"GAME") != 0 ) need_GAME = 1; + if ( strcmp(coin->symbol,"HUSH") != 0 ) + need_HUSH = 1; if ( need_KMD != 0 && (coin= iguana_coinfind("KMD")) != 0 ) { bitcoin_priv2wif(wifstr,waddr.privkey,coin->chain->wiftype); jaddstr(retjson,"KMDwif",wifstr); } + if ( need_HUSH != 0 && (coin= iguana_coinfind("HUSH")) != 0 ) + { + bitcoin_priv2wif(wifstr,waddr.privkey,coin->chain->wiftype); + jaddstr(retjson,"HUSHwif",wifstr); + } if ( (coin= iguana_coinfind("LTC")) != 0 ) { bitcoin_priv2wif(wifstr,waddr.privkey,coin->chain->wiftype); diff --git a/iguana/m_mm_android b/iguana/m_mm_android new file mode 100755 index 000000000..66ef30220 --- /dev/null +++ b/iguana/m_mm_android @@ -0,0 +1,3 @@ +cd secp256k1; ./m_android; cd .. +cd ../crypto777; ./m_android; cd ../iguana +$CC2 -g -o marketmaker -I../crypto777 exchanges/mm.c ../crypto777/cJSON.c mini-gmp.c secp256k1.o ../agents/libcrypto777.a ../OSlibs/android/lib/libcurl.a -L../OSlibs/android/lib/ -lnanomsg -lcurl -lpthread -lm diff --git a/iguana/m_notary_run b/iguana/m_notary_run index 254c6033c..fd2b90ab9 100755 --- a/iguana/m_notary_run +++ b/iguana/m_notary_run @@ -20,10 +20,10 @@ curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"ad curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"82.202.193.98\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"54.95.68.31\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"142.54.164.114\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"45.7.229.33\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"103.6.12.111\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"155.254.17.21\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"138.121.203.210\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"139.99.149.41\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"209.58.169.65\"}" #tests/addnotarys_7776 @@ -60,6 +60,12 @@ coins/oot_7776 coins/bntn_7776 coins/chain_7776 coins/prlpay_7776 +coins/dsec_7776 +coins/glxt_7776 +coins/eql_7776 +coins/zilla_7776 +coins/vrsc_7776 +coins/rfox_7776 #curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"passthru\",\"method\":\"paxfiats\",\"timeout\":900000}" diff --git a/iguana/m_splitfund b/iguana/m_splitfund index 34d9840ed..58b80a3b7 100755 --- a/iguana/m_splitfund +++ b/iguana/m_splitfund @@ -32,3 +32,7 @@ curl --url "http://127.0.0.1:7776" --data "{\"coin\":\"OOT\",\"agent\":\"iguana\ curl --url "http://127.0.0.1:7776" --data "{\"coin\":\"BNTN\",\"agent\":\"iguana\",\"method\":\"splitfunds\",\"satoshis\":\"10000\",\"sendflag\":1,\"duplicates\":50}" curl --url "http://127.0.0.1:7776" --data "{\"coin\":\"PRLPAY\",\"agent\":\"iguana\",\"method\":\"splitfunds\",\"satoshis\":\"10000\",\"sendflag\":1,\"duplicates\":50}" curl --url "http://127.0.0.1:7776" --data "{\"coin\":\"CHAIN\",\"agent\":\"iguana\",\"method\":\"splitfunds\",\"satoshis\":\"10000\",\"sendflag\":1,\"duplicates\":50}" +curl --url "http://127.0.0.1:7776" --data "{\"coin\":\"DSEC\",\"agent\":\"iguana\",\"method\":\"splitfunds\",\"satoshis\":\"10000\",\"sendflag\":1,\"duplicates\":50}" +curl --url "http://127.0.0.1:7776" --data "{\"coin\":\"GLXT\",\"agent\":\"iguana\",\"method\":\"splitfunds\",\"satoshis\":\"10000\",\"sendflag\":1,\"duplicates\":50}" +curl --url "http://127.0.0.1:7776" --data "{\"coin\":\"EQL\",\"agent\":\"iguana\",\"method\":\"splitfunds\",\"satoshis\":\"10000\",\"sendflag\":1,\"duplicates\":50}" +curl --url "http://127.0.0.1:7776" --data "{\"coin\":\"ZILLA\",\"agent\":\"iguana\",\"method\":\"splitfunds\",\"satoshis\":\"10000\",\"sendflag\":1,\"duplicates\":50}" diff --git a/iguana/main.c b/iguana/main.c index 0f18c35b1..571f45549 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -2212,8 +2212,10 @@ void iguana_main(void *arg) myinfo->rpcport = atoi(&((char *)arg)[6]); printf("OVERRIDE IGUANA port <- %u\n",myinfo->rpcport); } - else if ( strcmp((char *)arg,"notary") == 0 ) // must be second to last + else if ( strncmp((char *)arg,"notary",strlen("notary")) == 0 ) // must be second to last { + if ( strcmp((char *)arg,"notary_nosplit") == 0 ) + myinfo->nosplit = 1; myinfo->rpcport = IGUANA_NOTARYPORT; myinfo->IAMNOTARY = 1; myinfo->DEXEXPLORER = 0;//1; disable as SPV is used now diff --git a/iguana/mini-gmp.c b/iguana/mini-gmp.c index 99cb68222..a40341c1b 100644 --- a/iguana/mini-gmp.c +++ b/iguana/mini-gmp.c @@ -4403,7 +4403,7 @@ int32_t bitcoin_base58decode(uint8_t *data,char *coinaddr) if ( *p != '\0' ) { int32_t zeroval(); - printf("bitcoin_base58decode error: p %02x != 0x00\n",*p); + //printf("bitcoin_base58decode error: p %02x != 0x00\n",*p); mpz_clear(bn), mpz_clear(bn58); return(-1); } diff --git a/iguana/secp256k1/m_android b/iguana/secp256k1/m_android index 5e2421160..10855cef4 100755 --- a/iguana/secp256k1/m_android +++ b/iguana/secp256k1/m_android @@ -3,4 +3,4 @@ #$CC -c -O2 src/secp256k1.c -I $NDK/platforms/android-21/arch-arm/usr/include #rm -f ../../agents/libsecp256k1.a; $AR rcu ../../agents/libsecp256k1.a *.o -$CC2 -c -o ../sec256k1.o -I. -I./src -I./include -I./src -O3 -W -std=c89 -pedantic -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -Wno-long-long -Wno-overlength-strings -fvisibility=hidden -DHAVE_CONFIG_H src/secp256k1.c +$CC2 -c -o ../secp256k1.o -I. -I./src -I./include -I./src -O3 -W -std=c89 -pedantic -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -Wno-long-long -Wno-overlength-strings -fvisibility=hidden -DHAVE_CONFIG_H src/secp256k1.c