diff --git a/.gitignore b/.gitignore index 92b11bd00..d7f6bfab7 100755 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ - +x64 *.o agents/iguana.exe Debug/* diff --git a/OSlibs/linux/x86_64/libnanomsg-static.a b/OSlibs/linux/x86_64/libnanomsg-static.a new file mode 100644 index 000000000..064e32591 Binary files /dev/null and b/OSlibs/linux/x86_64/libnanomsg-static.a differ diff --git a/OSlibs/win/mingw.h b/OSlibs/win/mingw.h index a59a2305a..6be81f99b 100755 --- a/OSlibs/win/mingw.h +++ b/OSlibs/win/mingw.h @@ -28,18 +28,52 @@ * are copied from linux man pages. A poll() macro is defined to * call the version in mingw.c. */ -#define POLLIN 0x0001 /* There is data to read */ + #define POLLPRI 0x0002 /* There is urgent data to read */ +#if defined(_M_X64) + /* + * when we are using WSAPoll() with window's struct pollfd struct + * we need to update the value for POLLIN and POLLOUT according to window's + * WSAPoll() return values + * @author - fadedreamz@gmail.com + */ +//TODO: need to update other values to match with WSAPoll() function +#define POLLIN POLLRDNORM | POLLRDBAND /* There is data to read */ +#define POLLOUT POLLWRNORM /* Writing now will not block */ +#else +#define POLLIN 0x0001 /* There is data to read */ #define POLLOUT 0x0004 /* Writing now will not block */ +#endif #define POLLERR 0x0008 /* Error condition */ #define POLLHUP 0x0010 /* Hung up */ #define POLLNVAL 0x0020 /* Invalid request: fd not open */ + + /** + * we want to use mingw provided pollfd if and only if we are compiling this + * in windows 32bit but exclude it when we are compiling it in win 64 + * + * @author - fadedreamz@gmail.com + * @remarks - #if (defined(_M_X64) || defined(__amd64__)) && defined(WIN32) + * is equivalent to #if defined(_M_X64) as _M_X64 is defined for MSVC only + */ +#if !defined(_M_X64) struct pollfd { SOCKET fd; /* file descriptor */ short events; /* requested events */ short revents; /* returned events */ }; +#endif + +#if defined(_M_X64) +/* +* we want to use the window's poll function if poll() is invoked in win64 +* as we are using window's pollfd struct when we are using x64 +* @author - fadedreamz@gmail.com +*/ +#define poll(x, y, z) WSAPoll(x, y, z) +#else #define poll(x, y, z) win32_poll(x, y, z) +#endif /* These wrappers do nothing special except set the global errno variable if * an error occurs (winsock doesn't do this by default). They set errno diff --git a/OSlibs/win/nanomsg.dll b/OSlibs/win/nanomsg.dll new file mode 100644 index 000000000..4f454d25e Binary files /dev/null and b/OSlibs/win/nanomsg.dll differ diff --git a/OSlibs/win/nanomsg.lib b/OSlibs/win/nanomsg.lib new file mode 100644 index 000000000..f0fdac6fb Binary files /dev/null and b/OSlibs/win/nanomsg.lib differ diff --git a/OSlibs/win/release/nanomsg.dll b/OSlibs/win/release/nanomsg.dll new file mode 100644 index 000000000..5d5dc7e20 Binary files /dev/null and b/OSlibs/win/release/nanomsg.dll differ diff --git a/OSlibs/win/release/nanomsg.lib b/OSlibs/win/release/nanomsg.lib new file mode 100644 index 000000000..082e2cf03 Binary files /dev/null and b/OSlibs/win/release/nanomsg.lib differ diff --git a/OSlibs/win/release/pthreadVC2.lib b/OSlibs/win/release/pthreadVC2.lib new file mode 100644 index 000000000..d793e7144 Binary files /dev/null and b/OSlibs/win/release/pthreadVC2.lib differ diff --git a/OSlibs/win/release/pthreadvc2.dll b/OSlibs/win/release/pthreadvc2.dll new file mode 100644 index 000000000..93f562baa Binary files /dev/null and b/OSlibs/win/release/pthreadvc2.dll differ diff --git a/OSlibs/win/x64/nanomsg.dll b/OSlibs/win/x64/nanomsg.dll new file mode 100644 index 000000000..b5c4e1400 Binary files /dev/null and b/OSlibs/win/x64/nanomsg.dll differ diff --git a/OSlibs/win/x64/nanomsg.lib b/OSlibs/win/x64/nanomsg.lib new file mode 100644 index 000000000..9e15cde27 Binary files /dev/null and b/OSlibs/win/x64/nanomsg.lib differ diff --git a/OSlibs/win/x64/release/nanomsg.dll b/OSlibs/win/x64/release/nanomsg.dll new file mode 100644 index 000000000..1a9074fed Binary files /dev/null and b/OSlibs/win/x64/release/nanomsg.dll differ diff --git a/OSlibs/win/x64/release/nanomsg.lib b/OSlibs/win/x64/release/nanomsg.lib new file mode 100644 index 000000000..0a9a4a694 Binary files /dev/null and b/OSlibs/win/x64/release/nanomsg.lib differ diff --git a/basilisk/basilisk.c b/basilisk/basilisk.c index f5d1818b1..03fb5f2d9 100755 --- a/basilisk/basilisk.c +++ b/basilisk/basilisk.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -14,6 +14,7 @@ ******************************************************************************/ #include "../iguana/iguana777.h" +#include "../iguana/exchanges777.h" typedef char *basilisk_servicefunc(struct supernet_info *myinfo,char *CMD,void *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 hash,int32_t from_basilisk); @@ -209,10 +210,11 @@ int32_t basilisk_sendcmd(struct supernet_info *myinfo,char *destipaddr,char *typ } if ( basilisk_notarycmd(type) != 0 && myinfo->NOTARY.NUMRELAYS == 0 ) { - printf("no notary nodes to send (%s) to\n",type); + //printf("no notary nodes to send (%s) to\n",type); return(-1); } //portable_mutex_lock(&myinfo->allcoins_mutex); + //dex_reqsend(myinfo,&data[-(int32_t)sizeof(struct iguana_msghdr)],datalen); alreadysent = calloc(IGUANA_MAXPEERS * IGUANA_MAXCOINS,sizeof(*alreadysent)); HASH_ITER(hh,myinfo->allcoins,coin,tmp) { @@ -481,6 +483,7 @@ int32_t basilisk_relayid(struct supernet_info *myinfo,uint32_t ipbits) #include "basilisk_lisk.c" #include "basilisk_MSG.c" +#include "tradebots_liquidity.c" #include "basilisk_tradebot.c" #include "basilisk_swap.c" #include "basilisk_DEX.c" @@ -874,33 +877,55 @@ void basilisks_loop(void *arg) if ( relay == 0 ) relay = iguana_coinfind("RELAY"); startmilli = OS_milliseconds(); + endmilli = startmilli + 1000; + //fprintf(stderr,"A "); basilisk_issued_purge(myinfo,600000); + //fprintf(stderr,"B "); basilisk_p2pQ_process(myinfo,777); - if ( myinfo->NOTARY.RELAYID >= 0 ) + //fprintf(stderr,"C "); + if ( myinfo->IAMNOTARY != 0 ) { if ( relay != 0 ) + { + //fprintf(stderr,"D "); basilisk_ping_send(myinfo,relay); + } counter++; - if ( (counter % 10) == 0 && myinfo->numdpows == 1 ) + //fprintf(stderr,"E "); + if ( myinfo->numdpows == 1 ) { iguana_dPoWupdate(myinfo,&myinfo->DPOWS[0]); - endmilli = startmilli + 500; + endmilli = startmilli + 100; } else if ( myinfo->numdpows > 1 ) { dp = &myinfo->DPOWS[counter % myinfo->numdpows]; iguana_dPoWupdate(myinfo,dp); if ( (counter % myinfo->numdpows) != 0 ) + { + //fprintf(stderr,"F "); iguana_dPoWupdate(myinfo,&myinfo->DPOWS[0]); - endmilli = startmilli + 200; + } + endmilli = startmilli + 30; } } - else if ( myinfo->IAMLP != 0 ) - endmilli = startmilli + 1000; - else endmilli = startmilli + 2000; - //printf("RELAYID.%d endmilli %f vs now %f\n",myinfo->NOTARY.RELAYID,endmilli,OS_milliseconds()); + else + { + //fprintf(stderr,"G "); + dex_updateclient(myinfo); + if ( myinfo->IAMLP != 0 ) + endmilli = startmilli + 500; + else endmilli = startmilli + 1000; + } + if ( myinfo->expiration != 0 && (myinfo->dexsock >= 0 || myinfo->IAMLP != 0 || myinfo->DEXactive > time(NULL)) ) + { + //fprintf(stderr,"H "); + basilisk_requests_poll(myinfo); + } + //printf("RELAYID.%d endmilli %f vs now %f\n",myinfo->NOTARY.RELAYID,endmilli,startmilli); while ( OS_milliseconds() < endmilli ) usleep(10000); + //printf("finished waiting numdpow.%d\n",myinfo->numdpows); iter++; } } @@ -950,7 +975,7 @@ HASH_ARRAY_STRING(basilisk,balances,hash,vals,hexstr) timeoutmillis = BASILISK_TIMEOUT; if ( coin != 0 ) { - if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 ) + if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 || coin->notarychain >= 0 ) { if ( (ptr= basilisk_bitcoinbalances(&Lptr,myinfo,coin,remoteaddr,basilisktag,timeoutmillis,vals)) != 0 ) { @@ -1019,4 +1044,21 @@ HASH_ARRAY_STRING(basilisk,history,hash,vals,hexstr) return(jprint(retjson,1)); } +ZERO_ARGS(passthru,paxfiats) +{ + komodo_assetcoins(-1); + return(clonestr("{\"result\":\"success\"}")); +} + +ZERO_ARGS(basilisk,paxfiats) +{ + komodo_assetcoins(0); + return(clonestr("{\"result\":\"success\"}")); +} + +ZERO_ARGS(iguana,paxfiats) +{ + komodo_assetcoins(1); + return(clonestr("{\"result\":\"success\"}")); +} #include "../includes/iguana_apiundefs.h" diff --git a/basilisk/basilisk.h b/basilisk/basilisk.h index 2f8e95527..d90679ecd 100755 --- a/basilisk/basilisk.h +++ b/basilisk/basilisk.h @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -17,7 +17,7 @@ #define H_BASILISK_H //#define BASILISK_DISABLESENDTX -//#define BASILISK_DISABLEWAITTX +#define BASILISK_DISABLEWAITTX #include "../iguana/iguana777.h" @@ -79,6 +79,7 @@ struct basilisk_swapinfo struct basilisk_swap { struct supernet_info *myinfo; struct iguana_info *bobcoin,*alicecoin; + void (*balancingtrade)(struct supernet_info *myinfo,struct basilisk_swap *swap,int32_t iambob); struct basilisk_swapinfo I; struct basilisk_rawtx bobdeposit,bobpayment,alicepayment,myfee,otherfee,aliceclaim,alicespend,bobreclaim,bobspend,bobrefund,alicereclaim; bits256 privkeys[INSTANTDEX_DECKSIZE]; diff --git a/basilisk/basilisk_CMD.c b/basilisk/basilisk_CMD.c index 858786d3c..5696addc9 100755 --- a/basilisk/basilisk_CMD.c +++ b/basilisk/basilisk_CMD.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * diff --git a/basilisk/basilisk_DEX.c b/basilisk/basilisk_DEX.c index d643c81ab..b47ac7c72 100755 --- a/basilisk/basilisk_DEX.c +++ b/basilisk/basilisk_DEX.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -34,7 +34,7 @@ int32_t basilisk_ping_processDEX(struct supernet_info *myinfo,uint32_t senderipb if ( relay->numrequests < relay->maxrequests ) { memcpy(serialized,&data[len],clen); - //printf("ping processDEX\n"); + printf("ping processDEX\n"); n = basilisk_rwDEXquote(0,serialized,&R); if ( n != clen ) printf("n.%d clen.%d\n",n,clen); @@ -117,15 +117,16 @@ int32_t basilisk_rwDEXquote(int32_t rwflag,uint8_t *serialized,struct basilisk_r memcpy(rp->dest,&serialized[len],sizeof(rp->dest)), len += sizeof(rp->dest); } if ( rp->quoteid != 0 && basilisk_quoteid(rp) != rp->quoteid ) - printf("basilisk_rwDEXquote.%d: quoteid.%u mismatch calc %u\n",rwflag,rp->quoteid,basilisk_quoteid(rp)); + printf(" basilisk_rwDEXquote.%d: quoteid.%u mismatch calc %u rp.%p\n",rwflag,rp->quoteid,basilisk_quoteid(rp),rp); if ( basilisk_requestid(rp) != rp->requestid ) - printf("basilisk_rwDEXquote.%d: requestid.%u mismatch calc %u\n",rwflag,rp->requestid,basilisk_requestid(rp)); + printf(" basilisk_rwDEXquote.%d: requestid.%u mismatch calc %u rp.%p\n",rwflag,rp->requestid,basilisk_requestid(rp),rp); return(len); } uint32_t basilisk_request_enqueue(struct supernet_info *myinfo,struct basilisk_request *rp) { uint8_t serialized[256]; int32_t len; struct queueitem *item; + printf(" basilisk_request_enqueue\n"); len = basilisk_rwDEXquote(1,serialized+1,rp); if ( (item= calloc(1,sizeof(*item) + len + 1)) != 0 ) { @@ -177,7 +178,7 @@ cJSON *basilisk_requestjson(struct basilisk_request *rp) { for (i=0; irelaybits = (uint32_t)calc_ipbits(jstr(valsobj,"relay")); rp->requestid = basilisk_requestid(rp); + //printf("set requestid <- %u\n",rp->requestid); if ( rp->destamount != 0 && bits256_nonz(rp->desthash) != 0 ) { rp->quoteid = basilisk_quoteid(rp); - printf("set quoteid.%u\n",rp->quoteid); + //printf("set quoteid.%u\n",rp->quoteid); } //printf("create.%u calc.%u\n",rp->requestid,basilisk_requestid(rp)); return(0); @@ -227,11 +229,13 @@ int32_t basilisk_request_create(struct basilisk_request *rp,cJSON *valsobj,bits2 return(-1); } -char *basilisk_start(struct supernet_info *myinfo,struct basilisk_request *rp,uint32_t statebits,int32_t optionduration) +char *basilisk_start(struct supernet_info *myinfo,struct basilisk_request *_rp,uint32_t statebits,int32_t optionduration) { - cJSON *retjson; - if ( (bits256_cmp(rp->srchash,myinfo->myaddr.persistent) == 0 || bits256_cmp(rp->desthash,myinfo->myaddr.persistent) == 0) ) + cJSON *retjson; struct basilisk_request *rp; + if ( (bits256_cmp(_rp->srchash,myinfo->myaddr.persistent) == 0 || bits256_cmp(_rp->desthash,myinfo->myaddr.persistent) == 0) ) { + rp = calloc(1,sizeof(*rp)); + *rp = *_rp; printf("START thread to complete %u/%u for (%s %.8f) <-> (%s %.8f) q.%u\n",rp->requestid,rp->quoteid,rp->src,dstr(rp->srcamount),rp->dest,dstr(rp->destamount),rp->quoteid); if ( basilisk_thread_start(myinfo,rp,statebits,optionduration) != 0 ) { @@ -256,6 +260,7 @@ void basilisk_requests_poll(struct supernet_info *myinfo) return; lastpoll = (uint32_t)time(NULL); memset(&issueR,0,sizeof(issueR)); + memset(&myinfo->DEXaccept,0,sizeof(myinfo->DEXaccept)); //printf("Call incoming\n"); if ( (retstr= InstantDEX_incoming(myinfo,0,0,0,0)) != 0 ) { @@ -274,12 +279,22 @@ void basilisk_requests_poll(struct supernet_info *myinfo) channel = 'D' + ((uint32_t)'E' << 8) + ((uint32_t)'X' << 16); if ( hwm > 0. ) { - printf("hwm %f\n",hwm); + //printf("hwm %f\n",hwm); + //for (i=0; iDEXaccept = issueR; + /*issueR.quoteid = basilisk_quoteid(&issueR); + datalen = basilisk_rwDEXquote(1,data,&issueR); + msgid = (uint32_t)time(NULL); + keylen = basilisk_messagekey(key,0,msgid,issueR.srchash,issueR.desthash); + if ( (retstr= basilisk_respond_addmessage(myinfo,key,keylen,data,datalen,0,BASILISK_DEXDURATION)) != 0 ) + free(retstr);*/ if ( bits256_cmp(myinfo->myaddr.persistent,issueR.srchash) == 0 ) // my request { - printf("my req hwm %f\n",hwm); if ( (retstr= InstantDEX_accept(myinfo,0,0,0,issueR.requestid,issueR.quoteid)) != 0 ) free(retstr); + printf("my req hwm %f -> %u\n",hwm,issueR.requestid); basilisk_channelsend(myinfo,issueR.srchash,issueR.desthash,channel,0x4000000,(void *)&issueR.requestid,sizeof(issueR.requestid),60); numiters = 0; while ( numiters < 10 && (crc= basilisk_crcsend(myinfo,0,buf,sizeof(buf),issueR.srchash,issueR.desthash,channel,0x4000000,(void *)&issueR.requestid,sizeof(issueR.requestid),crcs)) == 0 ) @@ -291,6 +306,7 @@ void basilisk_requests_poll(struct supernet_info *myinfo) } if ( crc != 0 ) { + printf("crc.%08x -> basilisk_starta\n",crc); if ( (retstr= basilisk_start(myinfo,&issueR,1,issueR.optionhours * 3600)) != 0 ) free(retstr); } else printf("couldnt accept offer\n"); @@ -361,15 +377,28 @@ static int _cmp_requests(const void *a,const void *b) #undef uint32_b } -struct basilisk_request *_basilisk_requests_uniq(struct supernet_info *myinfo,int32_t *nump,uint8_t *space,int32_t spacesize) +struct basilisk_request *_basilisk_requests_uniq(struct supernet_info *myinfo,int32_t *nump,uint8_t *space,int32_t spacesize,struct basilisk_request *refrp) { int32_t i,j,n,k,m; struct basilisk_relay *relay; struct basilisk_request *requests,*rp; - for (j=m=0; jNOTARY.NUMRELAYS; j++) + m = 0; + if ( refrp != 0 ) + m = 1; + for (j=0; jNOTARY.NUMRELAYS; j++) m += myinfo->NOTARY.RELAYS[j].numrequests; if ( m*sizeof(*requests) <= spacesize ) requests = (void *)space; else requests = calloc(m,sizeof(*requests)); - for (j=m=0; jNOTARY.NUMRELAYS; j++) + if ( refrp != 0 ) + { + requests[0] = *refrp; + //for (i=0; iNOTARY.NUMRELAYS; j++) { relay = &myinfo->NOTARY.RELAYS[j]; if ( (n= relay->numrequests) > 0 ) @@ -402,20 +431,22 @@ struct basilisk_request *_basilisk_requests_uniq(struct supernet_info *myinfo,in return(jprint(retjson,1)); }*/ -char *basilisk_respond_requests(struct supernet_info *myinfo,bits256 hash,uint32_t requestid,uint32_t quoteid) +char *basilisk_respond_requests(struct supernet_info *myinfo,bits256 hash,uint32_t requestid,uint32_t quoteid,struct basilisk_request *refrp) { int32_t i,qflag,num=0; cJSON *retjson,*array; struct basilisk_request *requests,*rp; uint8_t space[4096]; array = cJSON_CreateArray(); portable_mutex_lock(&myinfo->DEX_reqmutex); - if ( (requests= _basilisk_requests_uniq(myinfo,&num,space,sizeof(space))) != 0 ) + if ( (requests= _basilisk_requests_uniq(myinfo,&num,space,sizeof(space),refrp)) != 0 ) { - //printf("numrequests.%d r.%u q.%u\n",num,requestid,quoteid); for (i=0; iquoteid && (bits256_cmp(hash,rp->srchash) == 0 || bits256_cmp(hash,rp->desthash) == 0)) ) qflag = 1; else qflag = 0; + //int32_t j; for (j=0; jrequestid == requestid && qflag != 0) ) jaddi(array,basilisk_requestjson(rp)); } @@ -428,11 +459,11 @@ char *basilisk_respond_requests(struct supernet_info *myinfo,bits256 hash,uint32 return(jprint(retjson,1)); } -char *basilisk_respond_accept(struct supernet_info *myinfo,uint32_t requestid,uint32_t quoteid) +char *basilisk_respond_accept(struct supernet_info *myinfo,uint32_t requestid,uint32_t quoteid,struct basilisk_request *refrp) { int32_t i,num=0; char *retstr=0; struct basilisk_request *requests,*rp; uint8_t space[4096]; portable_mutex_lock(&myinfo->DEX_reqmutex); - if ( (requests= _basilisk_requests_uniq(myinfo,&num,space,sizeof(space))) != 0 ) + if ( (requests= _basilisk_requests_uniq(myinfo,&num,space,sizeof(space),refrp)) != 0 ) { for (i=0; iallcoins,coin,tmp) { if ( coin->virtualchain != 0 ) jaddistr(virtual,coin->symbol); if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 ) jaddistr(full,coin->symbol); + else if ( coin->notarychain >= 0 ) + jaddistr(notarychains,coin->symbol); else jaddistr(basilisk,coin->symbol); } jadd(retjson,"basilisk",basilisk); jadd(retjson,"full",full); jadd(retjson,"virtual",virtual); + jadd(retjson,"notarychains",notarychains); return(jprint(retjson,1)); } @@ -564,8 +599,8 @@ HASH_ARRAY_STRING(InstantDEX,request,hash,vals,hexstr) if ( (reqjson= basilisk_requestjson(&R)) != 0 ) free_json(reqjson); datalen = basilisk_rwDEXquote(1,serialized,&R); - int32_t i; for (i=0; iDEXactive = (uint32_t)time(NULL) + INSTANTDEX_LOCKTIME; - //if ( myinfo->IAMLP != 0 ) - // return(basilisk_respond_accept(myinfo,requestid,quoteid)); - //else + if ( myinfo->IAMLP != 0 || myinfo->dexsock >= 0 || myinfo->subsock >= 0 ) + return(basilisk_respond_accept(myinfo,requestid,quoteid,&myinfo->DEXaccept)); + else { vals = cJSON_CreateObject(); jaddnum(vals,"quoteid",(uint32_t)quoteid); diff --git a/basilisk/basilisk_MSG.c b/basilisk/basilisk_MSG.c index ba6fd9739..86d0eda80 100755 --- a/basilisk/basilisk_MSG.c +++ b/basilisk/basilisk_MSG.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -76,7 +76,7 @@ int32_t basilisk_msgcmp(struct basilisk_message *msg,int32_t width,uint32_t chan { while ( width >= 0 && n < 60 ) { - if ( msgid == keymsgid && keychannel == channel ) + if ( (keymsgid == 0 || msgid == keymsgid) && (keychannel == 0 || keychannel == channel) ) return(0); msgid--; n++; @@ -216,9 +216,6 @@ char *basilisk_respond_addmessage(struct supernet_info *myinfo,uint8_t *key,int3 msg->expiration = (uint32_t)time(NULL) + duration; HASH_ADD_KEYPTR(hh,myinfo->messagetable,msg->key,msg->keylen,msg); QUEUEITEMS++; - //int32_t i; for (i=0; iexpiration,msg,msg->hh.next,msg->hh.prev); portable_mutex_unlock(&myinfo->messagemutex); //if ( myinfo->NOTARY.RELAYID >= 0 ) // dpow_handler(myinfo,msg); @@ -277,34 +274,47 @@ HASH_ARRAY_STRING(basilisk,getmessage,hash,vals,hexstr) jdelete(vals,"msgid"); jaddnum(vals,"msgid",msgid); } - if ( myinfo->NOTARY.RELAYID >= 0 ) + if ( myinfo->NOTARY.RELAYID >= 0 || myinfo->dexsock >= 0 || myinfo->subsock >= 0 ) { channel = juint(vals,"channel"); width = juint(vals,"width"); retstr = basilisk_iterate_MSG(myinfo,channel,msgid,jbits256(vals,"srchash"),jbits256(vals,"desthash"),width); + //printf("getmessage.(%s)\n",retstr); return(retstr); } - //printf("getmessage not relay.%d\n",myinfo->NOTARY.RELAYID); + //printf("getmessage not relay.%d dexsock.%d subsock.%d\n",myinfo->NOTARY.RELAYID,myinfo->dexsock,myinfo->subsock); return(basilisk_standardservice("MSG",myinfo,0,jbits256(vals,"desthash"),vals,hexstr,1)); } HASH_ARRAY_STRING(basilisk,sendmessage,hash,vals,hexstr) { - int32_t keylen,datalen; uint8_t key[BASILISK_KEYSIZE],space[16384],*data,*ptr = 0; char *retstr=0; - if ( myinfo->IAMNOTARY != 0 && myinfo->NOTARY.RELAYID >= 0 ) + int32_t keylen,datalen,allocsize = 65536; uint8_t key[BASILISK_KEYSIZE],*space,*space2,*data,*ptr = 0; char *retstr=0; + space = calloc(1,allocsize); + space2 = calloc(1,allocsize); + data = get_dataptr(BASILISK_HDROFFSET,&ptr,&datalen,&space[BASILISK_KEYSIZE],allocsize-BASILISK_KEYSIZE,hexstr); + if ( myinfo->subsock >= 0 || myinfo->dexsock >= 0 || (myinfo->IAMNOTARY != 0 && myinfo->NOTARY.RELAYID >= 0) ) { keylen = basilisk_messagekey(key,juint(vals,"channel"),juint(vals,"msgid"),jbits256(vals,"srchash"),jbits256(vals,"desthash")); - if ( (data= get_dataptr(BASILISK_HDROFFSET,&ptr,&datalen,space,sizeof(space),hexstr)) != 0 ) + if ( data != 0 ) { retstr = basilisk_respond_addmessage(myinfo,key,keylen,data,datalen,0,juint(vals,"duration")); } else printf("no get_dataptr\n"); - if ( ptr != 0 ) - free(ptr); if ( retstr != 0 ) free(retstr); - } else printf("not notary.%d relayid.%d\n",myinfo->IAMNOTARY,myinfo->NOTARY.RELAYID); + } //else printf("not notary.%d relayid.%d\n",myinfo->IAMNOTARY,myinfo->NOTARY.RELAYID); if ( vals != 0 && juint(vals,"fanout") == 0 ) jaddnum(vals,"fanout",MAX(8,(int32_t)sqrt(myinfo->NOTARY.NUMRELAYS)+2)); + if ( BASILISK_KEYSIZE+datalen < allocsize ) + { + memcpy(space2,key,BASILISK_KEYSIZE); + if ( data != 0 && datalen != 0 ) + memcpy(&space2[BASILISK_KEYSIZE],data,datalen); + dex_reqsend(myinfo,"DEX",space2,datalen+BASILISK_KEYSIZE,1,""); + } else printf("sendmessage space too small error for %d\n",datalen); + free(space); + free(space2); + if ( ptr != 0 ) + free(ptr); return(basilisk_standardservice("OUT",myinfo,0,jbits256(vals,"desthash"),vals,hexstr,0)); } #include "../includes/iguana_apiundefs.h" @@ -436,7 +446,7 @@ uint32_t basilisk_majority32(int32_t *datalenp,uint32_t rawcrcs[64],int32_t data { for (i=0; i numcandidates.%d\n",i,numcandidates); + //printf("n.%d -> numcandidates.%d\n",i,numcandidates); if ( numcandidates > 0 ) { for (j=0; jblocks.hwmchain.height - height + 1); @@ -447,7 +448,7 @@ void *basilisk_getinfo(struct basilisk_item *Lptr,struct supernet_info *myinfo,s return(clonestr("{\"error\":\"null valsobj\"}")); if ( (myinfo->IAMNOTARY != 0 || myinfo->NOTARY.RELAYID >= 0) && strcmp(coin->symbol,"RELAY") != 0 ) return(0); - if ( coin->VALIDATENODE > 0 || coin->FULLNODE > 0 ) + if ( coin->VALIDATENODE > 0 || coin->FULLNODE > 0 || coin->notarychain >= 0 ) { infojson = iguana_getinfo(myinfo,coin); Lptr->retstr = jprint(infojson,1); @@ -549,7 +550,7 @@ char *iguana_utxoduplicates(struct supernet_info *myinfo,struct iguana_info *coi if ( signedtxidp != 0 ) memset(signedtxidp,0,sizeof(*signedtxidp)); bitcoin_address(changeaddr,coin->chain->pubtype,myinfo->persistent_pubkey33,33); - if ( (txobj= bitcoin_txcreate(coin->chain->isPoS,0,1,0)) != 0 ) + if ( (txobj= bitcoin_txcreate(coin->symbol,coin->chain->isPoS,0,1,0)) != 0 ) { if ( duplicates <= 0 ) duplicates = 1; @@ -584,8 +585,8 @@ char *basilisk_bitcoinrawtx(struct supernet_info *myinfo,struct iguana_info *coi uint8_t buf[4096]; int32_t oplen,offset,minconf,spendlen; cJSON *vins,*addresses,*txobj = 0; uint32_t locktime; char *opreturn,*spendscriptstr,*changeaddr,*rawtx = 0; int64_t amount,txfee,burnamount; if ( valsobj == 0 ) return(clonestr("{\"error\":\"null valsobj\"}")); - if ( myinfo->IAMNOTARY != 0 || myinfo->NOTARY.RELAYID >= 0 ) - return(clonestr("{\"error\":\"special relays only do OUT and MSG\"}")); + //if ( myinfo->IAMNOTARY != 0 || myinfo->NOTARY.RELAYID >= 0 ) + // return(clonestr("{\"error\":\"special relays only do OUT and MSG\"}")); vins = 0; changeaddr = jstr(valsobj,"changeaddr"); if ( (amount= j64bits(valsobj,"satoshis")) == 0 ) @@ -608,7 +609,7 @@ char *basilisk_bitcoinrawtx(struct supernet_info *myinfo,struct iguana_info *coi return(clonestr("{\"error\":\"invalid changeaddr or spendscript or addresses\"}")); if ( coin != 0 ) { - if ( (txobj= bitcoin_txcreate(coin->chain->isPoS,locktime,locktime==0?coin->chain->normal_txversion:coin->chain->locktime_txversion,juint(valsobj,"timestamp"))) != 0 ) + if ( (txobj= bitcoin_txcreate(coin->symbol,coin->chain->isPoS,locktime,locktime==0?coin->chain->normal_txversion:coin->chain->locktime_txversion,juint(valsobj,"timestamp"))) != 0 ) { spendlen = (int32_t)strlen(spendscriptstr) >> 1; decode_hex(buf,spendlen,spendscriptstr); @@ -882,11 +883,11 @@ cJSON *BTC_makeclaimfunc(struct supernet_info *myinfo,struct exchange_info *exch HASH_ARRAY_STRING(basilisk,value,hash,vals,hexstr) { - char *retstr=0,*symbol; uint32_t basilisktag; struct basilisk_item *ptr,Lptr; int32_t timeoutmillis; + char *retstr=0,*symbol,*coinaddr,*infostr; cJSON *retjson,*sobj,*info,*addrs,*txoutjson,*txjson,*array; uint32_t basilisktag,blocktime; bits256 txid,blockhash; struct basilisk_item *ptr,Lptr; uint64_t value; int32_t timeoutmillis,vout,height,n,m; if ( vals == 0 ) return(clonestr("{\"error\":\"null valsobj\"}")); - if ( myinfo->IAMNOTARY != 0 || myinfo->NOTARY.RELAYID >= 0 ) - return(clonestr("{\"error\":\"special relays only do OUT and MSG\"}")); + //if ( myinfo->IAMNOTARY != 0 || myinfo->NOTARY.RELAYID >= 0 ) + // return(clonestr("{\"error\":\"special relays only do OUT and MSG\"}")); //if ( coin == 0 ) { if ( (symbol= jstr(vals,"symbol")) != 0 || (symbol= jstr(vals,"coin")) != 0 ) @@ -894,8 +895,38 @@ HASH_ARRAY_STRING(basilisk,value,hash,vals,hexstr) } if ( jobj(vals,"fanout") == 0 ) jaddnum(vals,"fanout",MAX(5,(int32_t)sqrt(myinfo->NOTARY.NUMRELAYS)+1)); + txid = jbits256(vals,"txid"); + vout = jint(vals,"vout"); if ( coin != 0 ) { + if ( coin->FULLNODE < 0 ) + { + if ( (txoutjson= dpow_gettxout(myinfo,coin,txid,vout)) != 0 ) + { + if ( (coinaddr= jstr(txoutjson,"address")) != 0 && (value= SATOSHIDEN*jdouble(txoutjson,"value")) != 0 ) + { + retjson = cJSON_CreateObject(); + jaddstr(retjson,"result","success"); + jaddstr(retjson,"address",coinaddr); + jadd64bits(retjson,"satoshis",value); + jaddnum(retjson,"value",dstr(value)); + jaddnum(retjson,"amount",dstr(value)); + height = dpow_getchaintip(myinfo,&blockhash,&blocktime,0,0,coin); + jaddnum(retjson,"height",height); + jaddnum(retjson,"numconfirms",jint(txoutjson,"confirmations")); + jaddbits256(retjson,"txid",txid); + jaddnum(retjson,"vout",vout); + jaddstr(retjson,"coin",coin->symbol); + } + else + { + free_json(txoutjson); + return(clonestr("{\"error\":\"return from gettxout missing fields\"}")); + } + free_json(txoutjson); + return(jprint(retjson,1)); + } else return(clonestr("{\"error\":\"null return from gettxout\"}")); + } if ( (basilisktag= juint(vals,"basilisktag")) == 0 ) basilisktag = rand(); if ( (timeoutmillis= juint(vals,"timeout")) <= 0 ) @@ -907,6 +938,52 @@ HASH_ARRAY_STRING(basilisk,value,hash,vals,hexstr) return(retstr); } } + if ( myinfo->reqsock >= 0 ) + { + if ( (retstr= _dex_getrawtransaction(myinfo,symbol,txid)) != 0 ) + { + if ( (txoutjson= cJSON_Parse(retstr)) != 0 ) + { + //printf("TX.(%s)\n",jprint(txoutjson,0)); + retjson = cJSON_CreateObject(); + jaddstr(retjson,"result","success"); + jaddnum(retjson,"numconfirms",jint(txoutjson,"confirmations")); + if ( (array= jarray(&n,txoutjson,"vout")) != 0 && vout < n && (txjson= jitem(array,vout)) != 0 ) + { + //printf("txjson.(%s)\n",jprint(txjson,0)); + if ( (value= jdouble(txjson,"value") * SATOSHIDEN) != 0 ) + { + if ( (sobj= jobj(txjson,"scriptPubKey")) != 0 && (addrs= jarray(&m,sobj,"addresses")) != 0 && (coinaddr= jstri(addrs,0)) != 0 ) + jaddstr(retjson,"address",coinaddr); + jadd64bits(retjson,"satoshis",value); + jaddnum(retjson,"value",dstr(value)); + if ( (infostr= _dex_getinfo(myinfo,symbol)) != 0 ) + { + if ( (info= cJSON_Parse(infostr)) != 0 ) + { + if ( (height= jint(info,"blocks")) > 0 ) + { + height -= jint(txoutjson,"confirmations"); + jaddnum(retjson,"height",height); + } + free_json(info); + } + free(infostr); + } + jaddbits256(retjson,"txid",txid); + jaddnum(retjson,"vout",vout); + jaddstr(retjson,"coin",symbol); + free(retstr); + free_json(txoutjson); + return(jprint(retjson,1)); + } + } + free_json(txoutjson); + return(jprint(retjson,1)); + } + return(retstr); + } + } return(basilisk_standardservice("VAL",myinfo,0,hash,vals,hexstr,1)); } diff --git a/basilisk/basilisk_ping.c b/basilisk/basilisk_ping.c index c02e805f2..f5e6c30c7 100755 --- a/basilisk/basilisk_ping.c +++ b/basilisk/basilisk_ping.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * diff --git a/basilisk/basilisk_swap.c b/basilisk/basilisk_swap.c index 853206c50..bced7218b 100755 --- a/basilisk/basilisk_swap.c +++ b/basilisk/basilisk_swap.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -17,6 +17,11 @@ // mode to autocreate required outputs // more better LP commands +// depends on just three external functions: +// - iguana_sendrawtransaction(myinfo,coin,signedtx); +// - basilisk_value(myinfo,rawtx->coin,0,0,myinfo->myaddr.persistent,argjson,0) +// basilisk_bitcoinrawtx(myinfo,rawtx->coin,"",basilisktag,jint(valsobj,"timeout"),valsobj,V) + // included from basilisk.c /* https://bitcointalk.org/index.php?topic=1340621.msg13828271#msg13828271 @@ -252,7 +257,7 @@ int32_t basilisk_numconfirms(struct supernet_info *myinfo,struct basilisk_rawtx jaddstr(argjson,"coin",rawtx->coin->symbol); if ( (valstr= basilisk_value(myinfo,rawtx->coin,0,0,myinfo->myaddr.persistent,argjson,0)) != 0 ) { - //char str[65]; printf("%s %s valstr.(%s)\n",rawtx->name,bits256_str(str,rawtx->actualtxid),valstr); + //char str[65]; printf("%s %s valstr.(%s)\n",rawtx->name,bits256_str(str,rawtx->I.actualtxid),valstr); if ( (valuearray= cJSON_Parse(valstr)) != 0 ) { if ( is_cJSON_Array(valuearray) != 0 ) @@ -320,7 +325,7 @@ int32_t basilisk_rawtx_sign(struct supernet_info *myinfo,int32_t height,struct b V[0].ignore_cltverr = ignore_cltverr; if ( dest->I.redeemlen != 0 ) memcpy(V[0].p2shscript,dest->redeemscript,dest->I.redeemlen), V[0].p2shlen = dest->I.redeemlen; - txobj = bitcoin_txcreate(rawtx->coin->chain->isPoS,locktime,userdata == 0 ? 1 : 1,timestamp);//rawtx->coin->chain->locktime_txversion); + txobj = bitcoin_txcreate(rawtx->coin->symbol,rawtx->coin->chain->isPoS,locktime,userdata == 0 ? 1 : 1,timestamp);//rawtx->coin->chain->locktime_txversion); vins = cJSON_CreateArray(); item = cJSON_CreateObject(); if ( userdata != 0 && userdatalen > 0 ) @@ -861,11 +866,11 @@ int32_t basilisk_swapget(struct supernet_info *myinfo,struct basilisk_swap *swap uint32_t basilisk_swapsend(struct supernet_info *myinfo,struct basilisk_swap *swap,uint32_t msgbits,uint8_t *data,int32_t datalen,uint32_t nextbits,uint32_t crcs[2]) { + //if ( (rand() % 10) == 0 ) + basilisk_channelsend(myinfo,swap->I.myhash,swap->I.otherhash,swap->I.req.quoteid,msgbits,data,datalen,INSTANTDEX_LOCKTIME*2); if ( basilisk_crcsend(myinfo,0,swap->verifybuf,sizeof(swap->verifybuf),swap->I.myhash,swap->I.otherhash,swap->I.req.quoteid,msgbits,data,datalen,crcs) != 0 ) return(nextbits); - //if ( basilisk_channelsend(myinfo,swap->I.myhash,swap->I.otherhash,swap->I.req.quoteid,msgbits,data,datalen,INSTANTDEX_LOCKTIME*2) == 0 ) - // return(nextbits); - //printf("ERROR basilisk_channelsend\n"); + basilisk_channelsend(myinfo,swap->I.myhash,swap->I.otherhash,swap->I.req.quoteid,msgbits,data,datalen,INSTANTDEX_LOCKTIME*2); return(0); } @@ -1059,7 +1064,7 @@ struct basilisk_swap *bitcoin_swapinit(struct supernet_info *myinfo,struct basil { swap->bobcoin = iguana_coinfind("BTC"); swap->I.bobsatoshis = swap->I.req.srcamount; - swap->I.bobconfirms = (1 + sqrt(dstr(swap->I.bobsatoshis) * .1)); + swap->I.bobconfirms = (1*0 + sqrt(dstr(swap->I.bobsatoshis) * .1)); swap->alicecoin = iguana_coinfind(swap->I.req.dest); swap->I.alicesatoshis = swap->I.req.destamount; swap->I.aliceconfirms = swap->I.bobconfirms * 3; @@ -1068,7 +1073,7 @@ struct basilisk_swap *bitcoin_swapinit(struct supernet_info *myinfo,struct basil { swap->bobcoin = iguana_coinfind("BTC"); swap->I.bobsatoshis = swap->I.req.destamount; - swap->I.bobconfirms = (1 + sqrt(dstr(swap->I.bobsatoshis) * .1)); + swap->I.bobconfirms = (1*0 + sqrt(dstr(swap->I.bobsatoshis) * .1)); swap->alicecoin = iguana_coinfind(swap->I.req.src); swap->I.alicesatoshis = swap->I.req.srcamount; swap->I.aliceconfirms = swap->I.bobconfirms * 3; @@ -1500,7 +1505,7 @@ int32_t basilisk_swapiteration(struct supernet_info *myinfo,struct basilisk_swap basilisk_swapget(myinfo,swap,0x80000000,data,maxlen,basilisk_verify_otherstatebits); if ( (swap->I.otherstatebits & 0x80) != 0 && (swap->I.statebits & 0x80) != 0 ) break; - sleep(1);//3 + (swap->iambob == 0)*10); + sleep(3 + (swap->I.iambob == 0)*1); basilisk_swapget(myinfo,swap,0x80000000,data,maxlen,basilisk_verify_otherstatebits); basilisk_sendstate(myinfo,swap,data,maxlen); if ( (swap->I.otherstatebits & 0x80) == 0 ) @@ -1553,7 +1558,7 @@ int32_t basilisk_swapiteration(struct supernet_info *myinfo,struct basilisk_swap printf("Bob error spending alice payment\n"); else { - basilisk_swap_balancingtrade(myinfo,swap,1); + tradebot_swap_balancingtrade(myinfo,swap,1); printf("Bob spends alicepayment\n"); swap->I.statebits |= 0x40000; while ( basilisk_numconfirms(myinfo,&swap->bobspend) < swap->I.aliceconfirms ) @@ -1624,7 +1629,7 @@ int32_t basilisk_swapiteration(struct supernet_info *myinfo,struct basilisk_swap if ( basilisk_swapget(myinfo,swap,0x8000,data,maxlen,basilisk_verify_bobpaid) == 0 ) { printf("got bobpayment\n"); - basilisk_swap_balancingtrade(myinfo,swap,0); + tradebot_swap_balancingtrade(myinfo,swap,0); // verify payment and submit, set confirmed height swap->I.statebits |= 0x8000; } @@ -1683,7 +1688,7 @@ int32_t basilisk_swapiteration(struct supernet_info *myinfo,struct basilisk_swap } if ( (rand() % 30) == 0 ) printf("finished swapstate.%x other.%x\n",swap->I.statebits,swap->I.otherstatebits); - sleep(1);//3 + (swap->iambob == 0)); + sleep(3 + (swap->I.iambob == 0)); basilisk_sendstate(myinfo,swap,data,maxlen); basilisk_swapget(myinfo,swap,0x80000000,data,maxlen,basilisk_verify_otherstatebits); } @@ -1692,16 +1697,18 @@ int32_t basilisk_swapiteration(struct supernet_info *myinfo,struct basilisk_swap void basilisk_swaploop(void *_swap) { - uint8_t *data; uint32_t expiration; int32_t retval=0,i,j,datalen,maxlen; struct supernet_info *myinfo; struct basilisk_swap *swap = _swap; + uint8_t *data; uint32_t expiration; uint32_t channel; int32_t retval=0,i,j,datalen,maxlen; struct supernet_info *myinfo; struct basilisk_swap *swap = _swap; myinfo = swap->myinfo; fprintf(stderr,"start swap\n"); maxlen = 1024*1024 + sizeof(*swap); data = malloc(maxlen); expiration = (uint32_t)time(NULL) + 600; myinfo->DEXactive = expiration; + channel = 'D' + ((uint32_t)'E' << 8) + ((uint32_t)'X' << 16); while ( (swap->I.statebits & (0x08|0x02)) != (0x08|0x02) && time(NULL) < expiration ) { printf("A r%u/q%u swapstate.%x\n",swap->I.req.requestid,swap->I.req.quoteid,swap->I.statebits); + basilisk_channelsend(myinfo,swap->I.req.srchash,swap->I.req.desthash,channel,0x4000000,(void *)&swap->I.req.requestid,sizeof(swap->I.req.requestid),60); basilisk_sendstate(myinfo,swap,data,maxlen); basilisk_sendpubkeys(myinfo,swap,data,maxlen); // send pubkeys if ( basilisk_checkdeck(myinfo,swap,data,maxlen) == 0) // check for other deck 0x02 @@ -1710,17 +1717,23 @@ void basilisk_swaploop(void *_swap) if ( (swap->I.statebits & (0x08|0x02)) == (0x08|0x02) ) break; sleep(1); + //dpow_nanomsg_update(myinfo); + //dex_updateclient(myinfo); } while ( (swap->I.statebits & 0x20) == 0 && time(NULL) < expiration ) { printf("B r%u/q%u swapstate.%x\n",swap->I.req.requestid,swap->I.req.quoteid,swap->I.statebits); + basilisk_sendstate(myinfo,swap,data,maxlen); + basilisk_sendchoosei(myinfo,swap,data,maxlen); basilisk_sendmostprivs(myinfo,swap,data,maxlen); if ( basilisk_swapget(myinfo,swap,0x20,data,maxlen,basilisk_verify_privkeys) == 0 ) { swap->I.statebits |= 0x20; break; } - sleep(1);//3 + (swap->iambob == 0)*10); + sleep(3 + (swap->I.iambob == 0)*1); + //dpow_nanomsg_update(myinfo); + //dex_updateclient(myinfo); } if ( time(NULL) >= expiration ) retval = -1; @@ -1728,6 +1741,8 @@ void basilisk_swaploop(void *_swap) printf("C r%u/q%u swapstate.%x\n",swap->I.req.requestid,swap->I.req.quoteid,swap->I.statebits); while ( retval == 0 && (swap->I.statebits & 0x40) == 0 ) // send fee { + //dpow_nanomsg_update(myinfo); + //dex_updateclient(myinfo); basilisk_sendstate(myinfo,swap,data,maxlen); basilisk_swapget(myinfo,swap,0x80000000,data,maxlen,basilisk_verify_otherstatebits); if ( swap->myfee.txbytes == 0 ) @@ -1784,7 +1799,9 @@ void basilisk_swaploop(void *_swap) else { retval = 0; - printf("ALICE PAYMENT created\n"); + for (i=0; ialicepayment.I.spendlen; i++) + printf("%02x",swap->alicepayment.txbytes[i]); + printf(" ALICE PAYMENT created\n"); iguana_unspents_mark(myinfo,swap->alicecoin,swap->alicepayment.vins); basilisk_txlog(myinfo,swap,&swap->alicepayment,-1); break; @@ -1796,6 +1813,12 @@ void basilisk_swaploop(void *_swap) swap->I.statebits |= basilisk_swapdata_rawtxsend(myinfo,swap,0x80,data,maxlen,&swap->myfee,0x40); iguana_unspents_mark(myinfo,swap->I.iambob!=0?swap->bobcoin:swap->alicecoin,swap->myfee.vins); basilisk_txlog(myinfo,swap,&swap->myfee,-1); + for (i=0; imyfee.I.spendlen; i++) + printf("%02x",swap->myfee.txbytes[i]); + printf(" alice fee %p %x\n",swap->myfee.txbytes,swap->I.statebits); + swap->I.statebits |= 0x40; + if ( swap->alicepayment.txbytes != 0 && swap->alicepayment.I.spendlen > 0 ) + break; } else { @@ -1806,11 +1829,13 @@ void basilisk_swaploop(void *_swap) } while ( basilisk_swapiteration(myinfo,swap,data,maxlen) == 0 ) { - sleep(1); + sleep(3); basilisk_sendstate(myinfo,swap,data,maxlen); basilisk_swapget(myinfo,swap,0x80000000,data,maxlen,basilisk_verify_otherstatebits); if ( time(NULL) > swap->I.expiration ) break; + //dpow_nanomsg_update(myinfo); + //dex_updateclient(myinfo); } printf("end of atomic swap\n"); if ( swap->I.iambob != 0 && swap->bobdeposit.txbytes != 0 ) @@ -1850,16 +1875,17 @@ struct basilisk_swap *basilisk_thread_start(struct supernet_info *myinfo,struct vcalc_sha256(0,swap->I.orderhash.bytes,(uint8_t *)rp,sizeof(*rp)); swap->I.req = *rp; swap->myinfo = myinfo; - printf("START swap requestid.%u\n",rp->requestid); m = n = 0; if ( bitcoin_swapinit(myinfo,swap,optionduration) != 0 ) { starttime = (uint32_t)time(NULL); - while ( statebits == 0 && m <= n/2 && time(NULL) < starttime+300 ) + while ( statebits == 0 && m <= n/2 && time(NULL) < starttime+30 ) { m = n = 0; - printf("waiting for offer to be accepted\n"); + dpow_nanomsg_update(myinfo); + dex_updateclient(myinfo); sleep(3); + printf("waiting for offer to be accepted\n"); channel = 'D' + ((uint32_t)'E' << 8) + ((uint32_t)'X' << 16); if ( (retarray= basilisk_channelget(myinfo,rp->srchash,rp->desthash,channel,0x4000000,30)) != 0 ) { @@ -1874,14 +1900,16 @@ struct basilisk_swap *basilisk_thread_start(struct supernet_info *myinfo,struct if ( jobj(item,"data") != 0 && jobj(item,"key") != 0 ) m++; else printf("(%s)\n",jprint(item,0)); - } else printf("msgobj.%p m.%d n.%d\n",msgobj,m,n); + } //else printf("msgobj.%p m.%d n.%d\n",msgobj,m,n); } } } else printf("no retarray\n"); } if ( statebits != 0 || m > n/2 ) { - fprintf(stderr,"m.%d n.%d launch.%d %d\n",m,n,myinfo->numswaps,(int32_t)(sizeof(myinfo->swaps)/sizeof(*myinfo->swaps))); + //for (i=0; iI.req); i++) + // fprintf(stderr,"%02x",((uint8_t *)&swap->I.req)[i]); + //fprintf(stderr," M.%d N.%d launch.%d %d %p\n",m,n,myinfo->numswaps,(int32_t)(sizeof(myinfo->swaps)/sizeof(*myinfo->swaps)),&swap->I.req); if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)basilisk_swaploop,(void *)swap) != 0 ) { diff --git a/basilisk/basilisk_tradebot.c b/basilisk/basilisk_tradebot.c index 8930d28bf..19e4401c2 100755 --- a/basilisk/basilisk_tradebot.c +++ b/basilisk/basilisk_tradebot.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -14,60 +14,6 @@ ******************************************************************************/ // included from basilisk.c -void basilisk_swap_balancingtrade(struct supernet_info *myinfo,struct basilisk_swap *swap,int32_t iambob) -{ - // update balance, compare to target balance, issue balancing trade via central exchanges, if needed - double price,volume,srcamount,destamount,profitmargin,dir=0.,dotrade=1.; char base[64],rel[64]; - srcamount = swap->I.req.srcamount; - destamount = swap->I.req.destamount; - profitmargin = (double)swap->I.req.profitmargin / 1000000.; - if ( srcamount <= SMALLVAL || destamount <= SMALLVAL ) - { - printf("illegal amount for balancing %f %f\n",srcamount,destamount); - return; - } - strcpy(rel,"BTC"); - if ( strcmp(swap->I.req.src,"BTC") == 0 ) - { - strcpy(base,swap->I.req.dest); - price = (srcamount / destamount); - volume = destamount / SATOSHIDEN; - dir = -1.; - } - else if ( strcmp(swap->I.req.dest,"BTC") == 0 ) - { - strcpy(base,swap->I.req.src); - price = (destamount / srcamount); - volume = srcamount / SATOSHIDEN; - dir = 1.; - } - else - { - printf("only BTC trades can be balanced, not (%s/%s)\n",swap->I.req.src,swap->I.req.dest); - return; - } - if ( iambob != 0 ) - { - if ( myinfo->IAMLP != 0 ) - { - printf("BOB: price %f * vol %f -> %s newprice %f margin %.2f%%\n",price,volume,dir < 0. ? "buy" : "sell",price + dir * price * profitmargin,100*profitmargin); - if ( dir < 0. ) - InstantDEX_buy(myinfo,0,0,0,"poloniex",base,rel,price,volume,dotrade); - else InstantDEX_sell(myinfo,0,0,0,"poloniex",base,rel,price,volume,dotrade); - } - } - else - { - if ( myinfo->IAMLP != 0 ) - { - printf("ALICE: price %f * vol %f -> %s newprice %f margin %.2f%%\n",price,volume,dir > 0. ? "buy" : "sell",price - dir * price * profitmargin,100*profitmargin); - if ( dir > 0. ) - InstantDEX_buy(myinfo,0,0,0,"poloniex",base,rel,price,volume,dotrade); - else InstantDEX_sell(myinfo,0,0,0,"poloniex",base,rel,price,volume,dotrade); - } - } -} - cJSON *basilisk_rawtxobj(struct supernet_info *myinfo,struct basilisk_swap *swap,struct basilisk_rawtx *rawtx) { @@ -170,12 +116,13 @@ struct basilisk_swap *basilisk_swapstore(struct supernet_info *myinfo,struct bas struct basilisk_swap *basilisk_swapload(struct supernet_info *myinfo,struct basilisk_swap *swap,uint32_t requestid,uint32_t quoteid) { - return(swap); + // set swap fields and return it if found + return(0); } void basilisk_swapstart(struct supernet_info *myinfo) // scan saved tmpswap, purge if complete, else Q { - + // for resuming pending swaps } void basilisk_txlog(struct supernet_info *myinfo,struct basilisk_swap *swap,struct basilisk_rawtx *rawtx,int32_t delay) @@ -329,51 +276,6 @@ int32_t basilisk_request_cmpref(struct basilisk_request *ref,struct basilisk_req } else return(0); } -void tradebot_liquidity_command(struct supernet_info *myinfo,char *base,bits256 hash,cJSON *vals) -{ - struct liquidity_info li,refli; int32_t i; - memset(&li,0,sizeof(li)); - strcpy(li.base,base), strcpy(li.rel,"BTC"); - li.profit = jdouble(vals,"profit"); - li.refprice = jdouble(vals,"refprice"); - for (i=0; ilinfos)/sizeof(*myinfo->linfos); i++) - { - refli = myinfo->linfos[i]; - if ( strcmp(li.rel,refli.base) == 0 && strcmp(li.base,refli.rel) == 0 ) - { - strcpy(li.base,refli.base); - strcpy(li.rel,refli.rel); - li.refprice = (1. / li.refprice); - printf("Set rev linfo[%d] (%s/%s) %.6f %.8f\n",i,li.base,li.rel,li.profit,li.refprice); - myinfo->linfos[i] = li; - return; - } - else if ( refli.base[0] == 0 || (strcmp(li.base,refli.base) == 0 && strcmp(li.rel,refli.rel) == 0) ) - { - myinfo->linfos[i] = li; - printf("Set linfo[%d] (%s/%s) %.6f %.8f\n",i,li.base,li.rel,li.profit,li.refprice); - return; - } - } - printf("ERROR: too many linfos %d\n",i); -} - -double tradebot_liquidity_active(struct supernet_info *myinfo,double *refpricep,char *base,char *rel) -{ - int32_t i; struct liquidity_info refli; - *refpricep = 0.; - for (i=0; ilinfos)/sizeof(*myinfo->linfos); i++) - { - refli = myinfo->linfos[i]; - if ( (strcmp(base,refli.base) == 0 && strcmp(rel,refli.rel) == 0) || (strcmp(rel,refli.base) == 0 && strcmp(base,refli.rel) == 0 )) - { - *refpricep = refli.refprice; - return(refli.profit); - } - } - return(0.); -} - double basilisk_request_listprocess(struct supernet_info *myinfo,struct basilisk_request *issueR,struct basilisk_request *list,int32_t n) { int32_t i,noquoteflag=0,havequoteflag=0,myrequest=0,maxi=-1; int64_t balance=0,destamount,minamount = 0,maxamount = 0; uint32_t pendingid=0; struct basilisk_swap *active; double metric = 0.; @@ -412,7 +314,7 @@ double basilisk_request_listprocess(struct supernet_info *myinfo,struct basilisk } //printf("%s -> %s myrequest.%d pendingid.%u noquoteflag.%d havequoteflag.%d maxi.%d %.8f\n",list[0].src,list[0].dest,myrequest,pendingid,noquoteflag,havequoteflag,maxi,dstr(maxamount)); double retvals[4],refprice,profitmargin,aveprice; cJSON *retjson; char *retstr; - if ( myinfo->IAMLP != 0 && myrequest == 0 && pendingid == 0 && noquoteflag != 0 && (profitmargin= tradebot_liquidity_active(myinfo,&refprice,list[0].src,list[0].dest)) > 0. ) + if ( maxi >= 0 && myinfo->IAMLP != 0 && myrequest == 0 && pendingid == 0 && noquoteflag != 0 && (profitmargin= tradebot_liquidity_active(myinfo,&refprice,"DEX",list[maxi].src,list[maxi].dest,(double)maxamount/SATOSHIDEN)) > 0. ) { if ( (aveprice= instantdex_avehbla(myinfo,retvals,list[0].src,list[0].dest,1.3 * dstr(list[0].srcamount))) == 0. || refprice > aveprice ) aveprice = refprice; @@ -447,8 +349,10 @@ double basilisk_request_listprocess(struct supernet_info *myinfo,struct basilisk { if ( minamount != 0 && maxamount > minamount && time(NULL) > BASILISK_DEXDURATION/2 ) { - printf("automatch quoteid.%u triggered %.8f > %.8f\n",list[maxi].quoteid,dstr(maxamount),dstr(minamount)); *issueR = list[maxi]; + for (i=0; i %.8f\n",maxi,list[maxi].quoteid,dstr(maxamount),dstr(minamount)); if ( minamount > 0 ) metric = (dstr(maxamount) / dstr(minamount)) - 1.; else metric = 1.; @@ -489,6 +393,7 @@ double basilisk_process_results(struct supernet_info *myinfo,struct basilisk_req *issueR = tmpR; hwm = metric; refR = tmpR; + printf("SET HWM\n"); } m = 0; } @@ -504,7 +409,13 @@ double basilisk_process_results(struct supernet_info *myinfo,struct basilisk_req //printf("process_results n.%d m.%d nonz.%d\n",n,m,nonz); if ( m > 0 && m < sizeof(list)/sizeof(*list) ) if ( (metric= basilisk_request_listprocess(myinfo,&tmpR,list,m)) > hwm ) + { *issueR = tmpR, hwm = metric; + printf("set hwm\n"); + for (i=0; i + +typedef float svmtype; +#ifdef WIN32 +// fadedreamz@gmail.com - added for successful compilation, however, for MSVC probably require a particular OpenCL SDK +// to work with it (e,g nvidia or amd SDK) +typedef struct fake_opencl_double { + double x; + double y; +}double2; +#else +typedef double double2 __attribute__((ext_vector_type(2))); +#endif +#define MAX_VECTORS (1440 * 365 * 5) +#define MAIN_MAXCORES 16 +#define c_to_refc(c) (c) +#define refc_to_c(refc) (refc) + +#define CONDITION(feature) (feature) +#define FEATURE_THRESHOLD 10. +#define HWMPERC_THRESHOLD 101 +#define HWMPERC_THRESHOLD0 HWMPERC_THRESHOLD + +#ifdef INSIDE_OPENCL +#pragma OPENCL EXTENSION cl_khr_fp64: enable +#define local_barrier() barrier(CLK_LOCAL_MEM_FENCE) +#define global_barrier() barrier(CLK_GLOBAL_MEM_FENCE) +#else +//double get_features(register struct ocas_ptrs *PTRS,register int c,register int weekind,register int numfeatures,register double *features,register double *model,register double *addptr,register struct baserel_info *BR,register double wt); +svmtype *get_jfp_features(register int selector,register int numfeatures,register int c,register int weekind); + +#endif + +#define OCAS_INFINITY (-log(0.0)) +#define OCAS_NEGINFINITY (log(0.0)) +#define OCAS_DECAY .1 +#define OCAS_BIAS 1. +#define OCAS_INDEX(ROW,COL,NUM_ROWS) ((COL)*(NUM_ROWS)+(ROW)) +#define QPSOLVER_MAXITER 1000000 +#define QPSOLVER_MINITER (QPSOLVER_MAXITER * .1) +//#define NUM_CUDA_GROUPS 14 +//#define NUM_BUNDLE_ANSWERS 64 +//#define NUM_TOPCOEFFIS 558 +//#define SMALLVAL .00000000000001 +//#define NUM_PRIMARY_FEATURES 4096 +#ifdef __APPLE__ +#define MAX_OCAS_LHS 512 +#else +#define MAX_OCAS_LHS 2000 +#endif +#define MAX_OCAS_FEATURES (1024 * 1024) + +struct ptrhdr { long allocsize; void *ptr; int devid; char str[64]; }; + +struct ocas_lhsbuffers +{ + double H[MAX_OCAS_LHS * MAX_OCAS_LHS]; + double alpha[MAX_OCAS_LHS],b[MAX_OCAS_LHS],diag_H[MAX_OCAS_LHS],A0[MAX_OCAS_LHS],d[MAX_OCAS_LHS]; + double full_A[]; +}; + +struct ocas_CLtmpspace +{ + double2 hpfb[MAX_VECTORS]; + int poslist[MAX_VECTORS],neglist[MAX_VECTORS]; +}; + +struct ocas_CLbuffers +{ + double output_pred[MAX_VECTORS],old_output[MAX_VECTORS]; + double W[MAX_OCAS_FEATURES+4],oldW[MAX_OCAS_FEATURES+4],new_a[MAX_OCAS_FEATURES+4]; +}; + +struct ocas_vars +{ + struct ptrhdr pH[256]; + double Q_P[TRADEBOTS_NUMANSWERS],Q_D[TRADEBOTS_NUMANSWERS]; + double netcuts[TRADEBOTS_NUMANSWERS],perc[TRADEBOTS_NUMANSWERS],hwmperc[TRADEBOTS_NUMANSWERS],lastmetrics[TRADEBOTS_NUMANSWERS][2]; + double learningrates[TRADEBOTS_NUMANSWERS][2],maxiters[TRADEBOTS_NUMANSWERS],dot_prod_WoldW[TRADEBOTS_NUMANSWERS],cutsum[TRADEBOTS_NUMANSWERS]; + double sq_norm_oldW[TRADEBOTS_NUMANSWERS],oldW0[TRADEBOTS_NUMANSWERS],W0[TRADEBOTS_NUMANSWERS],sq_norm_W[TRADEBOTS_NUMANSWERS]; + double predabs[TRADEBOTS_NUMANSWERS],predsum[TRADEBOTS_NUMANSWERS],dist[TRADEBOTS_NUMANSWERS]; + double xi[TRADEBOTS_NUMANSWERS],pratio[TRADEBOTS_NUMANSWERS],errperc[TRADEBOTS_NUMANSWERS],hwmdist[TRADEBOTS_NUMANSWERS]; + double answerabsaves[TRADEBOTS_NUMANSWERS],answeraves[TRADEBOTS_NUMANSWERS]; + int answercounts,firstweekinds[TRADEBOTS_NUMANSWERS]; + int posA[TRADEBOTS_NUMANSWERS],negA[TRADEBOTS_NUMANSWERS]; + int numIt[TRADEBOTS_NUMANSWERS],numlhs[TRADEBOTS_NUMANSWERS],nNZAlpha[TRADEBOTS_NUMANSWERS],trn_err[TRADEBOTS_NUMANSWERS]; + int qp_exitflag[TRADEBOTS_NUMANSWERS],exitflag[TRADEBOTS_NUMANSWERS],len[TRADEBOTS_NUMANSWERS]; + int have_pendingmodel[TRADEBOTS_NUMANSWERS],cutlen[TRADEBOTS_NUMANSWERS],good[TRADEBOTS_NUMANSWERS],bad[TRADEBOTS_NUMANSWERS]; + int nohwm[TRADEBOTS_NUMANSWERS],numposcuts[TRADEBOTS_NUMANSWERS],numnegcuts[TRADEBOTS_NUMANSWERS]; + struct ocas_CLbuffers *CLspaces[TRADEBOTS_NUMANSWERS]; + struct ocas_lhsbuffers *lhs[TRADEBOTS_NUMANSWERS]; + int *weekinds[TRADEBOTS_NUMANSWERS]; + float *answers,**features; + //unsigned long CLallocsize,tmpallocsize,tmpCLallocsize; + double C,TolRel,TolAbs,MaxTime,QPBound,QPSolverTolAbs,QPSolverTolRel; + double output_time,sort_time,add_time,w_time,qp_solver_time,ocas_time; // total time spent in svm_ocas_solver + int selector,numthreads,starti,modelind,c,refc,maxlen,numfeatures,firstweekind,startweekind,endweekind,numptrs,maxlhs; +}; + +/////////////////////////// Most of runtime is in the add/dot functions +#ifdef INSIDE_OPENCL +typedef double svmtype; + +// numCLthreads: NUM_CUDA_CORES, numgroups: (numdocs + NUM_CUDA_CORES-1)/NUM_CUDA_CORES +__kernel void dot_featuresCL(__local void *lp,__global double *preds,int numfeatures,__global double *W,double W0,__global svmtype *matrix,int numdocs) +{ + register int i,j,docid; + register double sum; + register __global svmtype *features; + if ( (docid = (int)get_global_id(0)) < numdocs ) + { + sum = 0.; + features = &matrix[docid * numfeatures]; + for (i=0; i>= 1; + if ( docid < numdocs ) + { + features = &matrix[docid * numfeatures]; + if ( dir == 0 ) + sum += CONDITION(features[j]); + else sum -= CONDITION(features[j]); + } + } + new_a[j] = sum; + } +} + +#else + +void ocas_purge(struct ocas_vars *vars) +{ + int32_t i; + free(vars->answers); + for (i=0; imaxlen; i++) + if ( vars->features[i] != 0 ) + free(vars->features[i]); + free(vars->features); + for (i=0; iCLspaces[i] != 0 ) + myaligned_free(vars->CLspaces[i],sizeof(*vars->CLspaces[i])); + if ( vars->lhs[i] != 0 ) + myaligned_free(vars->lhs[i],sizeof(*vars->lhs[i]) + vars->numfeatures*vars->maxlhs*sizeof(double)); + if ( vars->weekinds[i] != 0 ) + free(vars->weekinds[i]); + } + free(vars); +} + +/*static inline double dot_expanded_features(register double *W,register int c,register int selector,register int numfeatures) + { + fatal("dot_expanded_features not implemented"); + return(0); + } + + static inline void add_expanded_features(register double *W,register double y,register int c,register int selector,register int numfeatures) + { + fatal("add_expanded_features not implemented"); + }*/ + +static inline double calc_ocas_output(register struct ocas_vars *vars,register int selector,register int c,register int weekind,register int answerind,register double *W,register double W0,register int numfeatures) +{ + register svmtype *features; + register double feature,y,sum = 0.; + register int coeffi; + if ( (y= vars->answers[(weekind-vars->starti)*TRADEBOTS_NUMANSWERS + answerind]) != 0.f ) + { + if ( (features= vars->features[weekind-vars->starti]) != 0 )//get_jfp_features(vars->selector,numfeatures,c,weekind)) != 0 ) + { +#ifdef OCAS_USE_TOPCOEFFIS + for (int i=0; iselector,numfeatures); + sum = y * (W0 + sum); + } + // printf("%f ",sum); + return(sum); +} + +static inline void add_ocas_output(register double y,register struct ocas_vars *vars,register int selector,register int c,register int weekind,register int answerind,register double *W,register double *new_a,register int numfeatures) +{ + register int coeffi; + register svmtype *features,feature; + if ( y != 0 ) + { + if ( (features= vars->features[weekind-vars->starti]) != 0 )//get_jfp_features(vars->selector,numfeatures,c,weekind)) != 0 ) + { + //features = get_jfp_features(vars->selector,numfeatures,c,weekind); +#ifdef OCAS_USE_TOPCOEFFIS + int32_t i; + for (i=0; iselector,numfeatures); + } +} + +static inline void STocas_calc_outputs(register struct ocas_vars *vars,register int c,register int answerind,register double *output,register double *old_output,register double *W,register double W0,register int numfeatures,register int *weekinds,register int numdocs) +{ + register int i,j; + //vars->good[answerind] = vars->bad[answerind] = 0; + //printf("start STocas_calc_outputs.(%p %s.A%d %p) %p %p %p\n",vars,CONTRACTS[c],answerind,weekinds,output,old_output,W); + for (i=0; iselector,c,weekinds[i],answerind,W,W0,numfeatures); + if ( 1 && isnan(output[i]) != 0 ) + { + svmtype *features = vars->features[weekinds[i]-vars->starti];//get_jfp_features(vars->selector,numfeatures,c,weekinds[i]); + if ( features != 0 ) + { + for (j=0; janswers[(i-vars->starti)*TRADEBOTS_NUMANSWERS + answerind]*output[i] <= 0 ) + { + if ( vars->answers[(i-vars->starti)*TRADEBOTS_NUMANSWERS + answerind] != 0.f ) + printf("(%f %f) ",vars->answers[(i-vars->starti)*TRADEBOTS_NUMANSWERS + answerind],output[i]); + } + //printf("[%f %f] ",vars->answers[(i-vars->starti)*TRADEBOTS_NUMANSWERS + answerind],output[i]); + } + } + //printf("finish STocas_calc_outputs\n"); +} + +static inline void STocas_add_newcuts(register struct ocas_vars *vars,register int answerind,register int numfeatures,register int *weekinds,register int *new_cut,register int numcuts,register double *W,register double *new_a) +{ + register int weekind,dir,i,c = vars->c; + memset(new_a,0,sizeof(*new_a) * numfeatures); + //printf("STocas_add_newcuts numcuts.%d numfeatures.%d\n",numcuts,numfeatures); + for (i=0; i>= 1; + add_ocas_output(dir==0?1:-1,vars,vars->selector,c,weekind,answerind,W,new_a,numfeatures); + } +} +//////////////////////////// end of add/dot functions +static inline double _dbufave(register double *buf,register int len) +{ + register int i,n; + register double sum; + sum = 0.; + n = 0; + for (i=0; i 0.0000000001 ) + { + n++; + sum += buf[i]; + } + } + if ( n != 0 ) + sum /= n; + if ( fabs(sum) <= 0.0000000001 ) + sum = 0.; + return(sum); +} + +static inline void add_newcut_entry(register struct ocas_vars *vars,register int answerind,register int *new_cut,register int i,register int weekind,register double y) +{ + weekind <<= 1; + if ( y > 0 ) vars->numposcuts[answerind]++; + else if ( y < 0 ) vars->numnegcuts[answerind]++, weekind |= 1; + new_cut[vars->cutlen[answerind]++] = weekind; +} + +static inline double validate_ocas_model(register struct ocas_vars *vars,register int answerind,register double *output_pred,register double *old_output,register int *weekinds,register int numdocs,register double *W,register double W0,register int numfeatures,register int paranoid) +{ + register svmtype *features; + register double y,pred,perc,answer=0.,feature; + register int i,j,pos,neg,good,bad,oldcuts,training_errors,weekind,nonz,posA,negA; + for (i=pos=neg=good=bad=oldcuts=training_errors=posA=negA=0; ianswers[(weekind-vars->starti)*TRADEBOTS_NUMANSWERS + answerind]) != 0. ) + { + if ( y > 0 ) posA++; + else if ( y < 0 ) negA++; + if ( paranoid != 0 ) + { + pred = 0.; + if ( (features= vars->features[weekind-vars->starti]) != 0 )//get_jfp_features(vars->selector,numfeatures,vars->c,weekind)) != 0 ) + { + for (j=nonz=0; j SMALLVAL ) + pred += W0; + } + else pred = 0;//dot_expanded_features(W,c,selector,numfeatures); + if ( output_pred[i] != 0 && fabs(pred - output_pred[i]) > .000001 ) + // if ( (rand() % 10000) == 0 ) + printf("i.%d A %9.6f pred %9.6f != output_pred %9.6f [%14.10f]\n",i,answer,pred,output_pred[i],pred-output_pred[i]); + } + else pred = output_pred[i], nonz = numfeatures; + if ( nonz != 0 ) + { + if ( pred > 0 ) pos++; + else if ( pred < 0 ) neg++; + if ( pred*y > 0 ) good++; + else if ( pred*y < 0 ) bad++; + } + if ( old_output[i] <= 1. ) + { + oldcuts++; + if ( old_output[i] <= 0. ) + training_errors++; + } + } + } + nonz = 0; + for (i=0; i>>>>> %d.A%02d.(+%-6d -%-6d oc.%-6d | good.%-6d bad.%-6d >>>>> %6.2f%% <<<<<).%-6d | W0 %9.6f W[%d] %9.6f | A +%-6d -%-6d | paranoid.%d numdocs.%d\n",c_to_refc(vars->c),answerind,pos,neg,oldcuts,good,bad,perc,training_errors,W0,nonz,_dbufave(W,numfeatures),posA,negA,paranoid,numdocs); + return(perc); +} + +static int _increasing_double(const void *a,const void *b) +{ +#define double_a (*(double *)a) +#define double_b (*(double *)b) + if ( double_b > double_a ) + return(-1); + else if ( double_b < double_a ) + return(1); + return(0); +#undef double_a +#undef double_b +} + +static inline void calc_ocas_strategy(register struct ocas_vars *vars,register int answerind,register double C,register int numfeatures,register int len,register int *weekinds,register int *new_cut,register double *W,register double *oldW,register double *output,register double *old_output,register double2 *hpfb) +{ + double answermag; + register int i,j,num_hp,good,bad,zero; + register double Bval,Cval,newoutput,W0,oldW0,sq_norm_W,A0val,B0,dist,GradVal,t,t1,t2,t_new,val,GradVal_new,y,starttime,*preds = output; + num_hp = 0; + W0 = vars->W0[answerind]; oldW0 = vars->oldW0[answerind]; + A0val = vars->sq_norm_W[answerind] - (2. * vars->dot_prod_WoldW[answerind]) + vars->sq_norm_oldW[answerind]; + B0 = (vars->dot_prod_WoldW[answerind] - vars->sq_norm_oldW[answerind]); + GradVal = B0; + for (i=0; ianswers[(weekinds[i]-vars->starti)*TRADEBOTS_NUMANSWERS + answerind]) != 0.f ) + { + svmtype *features = vars->features[weekinds[i]-vars->starti];//get_jfp_features(vars->selector,numfeatures,vars->c,weekinds[i]); + //printf("i.%d weekind.%d starti.%d y %f %p\n",i,weekinds[i],vars->starti,y,features); + if ( 0 && features != 0 ) + { + double oldsum=oldW0,sum=W0; + for (j=0; j .000001 ) + { + printf("A%d numIt.%d docid.%-6d sum %11.7f * y%2.0f %11.7f != %11.7f output [%11.7f] W0 %11.7f oldW0 %11.7f\n",answerind,vars->numIt[answerind],i,sum,y,sum*y,output[i],output[i]-sum*y,W0,oldW0); + //output[i] = sum*y; + } + if ( fabs(oldsum*y - old_output[i]) > .000001 ) + { + if ( old_output[i] != 0 && oldW0 != 0 && (rand() % 1000) == 0 ) + printf("A%d numIt.%d docid.%-6d oldsum %11.7f * y%2.0f %11.7f != %11.7f oldoutput [%11.7f] W0 %11.7f oldW0 %11.7f\n",answerind,vars->numIt[answerind],i,oldsum,y,oldsum*y,old_output[i],old_output[i]-oldsum*y,W0,oldW0); + old_output[i] = oldsum*y; + } + } + Cval = C * (1. - old_output[i]); + Bval = C * (old_output[i] - output[i]); + if ( Bval != 0 ) + val = -(Cval / Bval); + else val = OCAS_NEG_INF; + if ( val > 0 ) + { + hpfb[num_hp].y = Bval; + hpfb[num_hp].x = val; + num_hp++; + } + if ( (Bval < 0 && val > 0) || (Bval > 0 && val <= 0) ) + GradVal += Bval; + } + } + //printf("num_hp.%d\n",num_hp); + t = 0; + if ( GradVal < 0 ) + { + starttime = OS_milliseconds(); + qsort(hpfb,num_hp,sizeof(double2),_increasing_double); + //ocas_sort(hpfb,num_hp); + i = 0; + while ( GradVal < 0 && i < num_hp ) + { + t_new = hpfb[i].x; + GradVal_new = GradVal + fabs(hpfb[i].y) + A0val*(t_new - t); + if ( GradVal_new >= 0 ) + t = t + GradVal * (t - t_new) / (GradVal_new - GradVal); + else t = t_new, i++; + GradVal = GradVal_new; + } + vars->sort_time += OS_milliseconds() - starttime; + } + t = MAX(t,0.); // just sanity check; t < 0 should not occur + t1 = t; // new (best so far) W + t2 = t + OCAS_DECAY*(1. - t); // new cutting plane + W0 = oldW0 * (1. - t) + (t * W0); + sq_norm_W = W0 * W0; + for (j=0; jW0[answerind] = W0; vars->sq_norm_W[answerind] = sq_norm_W; + vars->trn_err[answerind] = 0; dist = 0.; + for (i=good=bad=zero=0; ianswers[(weekinds[i]-vars->starti)*TRADEBOTS_NUMANSWERS + answerind]) != 0.f ) + { + answermag = fabs(y); // 1.; + if ( (old_output[i] * (1. - t2) + t2*output[i]) <= answermag ) //1. + add_newcut_entry(vars,answerind,new_cut,i,weekinds[i],y); + newoutput = (old_output[i] * (1. - t1)) + (t1 * output[i]); + if ( 0 ) // won't match unless old_output corresponds with features*oldW + { + double sum=W0; + svmtype *features = vars->features[weekinds[i]-vars->starti];//get_jfp_features(vars->selector,numfeatures,vars->c,weekinds[i]); + if ( features != 0 ) + { + for (j=0; j .0000001 ) + printf("numIt.%d docid.%-6d w%-6d sum %11.7f * y%2.0f %11.7f != %11.7f newoutput [%11.7f] W0 %11.7f oldW0 %11.7f\n",vars->numIt[answerind],i,weekinds[i],sum,y,sum*y,newoutput,newoutput-sum*y,W0,oldW0); + newoutput = sum*y; + } + } + if ( newoutput <= answermag ) + { + vars->xi[answerind] += (answermag - newoutput); + if ( newoutput <= 0. ) + vars->trn_err[answerind]++; + } + preds[i] = y * newoutput; + dist += fabs(preds[i] - y); + old_output[i] = newoutput; + if ( newoutput > 0. ) good++; + else if ( newoutput < 0. ) + { + bad++; + //printf("(%f %f) ",y,newoutput); + } + } else zero++;//,printf("i.%d -> w%d | zeroes.%d good.%d bad.%d of len.%d\n",i,weekinds[i],zero,good,bad,len); + } + //printf("finished strategy\n"); + vars->good[answerind] = good; vars->bad[answerind] = bad; vars->dist[answerind] = dist / MAX(1,good+bad); + vars->perc[answerind] = (100. * (double)vars->good[answerind]) / MAX(1,good+bad); + if ( vars->perc[answerind] > vars->hwmperc[answerind] || (vars->perc[answerind] == vars->hwmperc[answerind] && (vars->hwmdist[answerind] == 0 || vars->dist[answerind] < vars->hwmdist[answerind])) ) + { + double set_ocas_model(int refc,int answerind,double *W,double W0,int numfeatures,int firstweekind,int len,int bad,double dist,double predabs,int posA,int negA,double answerabs,double aveanswer); + vars->W0[answerind] = set_ocas_model(vars->refc,answerind,vars->CLspaces[answerind]->W,vars->W0[answerind],vars->numfeatures,vars->firstweekind,vars->len[answerind],vars->trn_err[answerind],vars->dist[answerind],vars->predabs[answerind],vars->posA[answerind],vars->negA[answerind],vars->answerabsaves[answerind],0.); + vars->nohwm[answerind] = 0; + vars->hwmperc[answerind] = vars->perc[answerind]; vars->hwmdist[answerind] = vars->dist[answerind]; + } + else vars->nohwm[answerind]++; + //printf("good.%d bad.%d zero.%d errors.%d | selector.%d\n",good,bad,zero,vars->trn_err[answerind],vars->selector); +} + +static inline double ocas_splx_solver(register int *nonzalphap,register int maxlhs,register double *d,register double *activeH,register double *diag_H,register double *f,register double C,register double *alpha,register int n,register int MaxIter,register double TolAbs,register double TolRel,register double QP_TH) +{ + register double *col_u,*col_v; + register double QP,QD,lastQD,tmp,diff,distA,distB,etaA,etaB,improv,tmp_num,delta,x_neq0,xval,dval,diagval,tmp_den,tau; + register int u=0,v=0,i,j,iter,nonzalpha,unlikely = 0; + QP = distA = distB = OCAS_PLUS_INF; lastQD = QD = OCAS_NEG_INF; + x_neq0 = C; + etaA = etaB = 0.; + for (i=0; i 0. ) + { + col_u = &activeH[maxlhs * i]; + for (j=0; j 10*(MaxIter-iter) && etaB > 10*(MaxIter-iter) ) + unlikely++; + else unlikely = 0; + } else unlikely = 0; + diff = (QP - QD); + if ( 0 && (diff <= fabs(QP)*TolRel || diff <= TolAbs || QP <= QP_TH || unlikely > 100) ) + { + if ( 0 ) + { + if ( diff <= fabs(QP)*TolRel ) + printf("caseA %f | ",diff - fabs(QP)*TolRel); + else if ( diff <= TolAbs ) + printf("caseB %f | ",diff - TolAbs); + else if ( etaA > 2*(MaxIter-iter) && etaB > 2*(MaxIter-iter) ) + printf("caseC etas %f %f | ",etaA,etaB); + printf("%d: QP %f QD %f diff %f n.%d d0 %9.6f dA %9.6f %9.6f dB %9.6f %9.6f\n",iter,QP,QD,QP-QD,n,d[0],distA,etaA,distB,etaB); + } + break; + } + distA = (diff - fabs(QP)*TolRel); + distB = (diff - TolAbs); + lastQD = QD; + if ( d[u] > 0 ) + u = -1; + else delta -= C * d[u]; + // if satisfied then k-th block of variables needs update + if ( delta > TolAbs && delta > (TolRel * fabs(QP)) ) + { + // for fixed u select v = argmax_{i in I_k} Improvement(i) + improv = OCAS_NEG_INF; + for (i=0; i<=n; i++) + { + if ( i == u || (xval = ((i 0 ) + { + tmp_num = xval * dval; + if ( tmp_num < tmp_den ) + tmp = tmp_num*tmp_num / tmp_den; + else tmp = tmp_num - .5 * tmp_den; + if ( 0 && i < n ) // jimbo tweak + { + tmp = alpha[i] * MIN(1.,tmp_num/tmp_den); + alpha[i] -= tmp; + if ( u == -1 ) + x_neq0 += tmp; + else alpha[u] += tmp; + } + if ( tmp > improv ) + { + improv = tmp; + tau = MIN(1.,tmp_num/tmp_den); + v = i; + } + } + } + // update d = H*x + f + if ( v < n ) + { + tau *= alpha[v]; + alpha[v] -= tau; + if ( u != -1 ) + { + alpha[u] += tau; + col_v = &activeH[maxlhs * v]; + for (i=0; isq_norm_oldW[answerind] = vars->sq_norm_W[answerind]; + oldW0 = vars->oldW0[answerind] = vars->W0[answerind]; + W0 = 0.; + for (i=0; ialpha[i]) > 0 ) + { + //printf("%9.6f ",alpha); + for (j=0; jfull_A[OCAS_INDEX(j,i,numfeatures)]; + W0 += lhs->A0[i] * alpha; + } + } + vars->W0[answerind] = W0; + sq_norm_W = W0 * W0; + dot_prod_WoldW = W0 * oldW0; + for (j=0; jalpha,numlhs),W0,sq_norm_W,answerind); + vars->dot_prod_WoldW[answerind] = dot_prod_WoldW; + vars->sq_norm_W[answerind] = sq_norm_W; +} + +static inline void ocas_update_Lspace(register struct ocas_vars *vars,register int answerind,register double netcuts,register double cut_length,register int numfeatures,register double C,register double QPSolverTolAbs,register double QPSolverTolRel) +{ + register struct ocas_CLbuffers *ptr = vars->CLspaces[answerind]; + register struct ocas_lhsbuffers *lhs = vars->lhs[answerind]; + register double *new_col_H; + register double sq_norm_a,maxiters,metric,tmp; + register int i,j,iters,numlhs,maxlhs = vars->maxlhs; + numlhs = vars->numlhs[answerind]; + new_col_H = &lhs->H[OCAS_INDEX(0,numlhs,maxlhs)]; + lhs->A0[numlhs] = netcuts; + lhs->b[numlhs] = -cut_length; + sq_norm_a = lhs->A0[numlhs] * lhs->A0[numlhs]; + for (j=0; jfull_A[OCAS_INDEX(j,numlhs,numfeatures)] = ptr->new_a[j]; + if ( fabs(ptr->new_a[j]) > 1000 ) + { + //printf("(%d %9.6f %f) ",j,ptr->new_a[j],sq_norm_a); + ptr->new_a[j] = 0.; + } + else + sq_norm_a += ptr->new_a[j] * ptr->new_a[j]; + ptr->oldW[j] = ptr->W[j]; ptr->W[j] = 0.; + } + new_col_H[numlhs] = sq_norm_a; + //printf("QPsolver.A%02d: ABS %f Rel %.11f numlhs.%d cutlen.%f netcuts.%f sq_norm_a %f netcuts.%f\n",answerind,QPSolverTolAbs,QPSolverTolRel,vars->numlhs[answerind],cut_length,lhs->A0[numlhs],sq_norm_a,netcuts); + for (i=0; iA0[numlhs] * lhs->A0[i]; + for (j=0; jnew_a[j] * lhs->full_A[OCAS_INDEX(j,i,numfeatures)]; + new_col_H[i] = tmp; + } + lhs->d[numlhs] = lhs->alpha[numlhs] = 0.; + lhs->diag_H[numlhs] = lhs->H[OCAS_INDEX(numlhs,numlhs,maxlhs)]; + for (i=0; i H[OCAS_INDEX(numlhs,i,maxlhs)] = lhs->H[OCAS_INDEX(i,numlhs,maxlhs)]; + numlhs = ++vars->numlhs[answerind]; + iters = vars->numIt[answerind]; + if ( vars->nohwm[answerind] > 3 ) + vars->maxiters[answerind] *= 1 + sqrt(vars->nohwm[answerind])/100; + else if ( vars->nohwm[answerind] == 0 ) + vars->maxiters[answerind] *= .5; + if ( vars->maxiters[answerind] > QPSOLVER_MAXITER ) + vars->maxiters[answerind] = QPSOLVER_MAXITER; + if ( vars->maxiters[answerind] < QPSOLVER_MINITER ) + vars->maxiters[answerind] = QPSOLVER_MINITER; + maxiters = MAX(QPSOLVER_MINITER,vars->maxiters[answerind]); + vars->Q_D[answerind] = ocas_splx_solver(&vars->nNZAlpha[answerind],maxlhs,lhs->d,lhs->H,lhs->diag_H,lhs->b,C,lhs->alpha,vars->numlhs[answerind],MIN(maxiters,QPSOLVER_MAXITER),QPSolverTolAbs,QPSolverTolRel,OCAS_NEG_INF); + metric = ((double)vars->len[answerind] / MAX(1,vars->trn_err[answerind])) / 1.; + vars->lastmetrics[answerind][iters & 1] = metric; + update_ocas_model(ptr->W,ptr->oldW,vars,numfeatures,answerind,lhs,numlhs); +} + +static inline void start_ocas_iter(register struct ocas_vars *vars,register int c,register int answerind) +{ + if ( vars->pratio[answerind] == 0. ) + vars->pratio[answerind] = vars->answerabsaves[answerind]; + vars->good[answerind] = -1; + vars->bad[answerind] = vars->trn_err[answerind] = vars->cutlen[answerind] = vars->numposcuts[answerind] = vars->numnegcuts[answerind] = 0; + vars->xi[answerind] = vars->predsum[answerind] = vars->dist[answerind] = vars->cutsum[answerind] = vars->netcuts[answerind] = 0.; +} + +static void ocas_print(struct ocas_vars *vars,int answerind,int ishwm,double C) +{ + int i; + double dispvals[4]; + //printf("ocas_print.A%d\n",answerind); + //printf("%s.A%02d %4d %8.2f | QP %9.3f QD %9.3f [%9.4f %7.3f] SV.%d %4d | M%9.6f (%9.6f max %8.1f %9.6f) %s.A%02d %9.6f%%\n", + dispvals[0] = vars->Q_P[answerind]/1000000000.; dispvals[1] = (C * vars->Q_D[answerind])/1000000000.; + dispvals[2] = (vars->Q_P[answerind]-C * vars->Q_D[answerind]) / 1000000000; + dispvals[3] = (vars->Q_P[answerind]-C * vars->Q_D[answerind]) / MAX(1,fabs(vars->Q_P[answerind])); + printf("%3d %d.A%02d +%d -%d",vars->nohwm[answerind],vars->refc,answerind,vars->good[answerind],vars->bad[answerind]); + printf(" %4d %8.2f |QP %9.3f QD %10.2f [%11.2f %9.1f] SV.%3d %3d |M%9.3f errs.%-6d %-8.0f %5.2f%% errs %6.5f A%9.6f W0%9.6f D%11.9f\n",//[%7.4f%%]\n", + vars->numIt[answerind],vars->ocas_time/1000,dispvals[0],dispvals[1],dispvals[2],dispvals[3], + vars->nNZAlpha[answerind], vars->numlhs[answerind], + // PTRS->lastmetrics[answerind],PTRS->learningrates[answerind][0],PTRS->maxiters[answerind],PTRS->learningrates[answerind][1], + vars->lastmetrics[answerind][0],vars->trn_err[answerind],vars->maxiters[answerind],vars->perc[answerind], + vars->errperc[answerind]/100,_dbufave(vars->CLspaces[answerind]->new_a,vars->numfeatures),vars->W0[answerind], + vars->dist[answerind]/vars->answerabsaves[answerind]);//_dbufave(vars->hwmperc,81));//,vars->errperc+vars->perc); + for (i=0; i<4; i++) + if ( isnan(dispvals[i]) != 0 ) + break; + if ( vars->lastmetrics[answerind][0] > 10 ) + usleep(vars->lastmetrics[answerind][0] * vars->lastmetrics[answerind][0]); + /*if ( 0 && i < 4 )//|| (vars->answerind >= 32 && fabs(vars->W0) > .9) ) + { + int save_model(int refc,int answerind,double *W,int numfeatures,double W0,double perc,int posA,int negA); + memset(&vars->CLspaces[answerind],0,sizeof(vars->CLspaces[answerind])); + vars->W0[answerind] = vars->oldW0[answerind] = 0.; + vars->numIt[answerind] = 0; + vars->perc[answerind] = vars->hwmperc[answerind] = 0.; + printf("reset model %s.A%02d\n",CONTRACTS[vars->selector!=3?vars->refc:NUM_COMBINED],answerind); + save_model(vars->refc,answerind,vars->CLspaces[answerind]->W,vars->numfeatures,vars->W0[answerind],vars->perc[answerind]); + }*/ +} + +static inline void finish_ocasiter(register int answerind,register struct ocas_vars *vars,register double C) +{ + register double den; + vars->have_pendingmodel[answerind] = 0; + if ( vars->good[answerind] == 0 && vars->bad[answerind] == 0 ) + { + vars->bad[answerind] = vars->trn_err[answerind]; + vars->good[answerind] = (vars->len[answerind] - vars->trn_err[answerind]); + } + den = MAX(1.,vars->good[answerind]+vars->bad[answerind]); + if ( (vars->predabs[answerind] = (vars->predsum[answerind] / den)) != 0. ) + vars->pratio[answerind] = (vars->answerabsaves[answerind] / vars->predabs[answerind]); + else vars->pratio[answerind] = 0.; + vars->dist[answerind] = sqrt(vars->dist[answerind] / den); + //printf("W0 %9.6f pred sum %f %f | pratio %f distsum %f (%f vs hwm %f)\n",vars->W0[answerind],vars->predsum[answerind],vars->predabs[answerind],vars->pratio[answerind],vars->dist[answerind],vars->perc[answerind],vars->hwmperc[answerind]); + vars->errperc[answerind] = (100 * (double)vars->trn_err[answerind])/(double)MAX(1,vars->len[answerind]); + vars->Q_P[answerind] = 0.5*vars->sq_norm_W[answerind] + (C * vars->xi[answerind]); + vars->ocas_time = (vars->output_time + vars->w_time + vars->add_time + vars->sort_time + vars->qp_solver_time); + ocas_print(vars,answerind,0,C); +} + +static inline int ocas_iter(struct ocas_vars *vars,int max_nohwm) +{ + int Method = 1; + int min_nohwm = 1; + int skipflags[84]; + static int new_cut[MAX_VECTORS]; + static double2 hpfb[MAX_VECTORS]; + int inactives[81]; + register struct ocas_CLbuffers *ptr; + register double netcuts,startmilli,y,psum,pcount,nosum; + register int i,numfeatures,cutlen,lastanswerind,lwm,numactive,numthreads,answerind,*weekinds; + numactive = 0; + if ( (numfeatures= vars->numfeatures) > MAX_OCAS_FEATURES ) + { + printf("numfeatures > MAX_OCAS_FEATURES\n"); + exit(-1); + } + psum = pcount = nosum = 0; + { + //printf("c.%d mask %lx %p\n",c,contractmask,PTRS->ocas[c]); + memset(inactives,0,sizeof(inactives)); + lastanswerind = TRADEBOTS_NUMANSWERS; + numfeatures = vars->numfeatures; + answerind = 0; + //printf("numIt.%d ocas iter.%s A.mask%lx len.%d CLspace.%p lhs.%p | vars.%p\n",vars->numIt[answerind],CONTRACTS[c_to_refc(c)],answerindmask,vars->len[answerind],vars->CLspaces[answerind],vars->lhs[answerind],vars); + memset(skipflags,0,sizeof(skipflags)); + for (answerind=0; answerindCLspaces[answerind],vars->weekinds[answerind],vars->nohwm[answerind],max_nohwm); + if ( vars->hwmperc[answerind] != 0 ) + { + nosum += vars->nohwm[answerind]; + pcount++, psum += vars->hwmperc[answerind]; + } + //printf("answerind.%d\n",answerind); + if ( vars->len[answerind] == 0 || vars->CLspaces[answerind] == 0 || (vars->nohwm[answerind] > min_nohwm && vars->hwmperc[answerind] > ((answerind==0) ? HWMPERC_THRESHOLD0 : HWMPERC_THRESHOLD)) ) + { + inactives[answerind] = 1; + continue; + } + if ( vars->nohwm[answerind] < max_nohwm ) + { + numactive++; + if ( vars->numIt[answerind]++ == 0 ) + { + for (i=0; iCLspaces[answerind]->W[i] != 0 ) + break; + if ( i == numfeatures ) + skipflags[answerind] = 1; + } + ptr = vars->CLspaces[answerind]; + weekinds = vars->weekinds[answerind]; + //printf("start iter %p %p\n",ptr,weekinds); + start_ocas_iter(vars,vars->c,answerind); + numthreads = vars->numthreads; + if ( skipflags[answerind] != 0 ) + { + for (i=0; ilen[answerind]; i++) + { + if ( (y= vars->answers[(weekinds[i]-vars->starti)*TRADEBOTS_NUMANSWERS + answerind]) != 0.f ) + { + ptr->output_pred[i] = 0; + add_newcut_entry(vars,answerind,new_cut,i,weekinds[i],y); + } + } + fprintf(stderr,"skip %d.A%02d cuts +%d -%d, ",c_to_refc(vars->c),answerind,vars->numposcuts[answerind],vars->numnegcuts[answerind]); + } + else + { + startmilli = OS_milliseconds(); + //printf("%s ocas_calc_outputs.A%d len.%d | numthreads.%d\n",CONTRACTS[c_to_refc(c)],answerind,vars->len[answerind],numthreads); + STocas_calc_outputs(vars,vars->c,answerind,ptr->output_pred,ptr->old_output,ptr->W,vars->W0[answerind],numfeatures,weekinds,vars->len[answerind]); + //ocas_calc_outputs(PTRS,numthreads,vars,c,answerind,ptr->output_pred,ptr->old_output,ptr->W,vars->W0[answerind],numfeatures,weekinds,vars->len[answerind]); + vars->output_time += (OS_milliseconds() - startmilli); + if ( Method != 0 ) + { + startmilli = OS_milliseconds(); + //printf("%d calc_ocas_strategy.A%d len.%d | numthreads.%d\n",c_to_refc(vars->c),answerind,vars->len[answerind],numthreads); + calc_ocas_strategy(vars,answerind,vars->C,numfeatures,vars->maxlen,weekinds,new_cut,ptr->W,ptr->oldW,ptr->output_pred,ptr->old_output,hpfb); + vars->w_time += (OS_milliseconds() - startmilli); + } + finish_ocasiter(answerind,vars,vars->C); + } + //printf("%s calc ocas_add_newcuts.A%d poscuts.%d negcuts.%d | numthreads.%d\n",CONTRACTS[c_to_refc(c)],answerind,vars->numposcuts[answerind],vars->numnegcuts[answerind],vars->numthreads); + startmilli = OS_milliseconds(); + //if ( vars->nohwm[answerind] > 13 ) + // numthreads = vars->numthreads;///MAIN_MAXCORES; + memset(ptr->new_a,0,sizeof(ptr->new_a)); + //ocas_add_newcuts(PTRS,numthreads,vars,answerind,numfeatures,weekinds,new_cut,vars->numposcuts[answerind]+vars->numnegcuts[answerind],ptr->W,ptr->new_a); + STocas_add_newcuts(vars,answerind,numfeatures,weekinds,new_cut,vars->numposcuts[answerind]+vars->numnegcuts[answerind],ptr->W,ptr->new_a); + vars->add_time += (OS_milliseconds() - startmilli); +//printf("done %d calc ocas_add_newcuts.A%d poscuts.%d negcuts.%d | good.%d bad.%d\n",c_to_refc(vars->c),answerind,vars->numposcuts[answerind],vars->numnegcuts[answerind],vars->good[answerind],vars->bad[answerind]); + } else inactives[answerind] = 1;//, printf("maxnohwm.%d\n",max_nohwm); + } + startmilli = OS_milliseconds(); + for (answerind=0; answerindnumposcuts[answerind] - vars->numnegcuts[answerind]); + cutlen = (vars->numposcuts[answerind] + vars->numnegcuts[answerind]); + if ( vars->nohwm[answerind] < lwm ) + lwm = vars->nohwm[answerind]; + ocas_update_Lspace(vars,answerind,netcuts,cutlen,numfeatures,vars->C,0.,vars->QPSolverTolRel); + } + vars->qp_solver_time += (OS_milliseconds() - startmilli); + } + if ( pcount != 0 ) + printf("numactive.%d %.0f | ave perf %f%% | ave nohwm %.1f\n",numactive,pcount,psum/pcount,nosum/pcount); + return(numactive); +} + +static inline int init_ocas_vars(int numthreads,int selector,long answerindmask,struct ocas_vars *vars,int c,double C,int numfeatures,int maxlhs,int maxlen,int len,double *answerabsave,int *posA,int *negA) +{ + int answerind,lastanswerind,retval = 0; + lastanswerind = TRADEBOTS_NUMANSWERS; + vars->maxlen = maxlen; + vars->numthreads = numthreads; + vars->selector = selector; + //printf("init_ocas_vars lastanswerind.%d\n",lastanswerind); + for (answerind=0; answerindlen[answerind]); + if ( vars->len[answerind] > 0 )//&& (answerindmask == -1L || ((1L<refc = c_to_refc(c); vars->c = c; vars->C = C; + vars->numfeatures = numfeatures; vars->maxlhs = maxlhs; + if ( vars->CLspaces[answerind] == 0 ) + vars->CLspaces[answerind] = myaligned_alloc(sizeof(*vars->CLspaces[answerind])); + vars->answerabsaves[answerind] = answerabsave[answerind]; + vars->posA[answerind] = posA[answerind]; vars->negA[answerind] = negA[answerind]; + if ( vars->lhs[answerind] == 0 ) + vars->lhs[answerind] = myaligned_alloc(sizeof(*vars->lhs[answerind]) + numfeatures*maxlhs*sizeof(double)); + vars->maxiters[answerind] = QPSOLVER_MINITER; vars->trn_err[answerind] = vars->len[answerind]; vars->Q_P[answerind] = 0.5*vars->sq_norm_W[answerind] + C*vars->len[answerind]; + vars->perc[answerind] = vars->hwmperc[answerind] = vars->dist[answerind] = vars->hwmdist[answerind] = 0.; vars->numIt[answerind] = 0; + //printf("init.A%d %d | %p %p weekinds.%p\n",answerind,vars->len[answerind],vars->CLspaces[answerind],vars->lhs[answerind],vars->weekinds[answerind]); + } + } + //printf("mask.%lx init_ocas_vars selector.%d weekinds[0].%p\n",answerindmask,selector,vars->weekinds[0]); + return(retval); +} + +void ocas_init(struct ocas_vars *vars,int32_t c,int32_t numfeatures,int32_t starti,int32_t endi) +{ + struct ocas_CLbuffers *ptr; struct ocas_lhsbuffers *lhs; + int32_t nonz,weekind,answerind; double answer,y; + if ( numfeatures < 0 ) + return; + vars->maxlhs = MAX_OCAS_LHS; + vars->numfeatures = numfeatures; + vars->maxlen = (endi - starti + 1); + vars->C = 1.; + vars->c = c; + vars->TolRel = 0.01; + vars->TolAbs = 0.0; + vars->QPSolverTolRel = vars->TolRel*0.5; + vars->QPSolverTolAbs = vars->TolAbs*0.5; + vars->MaxTime = OCAS_INFINITY; + vars->QPBound = 0.0; + memset(vars->posA,0,sizeof(vars->posA)); + memset(vars->negA,0,sizeof(vars->negA)); + memset(vars->answeraves,0,sizeof(vars->answeraves)); + memset(vars->answerabsaves,0,sizeof(vars->answerabsaves)); + memset(vars->firstweekinds,0,sizeof(vars->firstweekinds)); + vars->starti = starti; + vars->answers = calloc(TRADEBOTS_NUMANSWERS,sizeof(vars->answers)*vars->maxlen); + vars->features = calloc(vars->maxlen,sizeof(*vars->features)); + for (answerind=0; answerindweekinds[answerind] = calloc(vars->maxlen,sizeof(*vars->weekinds[answerind])); + for (weekind=starti; weekind<=endi; weekind++) + { + if ( (vars->features[weekind - starti]= get_features(numfeatures,c,weekind)) == 0 ) + continue; + for (answerind=0; answerindposA[answerind]+vars->negA[answerind]) >= vars->maxlen ) + continue; + if ( (y= get_yval(&answer,0,weekind,c,answerind)) != 0.f ) + { + vars->answers[(weekind-starti)*TRADEBOTS_NUMANSWERS + answerind] = y; + vars->weekinds[answerind][vars->len[answerind]++] = weekind; + if ( vars->posA[answerind]+vars->negA[answerind] == 0 ) + vars->firstweekinds[answerind] = weekind; + vars->answeraves[answerind] += answer; + if ( answer > 0 ) + { + vars->posA[answerind]++; + vars->answerabsaves[answerind] += answer; + } + else if ( answer < 0 ) + { + vars->negA[answerind]++; + vars->answerabsaves[answerind] -= answer; + } + } + } + } + for (answerind=0; answerindposA[answerind]+vars->negA[answerind])) != 0 ) + { + vars->answerabsaves[answerind] /= nonz; + vars->answeraves[answerind] /= nonz; + printf("A%02d.(%9.6f %d %d) ",answerind,vars->answerabsaves[answerind],vars->posA[answerind],vars->negA[answerind]); + } + init_ocas_vars(1,0,-1,vars,c,vars->C,numfeatures,MAX_OCAS_LHS,vars->maxlen,vars->maxlen,vars->answerabsaves,vars->posA,vars->negA); + for (answerind=0; answerindlen[answerind]); + lhs = vars->lhs[answerind]; + ptr = vars->CLspaces[answerind]; + //printf("%d.A%d call init ocas vars weekinds[0] %p numfeatures.%d (%p %p)\n",c_to_refc(vars->c),answerind,vars->weekinds[0],numfeatures,lhs,ptr); + if ( lhs == 0 || ptr == 0 ) + continue; + vars->numlhs[answerind] = 0;//init_full_A(lhs->full_A,vars->numfeatures,c,answerind,models); + memset(ptr->W,0,sizeof(*ptr->W) * numfeatures); + memset(ptr->oldW,0,sizeof(*ptr->oldW) * numfeatures); + vars->W0[answerind] = vars->oldW0[answerind] = 0; +#ifndef DISABLE_EXISTINGMODEL + double init_model(double *percp,double *W,double *oldW,int c,int answerind,int numfeatures); + vars->W0[answerind] = init_model(&vars->hwmperc[answerind],ptr->W,ptr->oldW,c,answerind,vars->numfeatures); + if ( _dbufave(ptr->W,numfeatures) != 0 ) + validate_ocas_model(vars,answerind,ptr->output_pred,ptr->old_output,vars->weekinds[answerind],vars->len[answerind],ptr->W,vars->W0[answerind],numfeatures,1); +#endif + //printf("%s.A%d call init ocas vars weekinds[0] %p\n",CONTRACTS[c_to_refc(c)],answerind,vars->weekinds[0]); + } + vars->output_time = vars->sort_time = vars->w_time = vars->qp_solver_time = vars->ocas_time = vars->add_time = 0; + vars->startweekind = starti; vars->endweekind = endi; +} + +int32_t ocas_gen(int32_t c,int32_t numfeatures,int32_t starti,int32_t endi) +{ + int32_t i; struct ocas_vars *vars = calloc(1,sizeof(*vars)); + ocas_init(vars,c,numfeatures,starti,endi); + for (i=0; i<10; i++) + ocas_iter(vars,3); + ocas_purge(vars); + return(0); +} +#endif + diff --git a/basilisk/tradebots_liquidity.c b/basilisk/tradebots_liquidity.c new file mode 100755 index 000000000..38097caac --- /dev/null +++ b/basilisk/tradebots_liquidity.c @@ -0,0 +1,1227 @@ +/****************************************************************************** + * Copyright © 2014-2017 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. * + * * + ******************************************************************************/ + +// included from basilisk.c +/* + In order to provide liquidity from central exchanges, we need to issue balancing trades, however to do this properly, we need to know what the desired balance is. If unspecified, then a neutral balance is assumed. + The liquidity_info interface is quite flexible, there is a single function liquidity_active() which returns non-zero if the LP node should respond. The model is that the liquidity_command() is used to configure the liquidity_active()'s response. + In order for dynamic adaptiveness to work, the liquidity_command/liquidity_active needs to interact with the balancing. + A simplistic default trio of functions are provided, but any level of complexity is possible with the liquidity interface. + */ + +#define TRADEBOTS_NUMANSWERS 8 +#define TRADEBOTS_NUMDECAYS 8 +#define TRADEBOTS_RAWFEATURESINCR 7 +#define TRADEBOTS_MAXPAIRS 1024 + +#define _OCAS_PLUS_INF (-log(0.0)) +double OCAS_PLUS_INF,OCAS_NEG_INF; + +double Tradebots_decays[TRADEBOTS_NUMDECAYS] = { 0.5, 0.666, 0.8, 0.9, 0.95, 0.99, 0.995, 0.999 }; +int32_t Tradebots_answergaps[TRADEBOTS_NUMANSWERS] = { 60, 60, 120, 120, 240, 240, 720, 720 }; + +struct tradebot_arbentry +{ + char exchange[16]; + double price,volume,profitmargin; + uint32_t timestamp; +}; + +struct tradebot_arbexchange +{ + char name[16]; + struct tradebot_arbentry trades[2]; +}; + +struct tradebot_arbpair +{ + char base[32],rel[32]; + uint32_t lasttime,lastanswertime; FILE *fp; + int32_t numexchanges,counter,btccounter,usdcounter,cnycounter,refc; + double highbid,lowask,hblavolume,btcbid,btcask,btcvol,usdbid,usdask,usdvol,cnybid,cnyask,cnyvol; + double bidaves[TRADEBOTS_NUMDECAYS],askaves[TRADEBOTS_NUMDECAYS]; + double bidslopes[TRADEBOTS_NUMDECAYS],askslopes[TRADEBOTS_NUMDECAYS]; + struct tradebot_arbexchange exchanges[16]; + uint8_t dirmasks[2],slopedirs[2]; + char *svmpairs[TRADEBOTS_MAXPAIRS][2]; + int32_t RTgood[TRADEBOTS_NUMANSWERS],RTbad[TRADEBOTS_NUMANSWERS],numrawfeatures,numsvmfeatures,numpairs; + float rawfeatures[TRADEBOTS_NUMANSWERS+64],prevrawfeatures[60 * TRADEBOTS_NUMANSWERS+64],*svms; // svms is coeffs vector[TRADEBOTS_NUMANSWERS] + float RTpreds[TRADEBOTS_NUMANSWERS],svmpreds[TRADEBOTS_NUMANSWERS],answers[TRADEBOTS_NUMANSWERS]; +}; +struct tradebot_arbpair Arbpairs[TRADEBOTS_MAXPAIRS],*Pair_NXTBTC,*Pair_BTCUSD,*Pair_BTCCNY; +int32_t Tradebot_numarbpairs; + +struct tradebot_arbpair *tradebots_arbpair_find(char *base,char *rel) +{ + int32_t i; + for (i=0; i0; i--) + memcpy(&pair->prevrawfeatures[i*72],&pair->prevrawfeatures[(i-1)*72],sizeof(pair->rawfeatures)); + memcpy(pair->prevrawfeatures,pair->rawfeatures,sizeof(pair->rawfeatures)); + memset(pair->rawfeatures,0,sizeof(pair->rawfeatures)); + if ( fabs(pair->highbid) < SMALLVAL || fabs(pair->lowask) < SMALLVAL ) + return(-1); + ave = _pairaved(pair->highbid,pair->lowask); + timestamp = (uint32_t)time(NULL); + n = TRADEBOTS_NUMANSWERS; + memcpy(&pair->rawfeatures[TRADEBOTS_NUMANSWERS],×tamp,sizeof(*pair->rawfeatures)), n++; + pair->rawfeatures[n++] = pair->highbid; + pair->rawfeatures[n++] = pair->lowask; + pair->rawfeatures[n++] = pair->hblavolume / ave; + n = TRADEBOTS_RAWFEATURESINCR + TRADEBOTS_NUMANSWERS; + for (i=0; ibidaves[i]) < SMALLVAL || fabs(pair->askaves[i]) < SMALLVAL ) + return(-1); + starti = n; + pair->rawfeatures[n++] = (pair->bidaves[i] / ave) - 1.; + pair->rawfeatures[n++] = (pair->askaves[i] / ave) - 1.; + pair->rawfeatures[n++] = 10000. * (pair->bidslopes[i] / ave); + pair->rawfeatures[n++] = 10000. * (pair->askslopes[i] / ave); + if ( n < starti+TRADEBOTS_RAWFEATURESINCR ) + n = starti+TRADEBOTS_RAWFEATURESINCR; + } + if ( pair->fp != 0 ) + { + if ( fwrite(pair->rawfeatures,1,sizeof(pair->rawfeatures),pair->fp) != sizeof(pair->rawfeatures) ) + printf("fwrite error for %s/%s rawfeatures[%d]\n",pair->base,pair->rel,n); + else fflush(pair->fp); + } + if ( n > sizeof(pair->rawfeatures)/sizeof(*pair->rawfeatures) ) + { + printf("n.%d too many for rawfeatures %ld\n",n,sizeof(pair->rawfeatures)/sizeof(*pair->rawfeatures)); + exit(-1); + } + return(n); +} + +uint32_t tradebots_featureset(double *highbidp,double *lowaskp,double *avep,double *volp,double *bidaves,double *askaves,double *bidslopes,double *askslopes,float *rawfeatures) +{ + uint32_t timestamp; int32_t i,n,starti; + memcpy(×tamp,&rawfeatures[TRADEBOTS_NUMANSWERS],sizeof(timestamp)); + n = TRADEBOTS_NUMANSWERS + 1; + *highbidp = rawfeatures[n++]; + *lowaskp = rawfeatures[n++]; + *avep = _pairaved(*highbidp,*lowaskp); + *volp = rawfeatures[n++]; + //printf("[%9.6f %9.6f] vol %f t.%u\n",*highbidp,*lowaskp,*volp,timestamp); + n = TRADEBOTS_RAWFEATURESINCR + TRADEBOTS_NUMANSWERS; + for (i=0; irefc = Tradebot_numarbpairs++; + strcpy(pair->rel,rel); + strcpy(pair->base,base); + if ( strcmp(base,"NXT") == 0 && strcmp(rel,"BTC") == 0 ) + Pair_NXTBTC = pair, printf("Pair_NXTBTC <- %p\n",pair); + else if ( strcmp(base,"BTC") == 0 && strcmp(rel,"USD") == 0 ) + Pair_BTCUSD = pair; + else if ( strcmp(base,"BTC") == 0 && strcmp(rel,"CNY") == 0 ) + Pair_BTCCNY = pair; + sprintf(fname,"SVM/rawfeatures/%s_%s",base,rel); + pair->fp = OS_appendfile(fname); + if ( (ftell(pair->fp) % sizeof(pair->rawfeatures)) != 0 ) + { + printf("misalinged rawfeatures %ld %ld\n",ftell(pair->fp),(ftell(pair->fp) % sizeof(pair->rawfeatures))); + } + fseek(pair->fp,(ftell(pair->fp) / sizeof(pair->rawfeatures)) * sizeof(pair->rawfeatures) - sizeof(pair->rawfeatures),SEEK_SET); + if ( fread(pair->rawfeatures,1,sizeof(pair->rawfeatures),pair->fp) == sizeof(pair->rawfeatures) ) + { + pair->lasttime = tradebots_featureset(&pair->highbid,&pair->lowask,&ave,&pair->hblavolume,pair->bidaves,pair->askaves,pair->bidslopes,pair->askslopes,pair->rawfeatures); + printf("%s/%s [%.8f %.8f] %u\n",pair->base,pair->rel,pair->highbid,pair->lowask,pair->lasttime); + } + return(pair); + } else return(0); +} + +int32_t tradebots_expandrawfeatures(double *svmfeatures,float *rawfeatures,uint32_t reftimestamp,float *refrawfeatures) +{ + double factor,highbid,lowask,ave,vol,bidaves[TRADEBOTS_NUMDECAYS],askaves[TRADEBOTS_NUMDECAYS],bidslopes[TRADEBOTS_NUMDECAYS],askslopes[TRADEBOTS_NUMDECAYS]; + double refhighbid,reflowask,refave,refvol,refbidaves[TRADEBOTS_NUMDECAYS],refaskaves[TRADEBOTS_NUMDECAYS],refbidslopes[TRADEBOTS_NUMDECAYS],refaskslopes[TRADEBOTS_NUMDECAYS]; + uint32_t timestamp; int32_t i,j,starti,n = 0; + tradebots_featureset(&refhighbid,&reflowask,&refave,&refvol,refbidaves,refaskaves,refbidslopes,refaskslopes,refrawfeatures); + timestamp = tradebots_featureset(&highbid,&lowask,&ave,&vol,bidaves,askaves,bidslopes,askslopes,rawfeatures); + if ( timestamp == 0 || reftimestamp == 0 || timestamp >= reftimestamp+60 ) + { + //printf("tradebots_expandrawfeatures: timestamp.%u vs reftimestamp.%u\n",timestamp,reftimestamp); + return(-1); + } + factor = sqrt(reftimestamp - timestamp); + if ( factor > 60. ) + factor = 60.; + else if ( factor < 1. ) + factor = 1.; + factor = 1. / factor; + if ( refhighbid == 0. || highbid == 0. || lowask == 0. || reflowask == 0. ) + { + //printf("tradebots_expandrawfeatures: (%f %f) ref (%f %f)\n",highbid,lowask,refhighbid,reflowask); + return(-1); + } + svmfeatures[n++] = highbid; + svmfeatures[n++] = (highbid / ave) - 1.; + svmfeatures[n++] = lowask; + svmfeatures[n++] = (lowask / ave) - 1.; + svmfeatures[n++] = (lowask - highbid); + svmfeatures[n++] = (lowask - highbid) / ave; + svmfeatures[n++] = vol; + starti = n; + svmfeatures[n++] = refhighbid; + svmfeatures[n++] = (refhighbid / refave) - 1.; + svmfeatures[n++] = reflowask; + svmfeatures[n++] = (reflowask / refave) - 1.; + svmfeatures[n++] = (reflowask - refhighbid); + svmfeatures[n++] = (reflowask - refhighbid) / refave; + svmfeatures[n++] = refvol; + for (i=0; i SMALLVAL ) + { + for (i=starti; i 0. ) + svmfeatures[i] = cbrt(svmfeatures[i]); + else svmfeatures[i] = -cbrt(-svmfeatures[i]); + } + } + return(n); +} + +int32_t tradebots_calcsvmfeatures(double *svmfeatures,struct tradebot_arbpair *pair,float *rawfeatures,float *prevrawfeatures) +{ + int32_t i,j,n,numpairfeatures,flag; struct tradebot_arbpair *ptr; uint32_t reftimestamp; + memcpy(&reftimestamp,&rawfeatures[TRADEBOTS_NUMANSWERS],sizeof(reftimestamp)); + if ( reftimestamp == 0 ) + { + printf("reftimestamp.%u is illegal\n",reftimestamp); + return(-1); + } + numpairfeatures = n = tradebots_expandrawfeatures(svmfeatures,prevrawfeatures,reftimestamp,rawfeatures); + if ( n <= 0 ) + return(-1); + for (i=0; i<60; i++,n+=numpairfeatures) + tradebots_expandrawfeatures(&svmfeatures[n],&prevrawfeatures[i*72],reftimestamp,rawfeatures); + if ( 0 && pair->numsvmfeatures != (1+pair->numpairs)*n ) + { + for (i=0; inumpairs; i++) // need to do lookups + { + flag = -1; + if ( (ptr= tradebots_arbpair_find(pair->svmpairs[i][0],pair->svmpairs[i][1])) != 0 ) + flag = tradebots_expandrawfeatures(&svmfeatures[n],ptr->rawfeatures,reftimestamp,rawfeatures); + if ( flag < 0 ) + { + for (j=0; jsvms != 0 ) + { + for (i=n=0; inumsvmfeatures; i++) + { + feature = svmfeatures[i]; + for (j=0; jsvms[n++]; + } + } + return(n); +} + +void tradebots_calcanswers(struct tradebot_arbpair *pair) +{ + double highbid,lowask,futurebid,futureask,ave,vol,bidaves[TRADEBOTS_NUMDECAYS],askaves[TRADEBOTS_NUMDECAYS],bidslopes[TRADEBOTS_NUMDECAYS],askslopes[TRADEBOTS_NUMDECAYS]; + float rawfeatures[sizeof(pair->rawfeatures)/sizeof(*pair->rawfeatures)],futuremin,futuremax,minval,maxval,*hblas = 0; + uint32_t timestamp,firsttime = 0; long fpos,savepos; int32_t flag,i,iter,j,ind,maxi; + OCAS_PLUS_INF = _OCAS_PLUS_INF; OCAS_NEG_INF = -_OCAS_PLUS_INF; + if ( pair->fp != 0 ) + { + for (iter=0; iter<2; iter++) + { + rewind(pair->fp); + fpos = 0; + while ( fread(rawfeatures,1,sizeof(pair->rawfeatures),pair->fp) == sizeof(pair->rawfeatures) ) + { + savepos = ftell(pair->fp); + timestamp = tradebots_featureset(&highbid,&lowask,&ave,&vol,bidaves,askaves,bidslopes,askslopes,rawfeatures); + //printf("timestamp.%u firsttime.%u\n",timestamp,firsttime); + if ( timestamp == 0 ) + continue; + if ( firsttime == 0 ) + { + firsttime = timestamp; + maxi = (int32_t)((time(NULL) - firsttime) / 60 + 1); + hblas = calloc(maxi,sizeof(*hblas)*2); + printf("HBLAS[%d] allocated\n",maxi); + } + if ( (i= (timestamp - firsttime)/60) >= 0 && i < maxi ) + { + if ( iter == 0 ) + { + if ( hblas[i << 1] == 0 ) + { + hblas[i << 1] = highbid; + hblas[(i << 1) + 1] = lowask; + } + else + { + _xblend(&hblas[i << 1],highbid,0.5); + _xblend(&hblas[(i << 1) + 1],lowask,0.5); + } + } + else + { + highbid = hblas[i << 1]; + lowask = hblas[(i << 1) + 1]; + if ( fabs(highbid) > SMALLVAL && fabs(lowask) > SMALLVAL ) + { + memset(pair->answers,0,sizeof(pair->answers)); + flag = 0; + for (j=0; janswers[j] = _pairaved(futuremax,futuremin) - _pairaved(minval,maxval); + else + { + futurebid = hblas[ind << 1]; + futureask = hblas[(ind << 1) + 1]; + minval = MIN(highbid,lowask); + maxval = MAX(highbid,lowask); + futuremin = MIN(futurebid,futureask); + futuremax = MAX(futurebid,futureask); + if ( futuremin > maxval ) + { + if ( futuremax < minval ) + printf("%s/%s A%d: highly volatile minmax.(%f %f) -> (%f %f) %d of %d\n",pair->base,pair->rel,j,minval,maxval,futuremin,futuremax,i,maxi); + else + { + pair->answers[j] = (futuremin - maxval); + flag++; + } + } + else if ( futuremax < minval ) + pair->answers[j] = (futuremax - minval), flag++; + //printf("i.%d j.%d gap.%d ind.%d answer %9.6f (%f %f) -> (%f %f)\n",i,j,Tradebots_answergaps[j],ind,pair->answers[j],minval,maxval,futuremin,futuremax); + } + } + } + if ( flag != 0 ) + { + fseek(pair->fp,fpos,SEEK_SET); + if ( fwrite(pair->answers,1,sizeof(pair->answers),pair->fp) != sizeof(pair->answers) ) + printf("error writing answers for %s/%s t%u i.%d of %d\n",pair->base,pair->rel,timestamp,i,maxi); + else if ( 0 ) + { + for (j=0; janswers[j]); + printf("%s/%s answers %d of %d\n",pair->base,pair->rel,i,maxi); + } + fseek(pair->fp,savepos,SEEK_SET); + } + } + } + } + fpos = ftell(pair->fp); + } + if ( iter == 0 ) + { + if ( hblas == 0 ) + break; + highbid = hblas[0]; + lowask = hblas[1]; + for (i=1; i SMALLVAL && fabs(hblas[(i << 1) + 1]) > SMALLVAL ) + { + highbid = hblas[i << 1]; + lowask = hblas[(i << 1) + 1]; + } + else + { + hblas[i << 1] = highbid; + hblas[(i << 1) + 1] = lowask; + } + //printf("%9.6f ",_pairaved(highbid,lowask)); + } + //printf("maxi.%d\n",maxi); + } + } + if ( hblas != 0 ) + free(hblas); + } + if ( pair->fp != 0 && (ftell(pair->fp) % sizeof(pair->rawfeatures)) != 0 ) + printf("ERROR: %s/%s not on feature boundary\n",pair->base,pair->rel); +} + +double get_yval(double *answerp,int32_t selector,int32_t ind,int32_t refc,int32_t answerind) +{ + float answer; struct tradebot_arbpair *pair; long savepos; + pair = &Arbpairs[refc]; + if ( pair->fp != 0 ) + { + savepos = ftell(pair->fp); + fseek(pair->fp,ind*sizeof(pair->rawfeatures)+answerind*sizeof(*pair->rawfeatures),SEEK_SET); + if ( fread(&answer,1,sizeof(answer),pair->fp) != sizeof(answer) ) + answer = 0; + fseek(pair->fp,savepos,SEEK_SET); + if ( isnan(answer) != 0 ) + return(0); + answer /= 10.; + /*if ( answer > .01 ) + answer = .01; + else if ( answer < -.01 ) + answer = -.01; + if ( answerp != 0 ) + *answerp = answer; + */ + if ( answer > 0. ) + answer = sqrt(answer); + else answer = -sqrt(-answer); + *answerp = answer; + /*if ( answer > 0. ) + return(1.); + else if ( answer < 0. ) + return(-1.);*/ + return(answer); + } + return(0.); +} + +float *get_features(int32_t numfeatures,int32_t refc,int32_t ind) +{ + struct tradebot_arbpair *pair; long savepos; int32_t i,n; double svmfeatures[32768]; + float rawfeatures[sizeof(pair->rawfeatures)],prevrawfeatures[60 * sizeof(pair->rawfeatures)],*svmf=0; + pair = &Arbpairs[refc]; + pair->numsvmfeatures = numfeatures; + if ( pair->fp != 0 && ind > 61 ) + { + savepos = ftell(pair->fp); + fseek(pair->fp,(ind-60)*sizeof(pair->rawfeatures),SEEK_SET); + if ( fread(prevrawfeatures,60,sizeof(pair->rawfeatures),pair->fp) == sizeof(pair->rawfeatures) && fread(&rawfeatures,1,sizeof(pair->rawfeatures),pair->fp) == sizeof(pair->rawfeatures) ) + { + n = tradebots_calcsvmfeatures(svmfeatures,pair,rawfeatures,prevrawfeatures); + //int32_t nonz; for (i=nonz=0; i %d\n",ind,n); + if ( n != pair->numsvmfeatures ) + { + //printf("unexpected numsvmfeatures refc.%d ind.%d %d vs %d\n",refc,ind,n,pair->numsvmfeatures); + return(0); + } + svmf = calloc(n,sizeof(*svmf)); + for (i=0; ifp,savepos,SEEK_SET); + } + return(svmf); +} + +/*double set_ocas_model(int refc,int answerind,double *W,double W0,int numfeatures,int firstweekind,int len,int bad,double dist,double predabs,int posA,int negA,double answerabs,double aveanswer) +{ + int32_t i,nonz=0; + for (i=0; i 0 ) + { + bestmodel = W; + if ( bestmodel != 0 ) + { + for (j=0; j<=numfeatures; j++) + { + if ( bestmodel[j] != 0 ) + nonz++; + oldW[j] = W[j]; + } + if ( nonz != 0 ) + return(bestmodel[numfeatures]); + } + } + return(0.); +} + +double set_ocas_model(int refc,int answerind,double *W,double W0,int numfeatures,int firstweekind,int len,int bad,double dist,double predabs,int posA,int negA,double answerabs,double aveanswer) +{ + double perc = (100. * (double)(len - bad)) / len; +#ifndef DISABLE_EXISTINGMODEL + int32_t _posA,_negA; double *tmpW,fileperc; + tmpW = calloc(numfeatures+2,sizeof(*tmpW)); + if ( (fileperc= load_model(&_posA,&_negA,tmpW,refc,answerind,numfeatures)) > perc ) + { + if ( (_posA+_negA) != 0 && _posA >= posA && _negA >= negA ) + { + memcpy(W,tmpW,sizeof(*W)*numfeatures); + printf("%s/%s.A%02d numfeatures.%d posA.%d negA.%d saved model %f is better than %f +A%d -A%d\n",Arbpairs[refc].base,Arbpairs[refc].rel,answerind,numfeatures,_posA,_negA,fileperc,perc,posA,negA); + W0 = tmpW[numfeatures]; + free(tmpW); + return(tmpW[numfeatures]); + } + } + free(tmpW); +#endif + save_model(refc,answerind,W,numfeatures,W0,perc,posA,negA); + return(W0); +} + +#ifndef _WIN +#include "tradebots_SVM.h" +#endif + +static char *assetids[][2] = +{ + { "12071612744977229797", "UNITY" }, + { "15344649963748848799", "DEX" }, + { "6883271355794806507", "PANGEA" }, + { "17911762572811467637", "JUMBLR" }, + { "17083334802666450484", "BET" }, + { "13476425053110940554", "CRYPTO" }, + { "6932037131189568014", "HODL" }, + { "3006420581923704757", "SHARK" }, + { "17571711292785902558", "BOTS" }, + { "10524562908394749924", "MGW" }, +}; + +uint64_t NXT_assetidfind(char *base) +{ + int32_t i; + for (i=0; iexchange[0] == 0 ) + strcpy(arb->exchange,exchange); + if ( strcmp(arb->exchange,exchange) == 0 ) + { + arb->price = price; + arb->volume = volume; + arb->timestamp = timestamp; + arb->profitmargin = profitmargin; + } else printf("mismatched arbexchange? (%s vs %s)\n",arb->exchange,exchange); +} + +struct tradebot_arbexchange *tradebots_arbexchange_find(struct tradebot_arbpair *pair,char *exchange) +{ + int32_t i; + if ( pair->numexchanges > sizeof(pair->exchanges)/sizeof(*pair->exchanges) ) + { + printf("data corruption pair.%p %s %s/%s numexchanges.%d\n",pair,exchange,pair->base,pair->rel,pair->numexchanges); + return(0); + } + for (i=0; inumexchanges; i++) + if ( strcmp(pair->exchanges[i].name,exchange) == 0 ) + return(&pair->exchanges[i]); + return(0); +} + +struct tradebot_arbexchange *tradebots_arbexchange_create(struct tradebot_arbpair *pair,char *exchange) +{ + if ( pair->numexchanges < sizeof(pair->exchanges)/sizeof(*pair->exchanges) ) + { + strcpy(pair->exchanges[pair->numexchanges].name,exchange); + return(&pair->exchanges[pair->numexchanges++]); + } else return(0); +} + +void tradebot_arbcandidate(struct supernet_info *myinfo,char *exchange,int32_t tradedir,char *base,char *rel,double price,double volume,uint32_t timestamp,double profitmargin) +{ + int32_t i,offset,flag; double highbid,lowask,lastbid,lastask,arbval; uint32_t now; + struct tradebot_arbentry *bid,*ask; struct tradebot_arbexchange *arbex; struct tradebot_arbpair *pair = 0; + if ( strcmp(rel,"BTC") != 0 && strcmp(rel,"NXT") != 0 && strcmp(rel,"USD") != 0 && strcmp(rel,"CNY") != 0 ) + { + printf("reject non-BTC arbcandidate (%s/%s)\n",base,rel); + return; + } + offset = (tradedir > 0) ? 0 : 1; + if ( (pair= tradebots_arbpair_find(base,rel)) == 0 ) + pair = tradebots_arbpair_create(base,rel); + if ( pair == 0 ) + { + printf("cant get pair for %s %s/%s\n",exchange,base,rel); + return; + } + if ( (arbex= tradebots_arbexchange_find(pair,exchange)) == 0 ) + arbex = tradebots_arbexchange_create(pair,exchange); + if ( arbex != 0 ) + { + //printf("cand.%d %16s %s %12.6f (%5s/%-5s) at %12.8f profit %.03f\n",pair->numexchanges,exchange,tradedir<0?"ask":"bid",volume,base,rel,price,profitmargin); + tradebot_arbentry(&arbex->trades[offset],exchange,price,volume,timestamp,profitmargin); + bid = ask = 0; + pair->highbid = pair->lowask = highbid = lowask = 0.; + now = (uint32_t)time(NULL); + //if ( pair->numexchanges >= 2 ) + { + for (i=0; inumexchanges; i++) + { + arbex = &pair->exchanges[i]; + if ( arbex->trades[0].price != 0. && (highbid == 0. || arbex->trades[0].price >= highbid) ) + { + bid = &arbex->trades[0]; + if ( now > bid->timestamp+30 ) + bid->price = 0.; + else highbid = bid->price; + } + if ( arbex->trades[1].price != 0. && (lowask == 0. || arbex->trades[1].price <= lowask) ) + { + ask = &arbex->trades[1]; + if ( now > ask->timestamp+30 ) + ask->price = 0.; + else lowask = ask->price; + } + //printf("%p %s %s %f %f -> %p %p %f %f (%f %f)\n",pair,pair->base,arbex->name,arbex->trades[0].price,arbex->trades[1].price,bid,ask,highbid,lowask,pair->highbid,pair->lowask); + } + flag = 0; + if ( Pair_NXTBTC != 0 && pair->btccounter != Pair_NXTBTC->counter ) + flag |= 1; + if ( Pair_BTCUSD != 0 && pair->usdcounter != Pair_BTCUSD->counter ) + flag |= 2; + if ( Pair_BTCCNY != 0 && pair->cnycounter != Pair_BTCCNY->counter ) + flag |= 4; + //printf("%s %s/%s flag.%d (%d %d) %p %p\n",exchange,base,rel,flag,pair->btccounter,Pair_NXTBTC!=0?Pair_NXTBTC->counter:-1,bid,ask); + if ( bid != 0 && ask != 0 && bid->price != 0. && ask->price != 0 && (now - bid->timestamp) < 30 && (now - ask->timestamp) < 30 && (fabs(bid->price - pair->highbid) > SMALLVAL || fabs(ask->price - pair->lowask) > SMALLVAL || (strcmp(pair->rel,"NXT") == 0 && flag != 0)) ) + { + pair->counter++; + pair->hblavolume = volume = MIN(bid->volume,ask->volume); + arbval = lastbid = lastask = 0.; + memset(pair->dirmasks,0,sizeof(pair->dirmasks)); + memset(pair->slopedirs,0,sizeof(pair->slopedirs)); + if ( strcmp(pair->rel,"NXT") == 0 ) + { + if ( Pair_NXTBTC != 0 && Pair_NXTBTC->highbid != 0. && Pair_NXTBTC->lowask != 0. ) + { + pair->btccounter = Pair_NXTBTC->counter; + pair->btcbid = highbid * Pair_NXTBTC->highbid; + pair->btcask = lowask * Pair_NXTBTC->lowask; + pair->btcvol = volume * _pairaved(pair->btcbid,pair->btcask); + } + } + else if ( strcmp(pair->rel,"BTC") == 0 ) + { + pair->btcbid = highbid; + pair->btcask = lowask; + pair->btcvol = volume; + } + if ( strcmp(pair->rel,"USD") == 0 ) + { + pair->usdbid = highbid; + pair->usdask = lowask; + pair->usdvol = volume; + } + if ( strcmp(pair->rel,"CNY") == 0 ) + { + pair->cnybid = highbid; + pair->cnyask = lowask; + pair->cnyvol = volume; + } + if ( pair->btcbid != 0. && pair->btcask != 0. ) + { + if ( strcmp(pair->rel,"USD") != 0 && Pair_BTCUSD != 0 && Pair_BTCUSD->highbid != 0. && Pair_BTCUSD->lowask != 0. ) + { + pair->usdcounter = Pair_BTCUSD->counter; + pair->usdbid = pair->btcbid * Pair_BTCUSD->highbid; + pair->usdask = pair->btcask * Pair_BTCUSD->lowask; + pair->usdvol = pair->btcvol * _pairaved(pair->usdbid,pair->usdask); + } + if ( strcmp(pair->rel,"CNY") != 0 && Pair_BTCCNY != 0 && Pair_BTCCNY->highbid != 0. && Pair_BTCCNY->lowask != 0. ) + { + pair->cnycounter = Pair_BTCCNY->counter; + pair->cnybid = pair->btcbid * Pair_BTCCNY->highbid; + pair->cnyask = pair->btcask * Pair_BTCCNY->lowask; + pair->cnyvol = pair->btcvol * _pairaved(pair->cnybid,pair->cnyask); + } + } + for (i=0; ibidslopes[i]= dxblend(&pair->bidaves[i],highbid,Tradebots_decays[i])) > 0. ) + pair->slopedirs[0] |= (1 << i); + if ( (pair->askslopes[i]= dxblend(&pair->askaves[i],lowask,Tradebots_decays[i])) > 0. ) + pair->slopedirs[1] |= (1 << i); + lastbid = pair->bidaves[i]; + lastask = pair->askaves[i]; + //printf("(%.8f %.8f) ",lastbid,lastask); + } + for (i=0; i lastbid ) + pair->dirmasks[0] |= (1 << i); + if ( lowask > lastask ) + pair->dirmasks[1] |= (1 << i); + } + else + { + if ( pair->bidaves[i-1] > lastbid ) + pair->dirmasks[0] |= (1 << i); + if ( pair->askaves[i-1] > lastask ) + pair->dirmasks[1] |= (1 << i); + } + } + //printf("%12.6f %7s/%-3s %8s %14.8f %8s %14.8f spread %6.2f%% %02x:%02x %02x:%02x %d\n",volume,base,rel,bid->exchange,highbid,ask->exchange,lowask,100.*(lowask-highbid)/_pairaved(highbid,lowask),pair->dirmasks[0],pair->slopedirs[0],pair->dirmasks[1],pair->slopedirs[1],pair->counter); + //printf("BTC.(%.8f %.8f) %.8f %.8f USD.(%.4f %.4f) CNY.(%.3f %.3f)\n",pair->btcbid,pair->btcask,Pair_BTCUSD!=0?Pair_BTCUSD->highbid:0,Pair_BTCUSD!=0?Pair_BTCUSD->lowask:0,pair->usdbid,pair->usdask,pair->cnybid,pair->cnyask); + } + if ( highbid != 0 ) + pair->highbid = highbid; + if ( lowask != 0 ) + pair->lowask = lowask; + //printf(">>>>>>> %s (%s/%s) BTC %.8f %.8f v%f counter.%d btc.%d (%d)\n",exchange,pair->base,pair->rel,pair->btcbid,pair->btcask,pair->btcvol,pair->counter,pair->btccounter,Pair_NXTBTC!=0?Pair_NXTBTC->counter:-1); + if ( bid != 0 && ask != 0 && highbid != 0. && lowask != 0. && highbid > lowask && strcmp(bid->exchange,ask->exchange) != 0 && strcmp(rel,"BTC") == 0 ) + { + volume = MIN(bid->volume,ask->volume); + if ( volume*_pairaved(highbid,lowask) > 0.1 ) + volume = 0.1 / _pairaved(highbid,lowask); + if ( highbid * (1. - bid->profitmargin) > lowask * (1. + ask->profitmargin) ) + { + arbval = highbid * (1. - bid->profitmargin) - lowask * (1. + ask->profitmargin); + printf(">>>>>>>> FOUND ARB %s/%s highbid.%s %.8f lowask.%s %.8f volume %f (%.8f %.8f) %.4f%%\n",pair->base,pair->rel,bid->exchange,bid->price,ask->exchange,ask->price,volume,highbid,lowask,100.*(highbid-lowask)/_pairaved(highbid,lowask)); + InstantDEX_buy(myinfo,0,0,0,ask->exchange,pair->base,"BTC",ask->price,volume,1); + InstantDEX_sell(myinfo,0,0,0,bid->exchange,pair->base,"BTC",bid->price,volume,1); + printf("finished trades %s/%s volume %f\n",pair->base,pair->rel,volume); + } + } + if ( pair->counter > TRADEBOTS_NUMDECAYS ) + { + if ( pair->lasttime != time(NULL) ) + { + if ( (pair->numrawfeatures= tradebots_calcrawfeatures(pair)) > 0 ) + { + if ( pair->numsvmfeatures != 0 ) + { + if ( myinfo->svmfeatures == 0 ) + myinfo->svmfeatures = calloc(sizeof(*myinfo->svmfeatures),pair->numsvmfeatures); + if ( tradebots_calcsvmfeatures(myinfo->svmfeatures,pair,pair->rawfeatures,pair->prevrawfeatures) > 0 ) + tradebots_calcpreds(pair->RTpreds,pair,myinfo->svmfeatures); + } + } + pair->lasttime = (uint32_t)time(NULL); + } + if ( 0 && time(NULL) > pair->lastanswertime+3600 ) + { + tradebots_calcanswers(pair); + pair->lastanswertime = (uint32_t)time(NULL); + } + } + } + } +} + +cJSON *linfo_json(struct liquidity_info *li) +{ + cJSON *item = cJSON_CreateObject(); + jaddstr(item,"base",li->base); + jaddstr(item,"rel",li->rel); + if ( li->exchange[0] != 0 ) + jaddstr(item,"exchange",li->exchange); + if ( li->assetid != 0 ) + jadd64bits(item,"assetid",li->assetid); + if ( li->profit != 0. ) + jaddnum(item,"profitmargin",li->profit); + if ( li->refprice != 0. ) + jaddnum(item,"refprice",li->refprice); + if ( li->bid != 0. ) + jaddnum(item,"bid",li->bid); + if ( li->ask != 0. ) + jaddnum(item,"ask",li->ask); + if ( li->minvol != 0. ) + jaddnum(item,"minvol",li->minvol); + if ( li->maxvol != 0. ) + jaddnum(item,"maxvol",li->maxvol); + if ( li->totalvol != 0. ) + jaddnum(item,"totalvol",li->totalvol); + return(item); +} + +void _default_liquidity_command(struct supernet_info *myinfo,char *base,bits256 hash,cJSON *vals) +{ + struct liquidity_info li,refli; int32_t i; char *exchange,*relstr,numstr[32]; + if ( (exchange= jstr(vals,"exchange")) == 0 ) + exchange = "DEX"; + else if ( strcmp(exchange,"*") == 0 ) + exchange = ""; + else if ( exchanges777_find(exchange) == 0 ) + { + printf("cant find exchange.(%s)\n",exchange); + return; + } + if ( (relstr= jstr(vals,"rel")) == 0 ) + relstr = "BTC"; + if ( base == 0 || base[0] == 0 ) + base = jstr(vals,"base"); + if ( base == 0 || base[0] == 0 ) + return; + memset(&li,0,sizeof(li)); + safecopy(li.base,base,sizeof(li.base)); + safecopy(li.rel,relstr,sizeof(li.rel)); + strncpy(li.exchange,exchange,sizeof(li.exchange)); + li.profit = jdouble(vals,"profit"); + li.refprice = jdouble(vals,"refprice"); + li.bid = jdouble(vals,"bid"); + li.ask = jdouble(vals,"ask"); + if ( (li.minvol= jdouble(vals,"minvol")) <= 0. ) + li.minvol = (strcmp("BTC",base) == 0) ? 0.0001 : 0.01; + if ( (li.maxvol= jdouble(vals,"maxvol")) < li.minvol ) + li.maxvol = li.minvol; + if ( (li.totalvol= jdouble(vals,"total")) < li.maxvol ) + li.totalvol = li.maxvol; + if ( strcmp("NXT",li.rel) == 0 ) + li.assetid = NXT_assetidfind(base); + else if ( strcmp("UNITY",base) == 0 ) + li.assetid = NXT_assetidfind(base); + if ( strcmp(li.base,"BTC") == 0 && strcmp("USD",li.rel) != 0 && strcmp("CNY",li.rel) != 0 ) + { + printf("unsupported base BTC (%s/%s)\n",li.base,li.rel); + return; + } + if ( strcmp(li.base,"BTC") != 0 && strcmp("BTC",li.rel) != 0 && + strcmp(li.base,"NXT") != 0 && strcmp("NXT",li.rel) != 0 && + strcmp(li.base,"USD") != 0 && strcmp("USD",li.rel) != 0 && + strcmp(li.base,"CNY") != 0 && strcmp("CNY",li.rel) != 0 && + strcmp(li.exchange,"DEX") != 0 ) // filter out most invalids + { + printf("unsupported base/rel %s/%s\n",li.base,li.rel); + return; + } + for (i=0; ilinfos)/sizeof(*myinfo->linfos); i++) + { + refli = myinfo->linfos[i]; + if ( strcmp(li.rel,refli.base) == 0 && strcmp(li.base,refli.rel) == 0 ) + { + /*li = refli; + strcpy(li.base,refli.base); + strcpy(li.rel,refli.rel); + if ( fabs(li.refprice) > SMALLVAL ) + li.refprice = (1. / li.refprice); + else li.refprice = 0.; + li.dir = -li.dir; + myinfo->linfos[i] = li;*/ + printf("cant Set rev linfo[%d] (%s/%s) %.6f %.8f already have (%s/%s)\n",i,li.rel,li.base,li.profit,li.refprice,refli.base,refli.rel); + return; + } + else if ( refli.base[0] == 0 || (strcmp(li.base,refli.base) == 0 && strcmp(li.rel,refli.rel) == 0 && strcmp(li.exchange,refli.exchange) == 0) ) + { + if ( refli.base[0] == 0 && li.exchange[0] != 0 && strcmp(li.exchange,"DEX") != 0 ) + { + if ( strcmp("NXT",li.rel) == 0 && li.assetid != 0 ) + { + sprintf(numstr,"%llu",(long long)li.assetid); + printf("monitor %s %s\n",li.rel,numstr); + tradebot_monitor(myinfo,0,0,0,li.exchange,numstr,li.rel,0.); + } else tradebot_monitor(myinfo,0,0,0,li.exchange,li.base,li.rel,0.); + } + myinfo->linfos[i] = li; + printf("Set linfo[%d] %s (%s/%s) profitmargin %.6f bid %.6f ask %.8f maxvol %.f ref %.8f\n",i,li.exchange,li.base,li.rel,li.profit,li.bid,li.ask,li.maxvol,li.refprice); + return; + } + } + printf("ERROR: too many linfos %d\n",i); +} + +int32_t _default_volume_ok(struct supernet_info *myinfo,struct liquidity_info *li,int32_t dir,double volume) +{ + if ( (li->minvol == 0 || volume >= li->minvol) && (li->maxvol == 0 || volume <= li->maxvol) ) + return(0); + else return(-1); +} + +double _default_liquidity_active(struct supernet_info *myinfo,double *refpricep,char *exchange,char *base,char *rel,double volume) +{ + int32_t i,dir; struct liquidity_info refli; + *refpricep = 0.; + //printf("%s %s/%s\n",exchange,base,rel); + for (i=0; ilinfos)/sizeof(*myinfo->linfos); i++) + { + refli = myinfo->linfos[i]; + if ( refli.base[0] == 0 ) + continue; + if ( strcmp(base,refli.base) == 0 && strcmp(rel,refli.rel) == 0 ) + dir = 1; + else if ( strcmp(rel,refli.base) == 0 && strcmp(base,refli.rel) == 0 ) + dir = -1; + else dir = 0; + if ( exchange[0] != 0 && refli.exchange[0] != 0 && strcmp(exchange,refli.exchange) != 0 ) + { + //printf("continue %s %s/%s [%d] dir.%d refli.dir %d vs %s %s/%s\n",exchange,base,rel,i,dir,refli.dir,refli.exchange,refli.base,refli.rel); + continue; + } + //printf(">>>>>>>> %s %s/%s [%d] dir.%d refli.dir %d vs %s/%s\n",exchange,base,rel,i,dir,refli.dir,refli.base,refli.rel); + if ( _default_volume_ok(myinfo,&refli,dir,volume) == 0 ) + { + if ( refli.profit != 0. ) + *refpricep = refli.refprice; + else if ( dir > 0 ) + *refpricep = refli.bid; + else if ( dir < 0 ) + *refpricep = refli.ask; + return(refli.profit); + } + break; + } + return(0.); +} + +struct liquidity_info *_default_lifind(struct supernet_info *myinfo,int32_t *dirp,char *base,char *rel) +{ + struct liquidity_info *li; int32_t i; + *dirp = 0; + for (i=0; ilinfos)/sizeof(*myinfo->linfos); i++) + { + li = &myinfo->linfos[i]; + if ( strcmp(li->base,base) == 0 && strcmp(li->rel,rel) == 0 ) + { + *dirp = 1; + return(li); + } + else if ( strcmp(li->base,rel) == 0 && strcmp(li->rel,base) == 0 ) + { + *dirp = -1; + return(li); + } + } + return(0); +} + +void _default_swap_balancingtrade(struct supernet_info *myinfo,struct basilisk_swap *swap,int32_t iambob) +{ + // update balance, compare to target balance, issue balancing trade via central exchanges, if needed + struct liquidity_info *li; double vol,price,volume,srcamount,destamount,profitmargin,dir=0.,dotrade=1.; char base[64],rel[64]; int32_t idir; + srcamount = swap->I.req.srcamount; + destamount = swap->I.req.destamount; + profitmargin = (double)swap->I.req.profitmargin / 1000000.; + if ( srcamount <= SMALLVAL || destamount <= SMALLVAL ) + { + printf("illegal amount for balancing %f %f\n",srcamount,destamount); + return; + } + if ( (li= _default_lifind(myinfo,&idir,swap->I.req.src,swap->I.req.dest)) != 0 ) + { + if ( idir < 0 ) + vol = 1. / ((double)destamount / SATOSHIDEN); + else vol = ((double)srcamount / SATOSHIDEN); + li->totalvol -= vol; + if ( li->totalvol <= 0. || (li->minvol != 0. && li->totalvol < li->minvol) ) + li->minvol = li->maxvol = li->totalvol = 0.; + printf("li.(%s/%s) totalvol %f after -= %f minmax.(%f %f)\n",li->base,li->rel,li->totalvol,vol,li->minvol,li->maxvol); + } + strcpy(rel,"BTC"); + if ( strcmp(swap->I.req.src,"BTC") == 0 ) + { + strcpy(base,swap->I.req.dest); + price = (srcamount / destamount); + volume = destamount / SATOSHIDEN; + dir = -1.; + } + else if ( strcmp(swap->I.req.dest,"BTC") == 0 ) + { + strcpy(base,swap->I.req.src); + price = (destamount / srcamount); + volume = srcamount / SATOSHIDEN; + dir = 1.; + } + else + { + printf("only BTC trades can be balanced, not (%s/%s)\n",swap->I.req.src,swap->I.req.dest); + return; + } + if ( iambob != 0 ) + { + if ( myinfo->IAMLP != 0 ) + { + printf("BOB: price %f * vol %f -> %s newprice %f margin %.2f%%\n",price,volume,dir < 0. ? "buy" : "sell",price + dir * price * profitmargin,100*profitmargin); + if ( dir < 0. ) + InstantDEX_buy(myinfo,0,0,0,"poloniex",base,rel,price,volume,dotrade); + else InstantDEX_sell(myinfo,0,0,0,"poloniex",base,rel,price,volume,dotrade); + } + } + else + { + if ( myinfo->IAMLP != 0 ) + { + printf("ALICE: price %f * vol %f -> %s newprice %f margin %.2f%%\n",price,volume,dir > 0. ? "buy" : "sell",price - dir * price * profitmargin,100*profitmargin); + if ( dir > 0. ) + InstantDEX_buy(myinfo,0,0,0,"poloniex",base,rel,price,volume,dotrade); + else InstantDEX_sell(myinfo,0,0,0,"poloniex",base,rel,price,volume,dotrade); + } + } +} + +void tradebot_swap_balancingtrade(struct supernet_info *myinfo,struct basilisk_swap *swap,int32_t iambob) +{ + if ( swap->balancingtrade == 0 ) + _default_swap_balancingtrade(myinfo,swap,iambob); + else (*swap->balancingtrade)(myinfo,swap,iambob); +} + +void tradebot_liquidity_command(struct supernet_info *myinfo,char *base,bits256 hash,cJSON *vals) +{ + // processed in LIFO manner which allows to override existing command + if ( myinfo->liquidity_command == 0 ) + _default_liquidity_command(myinfo,base,hash,vals); + else (*myinfo->liquidity_command)(myinfo,base,hash,vals); +} + +double tradebot_liquidity_active(struct supernet_info *myinfo,double *refpricep,char *exchange,char *base,char *rel,double destvolume) +{ + if ( myinfo->liquidity_active == 0 ) + return(_default_liquidity_active(myinfo,refpricep,exchange,base,rel,destvolume)); + else return((*myinfo->liquidity_active)(myinfo,refpricep,exchange,base,rel,destvolume)); +} + +// struct exchange_quote { uint64_t satoshis,orderid,offerNXT,exchangebits; double price,volume; uint32_t timestamp,val; }; + +void tradebots_processprices(struct supernet_info *myinfo,struct exchange_info *exchange,char *base,char *rel,struct exchange_quote *bidasks,int32_t numbids,int32_t numasks) +{ + double price,profitmargin,volume; struct tradebot_arbpair *pair; + if ( strcmp(rel,"NXT") == 0 && strcmp(base,"BTC") != 0 && (base= NXT_assetnamefind(base)) == 0 ) + { + //printf("reject %s %s/%s\n",exchange,base,rel); + return; + } + else if ( strcmp(base,"NXT") == 0 && strcmp(rel,"BTC") != 0 && (rel= NXT_assetnamefind(rel)) == 0 ) + { + //printf("reject %s %s/%s\n",exchange,base,rel); + return; + } + //printf("%s %s/%s bids.%d asks.%d\n",exchange->name,base,rel,numbids,numasks); + if ( numbids > 0 && (volume= bidasks[0].volume) > 0. && (profitmargin= + tradebot_liquidity_active(myinfo,&price,exchange->name,base,rel,volume)) > 0. ) + { + if ( price == 0. ) + price = bidasks[0].price; + tradebot_arbcandidate(myinfo,exchange->name,1,base,rel,price,volume,(uint32_t)time(NULL),profitmargin); + } + if ( numasks > 0 && (volume= bidasks[1].volume) > 0. && (profitmargin= + tradebot_liquidity_active(myinfo,&price,exchange->name,rel,base,volume)) > 0. ) + { + if ( price == 0. ) + price = bidasks[1].price; + tradebot_arbcandidate(myinfo,exchange->name,-1,base,rel,price,volume,(uint32_t)time(NULL),profitmargin); + } + if ( (pair= tradebots_arbpair_find(base,rel)) == 0 ) + pair = tradebots_arbpair_create(base,rel); + if ( pair != 0 ) + { + if ( strcmp(rel,"NXT") == 0 ) + { + if ( pair->btcbid != 0. && pair->btcask != 0. ) + { + tradebot_arbcandidate(myinfo,"arb",1,base,"BTC",pair->btcbid,pair->btcvol,(uint32_t)time(NULL),profitmargin); + tradebot_arbcandidate(myinfo,"arb",-1,base,"BTC",pair->btcask,pair->btcvol,(uint32_t)time(NULL),profitmargin); + } + } + if ( strcmp(rel,"USD") != 0 && pair->usdbid != 0. && pair->usdask != 0. ) + { + tradebot_arbcandidate(myinfo,"arb",1,base,"USD",pair->usdbid,pair->usdvol,(uint32_t)time(NULL),profitmargin); + tradebot_arbcandidate(myinfo,"arb",-1,base,"USD",pair->usdask,pair->usdvol,(uint32_t)time(NULL),profitmargin); + } + if ( strcmp(rel,"CNY") != 0 && pair->cnybid != 0. && pair->cnyask != 0. ) + { + tradebot_arbcandidate(myinfo,"arb",1,base,"CNY",pair->cnybid,pair->cnyvol,(uint32_t)time(NULL),profitmargin); + tradebot_arbcandidate(myinfo,"arb",-1,base,"CNY",pair->cnyask,pair->cnyvol,(uint32_t)time(NULL),profitmargin); + } + } +} + +#include "../includes/iguana_apidefs.h" +#include "../includes/iguana_apideclares.h" + +TWO_STRINGS(tradebot,gensvm,base,rel) +{ +#ifdef _WIN + return(clonestr("{\"error\":\"windows doesnt support SVM\"}")); +#else + int32_t numfeatures = 317*61; + struct tradebot_arbpair *pair; + if ( base[0] != 0 && rel[0] != 0 && (pair= tradebots_arbpair_find(base,rel)) != 0 && pair->fp != 0 ) + { + tradebots_calcanswers(pair); + ocas_gen(pair->refc,numfeatures,0,(int32_t)(ftell(pair->fp) / sizeof(pair->rawfeatures))); + return(clonestr("{\"result\":\"success\"}")); + } else return(clonestr("{\"error\":\"cant find arbpair\"}")); +#endif +} + +ZERO_ARGS(tradebot,openliquidity) +{ + int32_t i; cJSON *array = cJSON_CreateArray(); + for (i=0; ilinfos)/sizeof(*myinfo->linfos); i++) + { + if ( myinfo->linfos[i].base[0] != 0 ) + jaddi(array,linfo_json(&myinfo->linfos[i])); + } + return(jprint(array,1)); +} + +#include "../includes/iguana_apiundefs.h" diff --git a/crypto777/OS_nonportable.c b/crypto777/OS_nonportable.c index 56a7a8258..9e4e3f281 100755 --- a/crypto777/OS_nonportable.c +++ b/crypto777/OS_nonportable.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -13,7 +13,24 @@ * * ******************************************************************************/ - + /** + * - we need to include WinSock2.h header to correctly use windows structure + * as the application is still using 32bit structure from mingw so, we need to + * add the include based on checking + * + * @author - fadedreamz@gmail.com + * @remarks - #if (defined(_M_X64) || defined(__amd64__)) && defined(WIN32) + * is equivalent to #if defined(_M_X64) as _M_X64 is defined for MSVC only + * + * @remarks - we need this because in win64 we are using windows provided pollfd structure + * not from the mingw header, so we need to include the windows header + * if we are compiling in windows 64bit + */ +#if defined(_M_X64) +#define WIN32_LEAN_AND_MEAN +#include +#endif + #include "OS_portable.h" diff --git a/crypto777/OS_portable.c b/crypto777/OS_portable.c index ff16d4a65..7f614b816 100755 --- a/crypto777/OS_portable.c +++ b/crypto777/OS_portable.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -94,6 +94,17 @@ char *OS_portable_path(char *str) #endif } +FILE *OS_appendfile(char *origfname) +{ + char fname[1024]; FILE *fp; + strcpy(fname,origfname); + OS_portable_path(fname); + if ( (fp= fopen(fname,"rb+")) == 0 ) + fp = fopen(fname,"wb"); + else fseek(fp,0,SEEK_END); + return(fp); +} + int32_t OS_portable_renamefile(char *fname,char *newfname) { #ifdef _WIN32 diff --git a/crypto777/OS_portable.h b/crypto777/OS_portable.h index f0d61365e..d1baed4e0 100755 --- a/crypto777/OS_portable.h +++ b/crypto777/OS_portable.h @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -219,6 +219,7 @@ uint32_t OS_conv_datenum(int32_t datenum,int32_t hour,int32_t minute,int32_t sec int32_t OS_conv_unixtime(struct tai *t,int32_t *secondsp,time_t timestamp); char *OS_compatible_path(char *str); +FILE *OS_appendfile(char *origfname); int32_t OS_compare_files(char *fname,char *fname2); int64_t OS_copyfile(char *src,char *dest,int32_t cmpflag); diff --git a/crypto777/OS_time.c b/crypto777/OS_time.c index e127ad7a5..245da6928 100755 --- a/crypto777/OS_time.c +++ b/crypto777/OS_time.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * diff --git a/crypto777/SaM.c b/crypto777/SaM.c index 3f9c2d092..bfc97df59 100755 --- a/crypto777/SaM.c +++ b/crypto777/SaM.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * diff --git a/crypto777/bitcoind_RPC.c b/crypto777/bitcoind_RPC.c index 75612a484..2d31acdd2 100755 --- a/crypto777/bitcoind_RPC.c +++ b/crypto777/bitcoind_RPC.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -89,10 +89,13 @@ char *post_process_bitcoind_RPC(char *debugstr,char *command,char *rpcstr,char * } else if ( (error->type&0xff) != cJSON_NULL || (result->type&0xff) != cJSON_NULL ) { - if ( strcmp(command,"signrawtransaction") != 0 ) + if ( strcmp(command,"signrawtransaction") != 0 && strcmp(command,"sendrawtransaction") != 0 ) printf("<<<<<<<<<<< bitcoind_RPC: %s post_process_bitcoind_RPC (%s) error.%s\n",debugstr,command,rpcstr); + retstr = rpcstr; + rpcstr = 0; } - free(rpcstr); + if ( rpcstr != 0 ) + free(rpcstr); } else retstr = rpcstr; free_json(json); //fprintf(stderr,"<<<<<<<<<<< bitcoind_RPC: postprocess returns.(%s)\n",retstr); @@ -152,6 +155,7 @@ try_again: curl_easy_setopt(curl_handle,CURLOPT_WRITEDATA, &s); // we pass our 's' struct to the callback 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 + //curl_easy_setopt(curl_handle,CURLOPT_TIMEOUT, 60L); if ( strncmp(url,"https",5) == 0 ) { curl_easy_setopt(curl_handle,CURLOPT_SSL_VERIFYPEER,0); diff --git a/crypto777/cJSON.c b/crypto777/cJSON.c index d67dfa742..719c3eb8e 100755 --- a/crypto777/cJSON.c +++ b/crypto777/cJSON.c @@ -634,7 +634,7 @@ void cJSON_Minify(char *json) // the following written by jl777 /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * diff --git a/crypto777/curve25519.c b/crypto777/curve25519.c index 6e06267c9..5d2c24930 100755 --- a/crypto777/curve25519.c +++ b/crypto777/curve25519.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -1839,7 +1839,11 @@ uint64_t acct777_validate(struct acct777_sig *sig,bits256 privkey,bits256 pubkey struct acct777_sig checksig; uint64_t signerbits; int32_t datalen; uint8_t *serialized; datalen = (int32_t)(sig->allocsize - sizeof(*sig)); checksig = *sig; +#if defined(_M_X64) + serialized = (uint8_t *)((unsigned char *)sig + sizeof(*sig)); +#else serialized = (uint8_t *)((long)sig + sizeof(*sig)); +#endif //{ int32_t i; for (i=0; itimestamp,serialized,datalen); if ( memcmp(checksig.sigbits.bytes,sig->sigbits.bytes,sizeof(checksig.sigbits)) != 0 ) diff --git a/crypto777/hmac_sha512.c b/crypto777/hmac_sha512.c index 68c428189..e1fe4e523 100755 --- a/crypto777/hmac_sha512.c +++ b/crypto777/hmac_sha512.c @@ -506,7 +506,7 @@ char *hmac_sha512_str(char *dest,char *key,int32_t key_size,char *message) hmac_memory(&sha512_desc,(void *)key,key_size,(void *)message,strlen(message),checkbuf,&size); init_hexbytes_noT(dest,mac,SHA512_DIGEST_SIZE); init_hexbytes_noT(dest2,checkbuf,SHA512_DIGEST_SIZE); - //if ( memcmp(checkbuf,mac,SHA512_DIGEST_SIZE) != 0 ) + if ( memcmp(checkbuf,mac,SHA512_DIGEST_SIZE) != 0 ) printf("hmac_512 : %s vs %s\n",dest,dest2); return(dest); } diff --git a/crypto777/iguana_OS.c b/crypto777/iguana_OS.c index d53a0ccbd..5363f2135 100755 --- a/crypto777/iguana_OS.c +++ b/crypto777/iguana_OS.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -217,10 +217,18 @@ static uint64_t _align16(uint64_t ptrval) { if ( (ptrval & 15) != 0 ) ptrval += void *myaligned_alloc(uint64_t allocsize) { void *ptr,*realptr; uint64_t tmp; +#if defined(_M_X64) + realptr = mycalloc('A', 1, (uint64_t)(allocsize + 16 + sizeof(realptr))); +#else realptr = mycalloc('A',1,(long)(allocsize + 16 + sizeof(realptr))); +#endif tmp = _align16((long)realptr + sizeof(ptr)); memcpy(&ptr,&tmp,sizeof(ptr)); +#if defined(_M_X64) + memcpy((void *)((unsigned char *)ptr - sizeof(realptr)), &realptr, sizeof(realptr)); +#else memcpy((void *)((long)ptr - sizeof(realptr)),&realptr,sizeof(realptr)); +#endif //printf("aligned_alloc(%llu) realptr.%p -> ptr.%p, diff.%ld\n",(long long)allocsize,realptr,ptr,((long)ptr - (long)realptr)); return(ptr); } @@ -446,7 +454,16 @@ void *iguana_memalloc(struct OS_memspace *mem,long size,int32_t clearflag) #endif if ( (mem->used + size) <= mem->totalsize ) { + /* + * solution to calculate memory address in a portable way + * in all platform sizeof(char) / sizeof(uchar) == 1 + * @author - fadedreamz@gmail.com + */ +#if defined(_M_X64) + ptr = (void *)((unsigned char *)mem->ptr + mem->used); +#else ptr = (void *)(long)(((long)mem->ptr + mem->used)); +#endif mem->used += size; if ( size*clearflag != 0 ) memset(ptr,0,size); diff --git a/crypto777/iguana_serdes.c b/crypto777/iguana_serdes.c index eff6f3e5f..996743c78 100755 --- a/crypto777/iguana_serdes.c +++ b/crypto777/iguana_serdes.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * diff --git a/crypto777/iguana_utils.c b/crypto777/iguana_utils.c index 700cd73cc..cc058efd1 100755 --- a/crypto777/iguana_utils.c +++ b/crypto777/iguana_utils.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -193,6 +193,14 @@ void calc_OP_HASH160(char hexstr[41],uint8_t rmd160[20],char *pubkey) init_hexbytes_noT(hexstr,rmd160,20); } +double _xblend(float *destp,double val,double decay) +{ + double oldval; + if ( (oldval = *destp) != 0. ) + return((oldval * decay) + ((1. - decay) * val)); + else return(val); +} + double _dxblend(double *destp,double val,double decay) { double oldval; diff --git a/crypto777/m_LP_StaticNanoMsg b/crypto777/m_LP_StaticNanoMsg new file mode 100755 index 000000000..f6487bc1d --- /dev/null +++ b/crypto777/m_LP_StaticNanoMsg @@ -0,0 +1,30 @@ +# Very basic makefile for compiling iguana in Linux with StaticNanoMsg +# derived from m_LP (used to compile iguana for linux) +# author: fadedreamz + +SRCS=$(wildcard *.c) +SRCS+=$(wildcard jpeg/*.c) +SRCS+=$(wildcard jpeg/unix/*.c) + +OBJS=$(SRCS:%.c=%.o) + +INCLUDE_DIRS+=-I/usr/lib/x86_64-linux-gnu/curl +PREPROCESSORS+=-DLIQUIDITY_PROVIDER=1 -DUSE_STATIC_NANOMSG + +CFLAGS+=-O2 $(PREPROCESSORS) $(INCLUDE_DIRS) + +update_repo: + git pull + +clean: + -rm $(OBJS) + +all: update_repo $(OBJS) static + @echo ' ================' + @echo '| crypto777 [OK] |' + @echo ' ================' + +static: $(OBJS) + ar rc ../agents/libcrypto777.a $(OBJS) + +.PHONY: update_repo clean all static \ No newline at end of file diff --git a/crypto777/nanosrc/nn_config.h b/crypto777/nanosrc/nn_config.h index e3f132847..d9e9c6468 100755 --- a/crypto777/nanosrc/nn_config.h +++ b/crypto777/nanosrc/nn_config.h @@ -54,11 +54,13 @@ void PNACL_message(const char* format, ...); #include #include #else +#if !defined(WIN32) //#define NN_ENABLE_EXTRA 1 #define PNACL_message printf #include #include #endif +#endif /* Size of the buffer used for batch-reads of inbound data. To keep the performance optimal make sure that this value is larger than network MTU. */ diff --git a/crypto777/ramcoder.c b/crypto777/ramcoder.c index d495914de..86760289f 100755 --- a/crypto777/ramcoder.c +++ b/crypto777/ramcoder.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * diff --git a/datachain/datachain.c b/datachain/datachain.c index d0f661c79..9922e3f78 100755 --- a/datachain/datachain.c +++ b/datachain/datachain.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * diff --git a/deprecated/STEEM.c b/deprecated/STEEM.c new file mode 100644 index 000000000..83b79f9f5 --- /dev/null +++ b/deprecated/STEEM.c @@ -0,0 +1,304 @@ +/****************************************************************************** + * Copyright © 2016 jl777 * + * ALL RIGHTS RESERVED * + * * + * Removal or modification of this copyright notice is prohibited. * + * * + ******************************************************************************/ + +#ifndef __APPLE__ +#include "../iguana/iguana777.h" +#else +#include "iguana777.h" +#endif + +#define STEEMIT_PLANKTON 0 +#define STEEMIT_MINNOW_BALANCE 100 +#define STEEMIT_MINNOW 1 +#define STEEMIT_DOLPHIN_BALANCE 1000 +#define STEEMIT_DOLPHIN 2 +#define STEEMIT_WHALE_BALANCE 100000 +#define STEEMIT_WHALE 3 +#define STEEMIT_MEGAWHALE_BALANCE 1000000 +#define STEEMIT_MEGAWHALE 4 + +#include "postingkeys.c" +#define rand_account() postingkeys[rand() % (sizeof(postingkeys)/sizeof(*postingkeys))][0] + +struct vote_totals { char name[16]; uint32_t whale,nonwhale,whale_for_whale,whale_for_nonwhale,nonwhale_for_whale,nonwhale_for_nonwhale,whale_selfvote,nonwhale_selfvote; }; +struct steemit_word { UT_hash_handle hh; int score,ind; char wordpair[]; }; +struct steemit_vote { UT_hash_handle hh; double payout; char permlink[]; }; +struct steemit_whale { UT_hash_handle hh; double stake; char whale[]; }; +struct steemit_post { UT_hash_handle hh; double author_steempower,tallypower[STEEMIT_MEGAWHALE+1]; uint32_t height,author_type,tally[STEEMIT_MEGAWHALE+1]; char key[]; }; + +void steemit_vote(int32_t height,int32_t ind,int32_t j,cJSON *json); +void steemit_comment(int32_t height,int32_t ind,int32_t j,cJSON *json,int32_t activeflag); + +struct upvote_info +{ + char upvoter[64],*author,*permlink,*voters[1000]; + int32_t numvoters,whaleids[1000]; double weights[1000]; uint32_t starttime; +}; + +#define issue_IGUANA(url) bitcoind_RPC(0,"curl",url,0,0,0) +void *curl_post(void **cHandlep,char *url,char *userpass,char *postfields,char *hdr0,char *hdr1,char *hdr2,char *hdr3); +int32_t USE_JAY,Startheight; + +char *STEEM_getstate(char *category) +{ + static void *cHandle; + char params[1024],url[512],*retstr; + if ( category == 0 ) + category = ""; + sprintf(url,"http://127.0.0.1:8090"); + sprintf(params,"{\"id\":%llu,\"method\":\"call\",\"params\":[\"database_api\", \"get_state\", [\"%s\"]]}",(long long)(time(NULL)*1000 + ((int32_t)OS_milliseconds() % 1000)),category); + retstr = curl_post(&cHandle,url,"",params,0,0,0,0); + return(retstr); +} + +char *STEEM_getblock(int32_t height) +{ + static void *cHandle; + char params[1024],url[512],*retstr; + sprintf(url,"http://127.0.0.1:8090"); + sprintf(params,"{\"id\":%llu,\"method\":\"call\",\"params\":[\"database_api\", \"get_block\", [%d]]}",(long long)(time(NULL)*1000 + ((int32_t)OS_milliseconds() % 1000)),height); + retstr = curl_post(&cHandle,url,"",params,0,0,0,0); + return(retstr); +} + +char *STEEM_vote(char *voter,char *author,char *permalink,int8_t wt,int32_t forceflag) +{ + static void *cHandle; static portable_mutex_t mutex; + char params[1024],url[512],*retstr; + if ( cHandle == 0 ) + portable_mutex_init(&mutex); + if ( strcmp(voter,"jl777") != 0 && strcmp(voter,"taker") != 0 && strcmp(voter,"karen13") != 0 && strcmp(voter,"proto") != 0 && strcmp(voter,"yefet") != 0 ) + { + printf("OVERRIDE: only jl777 upvotes %s.(%s %s)\n",voter,author,permalink); + return(clonestr("{\"error\":\"override and dont vote\"}")); + } + if ( forceflag == 0 && strncmp(permalink,"re-",3) == 0 )//&& (strcmp(voter,"jl777") == 0 || strcmp(voter,"taker") == 0) ) + { + printf("OVERRIDE: no upvoting on comments.(%s %s)\n",author,permalink); + return(clonestr("{\"error\":\"override and dont vote\"}")); + } + portable_mutex_lock(&mutex); + if ( wt > 100 ) + wt = 100; + else if ( wt < -100 ) + wt = -100; + sprintf(url,"http://127.0.0.1:8091"); + sprintf(params,"{\"id\":%llu,\"method\":\"vote\",\"params\":[\"%s\", \"%s\", \"%s\", %d, true]}",(long long)(time(NULL)*1000 + ((int32_t)OS_milliseconds() % 1000)),voter,author,permalink,wt); + retstr = curl_post(&cHandle,url,"",params,0,0,0,0); + portable_mutex_unlock(&mutex); + return(retstr); +} + +char *STEEM_getcontent(char *author,char *permalink) +{ + static void *cHandle; + char params[1024],url[512],*retstr; + sprintf(url,"http://127.0.0.1:8090"); + sprintf(params,"{\"id\":%llu,\"method\":\"get_content\",\"params\":[\"%s\", \"%s\"]}",(long long)(time(NULL)*1000 + ((int32_t)OS_milliseconds() % 1000)),author,permalink); + //printf("(%s %s) -> (%s)\n",author,permalink,params); + retstr = curl_post(&cHandle,url,"",params,0,0,0,0); + return(retstr); +} + +char *STEEM_getcomments(char *author,char *permalink) +{ + static void *cHandle; + char params[1024],url[512],*retstr; + sprintf(url,"http://127.0.0.1:8090"); + sprintf(params,"{\"id\":%llu,\"method\":\"get_content_replies\",\"params\":[\"%s\", \"%s\"]}",(long long)(time(NULL)*1000 + ((int32_t)OS_milliseconds() % 1000)),author,permalink); + //printf("(%s %s) -> (%s)\n",author,permalink,params); + retstr = curl_post(&cHandle,url,"",params,0,0,0,0); + return(retstr); +} + +char *STEEM_accountinfo(char *author) +{ + static void *cHandle; + char params[1024],url[512],*retstr; + sprintf(url,"http://127.0.0.1:8091"); + sprintf(params,"{\"id\":%llu,\"method\":\"get_account\",\"params\":[\"%s\"]}",(long long)(time(NULL)*1000 + ((int32_t)OS_milliseconds() % 1000)),author); + retstr = curl_post(&cHandle,url,"",params,0,0,0,0); + return(retstr); +} + +int32_t permalink_str(char *permalink,int32_t size,char *str) +{ + int32_t i,c; + for (i=0; str[i]!=0 && i= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') ) + { + + } else c = '-'; + permalink[i] = tolower(c); + } + permalink[i] = 0; + return(i); +} + +char *STEEM_comment(char *author,char *usepermalink,char *parent,char *parentpermalink,char *title,char *body,char *tag) +{ + /*post_comment(string author, string permlink, string parent_author, string parent_permlink, string title, string body, string json, bool broadcast) + "parent_author": "", + "parent_permlink": "introduceyourself", + "author": "jl777", + "permlink": "steemit-is-crypto-s-first-mass-market-solution", + "title": "steemit is crypto's first mass market solution!", + "body": "test post" + "json_metadata": "{\"tags\":[\"introduceyourself\",\"blockchain\",\"bitcoin\",\"networking\",\"iguana\",\"supernet\",\"bitcoindark\",\"\"],\"links\":[\"https://bitco.in/forum/forums/iguana.23/\"]}" + curl --url "http://127.0.0.1:8091" --data "{\"id\":444,\"method\":\"post_comment\",\"params\":[\"taker\", \"test-title\", \"\", \"introduceyourself\", \"test title\", \"test body\", \"{\\\"tags\\\":[\\\"introduceyourself\\\", \\\"test\\\", \\\"\\\"]}\", true]}"*/ + static void *cHandle; + char *params,permalink[4096],url[512],*retstr; + params = malloc(1024*1024*10); + if ( parent != 0 && parent[0] != 0 && strlen(parentpermalink)+strlen(parent)+8 < sizeof(permalink) ) + { + if ( usepermalink != 0 ) + strcpy(permalink,usepermalink); + else sprintf(permalink,"re-%s-%s-r%d",parent,parentpermalink,rand() & 0x7fffffff); + } + else permalink_str(permalink,sizeof(permalink),title); + sprintf(url,"http://127.0.0.1:8091"); + if ( tag != 0 ) + sprintf(params,"{\"id\":%llu,\"method\":\"post_comment\",\"params\":[\"%s\", \"%s\", \"%s\", \"%s\", \"%s\", \"%s\", \"{\\\"tags\\\":[\\\"%s\\\", \\\"steem\\\", \\\"steemit\\\", \\\"test\\\", \\\"\\\"]}\", true]}",(long long)(time(NULL)*1000 + ((int32_t)OS_milliseconds() % 1000)),author,permalink,parent,parentpermalink,title,body,tag); //\\\"introduceyourself\\\", + else sprintf(params,"{\"id\":%llu,\"method\":\"post_comment\",\"params\":[\"%s\", \"%s\", \"%s\", \"%s\", \"%s\", \"%s\", \"{}\", true]}",(long long)(time(NULL)*1000 + ((int32_t)OS_milliseconds() % 1000)),author,permalink,parent,parentpermalink,title,body); + //printf("ABOUT TO POST.(%s)\n",params), getchar(); + retstr = curl_post(&cHandle,url,"",params,0,0,0,0); + free(params); + //printf("got.(%s)\n",retstr); + return(retstr); +} + +char *STEEM_post(char *author,char *title,char *body,char *tag) +{ + return(STEEM_comment(author,0,"",tag!=0?tag:"steemit",title,body,tag)); +} + +char *STEEM_gethistory(char *account,int32_t firsti,int32_t num) +{ + static void *cHandle; + char params[1024],url[512],*retstr; + sprintf(url,"http://127.0.0.1:8090"); + sprintf(params,"{\"id\":%llu,\"method\":\"get_account_history\",\"params\":[\"%s\", %d, %d]}",(long long)(time(NULL)*1000 + ((int32_t)OS_milliseconds() % 1000)),account,firsti,num); + retstr = curl_post(&cHandle,url,"",params,0,0,0,0); + //printf("(%s) -> (%s)\n",params,retstr); + return(retstr); +} + +char *IGUANA_request(char *agent,char *method,cJSON *argjson) +{ + static void *cHandle; + char *argstr=0,*retstr,url[512]; + if ( argjson != 0 ) + argstr = jprint(argjson,0); + sprintf(url,"http://127.0.0.1:7778/api/%s/%s",agent,method); + retstr = curl_post(&cHandle,url,"",argstr,0,0,0,0); + if ( argstr != 0 ) + free(argstr); + return(retstr); +} + +int32_t special_account(char *account) +{ + int32_t i; + if ( strcmp("jl777",account) == 0 || strcmp("upvotes",account) == 0 || strcmp("taker",account) == 0 ) + return(1); + for (i=0; i (%s)\n",author,permlink,retstr); + if ( (retjson= cJSON_Parse(retstr)) != 0 ) + { + if ( (result= jobj(retjson,"result")) != 0 ) + { + safecopy(author,jstr(result,"parent_author"),sizeof(author)); + safecopy(permlink,jstr(result,"parent_permlink"),sizeof(permlink)); + if ( author[0] != 0 ) + { + strcpy(_author,author); + strcpy(_permlink,permlink); + } + } else author[0] = 0; + free_json(retjson); + } + free(retstr); + } + } + return(depth); +} + +int32_t steemit_body(char *buf,int32_t size,char *author,char *permlink) +{ + char *retstr,*body; cJSON *retjson,*result; int32_t len = 0; + if ( (retstr= STEEM_getcomments(author,permlink)) != 0 ) + { + if ( (retjson= cJSON_Parse(retstr)) != 0 ) + { + if ( (result= jobj(retjson,"result")) != 0 ) + { + if ( (body= jstr(result,"body")) != 0 ) + { + if ( (len= (int32_t)strlen(body)) > size ) + len = size; + strncpy(buf,body,len); + } + } + free_json(retjson); + } + free(retstr); + } + return(len); +} + +int32_t steemit_power(double *powerp,char *author) +{ + char *retstr; cJSON *retjson,*result; double steempower; int32_t retval = 0; + *powerp = 0.; + if ( (retstr= STEEM_accountinfo(author)) != 0 ) + { + //printf("power.(%s)\n",retstr); + if ( (retjson= cJSON_Parse(retstr)) != 0 ) + { + if ( (result= jobj(retjson,"result")) != 0 ) + { + *powerp = steempower = jdouble(result,"vesting_shares") * .001; + if ( steempower >= STEEMIT_MINNOW_BALANCE ) + { + if ( steempower >= STEEMIT_DOLPHIN_BALANCE ) + { + if ( steempower >= STEEMIT_WHALE_BALANCE ) + { + if ( steempower >= STEEMIT_MEGAWHALE_BALANCE ) + retval = STEEMIT_MEGAWHALE; + else retval = STEEMIT_WHALE; + } else retval = STEEMIT_DOLPHIN; + } else retval = STEEMIT_MINNOW; + } else retval = STEEMIT_PLANKTON; + //printf("%s type.%d %.3f\n",author,retval,steempower); + } else printf("(%s) -> no result.(%s)\n",author,retstr); + free_json(retjson); + } + free(retstr); + } + return(retval); +} diff --git a/deprecated/iguana_instantdex.c b/deprecated/iguana_instantdex.c index 85755175b..5baf88af0 100755 --- a/deprecated/iguana_instantdex.c +++ b/deprecated/iguana_instantdex.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * diff --git a/deprecated/steemit_parser.c b/deprecated/steemit_parser.c new file mode 100644 index 000000000..d3ddb74bd --- /dev/null +++ b/deprecated/steemit_parser.c @@ -0,0 +1,384 @@ +/****************************************************************************** + * Copyright © 2016 jl777 * + * ALL RIGHTS RESERVED * + * * + * Removal or modification of this copyright notice is prohibited. * + * * + ******************************************************************************/ + +int32_t init_startheight(int32_t startheight) +{ + long filesize; int32_t height; char *heightstr; + if ( (heightstr= OS_filestr(&filesize,TRADEBOT_NAME)) != 0 ) + { + height = atoi(heightstr); + free(heightstr); + if ( height > 0 && height < startheight ) + startheight = height; + } + return(startheight); +} + +void steemit_history_limitorder(int32_t ind,char *acount,cJSON *opitem) +{ + // hwm.12081 flag.1 limit_order_create ({"owner":"taker","orderid":1469136578,"amount_to_sell":"24.346 SBD","min_to_receive":"7.770 STEEM","fill_or_kill":false,"expiration":"2016-07-24T23:21:24"}) +} + +void steemit_update_inventory(double *SBD,double *SBDVOL,double *STEEMVOL,double *STEEM,double myvol,char *mycoin,char *other,double othervol,char *othercoin) +{ + if ( strcmp(mycoin,"SBD") == 0 && strcmp(othercoin,"STEEM") == 0 ) + { + *SBD -= myvol; + *SBDVOL += myvol; + *STEEM += othervol; + *STEEMVOL += othervol; + } + else if ( strcmp(mycoin,"STEEM") == 0 && strcmp(othercoin,"SBD") == 0 ) + { + *STEEM -= myvol; + *STEEMVOL += myvol; + *SBD += othervol; + *SBDVOL += othervol; + } else printf("steemit_update_inventory: unexpected pair (%s) (%s)\n",mycoin,othercoin); +} + +void steemit_history_fillorder(int32_t ind,char *account,cJSON *opitem) +{ + static double SBD,STEEM,SBDVOL,STEEMVOL; + char *taker,*maker,*takercoin,*makercoin; uint64_t openorderid,fillorderid; double takervol,makervol; + taker = jstr(opitem,"current_owner"); + fillorderid = j64bits(opitem,"current_orderid"); + takercoin = jstr(opitem,"current_pays"); + maker = jstr(opitem,"open_owner"); + openorderid = j64bits(opitem,"open_orderid"); + makercoin = jstr(opitem,"open_pays"); + if ( taker != 0 && maker != 0 && takercoin != 0 && makercoin != 0 && (strcmp(account,taker) == 0 || strcmp(maker,account) == 0) ) + { + takervol = atof(takercoin); + while ( *takercoin != 0 && *takercoin != ' ' ) + takercoin++; + makervol = atof(makercoin); + while ( *makercoin != 0 && *makercoin != ' ' ) + makercoin++; + if ( strcmp(taker,account) == 0 ) + { + steemit_update_inventory(&SBD,&SBDVOL,&STEEMVOL,&STEEM,takervol,takercoin+1,maker,makervol,makercoin+1); + printf("%6d %s.(%.6f%s) <-> %s.(%.6f%s) SBD %.6f STEEM %.6f | VOL SBD %.6f STEEM %.6f-> %.6f\n",ind,taker,takervol,takercoin,maker,makervol,makercoin,SBD,STEEM,SBDVOL,STEEMVOL,SBD/STEEM); + } + else + { + steemit_update_inventory(&SBD,&SBDVOL,&STEEMVOL,&STEEM,takervol,takercoin+1,maker,makervol,makercoin+1); + printf("%6d %s.(%.6f%s) <-> %s.(%.6f%s) SBD %.6f STEEM %.6f | VOL SBD %.6f STEEM %.6f-> %.6f\n",ind,maker,makervol,makercoin,taker,takervol,takercoin,SBD,STEEM,SBDVOL,STEEMVOL,SBD/STEEM); + } + } + //hwm.12077 flag.1 fill_order ({"current_owner":"enki","current_orderid":3402053187,"current_pays":"19.613 SBD","open_owner":"taker","open_orderid":1469136521,"open_pays":"5.792 STEEM"}) + +} + +void steemit_tradehistory(char *account) +{ + int32_t j,n,m,ind,flag = 1,hwm = 0; cJSON *retjson,*result,*item,*oparray,*opitem; char *opstr,*retstr; + while ( flag != 0 ) + { + flag = 0; + if ( (retstr= STEEM_gethistory(account,hwm+1,1)) != 0 ) + { + if ( (retjson= cJSON_Parse(retstr)) != 0 ) + { + if ( (result= jarray(&n,retjson,"result")) != 0 ) + { + for (j=0; j %s",key,fname); + system(cmd); + if ( (str2= OS_filestr(&filesize,fname)) != 0 ) + { + if ( (json2= cJSON_Parse(str2)) != 0 ) + { + if ( (postingkey= jstr(json2,"result")) != 0 ) + { + //miner = ["supernet", "5J4gTpk4CMBdPzgaRj7yNXDZTzBBQ41bNyJTqHbBi7Ku6v75bXa"] + //fprintf(postingkeys,"miner = [\"%s\", \"%s\"]\n",name,postingkey); + fprintf(postingkeys,"witness = \"%s\"\n",name); + //fprintf(postingkeys,"{ \"%s\", \"%s\" },",name,postingkey); + } + else printf("no result in (%s)\n",jprint(json2,0)); + free_json(json2); + } else printf("couldnt parse (%s)\n",str2); + free(str2); + } else printf("couldnt load (%s)\n",fname); + } + } + } + } + fprintf(postingkeys,"\n};\n"); + fclose(postingkeys); + } + free_json(json); + } + free(str); + } +} + +void tradebots_LP(char *configjsonstr,char *arg) +{ + char *retstr,*cmdstr; int32_t i,tallymode=0,repeat,lastheight=0,j,n,one,height = -1; cJSON *obj,*json,*operations,*item,*retjson,*result,*props,*transactions; + if ( configjsonstr != 0 && (json= cJSON_Parse(configjsonstr)) != 0 ) + { + // process config + free_json(json); + } + strcpy(Articles.name,"Articles"); + strcpy(Comments.name,"Comments"); + strcpy(Votes.name,"Votes"); + if ( (retstr= STEEM_getstate(0)) == 0 ) + return; + for (i=0; i= 0 ) + { + if ( tallymode != 0 && height == Startheight ) + { + printf("reached Startheight.%d, getchar()\n",Startheight); + steemit_summary(Startheight); + getchar(); + exit(0); + } + if ( (retstr= STEEM_getblock(height)) != 0 ) + { + if ( (retjson= cJSON_Parse(retstr)) != 0 ) + { + if ( (result= jobj(retjson,"result")) != 0 ) + { + if ( (transactions= jarray(&n,result,"transactions")) != 0 ) + { + if ( tallymode == 0 ) + printf("lag.%d ht.%d n.%d\n",height-Startheight,height,n); + for (i=0; i= Startheight) && strcmp("comment",cmdstr) == 0 ) + steemit_comment(height,i,j,obj,height >= Startheight); + else if ( height >= Startheight ) + { + if ( strcmp("limit_order_create",cmdstr) == 0 ) + steemit_limitorder(height,i,j,obj); + else if ( strcmp("convert",cmdstr) == 0 ) + steemit_convert(height,i,j,obj); + else if ( strcmp("custom_json",cmdstr) == 0 ) + steemit_customjson(height,i,j,obj); + else if ( strcmp("transfer_to_vesting",cmdstr) == 0 ) + steemit_powerup(height,i,j,obj); + else if ( strcmp("account_update",cmdstr) == 0 ) + steemit_accountupdate(height,i,j,obj); + else if ( strcmp("transfer",cmdstr) == 0 ) + steemit_transfer(height,i,j,obj); + else if ( strcmp("limit_order_cancel",cmdstr) == 0 ) + steemit_cancelorder(height,i,j,obj); + else if ( strcmp("delete_comment",cmdstr) == 0 ) + steemit_deletecomment(height,i,j,obj); + else if ( strcmp("pow",cmdstr) == 0 ) + steemit_pow(height,i,j,obj); + else if ( strcmp("feed_publish",cmdstr) == 0 ) + steemit_feedpublish(height,i,j,obj); + else if ( strcmp("withdraw_vesting",cmdstr) == 0 ) + steemit_powerdown(height,i,j,obj); + else if ( strcmp("account_witness_vote",cmdstr) == 0 ) + steemit_accountwitness(height,i,j,obj); + else printf("%d.%d.%d: %s.(%s)\n",height,i,j,cmdstr,jprint(obj,0)); + } + } else printf("%d.%d: unexpected paired item.(%s)\n",height,i,jprint(item,0)); + } else printf("%d.%d: unexpected unpaired item.(%s)\n",height,i,jprint(item,0)); + } + } + } + } else if ( is_cJSON_Null(result) == 0 && jstr(result,"previous") == 0 ) + printf("ht.%d no transactions in result.(%s)\n",height,jprint(result,0)); + if ( is_cJSON_Null(result) == 0 ) + { + FILE *fp; + if ( (fp= fopen(TRADEBOT_NAME,"wb")) != 0 ) + { + // printf("startheight.%d for %s\n",height,TRADEBOT_NAME); + fprintf(fp,"%d\n",height); + fclose(fp); + } else printf("error saving startheight.%d for %s\n",height,TRADEBOT_NAME); + height++, repeat = 0; + if ( 0 && tallymode != 0 && (height % 1000) == 0 ) + disp_vote_totals(height); + } + } else printf("ht.%d no result in (%s)\n",height,jprint(retjson,0)); + //printf("ht.%d blockstr.(%s)\n",height,retstr); + free_json(retjson); + } else printf("ht.%d couldnt parse.(%s)\n",height,retstr); + free(retstr); + } else printf("error getting ht.%d\n",height); + if ( height >= Startheight ) + sleep(1); + if ( height == lastheight && ++repeat > 3 ) + height++, repeat = 0, lastheight = height; +#ifdef __APPLE__ + continue; +#endif + } + printf("done whale watching, hope you enjoyed the show\n"); +} diff --git a/gecko/gecko.c b/gecko/gecko.c index cd7667089..8de1611bf 100755 --- a/gecko/gecko.c +++ b/gecko/gecko.c @@ -1,6 +1,6 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -180,6 +180,8 @@ struct iguana_info *basilisk_geckochain(struct supernet_info *myinfo,char *symbo virt->enableCACHE = 1; serialized = get_dataptr(BASILISK_HDROFFSET,&ptr,&datalen,hexbuf,sizeof(hexbuf),hexstr); iguana_chaininit(myinfo,virt->chain,1,valsobj); + //if ( virt->FULLNODE >= 0 ) + // virt->chain->userpass[0] = 0; virt->chain->isPoS = 1; hdrsize = (virt->chain->zcash != 0) ? sizeof(struct iguana_msgzblockhdr) : sizeof(struct iguana_msgblockhdr); if ( gecko_blocknonce_verify(virt,serialized,hdrsize,virt->chain->nBits,0,0) > 0 ) diff --git a/gecko/gecko_miner.c b/gecko/gecko_miner.c index 77b592467..6a7bdee31 100755 --- a/gecko/gecko_miner.c +++ b/gecko/gecko_miner.c @@ -302,7 +302,7 @@ cJSON *gecko_paymentsobj(struct supernet_info *myinfo,cJSON *txjson,cJSON *valso if ( (txversion= juint(valsobj,"txversion")) == 0 ) txversion = (locktime == 0) ? IGUANA_NORMAL_TXVERSION : IGUANA_LOCKTIME_TXVERSION; if ( txjson == 0 ) - txjson = bitcoin_txcreate(1,locktime,txversion,juint(valsobj,"timestamp")); + txjson = bitcoin_txcreate("gecko",1,locktime,txversion,juint(valsobj,"timestamp")); if ( (array= jarray(&n,valsobj,"payments")) != 0 && n > 0 ) { for (i=0; iDisabled _CRT_SECURE_NO_WARNINGS;NATIVE_WINDOWS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 1Byte + .\iguana;%(AdditionalIncludeDirectories) Console true - Ws2_32.lib;%(AdditionalDependencies) + Ws2_32.lib;pthreadVC2.lib;nanomsg.lib;%(AdditionalDependencies) + .\iguana;.\OSlibs\win;%(AdditionalLibraryDirectories) @@ -105,12 +107,14 @@ Level3 Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + _DEBUG;_CONSOLE;NATIVE_WINDOWS;WIN32;%(PreprocessorDefinitions) 1Byte Console true + .\OSlibs\win\x64;%(AdditionalLibraryDirectories) + pthread_lib.lib;Ws2_32.lib;nanomsg.lib;%(AdditionalDependencies) @@ -122,13 +126,15 @@ true true _CRT_SECURE_NO_WARNINGS;NATIVE_WINDOWS;WIN32;_CONSOLE;NDEBUG;%(PreprocessorDefinitions) + 1Byte Console true true true - Ws2_32.lib;%(AdditionalDependencies) + Ws2_32.lib;pthreadVC2.lib;nanomsg.lib;%(AdditionalDependencies) + .\OSlibs\win\release;%(AdditionalLibraryDirectories) @@ -140,7 +146,7 @@ true true WIN64;_WIN64;_CRT_SECURE_NO_WARNINGS;NATIVE_WINDOWS;WIN32;_CONSOLE;NDEBUG;%(PreprocessorDefinitions) - 8Bytes + 1Byte MultiThreaded @@ -148,7 +154,8 @@ true true true - Ws2_32.lib;Advapi32.lib;$(SolutionDir)OSlibs\win\x64\pthread_lib.lib;%(AdditionalDependencies) + Ws2_32.lib;Advapi32.lib;$(SolutionDir)OSlibs\win\x64\pthread_lib.lib;nanomsg.lib;%(AdditionalDependencies) + .\OSlibs\win\x64\release;%(AdditionalLibraryDirectories) @@ -260,6 +267,7 @@ + diff --git a/iguana.vcxproj.filters b/iguana.vcxproj.filters index 0f03de4bd..3aa3d0fc6 100644 --- a/iguana.vcxproj.filters +++ b/iguana.vcxproj.filters @@ -102,6 +102,7 @@ + diff --git a/iguana/SuperNET_keys.c b/iguana/SuperNET_keys.c index be283118e..9eadf21f0 100755 --- a/iguana/SuperNET_keys.c +++ b/iguana/SuperNET_keys.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -84,7 +84,6 @@ bits256 SuperNET_wallet2priv(char *wallet2fname,bits256 wallethash) wallet2str[i] ^= wallethash.bytes[(i + r) % 32]; vcalc_sha256(0,wallet2priv.bytes,(void *)wallet2str,(int32_t)allocsize); free(wallet2str); - //char str[65]; printf("wallet2priv.(%s) from.(%s) crc.%u and passphrase r.%d len.%ld\n",bits256_str(str,wallet2priv),wallet2fname,crc,r,allocsize); } else if ( wallet2fname[0] != 0 ) printf("SuperNET_wallet2priv cant open (%s)\n",wallet2fname); return(wallet2priv); @@ -248,7 +247,6 @@ cJSON *SuperNET_decryptedjson(char *destfname,char *passphrase,int32_t passsize, wallethash = SuperNET_linehash(passphrase); SuperNET_linehash(fname2fa); // maps special chars wallet2priv = SuperNET_wallet2priv(fname2fa,wallethash); - //char str[65],str2[65]; printf("(%s + %s) -> wallethash.%s 2.(%s)\n",passphrase,fname2fa,bits256_str(str,wallethash),bits256_str(str2,wallet2priv)); } first = (bits256_nonz(wallethash) != 0 && bits256_cmp(wallethash,GENESIS_PRIVKEY) != 0); second = (bits256_nonz(wallet2priv) != 0 && bits256_cmp(wallet2priv,GENESIS_PRIVKEY) != 0); @@ -259,7 +257,6 @@ cJSON *SuperNET_decryptedjson(char *destfname,char *passphrase,int32_t passsize, wallet2shared = SuperNET_wallet2shared(wallethash,wallet2priv); wallet2pub = curve25519(wallet2shared,curve25519_basepoint9()); sprintf(destfname,"%s/%s",GLOBAL_CONFSDIR,bits256_str(str,wallet2pub)); - //printf("fname.(%s) wallet2pub.%s < [%s, %s]\n",destfname,bits256_str(str,wallet2pub),passphrase,fname2fa); if ( (confstr= OS_filestr(&allocsize,destfname)) != 0 ) { if ( (filejson= cJSON_Parse(confstr)) != 0 ) @@ -305,12 +302,9 @@ int32_t _SuperNET_encryptjson(struct supernet_info *myinfo,char *destfname,char wallethash = SuperNET_linehash(passphrase); SuperNET_linehash(fname2fa); // maps special chars wallet2priv = SuperNET_wallet2priv(fname2fa,wallethash); - //char str2[65]; printf("ENCRYPT.[%s %s] (%s) 2.%s\n",passphrase,fname2fa,bits256_str(str,wallethash),bits256_str(str2,wallet2priv)); wallet2shared = SuperNET_wallet2shared(wallethash,wallet2priv); wallet2pub = curve25519(wallet2shared,curve25519_basepoint9()); sprintf(destfname,"%s/%s",GLOBAL_CONFSDIR,bits256_str(str,wallet2pub)); - //printf("SAVE ARGJSON.(%s) [%s, %s] -> destfname.(%s)\n",jprint(argjson,0),passphrase,fname2fa,destfname); - //printf("shared.%llx -> pub.%s\n",(long long)wallet2shared.txid,bits256_str(str,wallet2pub)); SuperNET_savejsonfile(myinfo,destfname,wallethash,wallet2pub,argjson); return(0); } @@ -375,7 +369,6 @@ char *SuperNET_keysinit(struct supernet_info *myinfo,char *argjsonstr) passphrase[0] = fname2fa[0] = 0; wallethash = wallet2priv = GENESIS_PRIVKEY; coinargs = SuperNET_parsemainargs(myinfo,&wallethash,&wallet2priv,argjsonstr); - //printf("wallethash.%s 2.(%s)\n",bits256_str(str,wallethash),bits256_str(str2,wallet2priv)); if ( (msgjson= SuperNET_decryptedjson(destfname,passphrase,sizeof(passphrase),wallethash,fname2fa,sizeof(fname2fa),wallet2priv)) != 0 ) { SuperNET_parsemyinfo(myinfo,msgjson); @@ -395,9 +388,7 @@ char *SuperNET_keysinit(struct supernet_info *myinfo,char *argjsonstr) jaddbits256(json,"persistent_pub",myinfo->myaddr.persistent); OS_randombytes((void *)&r,sizeof(r)); jadd64bits(json,"rand",r); - //printf("call SuperNET_encryptjson\n"); _SuperNET_encryptjson(myinfo,destfname,passphrase,sizeof(passphrase),fname2fa,sizeof(fname2fa),json); - //printf("save.(%s)\n",jprint(json,0)); free_json(json); } if ( myinfo->ipaddr[0] == 0 ) diff --git a/iguana/coins/Agenbtcd b/iguana/coins/Agenbtcd new file mode 100755 index 000000000..f01315499 --- /dev/null +++ b/iguana/coins/Agenbtcd @@ -0,0 +1,2 @@ +#!/bin/bash +curl --url "http://127.0.0.1:7778" --data "{\"userpass\":\"username@password\",\"prefetchlag\":11,\"poll\":50,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"newcoin\":\"BTCD\",\"startpend\":512,\"endpend\":512,\"services\":129,\"maxpeers\":512,\"RELAY\":1,\"VALIDATE\":1,\"portp2p\":14631,\"rpc\":14632,\"minconfirms\":5}" diff --git a/iguana/coins/basilisk b/iguana/coins/basilisk.old similarity index 100% rename from iguana/coins/basilisk rename to iguana/coins/basilisk.old diff --git a/iguana/coins/basilisk/bet b/iguana/coins/basilisk/bet new file mode 100755 index 000000000..d2fae9771 --- /dev/null +++ b/iguana/coins/basilisk/bet @@ -0,0 +1,2 @@ +curl --url "http://127.0.0.1:7778" --data "{\"conf\":\"BET.conf\",\"path\":\"${HOME#"/"}/.komodo/BET\",\"unitval\":\"20\",\"zcash\":1,\"RELAY\":0,\"VALIDATE\":0,\"prefetchlag\":-1,\"poll\":100,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":4,\"endpend\":4,\"services\":129,\"maxpeers\":8,\"newcoin\":\"BET\",\"name\":\"BET\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"6b9e3e1b\",\"p2p\":15610,\"rpc\":15611,\"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/basilisk/bots b/iguana/coins/basilisk/bots new file mode 100755 index 000000000..6632e4803 --- /dev/null +++ b/iguana/coins/basilisk/bots @@ -0,0 +1,2 @@ +curl --url "http://127.0.0.1:7778" --data "{\"conf\":\"BOTS.conf\",\"path\":\"${HOME#"/"}/.komodo/BOTS\",\"unitval\":\"20\",\"zcash\":1,\"RELAY\":0,\"VALIDATE\":0,\"prefetchlag\":-1,\"poll\":100,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":4,\"endpend\":4,\"services\":129,\"maxpeers\":8,\"newcoin\":\"BOTS\",\"name\":\"BOTS\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"5bec8cf7\",\"p2p\":11363,\"rpc\":11364,\"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/basilisk/btc b/iguana/coins/basilisk/btc new file mode 100755 index 000000000..9479f35d7 --- /dev/null +++ b/iguana/coins/basilisk/btc @@ -0,0 +1,2 @@ +#!/bin/bash +curl --url "http://127.0.0.1:7778" --data "{\"conf\":\"bitcoin.conf\",\"path\":\"${HOME#"/"}/.bitcoin\",\"prefetchlag\":-1,\"poll\":1,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"newcoin\":\"BTC\",\"startpend\":64,\"endpend\":64,\"services\":0,\"maxpeers\":512,\"RELAY\":0,\"VALIDATE\":0,\"portp2p\":8333,\"minconfirms\":1}" diff --git a/iguana/coins/basilisk/crypto b/iguana/coins/basilisk/crypto new file mode 100755 index 000000000..49d7670f3 --- /dev/null +++ b/iguana/coins/basilisk/crypto @@ -0,0 +1,2 @@ +curl --url "http://127.0.0.1:7778" --data "{\"conf\":\"CRYPTO.conf\",\"path\":\"${HOME#"/"}/.komodo/CRYPTO\",\"unitval\":\"20\",\"zcash\":1,\"RELAY\":0,\"VALIDATE\":0,\"prefetchlag\":-1,\"poll\":100,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":4,\"endpend\":4,\"services\":129,\"maxpeers\":8,\"newcoin\":\"CRYPTO\",\"name\":\"CRYPTO\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"fced9e2a\",\"p2p\":12947,\"rpc\":12948,\"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/basilisk/dex b/iguana/coins/basilisk/dex new file mode 100755 index 000000000..7c245c2a5 --- /dev/null +++ b/iguana/coins/basilisk/dex @@ -0,0 +1,2 @@ +curl --url "http://127.0.0.1:7778" --data "{\"conf\":\"DEX.conf\",\"path\":\"${HOME#"/"}/.komodo/DEX\",\"unitval\":\"20\",\"zcash\":1,\"RELAY\":0,\"VALIDATE\":0,\"prefetchlag\":-1,\"poll\":100,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":4,\"endpend\":4,\"services\":129,\"maxpeers\":8,\"newcoin\":\"DEX\",\"name\":\"DEX\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"f2ae0516\",\"p2p\":11889,\"rpc\":11890,\"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/basilisk/hodl b/iguana/coins/basilisk/hodl new file mode 100755 index 000000000..934a21c69 --- /dev/null +++ b/iguana/coins/basilisk/hodl @@ -0,0 +1,2 @@ +curl --url "http://127.0.0.1:7778" --data "{\"conf\":\"HODL.conf\",\"path\":\"${HOME#"/"}/.komodo/HODL\",\"unitval\":\"20\",\"zcash\":1,\"RELAY\":0,\"VALIDATE\":0,\"prefetchlag\":-1,\"poll\":100,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":4,\"endpend\":4,\"services\":129,\"maxpeers\":8,\"newcoin\":\"HODL\",\"name\":\"HODL\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"9b13fb5f\",\"p2p\":14430,\"rpc\":14431,\"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/basilisk/jumblr b/iguana/coins/basilisk/jumblr new file mode 100755 index 000000000..be336dbb7 --- /dev/null +++ b/iguana/coins/basilisk/jumblr @@ -0,0 +1,2 @@ +curl --url "http://127.0.0.1:7778" --data "{\"conf\":\"JUMBLR.conf\",\"path\":\"${HOME#"/"}/.komodo/JUMBLR\",\"unitval\":\"20\",\"zcash\":1,\"RELAY\":0,\"VALIDATE\":0,\"prefetchlag\":-1,\"poll\":100,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":4,\"endpend\":4,\"services\":129,\"maxpeers\":8,\"newcoin\":\"JUMBLR\",\"name\":\"JUMBLR\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"7223759e\",\"p2p\":15105,\"rpc\":15106,\"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/basilisk/kmd b/iguana/coins/basilisk/kmd new file mode 100755 index 000000000..bfcb83cef --- /dev/null +++ b/iguana/coins/basilisk/kmd @@ -0,0 +1,4 @@ +#!/bin/bash + +curl --url "http://127.0.0.1:7778" --data "{\"conf\":\"komodo.conf\",\"path\":\"${HOME#"/"}/.komodo\",\"unitval\":\"20\",\"zcash\":1,\"RELAY\":0,\"VALIDATE\":0,\"prefetchlag\":-1,\"poll\":10,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":8,\"endpend\":8,\"services\":0,\"maxpeers\":32,\"newcoin\":\"KMD\",\"name\":\"Komodo\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"f9eee48d\",\"p2p\":7770,\"rpc\":7771,\"pubval\":60,\"p2shval\":85,\"wifval\":188,\"txfee_satoshis\":\"10000\",\"isPoS\":0,\"minoutput\":10000,\"minconfirms\":2,\"genesishash\":\"027e3758c3a65b12aa1046462b486d0a63bfa1beae327897f56c5cfb7daaae71\",\"protover\":170002,\"genesisblock\":\"0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000000000000000000000000000000000000000000000000000000000000029ab5f490f0f0f200b00000000000000000000000000000000000000000000000000000000000000fd4005000d5ba7cda5d473947263bf194285317179d2b0d307119c2e7cc4bd8ac456f0774bd52b0cd9249be9d40718b6397a4c7bbd8f2b3272fed2823cd2af4bd1632200ba4bf796727d6347b225f670f292343274cc35099466f5fb5f0cd1c105121b28213d15db2ed7bdba490b4cedc69742a57b7c25af24485e523aadbb77a0144fc76f79ef73bd8530d42b9f3b9bed1c135ad1fe152923fafe98f95f76f1615e64c4abb1137f4c31b218ba2782bc15534788dda2cc08a0ee2987c8b27ff41bd4e31cd5fb5643dfe862c9a02ca9f90c8c51a6671d681d04ad47e4b53b1518d4befafefe8cadfb912f3d03051b1efbf1dfe37b56e93a741d8dfd80d576ca250bee55fab1311fc7b3255977558cdda6f7d6f875306e43a14413facdaed2f46093e0ef1e8f8a963e1632dcbeebd8e49fd16b57d49b08f9762de89157c65233f60c8e38a1f503a48c555f8ec45dedecd574a37601323c27be597b956343107f8bd80f3a925afaf30811df83c402116bb9c1e5231c70fff899a7c82f73c902ba54da53cc459b7bf1113db65cc8f6914d3618560ea69abd13658fa7b6af92d374d6eca9529f8bd565166e4fcbf2a8dfb3c9b69539d4d2ee2e9321b85b331925df195915f2757637c2805e1d4131e1ad9ef9bc1bb1c732d8dba4738716d351ab30c996c8657bab39567ee3b29c6d054b711495c0d52e1cd5d8e55b4f0f0325b97369280755b46a02afd54be4ddd9f77c22272b8bbb17ff5118fedbae2564524e797bd28b5f74f7079d532ccc059807989f94d267f47e724b3f1ecfe00ec9e6541c961080d8891251b84b4480bc292f6a180bea089fef5bbda56e1e41390d7c0e85ba0ef530f7177413481a226465a36ef6afe1e2bca69d2078712b3912bba1a99b1fbff0d355d6ffe726d2bb6fbc103c4ac5756e5bee6e47e17424ebcbf1b63d8cb90ce2e40198b4f4198689daea254307e52a25562f4c1455340f0ffeb10f9d8e914775e37d0edca019fb1b9c6ef81255ed86bc51c5391e0591480f66e2d88c5f4fd7277697968656a9b113ab97f874fdd5f2465e5559533e01ba13ef4a8f7a21d02c30c8ded68e8c54603ab9c8084ef6d9eb4e92c75b078539e2ae786ebab6dab73a09e0aa9ac575bcefb29e930ae656e58bcb513f7e3c17e079dce4f05b5dbc18c2a872b22509740ebe6a3903e00ad1abc55076441862643f93606e3dc35e8d9f2caef3ee6be14d513b2e062b21d0061de3bd56881713a1a5c17f5ace05e1ec09da53f99442df175a49bd154aa96e4949decd52fed79ccf7ccbce32941419c314e374e4a396ac553e17b5340336a1a25c22f9e42a243ba5404450b650acfc826a6e432971ace776e15719515e1634ceb9a4a35061b668c74998d3dfb5827f6238ec015377e6f9c94f38108768cf6e5c8b132e0303fb5a200368f845ad9d46343035a6ff94031df8d8309415bb3f6cd5ede9c135fdabcc030599858d803c0f85be7661c88984d88faa3d26fb0e9aac0056a53f1b5d0baed713c853c4a2726869a0a124a8a5bbc0fc0ef80c8ae4cb53636aa02503b86a1eb9836fcc259823e2692d921d88e1ffc1e6cb2bde43939ceb3f32a611686f539f8f7c9f0bf00381f743607d40960f06d347d1cd8ac8a51969c25e37150efdf7aa4c2037a2fd0516fb444525ab157a0ed0a7412b2fa69b217fe397263153782c0f64351fbdf2678fa0dc8569912dcd8e3ccad38f34f23bbbce14c6a26ac24911b308b82c7e43062d180baeac4ba7153858365c72c63dcf5f6a5b08070b730adb017aeae925b7d0439979e2679f45ed2f25a7edcfd2fb77a8794630285ccb0a071f5cce410b46dbf9750b0354aae8b65574501cc69efb5b6a43444074fee116641bb29da56c2b4a7f456991fc92b2\",\"debug\":0}" + diff --git a/iguana/coins/basilisk/mgw b/iguana/coins/basilisk/mgw new file mode 100755 index 000000000..416befe2d --- /dev/null +++ b/iguana/coins/basilisk/mgw @@ -0,0 +1,2 @@ +curl --url "http://127.0.0.1:7778" --data "{\"conf\":\"MGW.conf\",\"path\":\"${HOME#"/"}/.komodo/MGW\",\"unitval\":\"20\",\"zcash\":1,\"RELAY\":0,\"VALIDATE\":0,\"prefetchlag\":-1,\"poll\":100,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":4,\"endpend\":4,\"services\":129,\"maxpeers\":8,\"newcoin\":\"MGW\",\"name\":\"MGW\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"fd9feb93\",\"p2p\":12385,\"rpc\":12386,\"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/basilisk/mvp b/iguana/coins/basilisk/mvp new file mode 100755 index 000000000..e77c37475 --- /dev/null +++ b/iguana/coins/basilisk/mvp @@ -0,0 +1,2 @@ +curl --url "http://127.0.0.1:7778" --data "{\"conf\":\"MVP.conf\",\"path\":\"${HOME#"/"}/.komodo/MVP\",\"unitval\":\"20\",\"zcash\":1,\"RELAY\":0,\"VALIDATE\":1,\"prefetchlag\":-1,\"poll\":100,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":4,\"endpend\":4,\"services\":129,\"maxpeers\":8,\"newcoin\":\"MVP\",\"name\":\"MVP\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"dd5ce076\",\"p2p\":11675,\"rpc\":11676,\"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/basilisk/pangea b/iguana/coins/basilisk/pangea new file mode 100755 index 000000000..715798269 --- /dev/null +++ b/iguana/coins/basilisk/pangea @@ -0,0 +1,2 @@ +curl --url "http://127.0.0.1:7778" --data "{\"conf\":\"PANGEA.conf\",\"path\":\"${HOME#"/"}/.komodo/PANGEA\",\"unitval\":\"20\",\"zcash\":1,\"RELAY\":0,\"VALIDATE\":0,\"prefetchlag\":-1,\"poll\":100,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":4,\"endpend\":4,\"services\":129,\"maxpeers\":8,\"newcoin\":\"PANGEA\",\"name\":\"PANGEA\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"5fa45ae8\",\"p2p\":14067,\"rpc\":14068,\"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/basilisk/revs b/iguana/coins/basilisk/revs new file mode 100755 index 000000000..6cef30fff --- /dev/null +++ b/iguana/coins/basilisk/revs @@ -0,0 +1,2 @@ +curl --url "http://127.0.0.1:7778" --data "{\"conf\":\"REVS.conf\",\"path\":\"${HOME#"/"}/.komodo/REVS\",\"unitval\":\"20\",\"zcash\":1,\"RELAY\":0,\"VALIDATE\":0,\"prefetchlag\":-1,\"poll\":100,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":4,\"endpend\":4,\"services\":129,\"maxpeers\":8,\"newcoin\":\"REVS\",\"name\":\"REVS\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"905c3498\",\"p2p\":10195,\"rpc\":10196,\"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/basilisk/shark b/iguana/coins/basilisk/shark new file mode 100755 index 000000000..9a4e73fe2 --- /dev/null +++ b/iguana/coins/basilisk/shark @@ -0,0 +1,2 @@ +curl --url "http://127.0.0.1:7778" --data "{\"conf\":\"SHARK.conf\",\"path\":\"${HOME#"/"}/.komodo/SHARK\",\"unitval\":\"20\",\"zcash\":1,\"RELAY\":0,\"VALIDATE\":0,\"prefetchlag\":-1,\"poll\":100,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":4,\"endpend\":4,\"services\":129,\"maxpeers\":8,\"newcoin\":\"SHARK\",\"name\":\"SHARK\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"54a5e30c\",\"p2p\":10113,\"rpc\":10114,\"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/basilisk/supernet b/iguana/coins/basilisk/supernet new file mode 100755 index 000000000..c4fc10ea2 --- /dev/null +++ b/iguana/coins/basilisk/supernet @@ -0,0 +1 @@ +curl --url "http://127.0.0.1:7778" --data "{\"conf\":\"SUPERNET.conf\",\"path\":\"${HOME#"/"}/.komodo/SUPERNET\",\"unitval\":\"20\",\"zcash\":1,\"RELAY\":0,\"VALIDATE\":0,\"prefetchlag\":-1,\"poll\":100,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":4,\"endpend\":4,\"services\":129,\"maxpeers\":8,\"newcoin\":\"SUPERNET\",\"name\":\"SUPERNET\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"cc55d9d4\",\"p2p\":11340,\"rpc\":11341,\"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/mvp_7776 b/iguana/coins/mvp_7776 new file mode 100755 index 000000000..c4a6d0dd0 --- /dev/null +++ b/iguana/coins/mvp_7776 @@ -0,0 +1,2 @@ +curl --url "http://127.0.0.1:7776" --data "{\"conf\":\"MVP.conf\",\"path\":\"${HOME#"/"}/.komodo/MVP\",\"unitval\":\"20\",\"zcash\":1,\"RELAY\":-1,\"VALIDATE\":1,\"prefetchlag\":-1,\"poll\":100,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":4,\"endpend\":4,\"services\":129,\"maxpeers\":8,\"newcoin\":\"MVP\",\"name\":\"MVP\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"dd5ce076\",\"p2p\":11675,\"rpc\":11676,\"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/confs/BTCD_hdrs.txt b/iguana/confs/BTCD_hdrs.txt index 6ebde857b..20e1e85ee 100644 --- a/iguana/confs/BTCD_hdrs.txt +++ b/iguana/confs/BTCD_hdrs.txt @@ -1,4 +1,4 @@ -1287010 +1451505 0 0000044966f40703b516c5af180582d53f783bfd319bb045e2dc3e05ea695d46 a5d211145f8e6ba0920b2893d307c5d7c207ae0800a80955299678d1706ea8ac 000000000c4682089c916de89eb080a877566494d4009c0089baf35fe94de22f 500 000000000680a9a697eb71155b18a5827e0889fca28afb81fcbb46469ed7877e 79f80a8f54c6762d6408347c6dd7dfd2f8b8c191077c1d7881dfc5b7ec6a408e 0000000002b868fe717dc60b8d146de4d9aecf779b7314224908566e01847769 1000 0000000000000cf908c887020f8970b7fe952f8b81164d83a87621dfdb581d08 3356ec4296ff2f04281492b0dedbaed80edeb6dd9170b87230ff79f6b0daade7 0000000000001e7c6d28962a03b3d75ffa1355ecc6d3021893b2727a1ccfc669 @@ -2573,4 +2573,332 @@ 1285500 47d91223c2513842f9833d26630079872e58b3c29ab1c2860704513ff817a017 4c4befed95e81a843b315466a3c459b61de781f68a4eb3e545a1168779f84fc2 1c4f2e61bde40eddbc29137cf4aefeca2b1445dbed4b642fa778dd481d70a7f9 1286000 d68322938435a8915aaa0a1755c5ef11294bac81d64a76bc576424b373079ae1 010ae35ee9093052277dcba8a3456effe7a0eccbe26a32a8e3dbe41df5b02409 72ef60d505eeeb89e538c243b860d03597bbd75e972e698f1a604d4523cc20c3 1286500 b68cca2dcb4aed574ecfd888f2d87711b3939b05ab5798c5671395b6b032a90d a4037221fe0b9fe5c4611d77d50c661d2efc4038d983e17c463236ca0412896b 23910f32c4f9ed70129db37cdcd238c217b255c806cacacf196e3524f8b37850 -1287000 20df89c8172f75ebf33e232d4b3ad8b4e81039a413952c625b8e8d661ec3d0ff +1287000 20df89c8172f75ebf33e232d4b3ad8b4e81039a413952c625b8e8d661ec3d0ff 8c488d6d7f4bdbac9fc46816f60af17f6192c0af223ea293c8ce6f5443defc0f 23a71e064d939c75322e060ef79ca80ed814b78a81fc411ddb831d7f30c869e7 +1287500 ba6383af803394cf08e1cd1104707c48abfa7c12079da59d8998f93cd3acf79c 106ff3286b6b0bdc1db8b9d99adb149549277874bed76801c2bb7971dae9d38b 6dffd66cd2b09cff26e69109a163053215a62f5fabe761dcdc065453c03f3d5a +1288000 14aa18ac460dfa1e2c7d63f961b78a728ed23358291a5685cf6b913ff83c6dfc c08b9cdff419ba06b7479704401e9168eab444f5269d970662e166b50576b026 304bc518e958126f4f9ef6815d7dc801c9c88820b474f77e9ce65009ce7c0eac +1288500 7e4bd680e1b5f1f46ebe238d6d40a9e6631ff0edd83d6ef740928e60b1682912 4248a1181d9e69e912280901a4e43eed13c926e4944c0c734e42d94f35084fde d494a6f50cb58e4a1b9f79821b869c405c64db057408e1fcc596b4549e71982f +1289000 414548e45f36896f22ad5f1a23c7a9af321c3ec785e5a817400522d32ddd8369 4b4fa31252bb8a9c8d493b021af4d23f95ed0b07ee1f4bc5e050fc301fde9706 08d3045cfb01cc60dc74dcac89b3033369276c879693dde857848f58ee026e97 +1289500 0f88ab1ab8359bb519c6c97c83f804a47cc692d75b440b149eeab343704b0947 5e6206c6266227673705b62a30dd47e4a262ca15f1932d1624422d4fa45191b8 a61cabc51c8b4b1296611938b94c2c7152292b8387c2319cf8540ae0464d1cee +1290000 590a14803906c881f2a821244c8c915c19e82cb9f10a66bd9aca03f9a15e82c7 9e7713b23cdea50014758a591d7505d4e46d3d3433b7c132d7610bf5aa874577 d22750df151945df3a67df0ce9e0cbe39191d177b19f3e1880b64b076789f773 +1290500 7e3f8559269c2326e55031cc64a7f1064a84ba9e3c05d64f3dbb0c0cb8004fce bc1402ffb523e4f9662699fd8f4012575dce33fa26dee5f43b04aac5d62e2731 19e01298956e0f1d70006cc93a49359a8f89eece634f9d3e745d699f094dbfd9 +1291000 59331a51e1155078bce69ae690d3d493c0ecf90e83550a9b7fc4ad553fe54748 a2dc677b5280c47c6a5329f6eacc531c6964aff4644d84a800290f5e6043f5e8 4fbdec3dba88001029ddf27ed6379748d1c7d0b72bef5d87bb1d4dab6c1d834d +1291500 408c40000bef4884b1a9f5447595d3032bb195b64edde0a9e2d1d2d3284cde71 93b3285e4412f2336afab88386a2a81fad4a88a09888b6fe6fba3810ff150003 72d51de88e1660f36dc602ff134184ebae354912cbb9c9d64fc5a67283d0b987 +1292000 fcb637884d11db210119514106fdba725059b56450b583e65b86a21abc3995f5 60931ed48f92c6f113e333e6b0e60ea8693f327ac646ecfec72fd08d26584471 dce81ce44896536fd646ac60decaee751b873ea9d32af538979af093bc5cf2df +1292500 a984b66998705b6ab9b9b75fc29a3cbf7426a9e6822622e87f7ce74d413c222e 39a199cb7c9df33c96314f8aa273aecdfb5ea79ae07b8d37ff56ec97778409e7 eea61fbb9d9e5f8e06f0c129cd46a55bd42cee4e33909507f1178c30d99a814c +1293000 079c6fdc893771a52ef83ccb7446c211aee5a450123e437679950ec259a732f9 2e1ac92fce11ee935c98ab01436df599e6cd902216c23f0f82398d52f6daca79 893e2588ba973d110bf7988bb94e555367cc8ba1f1a74b043bb9358dde4044cd +1293500 b89511bac310039ffc518832850462b6b0764dfb630daa85081f52d75a994cc7 52be93d0aad438223bed937820346a0670cd739786600e326f8e2df40b760557 cde2bc01b1ffc4bfe0eac517a1628e0c34ca795df5f3c41279fc776c6fc9bdf6 +1294000 04f5665ba3873e3112e4781f97999de407450023f4d96f8f5202b2fe4ebb61cb 5c69030cb3331e78c3d8bb6ca1c2f6b4ca53ff58961ebb7113a128d520bc206a 0f3a01ad2fb0ef1efcf5e869bdbc7799abac0a6d889c00558c5bc18b84ddd64a +1294500 aec70de5b6147e90937f37e5c985cd012387634c21c9df9e2bf0e8f1d5d46c89 f1ae24ba5754969938b4b1b00cd1dbeb8cf70c9e111dd77cea76138999f89e23 43b746ba357d64a69e5da9f14ac9cd4e9e2ce559858fa44b4014e77ce86fa31e +1295000 c5c31da183bdfa79f4ac6da353fb240edc01cbf1a5633ba52350117899088ce5 4c167cca85f5a846f0eb52d54280ae75c8f5991feb1bc18fd8acfe1ac29a418c 447ec1bc8cc5124e741456a96f030d6e25dbe21affb832e5064bde5886fd45aa +1295500 1aaf95d33f9e1c29510b7b46fc3aa120f3fd630354a17c6f2f06b3eaa6a19ad2 6e0427850445a6c8ec8b1f1d48663dca8bef215c0e91c4cfaab80e8357414eb4 9860e48a6c7309574649a363503bbdcee0985e7dcfe8166a00317573e4cc33f5 +1296000 37e8f1eee5c54282f50afa8afa6d9206f3cf5089252ccceece2a59fc6e25706a 66e7a2bf7b271c4d84ee9b0e8a769895c61fbd4fec16eb51a0cbdf08b344541b 7eb6245bcc57ad780c342096fb6c94d8b7682bf38de939d35793a9ad700a5c63 +1296500 6adf2392e205cfed81fa3e098a3fe5259398448bae7eadfb8e8e8e99eb83641b ca615dfbb481679822d1ae3588eb721f9a8d2771ac6410710dc2d9f1e1fca013 9b1fa56e4fbea01f4c4b1d5cffa3db4441097249688191d4c0b10bf2df453bb1 +1297000 f50fb839a010fd4049a78d16dc18c02226277a1160d45a31b51a5d8193e5dad4 2e8cc7bb69ef19638e8b4de77421c159430bc9b2a96f05d4461a3125ad167cb3 6a361e4157603d6486d3aab9a6344dcafb281727536506566c276ee30ec690c9 +1297500 f2c47a4395bf9b340ec2f97ab2980577af9aecbfd4a6153151771a9bda66cb90 912ae9da2434b0fa6b9f3154878bd7fa44c0fe3391f4bf7737a6d6abd289822a 389b8e6174cab770924950a3877b7cde32007613b88da8e9136e2ffa4dea5f9b +1298000 12f1be10df5d692a1c9c81e85ef78b4e7d0b3761a065ee44dd3d50b67689d021 8ed9590b5443c0c71de752292718e65ddb576fe2d6a0c81a46796ff0def3d7a1 982bb4d013c7cc8e042f8d5e1378885e9aff4e2e9476c0f97033362934ad501f +1298500 62d27b59d6467a101fec17ec5220382907447e2f9710d0784ecf5b723a611119 9512d7719b4fae3864bf692ca783131982ce81007d629446ebbe2d63df498e49 9b1db3cad736a13ca4d230c98ae4ddccc68525758e946c4f1a521bd0442903ad +1299000 e92c71ba19c0389dea054dcefe7198c1520a8512f82363d2b76b546b813a2204 91cd66c70bba8b4acfd8cd5cb27a12413abaec59b24e8d41cfb3175721744b67 9afad7e1981157c5e51d98a2e283cbdfe8a3496f17a6e2f5b6cfd0b73e4f0f16 +1299500 96ed3b01ff2316b7f5cd27680ab31198a606f5f2f0fd129892a7f692a6194201 956530a5d468696a16f9d3add8dbb38a1d375fea904813548636dfb5f124cc44 e2499622eac5c0a34adc22101b2a4d4721238547244e63089b5ca8d389ef96ae +1300000 975f2e29856bf89e0e6c38dc07ba8a6bb1505207b34b31426f437ffb1f98a078 bd912634d61420201a2bb34510b63007832a1c425aa1ef6f01e02456c1eda5dd 5825db0c30276437b7b4438d3bb99a97af8f855441b4c34ac76ae83c94418b1e +1300500 0ad9cec502fd4412f65f2c555bc345201f6b1c820d7ace8c27e7b559aba11de2 4425c5cf8a79b1c6823450c5faaa47c343f08f4bbee24d0b0571c3dfeca1860c 0fafe1c3b2ef9a337438bfb895f5e570a26aca52abbcaf8a246798ce7c64095f +1301000 c887909db7b46234543b9f5fb1c06070dea7cfcb59057d8a74b7cdc20763b46e 0fddda8bfdf47a5983e1213d76e659f96ee5bfca21623edd63da9f5c3bbb2dcf dd9717832aeb0abfab6ef027456e5635c3c5fde7c66b984b770744590433a514 +1301500 b94b86acd563f315962e65c1a13707cb4f744f743079eb5ccd4129139aa29162 db9fd455d23b53b7ab9eb38b261465b065c92111cb07656dd6e59db22c9c704b 0e1a2d9de95d2a890d62a2fb61e0c734ece7793b25cf19732aa5712c082375da +1302000 bce64a2df75d334569a0628937524f39a402190f4569dbc60911b8ea255aafc4 558caaffac3aac7a431c8f4b601705f274b7528fa4852a3ed8ac9916e6092355 52561f009c829ba11e2a3a8d04b097fb5d3de02639a26334f8a15fa3d442e7d0 +1302500 fd4a1145282430b8e05e1ff7292ec164de8242dc3b3707b3f10bec0e77832cfc 608778e86dd856fce3798e29199f33ba5a8d6bc03e1497e8953beb362fce3e78 6579ec234c0cb3fd53d4577fc17117c74c30221dd5963ad9f0871b35d1f7e714 +1303000 8133e0dabaecb7f19f01f4327851017e9e2684ee9aa35d5cffc588335137f81d a24036231b2a49debfc0eda8eacfc830e74093867cf7f05b785c44efef62944c 5664f5880b5d2e30b49cb29261dc1487a247708b3a6eea78e65d5d785df33521 +1303500 fd6c9d4534017e075406060204204c0578cc30be43f4531ce4fb485659c9396d 3d442de6e2a9c4cd50210f7114350d1d273cb65f1ee2cedcd4aaa5faff39f5d8 fd2b378b189a4f8c5ddc5b5a947f84eed858a1f28576a058b4ff626956da3e27 +1304000 7112169cf4509aaa768268a78f3b1d259baa146ad5327bbe7e41e9069d57ed13 7107274326934e899f8d90ff49115e9ac3afe50cdd236881a718029d2104855c 661851b7a27c004fd2438d24f7464548e09b4118a42a64cbbe4425bf1e1c635b +1304500 b10032a87ad4981f82dc7750aa39e9d6799b06b5cb4e21c773e85d850bfa2791 0b1ecfe1187d61df67b3c1837814a7d765f8f0f9143872452c0afb10f9a8ea28 6d1b44bc28dc5af3f96c375b81a40e695cc1149c79a2b4ba6bf6cd4411d5ec06 +1305000 1a130cee1b0f87f045a7ddebe316794b0c832941303924e987e4cbaacbb36975 2dfe373eeb1d5a995e02ae71d12c467e91393766daa5a1648ab82670bcc0a532 ecb1537854454e0fc332cfbd7de48bf1db6ee99110117ca8b45c877a2f4f9790 +1305500 e17eba1cc1b45569a84728dea0389b055d8bb9afcb8777a92eade5386ad05e07 bbbd49c9ae9bd0c76b428771cb8d7648919c0e1ffa619d6277c9d50e6d8c0fa3 5f8d86d2b7c0e906ad6b345ff2099414685acb5f0928f7baf6382ddcf87e6de7 +1306000 baad770e63b8324815b19d55dd164cecdeab4495c7cf474dc9f8914e77bb52de 25ea3293542b46107b15e5359e012cb99173193a0f470422b4132eafd69be03f ed593c06fef7f72fcd109fa3cb64c78fca75fe66567672a0ce21b5a48004cc9c +1306500 dad1ccd7f76c94a4e7ea6c94b8ca0154037509d0dfb7d40ae4c0674868e46d35 358a55160879b82869315151511732e9f1c7ea6f8c6695d778dbc9c80fd2b526 b4a89042edb0b747355ac0811a41657a2ad0bd5d736a93e44a4e82800c78e091 +1307000 449a40c7924c308ea4435762e3eba07b53113ca0f79b0f6e8382f22450959f16 5016ed7b1d89d52c08275c349a1e49c48bc334402a32a54ea1ae750a82ff0159 25d6ab38024133145b61919bb886479b3a4b2f7470bdb0ada052f07846dbd85c +1307500 6f7d300cc13d074b861c61ded690581a3de387b329898923344badb9e0fba8e0 a9af85bcdacf3bfa1dd74c5ce6f98be902beac71b715c46f4ac2f73e22ea292f ba918cf157d001ece92cae5e85147ac9d254214dd748082619c35d58b66ea8f5 +1308000 f2d1363624c5b5a75c5e33ac6e554ecbd0879b7c2faf1fa92a826315571350ab f5dc1f1eaae9aef8380140100659784247c2de2984c65266aaa23bcd865d923a 7366e95913db545bc58789da558447dc4bcb608a6cbb7a22c2112d9d70c8f2dc +1308500 d0b9ffd1f4e1b370fd6331976bad8b91266139069b4acbeeec23c4f58d5b04ab b85a1c505058e2182246ac231258adfcd1cce01fa22d112408c05c547e228549 ea1b220abc0d48583df9a3dff8e42a22e372e68517a7f6d4c4c5b3f2e17a0920 +1309000 65651bfa77d5faf1693f27d68cec53be2f89cf4ce9db85085fc366b120b421df 00707fac0f8feff0e78210251a4828000c48f25ae7d7606b09412704e4c1dc32 f3c1e90de4bec64d70bb6b3eab484b29e0d7b3112d0a85979c1fd973ca38f2f3 +1309500 52843cee7c3f212e3a87dfa07cd83247d2d92ca6460ddc770711d704ca5144a2 1ba329b5f25a19880699de989b426d3e53c0d548b985076832b88af0989c996c dd88970433faa179f4ed7a0ee5b3ce2cbe8e03487e76f61382eab67ed08718a0 +1310000 35aa5778e094f3b24b1033bc92ac76da70426e80e0bb1188b8f2795ec4687cd5 215baa73a90b7ecbdbdbd2ac39f9947adb07f95b188fe4aa4e43e2c432bbe29c c6fa8bdd27d9509d89a2a45791d743b80fb69b1d2901ee7ac1bb27fbce523bae +1310500 a0994a46751b8d2be5162369643c9641ac99916a38be19e1b0278a4ebd771f97 d361196a389889a3cfc524a353efed28384202fd1359de3412f3606afdf5fc93 e08a070ce0b2d11d08d399a619cc6c2e0cc44e79ee92e68ee76ad8dbfaa9186b +1311000 20c091753902fc684bb9e78032e4456e20603f2aa3799ecdf38744c9e826c82e 988d02e5265ba09e8e2e4b5f3d4a3033c3f5eb5a7c5d9ab39b176d97bd4a833e 6a4d7f67be57377e310794a7014737d65539d1e03d2ecbd6b5434d2113b6f5f7 +1311500 675919e065fb57de407cbda5e767d1f054519cad55927b5d731f788f74095ce5 bc9dadd029a4f294fa9065067a5afa88f36d038e1443b807200e9dc60488ad64 25aa0485a49308b89374f9bd7b3b11718d3e3f809d1f193c9867a46f71057f96 +1312000 d33f0d925ab7efd733a8697a54bb2e84337e88c24f9c6f62f93e1f16938d760e 6904935251a3af06aa30221df6fd55baabd76eda2ec5d8939cbb0b880d476ddf ed9abdad6170f8113d0868a4bc25eb15036e9063ea7e81db0b183a6dd13a99c2 +1312500 0b7b8a2979f1c01826e26d88668fbf591ebcb151a61aa2aad2db9bc621735bd6 302a0336299e06d75ee605c34c3f66e41f74d0f0694dcddee098d4c2e2aaa034 143426b6666867255c27a7d96cf5a30d64b15e5ccd503d965568de72516dd137 +1313000 46970f602f34804cb206672df8da4b06695a717a760e0c3e38d81a1f687aa93a 15348af5abae92b1a07f1d5bb5e14a5d56237965040394f15dc28ff0b4ebd958 c453778ef2cb1bbe9e3ab5209928e15a7a15bc1df313640d3e29ee488595fbb0 +1313500 5788242cd701f3e2fd301e920fe0759e9e79f6ebf33e3af9f5f810df6e07eb48 fc3b0ec24934c266cc3f953af9d3e852cd76dff6e4aaf15436541a2f99000130 ba3f2e8116a1405aa63d707ec22d05a1e64bf90f5a8db2dc6fe011ea8d86d7ed +1314000 8e752044324f93c8bf6b92e6196be5a78e3e732ef8187ff0a625b70fb377d588 83da93b29fd11d169567a3ebe0e8b69eb983177585fb14b2288766d66e01b892 250ff4a03277dce320ec0606bb007395fccce3ad40310ae6bcd371c5f0130dc1 +1314500 50cb9a85c311762f226056c6e2d3fdad77c72cac9689521252f7118b3d7f80a5 6daec22c53b55b5880e0a4e12133b3206a56e3c54f0a625b099f80b79ea04846 a597acea03376c209fa38173208279ce0e5a724885e63aee6fb94332fcef5ef1 +1315000 04e6b39f6b1ed74aa5f480356c06978ef66e86d7dc8420b1de1bba5d17c2ef66 a8322867072074c4f43a561a23589aedcf1b9309ae43003764e7693df8c3506c 2b10fc30946bb56db5e420b01b1e8e00fd2b68144276620c7b602c99197481d1 +1315500 a6e5fc3d9533df21d75c6ef6842d1876620335fa10f2b6125a7806a9a5cd719a 21caa446c64c612bca85e84938dc755ba399addcdd0f35a9c33112fb98e5eef1 a106d66bc5085410c37c425744ceaecfa13c9a0e058c0750dd5318b715829cb0 +1316000 db2863ef1d165fe68b5f9709db05674b22ccfefffd954563dee741defadfd1ba 408dd02ab1084a6a76c8f85fb4f92ea3f676ecee8b94b4693ce275e2d09ef6f9 4b01c70ef24f30b7b8fdce145116ba725161339dca17c2daaff1009fc7e8c95e +1316500 eeec218c3c1f10186abe46729df60f9d72f3fadaa35ba3480a60b099e5f60b27 3d1348e98cc2fb807e6fb7f76da5e9cad8d8ab4d51ce89c7c6f41feee4bd6698 f5bd4a8b35b80fd82b57ec845dfe4dd136361147bc8fa2f4bc96a4b50fd569fd +1317000 215ef30ce534c60be9f76c9d0a585233c9628b916a200c4f9b065fc4ea5510d1 0d05ed5c7e89756edf08be777afbdafa26bc8701d10c332c3aed01f755b6774e d605dd429eea4baab063ab12dcfc21b6feacc73da0ad544b59559642699eb8c1 +1317500 ec723a7ca3506a64ae6f72efe7cd6bfc5ceaa1f37fb12800fb574b35036edbd7 d3370646e718e1b9492a552d41c8487686570fbb5ec7cc7ddbb0a6a3fdd8bd4b e718953aa8621a11084673972c3eb7edc93167deef1d903cbbdac60825fe27c4 +1318000 42f2cd60745a2f20f12b711f71751f335b4e45384ed0475d886ccd25a1a09ffa 8db54d2f981ca18996400b1a5606cb9d0caa27a2c90c40e5d07eabdd93a152e2 db0d5df009e9619a46cf5bd8b85a15b87950540dec20e4b67b6b9cfe3246a215 +1318500 bc9257f668c2403e605c2d561accd6d9fa80391c8900f0ded17ccc2bfcd38c2b ea38513fe09a249f346b98aadf558fee9bc08fee5d41cd3c8e0b734da6a2b55b eadee28d3e19873a8dc80d5855416f10b32a5ed0d0a7c8a2b4a1704aab799ba1 +1319000 88ca4eba8f35c423e9385e3f248a204695a3ca251cec76690ed1c4d422000540 60b5e9c72314a0553c63412b5464038b61fa73ce85a9e79ec4952ce4e6514452 cc07f20b1d6bbc525d9976eb613d62f4a5a23b820ed6ff8f67269fbd6e24c28a +1319500 5d4f85d56fbda084409f4fa380b68be94a16a5149cb04f3ceac7006de58021c1 95180988392c9484d337d4c1c657a55cc01d7beb998b7f8da3a0b8ae0db5509f f729b56095b5b0f49feae95f2cb0c72252c24ac49308c40a38a7ac7a34f27915 +1320000 a8e38e06d11cdc27f90d4b261fb356fd8faf78fecf0c0eada19b662f0d4fff8b 78c11c66b71c77f44e8444cb24e65e3e235a373272da8cb4a8dc89a328ba0ab5 4c05cec3108ad339b56766628c4f130f54d284b9c41197e7575662dee9632d14 +1320500 892e535c9829da5008a53e47ab6aeebaa5eb5cb9db69c60fbaff054929acd663 910275228fcce2fe3136aaf1b0a18a2b9b404e527ee0e1c891f5297da1f8a8d3 843582d1a96d117f087a59db1684e1edde124a3b7869e773783b00a6db15a7eb +1321000 0826d8a9d96cf570c4e866b89380424b7052396fe71e583e829cb29b01ae6c41 f0f0461f3471924f1150ed7295ce927d2f1ac46c5a677620804218953322c23e 9815fed0072234489345c10678a0b5575d7beb1e3ea25f16691fa1a50178526c +1321500 1445c93572d625333aad113e9bcc1ceaf433b3cb9755e21dffaf5af6237acb1d b5e483b2101bfbc3236528c141ca2a2003eb196807c9b7fac73377ba487797d5 c94810a72cb495fb592ead8ec0823e78363ba4000aaebed9ee704bc35ffc0c59 +1322000 ed72c3f182a1db940de93f1e22c0cfcb3ae32f6c803e265e9d889f5dcbffa0e5 e7ed683971217957874b78bedf43b5a83fd6a6de3d8ccdec564e4dbb556555d9 97f9ef26d07ce1b83906e8226dde743e06a0426d4529b365e9f75ca04f87b8ad +1322500 66584b90e56161ef1e9566af0bd72cefd3ddc7b93d6236677943a717cb3675e9 a8279af051f87774ad83b9e738026868649934c1428b7067cf8d531c8f6325cf 9e3f7186be531b2727daaeecac65eada5e7f82dc5bd162dc282b4f7e501190f5 +1323000 3ceb9d6191356079cd1c7cc4e3864626b68bbf1a69165b0ced2c8d9aeee636d0 756078fc653f2749d855c7998815c9679835b832b1cb65a1a2d0672d098941fb d2d31a6343ba89fdaa0fe25af7ace703373a66e8cb86f73115996f8728df8668 +1323500 084987c0eb445632b5947efdda82b5c495907bad65415bed6c1974f02e49883d a9246e5fc38ac01ed5ac7b59610331cc474ce7fc839eef50e8a46388a2613078 133e9f74cf623442a8de0443ba6644a2cc42b432ec5f5d4181df44aa6552091b +1324000 f6c06411dcaeb4e047ae00791ba5e7e66777cbdf966765ba2b11281a2d6a207d abe842024abd3c854c6789204aa707cead8c8f0ddd1c61bed5209e54569ce8b4 83be6c1870c4701577ed5439cb92ea8ff7336d33b65fc088f86ed866790da165 +1324500 af410bc94deb902ce6d4c36b7a90960202c64f8398afcaa9e8e68aa2f41e0820 2ac8b1f399bb19550535d1f215c347fb60a53887cd756577a8992c83f7d1c83a c25aff30d3a74b1764ab377e66e01ffb7dd8be9f78ec00ecdbfe44181331cf1b +1325000 cb5b9a6b345db9b1ec8abb1eeb3e5c9013197e90dd6bf7d40e60cf9935e4d604 80825b63c7d1cc826f7b82b1588773e75f4b71b3255f283d5c5a584b967b351e f03213e41e99be31ec5cb9a75e5bed355d95c893e20468d9e40116a9e61448ec +1325500 7e8bdb833d586a3615380e6555e54cc5c8e5978caa75e556b3bffc160b425e1c 0137351633adb5b9b72b7bb29c8a055bf5bc37dcd9f935be1c9421eb85578572 4a1117fc1d36a0877cb3b2f31e6ee576eb01923b6b974e6b073d86ac0b57343d +1326000 5abc0c39b0cf29ab0ea335bb8fb4c873e5b3009e73ead08aa642147241d0a0d1 db6fd87fcf7b90f42e8404dfe9af95ebaf7038ffdab95eb2f015a53589059303 43f2991b18845e8c2d96cbb96e3bafbaba7a1c9da9b2e8543cb2ef64e35ce88b +1326500 00c71e710514946ecd24a4cb2a85d1107e481dbce53a196d3494071924a038b8 7ca02c6d7f7576ab327f402febb03403f4292f9d0fa6ceeea1684e3958e1c3d9 d8499c58af0993c9c028ed0f5436b33312ef1688f62e90a1e19846a1322b1afa +1327000 03403267f98c67b1b66e4f701aa3cb0e8219230838f400b8b0b49b442e023857 a163a0818e4f64334ad046e72fbbe3c8161a0f5ff1bf52aa9a7a556dd46e1ac9 645edce616a09a96bbfd6cbbc0f65f2d9fc1fafb41f83ec530d64916600c92c2 +1327500 8142b7c78effb1d6f2fabcb07f4b0d6909d083d8fd3fe0966c566c90fb5cf51f b94321ee62c251845156b9302646f8c1801659dffd6d92bb483da0f648cc72c8 9cdb8d09a66f35044287aa3f7a2bf3e3c56a55bd8809e426a3ebefc4b9d2248a +1328000 9137f3fc100719789a871a7f10da24d3561f4241fa03a39431ed3c6479114d7b 66860913ea6a119f760c42682cd44edd51cec90e4acaf28c8f3ba74467057a5b 256c892718054b55dc43a3a3fa304093ca7587073519a6694adb91128975dfff +1328500 4ef04e76037c445c2196d56112ae5cafde52b1232828196e415642f7bd479c95 0b5a8707eb6cc1df15188dffc9be91563ea9db12c8922d65df8c795b744c864a a24f07bf3430dfce44efd11c24e609149c12b596142ed14524079c4d3c43fe95 +1329000 dfd2f9d946de44d5216e2798cea1a523124781f7fce4cb573f724c9dc254e568 4ba701061cc0ee9c912474c8b878f4af8bdf00e59738ceeeb8d88c1b83a431fa 4d7c6b3362c653cb0ac2abced3b471db8c5425dcbdbc7b9339a4d5deab0d95c7 +1329500 208c82ed9e60057ffcee35fa36dc71d4b33bfa2cdece6822be9e71e6f16fddbc 82088ff7f2e31da6b683d76637f6e3278ca54777b9fcadeff34f3f36729fa593 be4be507926c06262387fba500ef8cb90eac657690eade13c94c4085766ff475 +1330000 7931b7542a1cc3de43ce17b17f7d59195113727d8b265d08416a94477dd8afcb 6bbde859522632482ea09ff25feffbf908710c893a3b4e50f377cfd9d13c7534 356bee4ba090d6a8fa7f6e5e9a151c60322b0d67643497534646b61445ed300e +1330500 9ccd443e94d6b67c10b6cbd64c01012ea022d25b1313fd33e824a7dc60a74632 25514c86048597db2a6e09601dd58112f481e659737baa8b2d21b70d0f6af744 c2b40441f53cbaf079da3df183378a1db3e79e53226e793305c47754a9d653bd +1331000 83692b3b50593d27009f1761c6fc280f34d4e50c8c3b9420cfeab83efaa07c70 892b4a419efc44a4907fcad1ed2d425d55691cd391a72880eb521702379feba0 06287dff06e3444ff13ba7366d07a34e1c98e84ba335acc64c4f20086dda3717 +1331500 4bc03c77379554bbda564435370b1f1e2013db69e41f6d2756a2bc6d1e4b552f 4d93224a32c6e5e275fd72860d656812bedd7fc065f6bac5709415f9e2d48757 8b1e34cd77a5f1bee1f3585bbb79fd4c9cc392bb3ef78075fefa1c54605461c5 +1332000 63e6b1c164691b3f40f0f3a085371397b3ef13063a6ae524403c4bb22496a23c f809a554c01090a1605b51ded6089e45c72e60ee0677458a08b881ca86982055 76475962222b473f5a41394bc830c1cef400b2af7cc8c3f86b468a3cc1b6ae9f +1332500 d2916dd6fd1ef7e51dcd9eb9c0dd1cfdefe1f9c6c71c7ffce3e8c40d0059bec1 094a7e0239be65639ddac077b033d0f068d7ff604d0a05d80195de8ea9e49748 707c305ea934df80d08bed5e9811a2cd8120913a99783f8da3aa0285c1727e25 +1333000 bcecec51228434805c3810493cbf2e5e4f6cc95f776ae67ec820fcad91fc7b11 83810181c3782804b81858b1034d369526cdeabd8c24138982ecb160f73f6ca4 ff1b019400e7e567d8774351b169930bb9a423231795c47e77b88f76110fca08 +1333500 4343737d8353646b1d21c6de7f90cdb0b736fc19ff66832cf460f0b67236989c 39a8c5d182e4279d82d43eb73c4a47e42516e66b02e6004f5b4cefbf00e173a5 be6b7a4687271617c5910c385d00c2983f74e5f51925383d9812b0f0c3e6f068 +1334000 465b6da0599df8a9f78b6cf69289411e23267f511d158d5da255ec7b4591510d ddb07992fd7e9268f045be35c904924e0ec1095860c2b0d2b004b84ce0ef5b6a 1eca38511ee969a2b094a82bdf06cf6a2c7160dae270e9db2adebda0ce8528c0 +1334500 03c77f8b51bc341353fbe867cf57eedeeb34b31a59c0de413230c44e402550ef 2e915d480db74cdea0434864f187a7748ce3d9e7d89dae0b2bf10c11a88d8fb5 d7dd6273423176f9aa9f41caf7bea8c92ff636182f3a7725d9b6ab894a9aecd8 +1335000 6f402f769dbb32764a692949c5904ec18f10a9b71e4f60b0b4953c12376474b7 bdcbd3edc0af31690d7a021013fdfd08e1dec0a41cec4ddec465b71c551f7f15 2f30200c4a9c30d2bfb9008c51ef5179c8cddb732c48fd2f60c04200a5585693 +1335500 32f6550a807836772ca293673dbdacac959b394bde868045000d26c297ac53c8 45605d4d0627f37ecb3ec62478391a66283b83a39ea11fff8dfead6530f92c2a 8fd8ff109aa2dc7ea0949a76d18b561b27ba25c1cf50afdc4f198c21b65b0977 +1336000 578dd00128bd139aebc6c2224c83c7643ae19b80167496e84561b1619f77891a adeba86609a56fd103b941fe64504559fa177ea010dcc6f761f82dd48068cf8e ecc6bf8433d174e5a167f74eb7d52548de90cc3ca81ab21d670f2176d2cbdf16 +1336500 7e0df61b0c310d89c1c76fe3fbe714bf65b4baacb688290dd87dcc5b5ada1d20 72ff1e9dc301116571223c8412808c5f8cdb586f6de1329445bf737899a136dd 787ba6fc54114c4267c44c3a6c5d823594607a1acb047d7207fe43f28a25a167 +1337000 c3a0fd31732bc0f037d4f784fd020a81f6f6ab9fe202530e420156b316cf9559 08ce6cc295422a60e6ff656471f886900fc29b805d4db048b05419512b0156bc b2209d83bbd0894421480607fae5c3587edceb620985b0ad375a30f4d87589e5 +1337500 aa2d085c6e4294d127befa7be56f68f088049d4af00edcce6e30f5f3df86934f ba03fcd4c1bfc55e4b1c9ff967d4ba0e2010d49320f34672080e4d5f013670db 33dc86ef43bf0fa8b75ad4c8f4e9f6cf89654c6a9af39b881584ddc827d991eb +1338000 3a66c94aedd2834802ee3afe2094f49c258cf09f3a2721f6a35de414f296b32e 896d36cd5b88586454f7369c132a974e7397791ed02e0fa77c764f65e0439fa2 e07b793685a3b7aa47da0c6e33673ce97b4630e8cdcc1dac6c49decd157e60aa +1338500 69e34fd7bccb7be43b96f4dbe5292d8345fffa0388f0edd353ec94783d46bb51 6741d4dbef0c44af99f7a1b99e5b0e0caa3de0eb00602a234f9f6a4d2eb33c07 ada3b5c9b98f12809f1faad2adaefbbddf176f6ab5769a43389f95b2e16dcef0 +1339000 b99ec6c8a6494a9e7500f0c0b999aef622ed9382426b62fd3585e40dfd0cfd79 d361f46a241b89703103f94f73a0b4b91a9d342d8788e6e4c29a6d98337d09f1 b4bfcf2665d277e12a410c561bd3e7c6844c16b3a25ec56437d85d3d2d9ef082 +1339500 bb97eb3aba318a66070aae5324d5dc3f21aca39b9a82c998bc76ecaa416e4b88 babf3c9d2265a8fa3899876607394285b8f8a8dfa8b57bf4e9e13ec6d36fbe56 9b47a725ba5a739efe63b20c5b8165b7a33502bc5c7ae4696e02b6bf16651c3c +1340000 5de5017252d8efb1c59c52f3db4a1633fb66c6712ff0695566941a1e9016b212 4793b3012b17b17a37579191f895c2d568ebbeb1c6231d9740901e28e23fbcb2 1e4049f676a2f829204a97b19e50fc048e8e4cebb29dadb73a9ab545c6b8fa35 +1340500 a5bce6a83a1d962dcedbf6fd51cf24fc5f84f32a9f517923960ceca278788476 f4bfcdab61d47aa5d7c46dc1d96b7ca9124b1d4f82ea88c8e7658d84213eb3cf ab2452cbb75e3acbe3d31dd2ff29d9f5831f61519f5afc9aa9eea9f1d39ca30e +1341000 c3e046334951b94c0ca2fd19e4805ef8795f588c8de4ac499e3e7bf4c6fd85ca 0970b5988fee1058cb0773020662290639037d210bab1acdb56d854dda2d3b97 e357a7f7fb04031023e07631093cb1a207d32ffdefc790476c30dfe7222207ab +1341500 1c1bfb92ccf91a8eacb187c970b0496bf1d5290e6a62b7d8098211673fa31267 ed36fbe8eb96e02f66ec816a427aaca059d5fdb2eaffa64a2af563be2ca041f5 25e64d0c9f1654bb0ea0215f20b70192a35fcd68fbb8de9d9a99475a03101a08 +1342000 2814181378366f0196ad0ee1a410d11750ebcd6ce2254a6b74a0ee29da4c9975 641e40090520106202a8429dccf863eec821972b2424458e0cc904ca69e20c97 bd3746520e2515a4c5cf01f4ea23a7338d23bfd8f5023e120cecce52f6d03bb6 +1342500 b9a08e013fff192f3d6a4faa8b94c680ea52751a81bb1e2b1aba0e6e86b88c8e d34e93ba5132f902035bab2c0ffceb26c139e15052b3bb04d2c377caf7161104 9845659c71a5ea1c5d3f1814e488a956db158c0290ff83ce1c827117514d674a +1343000 038bbf00842f1181184292096407329b8ed19c4af0501984995f230ad8bace8e 3812d9c5db37593e056cff975628aed1e241d1025d29420625ff64c570163644 e0dbdac3fb868e20b1e0e47507d74277a1a13a731474ea422f70993eb950134f +1343500 4b0cf19d29d2b5cb53690dccacb7963e204a179a72764f937a68d07b05efad6f d8d521de3d55ecf1bcf28c1d3929274bf7e88c9ec6f658856f69c2f973967589 ac10a7c1f0dcde7dd3f08d311015a90716ceea651fe360a5380adac7c61b1926 +1344000 b4f96630643fc69b3c56d723bbce7c92e601aa689fd6aebe1cda67bc8f9de69c 1d0ecb44638da74996b9bf1849dd8e65b36c971c022b82e22e84372e19412404 c3ca81484544c59d0b39b2a820da9cd43c8c7a1dff32bfa1720a07f9c8c98c2b +1344500 83b6d7d700027d3d7c7d1fc86d2a01d641d25157f91be2ad2e39c956d0a7949a 0ad368d615509ac20334d6c452c258b33c26b47587680d55842db0e31f53bb2a f1873e24d3962de41f7f2c444b9a5d6d12b99c012a2bf543b0f3bcaa6b0bfc12 +1345000 3191480a871167a41c33a32d7ec66cf6a1dd480176780ab90e86748982c2a7d6 eda0236d99778a1b348e0c6b4c338c9c4438e25384bbb5a5643bcc1615358521 5b7c368737036c86b3a5a9d0e583ddb6e82f2c87634c617a24d177754e7f83d5 +1345500 a5e9a1bec9b5b9651758f0b4b7326d7e7ce3c92766e0b7d3674f59f2ee7a3671 09a045e962f6f00182cec714cd59bb0697f07d2a7db8926b795f4ddd8f39c9e3 eb5079862bc3f270524c4935b6787fb0de708bcb5c1d6176a87462b2453c51cf +1346000 4931aaf3cafc65dce5bebab637820ac8691232a085733186f22c7df832286e1c b9a7a73b558d6d83eeebe12e660caa1adb82384ec8538f9a62fa5b682baae34c 34a0813cf4b6772ab99acf563b1104aacae50220ee6e229c1eea14ad357d76dd +1346500 615caf3dc2d54de35b346c02ecdd15ff1dea2a33a2c2fe384b88bb1b4484e387 c9290dbe6050f045538d42036e9d8ba840894a7a36de663ec4873367b33a44b3 8ae0755f90a9b40929fed4376006ea4d276feeffe2e5525dc574ee3382b5146f +1347000 9f2141db8da06017719371aba61c2870bc8489a3851905fe0fb68ac3eb3ffa0c 5aa216cc7f49e2a7e44d0c0cae9943e09e327700c59d98681382bb64db222703 9a12df471c56b23a0f87fcb606fa76177a34cf9599beec6a377dacbe2cffc94e +1347500 8f954e694ad36d2aa241cb3639a905b0172a4e493d290472272b2c7843f90a6f d00663fd2d358b51566b4659a4256ac81a52116bdc7f79e6f8608f787cd2e63c 910c1d960537172a91361d0b36cbf7710b39dc40fe031062376962faf38ba2bd +1348000 7c63f265959ba36a180cbf78d0e28d98c85775ec652e960da7b88544d75ee269 703d5a7af24b1444fed1470ee43f54331c9d3c5cc425cc7713ab5084870fb776 5df018b23edc754d96a0fb9ce8eaaa17aee136ab3ba7ba40d713cbc49ef845b2 +1348500 c8aa5a7888dfc12d8ea909d16f8bc2f4cb75ac52f2c2cc9ad2a7204c4fe91ed6 2665d6210f6419872e8d804adff0e6bdfb643ea4aa4966d89998312ad432d712 41192bad31bab841232a6154927c1471839ba2bc0a5da7e06b368ad9450de0bb +1349000 f8276c6d70887b37fe6a5ddf66f60bd59ec9addd24538f7adcbfa2b4e57ea3e0 e846ba1f214b54b40efd980e675326874e07b9be698b0beebfcbda0bccf3a472 eab0e993ae3378f6a6ca2101c8067283ec4171f47cc1bf11c8bdd418df7d6b3a +1349500 26bfbc01f2afa9a8bc2f7b6d7d3ebf446a02e539dc916a9329583f85932a4e94 6fab66ed6ffa3b0b419bdbc9e1d57feb249bfa4d6dbee098c5b4bb48a0a49867 7f6f111a19cd4d2f6d61fd2f3fe0139358fd7685497885ea5521013e6d53d951 +1350000 db914330d42468be64206d8936bdfb3d4b03474caa621f72623256edf7f80d9f 58072362690fe06a7a7d0c539779962943e3acf31e8a51109efb7da246e821b1 cc86ff3980059557cd7f3b33f9f4890f1eee0eb33ebc725a6f73fc1cd4bdfd87 +1350500 6096e1312edea656dcb92f65c85ab5e5cdebf3933e8d2173647a45a9a3210e0b 8c65ecf92dbdaaa95533bc15cb23d9857da92cf2d3592d2a5ff22efdc8a3364b 26a6671485e4bb35b0795f1f51ee14ddedfb4eb80c75e06b557080ef5bdeac9c +1351000 53cb04dbcce650f8e79df3c448d04ac741505118f6c3591144684dfca03928c1 b5d14b77a20bf416bb74bced28b7294723584616f0180c6cd2d989775ccdf9c2 1a013bda8dabcca13e995ae1456347b39a03fde3e686ae1d391f9418a322282e +1351500 8e072be1bbb012abe8596d5e9894b71bf659fb9c9bc28aec90c53de3f3e02e0f 41c0d88ca37aedf56f2edf7e66eb43bd8037eacfd4952259806ff81e3a0fd5a8 2a7beeb90f62ca7e91bc5f79ecba75eac51a5bd220d953741b28fca1f6140b64 +1352000 5acd06bbf2e1ea14040216b37d79d2966d438b0d142b85db7e3843b003489c01 3da4f82cb1a6e6de3ebe4e3146876bb1cb2dadc7ee9eab406a05c853571181ec 5caea07fb0da33639f6b85779f36ac5c7105679a0ed3fa3aff2b14b5457a6f69 +1352500 f5d89b3f3cc3e9649eb3e8b36089563aa908aa0ff0e7e109a2e7649343f63b87 dd0be9b771517d97f968a0e5f54605d6a7c8ad897922924f8a1957aae892d915 b901e6e76ca9aabd558e9d868d635350720b76eba9bcc44af56d09b71d678c02 +1353000 5d49abadbf137574e895a0f8d60e940fcb87a7a9b3da6f8a733b6349ebfb0b9f ab12ddbea464538c319d247f73ab6fdebad036b66ed58da2db3b40f49b1d2d9b eb6d531a464b5e5105d4bf86c77ad2bb844dcf85e01f4b8210b4e2bff9fc06dc +1353500 5c8063450d2985664ca20eac74a82564f95cda9bef9ba9517aa862a34450b9ba 40cf73bb2e680b7eba044131f7b4c7980d36e33f9401f79477bd0dec157a1845 e50b7634c1fdd4ec5c8e458dcd1eff860e80c5c55c434c30c115a4e733cc5243 +1354000 2d4991e9cb142acfd096875eb2a464510296fce5e5a2b4f8047a1cb659d7e0ec 3b075d1b4f2a832e673690ab5ea2d2dc7b4d88e3e0c4074187ec63415daf97be 59b8b76f1f07860cc92ca7152cbd8414e547b3198d671985fe6e054ac2420cac +1354500 9157d2348ac1bb37476d739da5a0b03f4406803596a64496a2167cbe32de306b 3387bd949d44556b6f0614809ee00f0be526b2b64f3e2d46f7b0346b8ea109fa a89ccf40d942037b793d775dd08f04a4115a81afb86ae7195256182ade918776 +1355000 79462a5b2495a1324620807079f1f9dfb8a8cdb990993b3156ba6261110a2529 1910799f7e75fd4f2e56ebc68569894a8cb5a35b91494cd91320037b554c2f40 ee9968bda17d6e846b13d1678d1c7259d63173b45422c1da4f349ba121c3ea14 +1355500 ce4974c7891b61213cc77b84c242d53203b83429d64e79721cf9a41810dd2ab9 2e8b5509aafb907b63def57d173838f08f6ef047a29f66b41fe0c6d6c1370780 63ab847b7b5998a33134d68a3d9957a61badaa9210bf72d1fb9ecccf3e39640c +1356000 023395d95890029d9d8962aaf7279809a90150fe9d4f61c0316c3895d4bf7dfa e4b11f5730152d2d73fc58987229929d80336c130feb18fc15ba9f741d9426f4 8c97da0686c2d7a8cd8c9302fb058c0641c72ddaeafaa3adf5db4933077a9e69 +1356500 a050c1ea17c09980b6c7f00e2f55802bb3127f8657560bd1f238fb0251fbbdf5 6a333264bf3abac9c07d30462d06ac0aa64878ac5190b6f1ce056d607387989c 55dc870906bc9ac8b417a8be30d8fae472af0d4f0dc8a1eb07457d33e8799936 +1357000 21c4e9c4a5010af0ef328fd691469b50099cc16e1d914a1bf197638176c78a96 795814be162b58833d5303da87846ab1cd01f14a58206748c8470f4818f8a2a7 70f634630c10cf077c236c9d12ae6692005a637b9ea7da6a01fc10c37aa31e72 +1357500 db1a2290db3c8daf8e98628c40de320d54248c85f0a275d882d9fa0c077fe0ae 60975cc6af2a67be2fc1e1e2d996468795a6df77a40ec630b8b6137841f9bb8d 24d173110006536cfc9e9fc8cbb5057830af1faf7159272623e622e83d98613e +1358000 622659842782032726cb02029cc1b60a3238db2f760fd830f908797271e6da71 3ac95814d20086330bb18fdf045db19db8b98f888d56c971a6d83b07b1ed7545 73e71d4eb55e51b98862c1662bd61093249cc32d3b9d53b91327e45f0b207ec5 +1358500 c3870498c6e13d7378a9b2979afc44c86a658c6ed0fbadfc8d80d10321a04fd8 e2683c703f97dec1616d7fcf95c5f110742af2bee8820e107378d5f6be3693a7 b58b3be70c6c41bcd584e324e21010b0604d3dea3b4f5e294239e2f0d72cce88 +1359000 48bc6741c874c270c6506ea68e14f803842fc3a045adcf41aa70a7f952f748bc 9fe96bf9be9977cd7e1e844d796420e9038d72506a5fa8a63fefd68cc6e51724 71cd975cb68cde056c2171cecbb94a27ac08a68cd95cf02a17298923c95f101d +1359500 95d98e7ea281c485df5ebae662a340402dc8fce0f7a487c3c1616e52286c79d4 e152f7374181d4539302d8d5f3a96c87b73dde4de9fc7def90cd82a4efcd47ab 149c0bb73bc9cd66e393414c282a574da5ff4617a7591243969312e3b32c7067 +1360000 241fec07ceca251c63f9d42a7d1646f66df2ff3faa6c4421c35d874d673f33c2 fc79d7e5d2d9c034da4344d77169d651f881e523c013046060c940849b474cf0 0bdd64b0d55d1880d3e8b2e36bd5c8bc440f39027ac404fdc27ad1192354a269 +1360500 7bec5df362dda54fe40aae98d9442d978d5ced91cad5febeb88dc4f4950e4bdd 7e7080775fbb20f5701d23713e5d70b8a24ebad406de58aac3ba899d63c1635b 01500a609d11927cb2189d351bd7d899180a3069f4bee2216f796341df37b1a7 +1361000 87d2666d95d14e3beffbdd4de72e7ef6fe60b0363e4fac0316d5afe0ff70dee6 242b9b14e80c5d87ed423060bb6fc808c15bfc0db548fdef08f27c6477464941 321aa04ef491a9292d3650b58afacf92a9a08e751b1dcbf92b295a128afd212d +1361500 2bec2cbb01a7e84bce2d3436dd83e5a712175d115d6bf915b240fbb639d46078 10a016f5ffc99d3a7771f6d3b4a4f767752fa59736ba95547b1d044d7e4a8191 c46c364324e570a422aafa228b3c29243475e073f89ab6d0b3e991fed49a1e73 +1362000 efc9b1bd796a7bb73e188e64f19dec202b931120ec1f1de995e239c583016d68 42e109e011f018fc0e803523c87e396923d7d16817c8ef379960251ccecd15d7 8a8fae769c5e9a74ed2332f0994316c9c5048dec873b08661fa6f579e36cf0c1 +1362500 0d00ee09aa83572f4619cdfcae958f07cc5754d85aff7308bef545e31c0edebb 50a127a73348df1e9d1eddb21d40cb8d96053f45c63153075d765953a5e2a995 aa590f65fb07197eca278d885828a25184c5236d425764e7a2497e35c22b6415 +1363000 8ac5d4cb7ae609dfd5272341a74785d21a29282089f80e1eeab5d8837e158007 fdf588860fe92ea12accce443758ee8c000930eb3646e1cf6dd1f581ff87df47 76c13b9ce1d80e442619c3835145cb000051ac099dacbce02c084fd8981020b6 +1363500 2a5195f60d986b071d7db1ac3e8fd13bc0bbb71e1d0fab407b60cc5fe83bfd5f 283de2f90e81f2f5b1e532ae4dd1da1d78567ffddc28394f03568bbfff455178 a7413d18fdf8fa29e161700305ad0c92cc49150a3842e08d7e502d1f01afa467 +1364000 df9b9296cc777b283b5a036c3e556204c9fcb25ec05da8ec4dabde8c3d13d7ff 322738792414a245c0075e630cf15dfcd6426c2ee5db743d701e8c8314bf8399 6fd14c20efc93e4e3d29eac05d09fff67936cdf7227b69aee5dea8c3d847aa97 +1364500 0e040bb3819a52102bed2a02b2d916d3a4ca27ca70581fee51c23be143ad7230 e1367dc512b0346a68fabea62adbddc575e6f46864aab790663318b8920ab115 6a6399830a202eafc0830d664ceca07854a404608e238b52f19256d8775b798a +1365000 7b5defc26897749720c6df07cdac18c52790d3e13d3678698aa100975198cc3e 8f0c75756bb5f45da428b16f2155fe77b85f4a78cdff48572d7e9233bbb6993c d7d3f08ada41cfe67a839692ada105459068fda83185957846e82eda06bd7084 +1365500 bbaf0d42419a72d2c1da75b77c7ad79dad79e283b56f671ff235c7f715fec350 ba7960c169371a86cd27743a6b3b28497f9411d942ab265b0e624f1743a4747a 1416e954246cbce0f788fd78e27ac94da11144fbfa038e2e76476f1633fcfbc5 +1366000 0dd08869a4673ebc933367fc785064583b523886dc1bd080cb5721c6b65e723d f0c28af3463c49fed6fa0d56f3cffdaff119da024bb18de553dfa03e99dc8d30 ea7d879e825d9ee04f06c07923ee85364f9ee41261a499091b0c552787d57e34 +1366500 7809434f8bcf2bba7c2eca9669ed3e1689ecd89a99d8586c4aecd37c0975e173 8f2457fcbdabc3f312d6b6ab1fab4d609a5ccb891e3ee5cee03b688e9272e142 da19a3eec131221757c6842f77fec09b297346af66d8146351fd909d6fb3743f +1367000 962f40b77e22bfe25904095e6ea6394e12d7514de0477dce1d4addd1d6446751 cdd06a2200640f4f0c139903e97c69cdfcb27784d6527b6b2e61360fa6405f91 d67e4e7550776c748c563451bf98f23c7346efc77db14ac717415255ee424592 +1367500 3f0994031ed4168548003ae429ee8c852a35f6de73ba28b1d019ad0d30f1e98a ad884d324964b4071a890780e669a3958a8633c725ec047cf68c5aa9eccca305 e2883086e4efd4b01f8fd4a70cd5e6cce491f3fe14de80fe933ef3e993ca3719 +1368000 4be76ef559c9544e0668fabcc76d4af327efcda792b5540ad5f4d877a1278cae 4c28a50dc5f11ff56e50e1aae05fd64f351bcd58a8ad88d5fcad3a8ac98803f0 b7c73f488e38cee6084ae007214fc7af93be1c763f1ac00591d41d7e906d8777 +1368500 c76240472a4ac9920940353d65c5ebb4d61e349076179aa27d7867b683faf6de c8def91415ea539f8613635a8686bbb59defe4a49148dda8aa29dce7b9caccc7 bbc6c21b9be1e45ba32711470ad80d567be0732eca335eaeda406ab3950e1706 +1369000 3d5e5769fddbafb4fadb319338322cc8d21cf8f6008b3e1bfabb449d503b7681 596efc6d6c59be4ec01fc472d73ec88c727b7944afb9ef851ce1241fbbe29ca4 082ad282dbaac5719fae620d6f17bc23674fdd9cb173d6158e68a2aeddf4e2e3 +1369500 df3d052dd89cd6f13c76454a5dc501a304143b3cf865cbe660a1ada94b45fd09 9b16c27f1aa7a2bede65e22f052fe9a440412f78afa59abd2d74c459a7c0980f 214634977984294cfd9e53afdb66b02fa64c27b3075fb69a8d059218c0213977 +1370000 82901017ed0a3c9fd170b22c8a3787fed742171774ac09e7bf6e5cc89c4e102e 59f0aa8ded3f030973e9a2ec96e6adbd7be5277850a9de8fd2fccff3d9bb06f3 7afa0c1ff8e69ae738ecb851b7b2ac0dc8ca7288d22ef44d12cf618aab82b892 +1370500 fe11b801da5e7f428cd13df2f1f21a56de1cc0f6b147a0654561501409a24e53 2516fdb36080fcce7e2c1cfc41f72d8d953cb005c47a7086dd64eb5e8bb3b9ab b87df119c0f729d30ba2f47c8781ffa71375aada7676938352fad0e2a1060c58 +1371000 e42763989f9c35e4644db2f1dd3970b0409817a73cf511e19d81a1cd69da20f3 2dcc7126dc05d375064fb213ea7a4989a05c8af81105dbfa2d29a0f6d37ca511 f180fade9a2f89ec00ef9055eb7b2b8db05a1d9022e5f05a9a5fe0250bb517a9 +1371500 7ddcd3c33a18db03ed734c2b583cf6fdbb258987711f3abcf836c26cc5cf1b4c 8a14fc9e85a782911697ae37273b7f6dd97a6247e218e7bb3b7f24de39a05037 67b6dc3e02e509907cded6fa65b1666b7e47eca3da28429ea35591782cc34d3f +1372000 709c19f51d172d312c56ef54bc785e32b6737829fbaf445b704efd5763ee36ef 5b2b82d083154c4e8bda21f3cc331c00266e314a5843bd4507e901aca9be457b d034490e45370ad0949cb7161fa7674f90d155ab0ee751e5ad82813fc4f14a55 +1372500 6646e0b458172d85a703c69817185a9d4616f257d3e74ffe25294f48994981fe d91fb8487fd9f865d496efde1dd741295ee5895acd1ecfb8dbfcaccd7a754068 78e58797920bbbf46bc69ceddd3de83bfa0345347e0a034da8cb819054bc112d +1373000 2cd773b180fd742cc31b9ddf96cc0061d43610fd2949a77b9cd6a93f8459f36c 38361c67a77e27d29e85f02be732b5f41971807b8887641addde9c3459d7badc 6e670df912b6cb2ea6d1ba05ba0ef8d78034e431b7bbf18b55f0ab3ef10fe006 +1373500 003405687c50009893335067329eaa341b128dd41776915e15de96273c1c939e bd893a9459353ae34f98bb4ac5ada0fada86aa2b076f4a1b9dca2f7f1d55ca97 7bcc8ce71cdbc3e27f52f31dfb94b60191459b3c9327ceab796d0fda53d75324 +1374000 66ebab13c4df35b8b50a127e24a713532e065864d104628a89c821853fdc02ca 9f41f9a5c55a3b3a8943b95534a6e89a32bcf458c947ac42e49e90b7a31402d9 95f0fee55905997fd1ede6bfdcb4f589f658b5c07dc81a79ae2e6c5b087f22be +1374500 7c51fdfc1280a845d1c292586899486e8b9bd74ecfea6b0c7a8866ee4193d815 560ff2ac8636db352d1b203cb460b3d516c17a51596dc4f2fcf9b8b2fd58982d 4a7f37f746148e36dcf40393384a7b191b5af3b88abeddf905a99f8977f75946 +1375000 8c1c7ad4ddf661b6696f09c5a215fcf5fb580e6526fbcbb1d56993a05bd9b395 71fe38608859a86b870b47a8d491288fa7d3ad049f7dd2b08e6d8fe41ddba7a3 1cd49aedacddb002f579c4c63b1ed4269b1aebc57423f56db1cbfb9854a1d6be +1375500 131362b82730ed11258dc186a69fba50942190b0af2cc9916290ff03ea128415 fbbdb2968a466b45f38590430297f763b5788c1837b45a33f514da32df05233c 0a246ff865614f6b073f23fae939d0b33aa7e731cd305195302fb7b4f9d75f6c +1376000 3d0f47dde43a432a0ca6bca020e6464e47ce1e47f583089a22cffe57b8bf25b3 784b1707faabb0679553ca65133edb80cae4d0675673ed3aa64412610b5ee0f9 540ba1600bfed4230cec6d72386ced851b664893017bfc9a61cf95f324f27a76 +1376500 f7f6daa3a21379733c6db7a50ff0e50fb01be614e0104f7f7a245e74cb841409 a095a6b397eed365dd40f6630ee8ddb2861624fe9b09bf3a6c3b6ee3ebaab5bb a8d92aec31dcbcc781a5293048e73c10e66634ea9371741d86c11aee4ccd1119 +1377000 fdffe12f78dca9729fbce3738e670c5e06caba1297bb60433660bba40cfa536f 83617e218464a4e588996764943c7d99673c617749260fffe93390860b8be234 8f22f18117baf3525c8ee2e118f00baa91e9e8cdd5372bd88d65eeefaa1d71d1 +1377500 53677d3f2433ef6b8c7a21f8b5378c87477d077c50c5c98920fb8379e278b6ad 7a88f0a4d5b7f5603f7dc441006bf1d696d8f922ac99000311a6691f6b8c37ef 2403ea937f3d43de564ee2d47fac12d511c2bd3ffcf19ea450016f6c2c6cea42 +1378000 059ea3d05a44144a98f878fa6d96e7a42966e54decb823dcc8c831f959accc2c f9f079c101c061acd1e157da58643abc3f4c57f5f318add638f296959430aae1 7b7339aefba9d1b16985e38d6d2d79b9e7eb741178690d55938e86d4cd6efcc8 +1378500 757ccc07ff0cf1917930c240eb998b3e8639e3675d11d3145f8af10f8559c02c 16346ca8e19e8a8146d7a5f2e33137d537195cce9f93a7a3db1e8bef0ab99763 e951d445d1dac492035d383d6abe1d3e91398edd3a5dc5ba891236adea8092e5 +1379000 5b36b30e7b6e80a37a03ac28feb2737077d22d049662b2d9520450a0aea88b34 b2f38cf9fd0cb0120373171374eb1a73bae4759874a83c07dd93a3746f2da967 d05a569fcc9eff6131318eeee2a079baeeb3c5832031d50a6d02e9ce5ed4c462 +1379500 ca6e2ecaa74a026682548eb0391aa64a778898327d66daaa397e9309f0226e18 974cbb87f0ced5598f43b2b74627b970858f168782e911803e74b253f091833e c20182944b16fd862ea73ae4f2f01282ff9a9a6fbda4c9673ec3447f73697510 +1380000 29df1aa8089215d19e7f9d97af769a753de3a1927314a98e4b66849c0d85e441 824abc7c2328e5c6d673b61bd395ce6f08ad4d694dfaaf06f5a11f27eae48a5a 379223f228185396aabb01c490f627cf6760840c26ba08cffca50511be25ba97 +1380500 50ac8d86f2272a3e324f7cfc34431ce3b2408f1f10e1c9d6cd676926de65ed7f f328142c777c439f93a41ef439efc9c8171170a8cec2349edcb73be476b0ea49 6450fa80013359ebbcce87bae9e3fadb6e1d4c760c1290fd143e623a8b0e22b3 +1381000 7efbd8e797d71e40598cc589b6036119ae31cf3065aa9a50a2dc31505e954d44 2969968c2995555ea8cfecdbfeed2661178647474a419407431ec159c819e5b6 64f966553c9e861612487341b68befd2d76848746828d1200f3b5fb6c1a0abf6 +1381500 18f71582a3fbf581a54287cf034fcdc338b9919ea3dcaf1adca080536dd44518 52b1102780eb1580f8f95f23adbdc9ea1d6fcc59ea1c9a59b39bed8c9d3db2dc 65664d2641979bfd545273d4d87e977516fabc7656bf8e72c65def85786e60b4 +1382000 f04eae4da4c932919586b83073c6ae816396affb39fa3c9e7d711c477b0f4f01 352c6c912943151ef946d6a63dfd1b49b24723c2cb8546ae576825fa206eadf1 3b9f36f62b618c97b525902ce25c60b78f4001876ebb395f2837b6685d028875 +1382500 498442069527d31f5e1869dade38cfd68f4af9bee2a11e8fa5aac53876c68f5c 9bce2522d2b6d1842945b2540982b67bd25a37ff35254ef804762d0e8eda40d7 68804cb18adbfc571e404f00c6eee9bccd2d34d0fd18528e34473edfd1851444 +1383000 90bd1f97c316355252cd4617a74de440303a4b9ec1b43264f9cbf122af6da728 00c41045f4aed48883018d269d0bf9a0af83cbb2ec7dfadb4b14054b85620baa 4cfcb71d624a7c4ebd997a5085a5000f6037f0b789664ef389895c8d070d94b5 +1383500 b341652f777e89b7c10473ffa0edb6ef32b9db3a0cf5fe834d14d340c0f501f4 2928e5d89f96e6b0d8f72727f42c5f27d7ef64a642709cc077d3aed5f653c3d7 e902bc0795797ed241da559ce937080939a0b0a699c454fdb60027c560019fc2 +1384000 8e7d3bec636dc0efe2906d5b32b652f1b8c63e307cd1f8f9bb62dbc8d3f91482 393933a6071fd7fc1cd27036a6a0cf5d2c274c8d19288df155974c4d16e4d7c4 b348713e32486cf429016011cf9fec82b7d1b1cb9b7533eabc934b7436cd2c4b +1384500 2524e1055ccf52beb59f566a6df92967480b440e31c72cb595faf50aedeb7b4e 92721f11c246e0dc123708f3ea3386e2af7d658bed413ae18dc20ed071804cc5 1c32df272a02cd86a314c95e33cd42ce287ca839229e9d98341dc1549fef3a12 +1385000 a3949e937db9477b440924d17eabba6df130315abb48a1a0cf4c376520024d8e 8ba0b50839626f009457414e892b0ade6f6391330a7de3e52ee8cda8d4d14843 ad2a7b142901684c2cf34808fbc507938b8e94abe8d907d78f49f0fd04e65a45 +1385500 7aed6b2bbc64a420adb2f4a876d8700f95286ab556932625e2388c86f5e64ce1 5906e9327170b4d080f7da835c01da4b0dc4c3cdbcef6e15ce565eed5a34522e 325ae8524ae0a48f53e85e0a064e5877bd24c21b9d48eb2ae075c71b7506a91a +1386000 635e8e1abdf01c40c5f68d897dfbd5599ffd8b306f4f12582a8beec39bf72b69 e32c26f7f6b2fb6798e29dce76a3b4f7197929a52f79ed1bbe65a384d33619d3 71d2689f8a01b81b332a7ab5cc31f08de2abd433305793c7a47ec0d4e4ccb7b4 +1386500 637b7737e58ab3d29f10eab76a186e1885fd47a221989625b82a35e326d145a7 f577cd1255398c716ec49581577a4228b1605957efb97213fd72af29fdd05919 7eae923d32bb8c50cf56fc9b503146a4ae8a6c5428371892624ebbf6e7d32d29 +1387000 d5aefed45fc4bea9b4bcdda1e44860543a878c2543d6546aa00ac9f503a725dc bc5e3ffd23093b15117ae932b3ee507f0c3a028e35e13ee66a38a933cf14498c 43c30f22a4a4a3ab3cea65424552f1e0e5642cd27808a8ffbacd300d89e82e9e +1387500 c34f7f08569aa435eb7742511015f03b73013118df4829f69e61740d35243995 cb47363bf5ea2f8327beccd1736b90c6b6cd6edc33dc3711de07bdb729d8e364 3ed742a1c460bbbfad7c6a09f1ecd1eff9b5fc724be35e1296f847060472925a +1388000 ef335fce6c2bd02b80af60285b4f0831f36e4fc365cc99302e55255dcaa854db d1fafb75a76ee17caf145e0c95bbe1418d4beed03e25ead8a346b960db22273d daf51e1e81cf641f371d57dfd8ffd8cd178345b0c65a3e3fdc2a0be8e936cbb0 +1388500 44ba1206fad06ca8f55cbd10c9256901e0418c3fb0e0691f3e809ed7fa6a0df0 1edbb4bc57de9959ac04262c845d80861bc5610b2495964e10806b76eb42a4c4 4c24f229f4d38192fba827e16167eba98f68bba783e2bbe0ebbdb023370f41b0 +1389000 605b93d26d873156688df6136a526f83a8aeef557011bc8059f4d4879c1f23a1 3aecde0b1a819ce476e787e271da0ba15b709d796ea7b1142bb6a08db2f4fbc6 f3b27d8eb85235c72bbbcf400f90c90d9932e8f8a2e92c68328580711c140cfb +1389500 ac7c64616575385bd276448132d9695c124a046ed46135d75a8c40a2193f3f54 d0515e04bad6b365716fa2943bfab9c39f6def009b785ea3e996b2d2b505bf5d cc3911c857f4b72bc693a5f8829c7502e8d2073442b18a13136d25c9277953ec +1390000 a306ca12aacb491586e34c6aebbd4be0054b193feb7a4ff2151b702db8ca73db 20abab754673ebe7665ff38f05f18d1cffeba2850c0ecd83e3ea1aea1598eaa5 8e3920c5953f603d782d0eb27499b33d7d6875efff42ad5938f523e71a78a41d +1390500 9941411440c5ff87e6c55de41b31eefe027f9a0de2c62c0d0267c1e2932f1396 dfb99ce37b2622d27ca46bf59d5c5df6752bec6958a6c5d088e6058dbb2c1410 5f4b85e4ddac5bf1928937b28070a9e1e20d57637c8f6ceddb84303d92d3f6c1 +1391000 0245ba8f313f627ffa804e3f0a7033d04ddd6e5a67782f825995c501cda982cb 7c77580d8bbac2c9583f5efe19e99ed0f5ed5495f8a4133e73e4ee9e6e5b4d44 4aa2fc5935d2285aecd8df81f429793fd6e6daa948a976f704d9ce696de9f016 +1391500 f86d824dda22a04e699d8351ea69d65d2c22825d3629fa7646ab9012d7a4aed7 d45a8b92a0ef4d348df77c0d748602d8b22a719d292029ae58eefeb2416f1806 79abe2a4a8dfcb2db8de877ab501ec2b5f4b4f2830723f5583370522204e15c2 +1392000 8ed5a8b8af9cfe376e62999351b8b364f182fea13af8a76dc5ed2d9433a62fa3 108f435ae8ce87adee70709514a024f7837c4c761f8a21690217e62e7b202564 e5da41c595a5c816a7b071863aa4d9a8276b0a344941f9a22bc149a699c69027 +1392500 567a3b3aa608d68cb04e9556562ad795e8fed26e390093209a6df669534f7fb7 9d22a222c28182008061f428cf6fe962d1a2bb47b5dcfbcf6f6793f93f3bcece cd49f15edee14609f504a416effc63a067289d5162de1d6b3a86813535a89158 +1393000 cb4c92e31402a34d755675a2e0d7a09dbdf45d6dd47f058708a3f74f15c2c328 a8f0f8d9614f6800670cf397fbfaf554c6f5b942f42bfb302c2614098ebf2441 157ce92b0bc9acc24c4a3ef547ddb558a768d5fa337af39ff25c6a1b2ccfd47b +1393500 4ec601ffbbfbaf55fba1be3787ee263cd2bee49653e4de02c31a4c15889633b3 ef268c8cca69ac5e9e1305686d72771f9fce19b4d18fa03c8df99d59faeb30c2 0bd13f7369506d884ef9ab1dfe7759aacca5005d4ab72579edc4964682968e61 +1394000 8b3bdb74f77eba1248ea7114edd15905c94fd883f81e9fa04fa87397275a647b 0d6a3fa98c56d94f7ce4b9fdbd800eb1bca305c612b5a10f971e6b274bc74b3e e0f8c19673d7b17ab5048f23b66745090c10895df2c3b39a064c3c8cf813e91a +1394500 6b4df84282ece1bac75bc13315fc9c3dbb1695e387c5a6354cc1181e21a3b0a8 26682914b5c1209da74e2eb42fdf39f93d3d5e05aa6b100feba849058cdde53d 6e46726b2fe881bd18dea4409168ac89f1d74b890df19aee9eed0b47874f5745 +1395000 e8cc3d042762b0b1a346eb9fe5217d082f50bf0f9de1ec58a197ff0d2503c161 9fd20576f2944f88fb26dbf5cf55c2408b60cead32c5a221429c6a3c25f1d58a 0fd8b1278f5c6c080840196f61a8281866126cdd73ac79c4fa13e6ae5c69721d +1395500 ad149d110be0585f88ed92d43d37946a006138d06b3caaaca6408254df3ea6f2 7b21a1a28aeaf51ef91d60139b7563130b47a9c815e0215d2ebffdef229e4ff4 9a7a2ec4d702e6e72c014adf0d00079f2425777e9e3351fca969b86b791e0b0f +1396000 ddfed3648f113543a8121db4408a2ae06b31806b3b1523a8fa1e27f1b6d9b872 abd8bf2774c1e70f90cfeb2a3602ff36a44c309ae3909c23e6b3ef790309e95d 602aa3edd48c2bfa1a6fb1e1e3337f748601413b3898668b74d8a7179d488585 +1396500 57fbdc9b1f8ce051a992781530e611ac606bdbaa884c76a40ea57ca084513ece e296982a809ae0dfa2528a5f2d05ec4ffccf5714150f2b279450675f0cc86f5a bdd1b3ee9e2ad1e7ce39311a35ba3b4162671182037bd836a3a4d7db42d79739 +1397000 86c1e2ff806291362b658869da53158c1d0f4e2e6b3dceffbc3f1746e877cb99 014d2677e49ce0200f6ba92b6a3d56ccc13a99a7a590a1f2a4400aed20998ae0 59d8699c09d5a1c9a8fcc93d935d85926e5b7524d1c81649e5531bfa29ad6aaa +1397500 e2d2ef0136f84444717f9e4e7a3b957bd605d6d2329f39da9f33a28d2e32c5c4 949e57fe7f7f06eecb0a50a1768df42cdcae06cd04cb2a7a22ab7ee6ed22e487 8793ea706658d7d06b662eb120ee38cc24aedcbb5aa536949f02a03e6bb187d8 +1398000 1c988d716315f43304dfd76df87edd8deced32fac3a10acd11ff31af286becf0 159674f54b80192f4231ece388db32b22d9c01636d29176c9529c5db11f7c99d 9c1b0b608647218cc188ab844a03214e9798d2e6c56769b2e960c0ee77ebd5db +1398500 e9358d427737bf442b8817341cb966b25a4a65834137aeed9fef8ed02f4e51b5 573f6d20764b27ad008db0f5a5f4de00a111dec6a046131bcf69b79e537fd9b9 63d03eb324c79c1a4e76f59fbd08744c9ce1192cd7a5417f185c4b3bd37de377 +1399000 1a76362f98f4a65607bf15f39fdd95b32d8cb8cc8a997ac52c8684ccf4c01832 6453f54f195185f7b06bc9e13a7b9f01e1d75f892f4e36307e9bdb065a57f17e 7fcc1a4084174ef6344564982fe209cd1d4cf9832dabbe9312a94a922e271c7d +1399500 1d96abbd52955c2ab1c1958767b2f07c452e78f32410bbb91083adaa41a44137 27396fe948a950e7fafc692db367cd9f0fdd77a80658ca4fec9b119eff15fe3e d85d1108114f726d401d5767c674e3e82e5c7661b2013bbc1270767cee79369d +1400000 f9e26fb0dbd2829054b1ccc22440cafcbe5ccfc93dba5629205f4fc163ada5f9 ff79fdaf77303394988940c9a0e49609cd6387e091e72b5c957507940646b505 63b7fe7d2b95a1de8169326800f1b62698edddfc5c372a8895452a5f10e2fb55 +1400500 40f196700baa6bc6022a4682bd8d220ff56ecf6900b9bfecb3e1372488acf8b4 f2851b1b8e443a8e43e20f46c2cd211fc7efe7c75be4f5bd9a0cba95ed379abe 47f5e9bc99c0622e22be876d081eff785e177922ff7a84f3c73fdd3260844ade +1401000 e365daaba77c2ffb8d6b2e14061fff7615b5344763fae293d9333de96131b562 89ff19dfeef9bae3694f7e475d21d62956b9968ec33a17c4cedb62a099f70c4a 517c8829f83b7a935d2f274310a28a7cdd6c50b9f407d93f640f9e1d8fdeffa8 +1401500 6a560a76676d91c59aa21e2cf2d984f87101c3e60a2625eb7a438054f8f839b0 091bd3575a64bbee5da7a44c42ba2d46a82a48f712b456c6cefe57371331d695 ca8872683fbb0e8ba396f436d85faef6ff2cb9075b13e3c514adc6a9c3f72513 +1402000 62e2f52a35c69728af7b28d9557bd2dd10742589d8800847b3264d865017be1a 8973fe4e9b4b2bda7950877e0e3e67b03857f39c9c040fdd4cc81d32921cd137 8215ee6145bc1e07819afdf00c33927ec5d23003e5a2c04bd4889dd8dfd313e0 +1402500 895232cb5997e093c701c37b123c689b69ab4f90bec0a92cd810212abd856750 5ae61f6fab15fe5a11905e85e469899453cc648bf59f7d94e33f37e70301a155 23799703c4b59a07010cefb90742f7d80df6f6cfe7ccaa3c6124a4e1cb602515 +1403000 88b55cea21ec3cd62d61782950e5b3563f3ee616d01ac3f88b72d8e28034c958 5032567f685ec639b4023b1ffbb11017f4fcb4a0435fee1d36a7d56ce944f2fa 8a2a6bf7420ff1fd77c4ff5006523a2e402bd84582982b98ede9a9e98ac650d8 +1403500 24b8a5636840a8a983845a420a6cd9e395fc10e5793b207c6924bcda91e52528 a5dc1ba6b9ce7b9762bea6eb69ddeefff1c2dc424d95379e1571a41ae926cf80 88d951cf6b865204379cc18988e537398fd2a7ba99da71544d3c348ccfbcab1a +1404000 fec3f803dc9b2e03c87d0491ee33b5a66bf68de499315cbcdadbcd3dbb0dd8c9 4a3c99af482ac1e4be859e277af80a59761ecdabb83f2396dbc4a0c85defd4dd 1ae5689dff2aa1795687fd5c5b17dbaf26879b8c07b651b307c7e4088b13a8da +1404500 e6288b72c91e6c69455d9bc42dced7a8be3ca2ebd5eadfaf4aa5ae41d203be83 2265636b9463376bf3ffb01c926717b69d103bc74a96a716ddcd6b07403d41c8 53ea6c1b6a4c0e1f9b023ba942717e364e6d074edd677234d1b3cd81d2dd99eb +1405000 b03737f29024ddc3844e876205e984ce3a6bb2f00247804a9ce4fc0f6bfc9eec 12148c0a89728eefd046abb7037a1bb38db8237586b7ccfa3eff80f31af4e069 f135686b3992574c3756e92583e89bf5e91b93a1df5528eaf162d7c161d3b9d2 +1405500 747824fbee194e1a5b85c96bc65c7af925ba6f648333f009a189164cbc3e1e21 be50d9853853596f4ec24da4d34dab2b54a854e6fc2bdb59e2f2f24323eb6fb7 56b510a6f97907a7b69e4ef38aa15a1057f7ee16f98dcbee34ba767970474596 +1406000 f817422a5052185cb6730097d2bc8511663a4bdb8429a33ada551e5cfcc6c62e da2284709ea49063f615345094be82199fe4b8c5c942324f058d53d918b2016e ad689c928dcc83eb1605f449dff702f5fc2b0d0ded5a49ad95d766ffb7bf00c3 +1406500 e9644dd6a0c430ffd8d3b4399ddcc96c11c2cf26c14d6d7e4126bf57eb8b4e8b ec4febf2fc289f43698b54b761f90923e48824d74e7392341d2c1d9d9d6555f7 d5426f0fb9b399efc4b1624f336434738b0f91c4a9804b4de17515069eeed6de +1407000 eb6e504aedb8afc6bde01ad745859bf845792aa93114a3694938786281c0a500 86dab15c1c415b66950d165062e9c285fee733d56e83f698ed3b2861bff1924e c28159ccb54b33d975e30cc3aec2d9896a082606f9a848a56f6ecafa95269c10 +1407500 0f381161a4533d5aec9e9030344c9fe8e208d2a973e22e8f4d5c88337428cc26 302d82ba0dc4c30a5442924631dc900ac8d812b6f6d8a292b885c0154157a946 88256f854cf7a9dfb8e7c5a08da513966ad1912ff7a6da3f6f6277e1d1f00199 +1408000 16e77c5d52a0f98077a0926a49a7209609b5e455c3912c84dba8899cc6e1ba11 d1e0966c8061240fc3af36473e76607471783aeb352b8ef2191a7c3526b1b495 e06c478ab5ebf0e5322a40434dd97a686683bc3f207b0dd8d077169075d3b41e +1408500 fb89f173897a51df2495064e452be7e4d5c5ce41597fa36d4f9c72812bc29b7e e4142511b775d3f4ce513993ebe6239b9e9905e1844ff721f3c7d89887dde717 ab341240c5c3f5c28207afa6efcb87aff423913d9860da66de3b9aa2a11db40a +1409000 6b1e74580c47b859243cee2e2937b1e7402f13a5808005c1fa542e89c3fb4b91 4d87ecee76e5fd1e14eefb1696b61bda885bd8667f11d4ea8ccff4d0ca01b394 4ab7e430257185ebb78ba69baf775a69ac51e5c8644992963f866ff9859d621d +1409500 950fb96dad70cf53850d92f78249bee78e228bbd2b946690d627bced8564ea63 852846f21fbf8af1443d919fc7b2a1b30ead6aad18098111f2de2457492e91ca e62e4e3db06870261141ca32bfc2ab2ff37580027ce4b93f5ba4475f139c9fdb +1410000 5a9cc3ca5065fd7d7a4dd74a370b35b7a19a218f79a48e2ec4efe25da41e9925 7d6f9f6ba0ecec30d7f6c1a79e0e6878e420a7af8d13046c7076f4efd570f630 9d76d49243410e349c36b144db6ea0c20ec1fc5d6289581315d1d87a2992a7e5 +1410500 94e419b37a6248dc6582842f9b5066840f274bb1a370a4202a008feb2c194a9a 9db315b6c1da9d704471326fe74eff7cd2615ca7323e6d690ff6b67a4250c049 a1f9d451fcf5d461648072d745694da9ff7918361b61172294f8c5a6db744027 +1411000 cefd4f2796001b36486a7c34186b2d6571c8ed644b3a95bb860f4dfb7789e5ad d8b16beeb89ca63dbd7a1966e415c95b7c88e9b3f44d5bcce9901c7ec3e8d913 dc26017394cb7b7388b1164be63148ff523856abddf3fb07003ef0f4869046e1 +1411500 d78c92f93901fb5da49d5642f61939c6acf47ff7b85e46be897fef77639fb86e acb9740da61a9c14b0b2c05f24f9139c44b12038f01d6e21e7870d0d329076bc 496d9c617b149475b1582b9c72058d851fad2578db0b35bf10a68e205fb8ae19 +1412000 ccc9ca6a3820c60e954cf1ec056c081e1f7efa0c17e42b2b9b25ddfd1b49da99 a1b8b5ca39d4844d3fdf89a45b634b7843b5957d61e256a7c6875ff9baf24db5 e05296050ac70909e3752d134971600801a454040e898861c506eaa829fd4b1e +1412500 af71cffdf5d5119bf2aad25b61e190bd6caeafe6c1a8908a4bcb8bfbabc3163f a6e63bf39f1c63b10919b557ab99f83080e165e837678148f675516a499424e6 1e9ed36915ea31315e8091f2ab8ee7c106f325c998dc9b63eaa452f94104c47f +1413000 a4c932111c3231982f96578e64babf22180a76891fa27d130baf3306ccce2e9d d7dea9fc0df8fca7889f93b6cfa5c7e5997abbfabf6a9592cca2fbab986f67f6 670cf68ed5e622f8c272f3a970b0cafdce33819c7febd56716a40fe4667fc50a +1413500 b8684d7fc2520d819ff714d60bc508dacdaf09f9b1df2b7a84cc3f066465eb19 fc7a7ecb650810e8edd590838d9e1bd3006b4817aebcaceb810442614ab9d663 9cbf74c74b33e156ed3e82261cb5fec2d13d58be8ab256158d6c437f294b9071 +1414000 1edf1f7ede292d4585bcf50725138809a78702a84ab867625239733afd3fed7c ad1936ff92eacff610bf29052303e097c61dadc7d7726aae52ba1d47d4f47acb d4f7646d195d176ca2f3373098a8ac118863bd45b423aa055df8338d4d9ade6d +1414500 505fadec80815b314303496dd791667f44632831bd6b36b3bd2b1bad83c56032 1794a5aee791877596b08586bb535d9c15f497a5391b1c4c97e5727cad42496a 9a73c6f21dd4d555403fac0b8bfd984da7c31c9602049ac42c0ce9fbcfd8c3e3 +1415000 a252b0c5e93c5d276da13715f6f3f781b6dddfe7021feafd41eab649fb42b029 918f9133e6efa7d67505d9592bb494615d1626270faf69d3b1020fee3e5316ae aaf0ad1223cd5315052e97d5a616a8c9d4d4fe4862c3d2cf5233181c0fea9630 +1415500 28c3176d903b9a18b09ae776b9e3a4fa731651c94b70b5a7accae6be798f6560 9fc07a6757d65e9dc3d03ec1ac98d53b37e31b96e37975b75e5f4d2d63c1abfa f1219feb096074bb1f21218d2d93c62cad06c77a2a36a5566b860eb56a806541 +1416000 89ddd5196ddea6682607095e9be7db395712708721b99aa9fa1dcfbae4497656 4213cee15df015b0872f3df661dd6876d134d906c23b8a37642f6882559fbb69 be368631e8ada4a543872bc060ec25a1acd762313bfe89c9f954b322c00e0a0f +1416500 6b8637c56f7b9179dea71bad981de70b3e83e2fa4e73301a76abcd092917bbf0 dbd4a302d26e4914e315fab898a62914ea41c17a65197897be166eccebfad01e 15c11cefccccfdab1f43b5bf7aced83a73345e58a594f8b34fceff7c5d11dccb +1417000 69bfa2ab9d8ca6dbd25043fd101c11d900c938e8d6b3041e8a7fccf19afbc15c 840a4375bb66a8495b04942e4539c7ef95e1849a83bde1f92fc6509386d4e045 dc0c1d343a98607008f3662d4dddae0e8d98210014b9742ed5c83de7339d7948 +1417500 442c09939727b080b88068635a6a81a7bcb26c3ca250d2e3397e99078f1afb9d 00937dcce0bc05f7a1de57a00e51491c6c0679512c8b4f800d2cfc01e19d3f01 b7155d0f396bed1fc14d91d445f3e3e9ea83e0863d358412e000787c877952eb +1418000 3569f30d857762670186132c4413a10cfc60ba623849049211e2a926354bb510 abf06d2de34999ac9509a99ac90263fc90061b18b84d4b3fcc93cc9f8e9c3dbd 6e9b279abaa4a8e56f62d5ed4a20898fbedb27e6c7ab21d303ae01e6cf7bfd24 +1418500 9627283c27a400806e40514bc7e23d29d8275d3fe58b08443523762a0d75d2c0 ed6bfcf4f1e93f1dd55fbcfeb3d3079a468a0c0b8ad48cb6c0e3d9303b16cc43 d10994a1a559193ef8244104168322e8dc403fe5a8667266edeaedc162942844 +1419000 4087787e9d1dde73892bf97e57270c5a8e173032f61a12511245ff7206fc0702 6e7bdc5625ecd5216b0506975a7e01d4429a2ecabe8c4598e584604ca8ebd28b 6c2711691a6787aa296c9df32c3e8af8879fc47fd739e8b4337ecd9c3b2c812a +1419500 f7d5fb1fbb507e4d294633581498d65f40fb5f91f4cfa4652d6b6a6b4a525279 00dd4638b508372ace47a221cbcb2fd364526702149aabcb9ba3c295875145b3 d61825d60023b4e5945685999f9f8dfad60a10557c1fc67a08f872a67723bd1d +1420000 dd22761d1b73a565f4ca27ac4ab5099d79a76df4bf1a8e684fd52b2ba65c2ab7 63302b06b5813e334db870366e09531441d7b0c2be27865f0d7a8735e0c7a75b 86ec4604d63c57648ab1da44731bd053e9c05f42ab4a995171d2f640d34791ec +1420500 bda52e2e5ee20f4be4d26e13047069a73b8d4b1583aa841569950cdaff4c3936 0d952138c239850ef703db1b323c45383e7f749a794c4e14d7654823716d4f0d 499a6b254d6cb88388fbff81fbaf9f72f014292a70e3802151466df04e1de038 +1421000 b537cb8fca3b686801558e74a9567638b5d68a1a035466f25e4016d7c7b544f2 772f0d7b78f44b1fb9019d50ec5037dac9c2ca751f1cb1db01d6817cc06ff52a 1c698a663c6b60843483e128a56554b226a32afb45f10f576212590bb15ede26 +1421500 acbc5037dfc8634454305688ba48dd256bd01d03f664a2c012e790df38934582 03fdcc81a4f0c1f1632545bd9a0ed349722b7e1db9d4496323d5c458de313716 85e91d7e68bd175071158a40cff6e5f2e952e9f6293fc1a7665e9e2b748d8c9a +1422000 2a2404d5bf4ed7399be3ebf682dab483eb9a8a1c39bc5a21277d12c5358f79fa fcc0acfac4e6f308fcbfba4085d423d405219f6a2641aeda59280f83210b2bc0 920edc7892c4861d47e93111dcbe8b64738b8194c668d9780942b48dce4e55c4 +1422500 8bebad21e607fbe48f2b24901c751802990fb9d6a83819f271b9557e7df629c9 5cc828b84c48015a2c59f74e22197b5d5de858b3c5d91eec995765eebba8d9f3 2cf2007fd44150d4088dd1e795068294809325c177a3b102c9986379ce3c8759 +1423000 238f119f7d72b6ca3bf57a296f21c2682998a7f26becf810045a30ac622b8c88 f95609a5a5fa40b8249005e820a0ec5d9753849a1b27c30d357d91eacf28a225 277a573c93f775ddd2efe788e75bf7ddc9179bd292edaf5fb1a9ec16fa85ebd3 +1423500 e549e71c042568111b1dd26f0f4aa364089f58d9f7bc06bfc39080772164c1d7 fe38ba05da5aa2171c421da54c185ee1f385660f589aab5c7e37e53f742526a9 a8945d2b5df103ddc46663c5cdc76776870c82b60e55e3baf24a53692e0254d9 +1424000 908f2b84b09ffdc6d6059e1cc19426cf0cf04689da8e8fd616ddd8a500cb1a80 d06dc5ea71e6d1634bcc675cd0dc6e25cc87acee106c3979e42961174ce5ab45 60d07d83b9e22a6d42d5d7b18a3a831396c6d9e5abb65faed09db9189fb54e8c +1424500 0e57b99fd449d97a26bbd4d86741b2ab3dfda56b0f8cd089773925ca1709284b 28260dafb45e13b2603e4b75821417ff4bc65d3bc42447e448b7cace1c306826 a068ff4dec4c46024a1d0eeeb2b0f9def2ba7b64f5bb5c978c8d288ab6a14898 +1425000 f4c0f2b761f2883431ad0e7d460f02db2f4f2460506814e726a367f83e401cbd b4437ec16383d8477e0759b8b1c7dc2ebebbc42e5fdf95a2544913de2bdfd120 fcc245441110b6fd3ebd5079ed09a400e4b3c9fc48bd1cc60ebc66010c97aaaf +1425500 631484dc1954c331b630800232f61b9555ed3f6d728c8bc40972524c3a476fad edc69a1871d99dff0d288b5276bc83adf4fbe411c33069bab6e2793a6458a267 c5e736a3d2dfc69405420359022ba0970abc5d7bdacaaecb9ad000e5163f151f +1426000 2b0e0bd0a8be000bf4deeba707590b61cb35b7489cd0e1d9536e0954dd5d9d09 c7e70d1d5efb8fa65cd25cd6015287b0eab187787056ca4e61face96ea82897e e9260e6e7490492bf6ba1a0fbc0b9988ac68dce1e712d0c4906f401d02062ca3 +1426500 0e333061d2aed1ece13489f6d9576ca3fcde54fee3ec100ac9cfad5ea755a579 5d6b7abe437393d1de65d6121a11497001ad88a51169d8f4f8c14d64b0a5b0f1 e9edcdb83924a9ba6242692cad08c001b7956cb981930fb755be8e7ab1c08efb +1427000 155853390fdadb3016de47cec48b265e34dd05a0c231f23b8957f8691728957b be61378bfc79b53a70223b482da9dbb778639a7e02f50cb4fad9e2431b17f3a1 9ba287e29e162ac4ac07f20a0789bbf3a8f63d293264938225685990456aa086 +1427500 4ef233e91a68ec5e048effb6f789b38231f73d3715ad5b3450c4047579a266e8 bd4a7c513bf4cd6bc81aec7e54b79588e418c77c9f794ee2b73a73b4a78f54ea b37df2b891571415dbe28738935764d36aae84902f8509c24874fbb925b0c81a +1428000 c16cdcda8c2dd8040eee589ab330fa2c2e1b53b560e3398e673892635c0d1d11 e2062775b080da9730f358c9f01554bc963b567124bdbdbe6b41a490e0a4f1f0 de8799c48a3be8473ce5a7d89becbd4ce8807fb31776416b692d4fa3528f17c8 +1428500 6c6756c99c78d1254cb07f7742eb79572908a8883e214717ad966210db49d6f9 7aedd6635652bdf8e2dd73d0f22ecf59800b0d7b48ac591553138228ec9d0ad5 fab6fae81d00758862a7e1b4d6b7c5a8088913f497cedb04360a8793cf638dab +1429000 3deadca463352d194e0d69f188d2bd97f4eeac2675b25356c0825c984abbf550 966232fca020eac0b583094a12c3a4f95608a18b09aee7bba50ae5b6a9403632 a8186ab3bd4fafdafebb46ec641db4de1b581a6ada5165e132854119ec21b3c0 +1429500 cc8f4ae3179f3b115e958962937b28a8f4360790efee2f574f52af7dffb4c418 10ec6991867cdb513c13a54da1c2a315b69f794094a4aecc437bfb824e18fd46 7303c30bc8fcd995c301556ac3b73ce61ea3a50a01049f92782b033e404cacfb +1430000 8ccf175e4a6aea397173129a5425d59351353abfe8db7b11662f6a7dfbe1c43a ecae611f76dbafb22b0f2e2deedceaa174bdb9673a30b1e3642e31c90c8ff80f a3d3dfa82ce94c52a3688c6582dabb07c2d1cc6bfc52da07d8ff0e5ec60e8b2c +1430500 47bfab777e65563cfded0698b12217944fd76afae32091ce76fbbb4cc1acec9a 81448e099c4f58b623a7ac30b62fd7693a6784eaa79517bd9f184bd15df99149 fb911aec6fca2d836dbba88ebb36c2e8d5b622e5e2f44506b7cb91671b9f178c +1431000 c512baeaf05340a6901618ed5602d3ec17aa8780b74ef8b1d45ac5821fa62475 538652fef1ef20da1feb2a821ef4ce204d6b0b9733a58e984596d6357cad6bcb 701f198b89f486c82294cb166e5a97009c2f2169d57c144f1af008fd030475c0 +1431500 830980fbf385f62bb57e1a9497f814279e0a0fdac8d5d8ddeb6791700e0cef48 521a7a6b1b6fd9cced1c579438bf47b6cf1cb63560739bf93017b752b804213f 1f081b3ea0909343b5a817d0397871e93117cb7fc7051540f420aa7bd0c15872 +1432000 530123444b6f51b50756db5b7fb33256497933e6e8820995ffb67de6bf62d6da 62e70ab6087166fed055667144238499f945d41c0332badaaeb664283b095923 e2edcb575fdfb34de6fa7e32875631e7c403d85952b4983b41b383782227568b +1432500 89d4931de0cfd2a95cad523251f30a1119c354452d50a1cc2a9ba20db77a4979 3c2268583da5ab084ed2cb5ac325fb00ebdebdde211dcb1643f04c12186ba7a5 50f2f5e9e67d0c025b74f855ee884ac5f3fe36dfc278ac183fc2a3076fd738d1 +1433000 64607b1563371086ce294c3079272889817aa48f75e60a56a2fe987d8660c47d 6736f3c502573f24e85ab86858496947eb1aa33c5220961f89cafce5115a2287 e4ef314d31ebf61abe223d78a40e73e6bc3f2d9c15c9ee07dcec5dd6c3e2af02 +1433500 ba051e04a5321bdd8c93540faf1bff2e10fec58d60459789bb4c516fffa73bdd a3f9efee68212b2920d41620de824c04f6ffcd3ed0eedd689153be9df67b8a4f da056883a569cb9e125bb28c02d34fe6ac1e95e7a4899397fa10e616644da9e0 +1434000 06d79f02d0790839773b9e4c0716f15ab695f14acd6b519a6daed5edf6239952 6091477a4195e893fc4958bade0f6f968330d83372f830cdbf7fbbe985d7d776 7eda9f328814982eba286beb8ce74ae7030a21c9ff062d3167b33100302a10e6 +1434500 97a0f3b33bb2691273ebc383ff3ff941932dbda10ea0673b64ffa2937726634d ff189c9f7173979653713e349d4890fb93428a13d946ca1ae6f78e87558cd12d 7cbcad7555be6c90c84cccf4de96817d219196804249ba6fc2de203383a5493e +1435000 a181b6a8eb934eb8191934f31e056d1851e29d631f7ec4c1028d52a84e68f1d2 33f3ae459afc6dd97b9c4f8bb759645232b34ef70c98efce94f023700d719911 19745095f47fbced60c335d5261c22381a49cfb0d7aabc34bd804e137bd34893 +1435500 62d074eed0e303a37b9b105856ba523af05899dcc2bacbccfddde11313d14af9 ac6ec9a0fdaa1d86681be189d00352775dbf862c16fc704f7ee88827126e97b8 648eca2ee1947fead88e1be9a9fbe0da21a12876dd6ef02c2f0ea9fc20a29c0c +1436000 3a3fc0e3ad84356251c646cbee2f3074b655fa3abf86315aaa7e957e01eb89f8 aef0cf31d538101472dad0d9d27791344f6fff964c6e6480d950814ae67b32a1 2b450f2aa4ad70c885fb54e2a1ca7489944f52d8c76b554f5eb7ef17ae39e096 +1436500 67e97cfb940a36a8d0099609fc76c6e3267b8c078eb20f5db25cbec0a90470a8 8a8004e415d4716355706c61cc16a6d8647d3456af400986935d01c051af130f e66100c236f17ab8d55e39b33ad9d2e72c02f6b98f278022e421db158fbf8f30 +1437000 7a1eab23011cdf4750a2e244a4e112de8fbde5c8294aff77927bafc9bf0e1b79 4b453da7657190f4f8eaa6f6f0ac8f061f232c3dc05fbacaa6f89b66a451c337 ba736e7bf4e5de2580869df81b80b0565021b8fde6b774b0cd6c2cecd38ab648 +1437500 b4251d0bc343612d5c8d3cd638584d81ae0b7f925184d2d1150f535faa664a01 70f2dab5062ec44432eba338059c00b3bbc112519cc427724170334b767fb3b2 2f23c3887488d58b9d6456f5cb930ec0546e1c6dc4b1a803e979711df7b15931 +1438000 d4390d7f2f0ec4883d473767463864dd69c0bd8eaa7ca7cb18867b3923cacf18 d4e07f34a01d790b55f605abee418ea71aed892d8dc6cafdaf540a30c456f073 c43543a673936d6e692edf4c8b1cb01f00e7b73449981580146e082f5526c4a5 +1438500 8a85c0128674d310efc2a41d18ce8216e881e38616bca7afac034047ab93364a e9497b5258bdf85e9cf186abdf89c3a0dd8ddb9ae21f586ced31cd86015ee1fe f5f8a5d0ebd0234ba3ba7d2aa72372fefa75e6221ed6b64126cd250c729f53b7 +1439000 17a29d0b26aec774eb4b76dc893906dc377426c20effaea2f3b053918e5006ea 5e9f7e91ce552517c76b9113b4912f898df50351063ce75e61401f2e40a8269c fefeab92f5f7824c2311b2170e3ed9e6bcb8a870a8bff2cce14bc75c1f391b75 +1439500 7db69e969f50d9530c5462054cff19f5fe0991881004de027ab6a233e6ebcf1d a073c4981183fec6098f4801111ec36a3991e92776eca38b312d3b579b89bdf4 156df5bcb9a3cfbb679ae03f097631be75e149009482cf1f384f9edaae9a245d +1440000 a5d484ff4c1cec801c17584ca0b9d41aa2591c302084514dfbe451cafc35a0a6 59a3e81b5692b6dd36f753f79f5a15adced8547dcea91572314f55ce35b007ff 1927fe143d05851a9ab37ed19c58dfe24380912766bf037e13af87e16cd8b4dd +1440500 351d93c828ba55dc7ca9004f041b77e4651ffa8fb709f19674545f3decf1cb31 01d09cfff0d8638e380dd4712325b76f79c63baaf7188b3db65040ce759095c7 02bac99571a8609d39b19687ad7c6da67f61e7b8849b9901a6f020a794de0d8b +1441000 311c932f5138e514f2dc51aade69c1d0c149dba382662492286a52585fe50f40 fc2113148b992f7714e4c520b3ee8cecbe1e1ab98341b3ec4bcb9a149e3b8adf e8363da245c0edd77a2b8ed237b2fd3fecc6ba210d986d9639048f8ac3fdeb64 +1441500 938e5bfaeb448f696eeb3284099c7a35672c11b9ab0e6927d3e7c91b546c315a b3c64c8c9c06bec1c5e546d2a0ccd2b9e136f700e3cd0afd3c47494170869994 d3b346a8c5f39b0b7f6ed27b7bb768d2ccc39e5315c16b3dd5df42944c501538 +1442000 6ddfa0ce1b862746bbf7c5f360f15424f92473dd1d098d4d7134801fc524bebd e2dfe2d263eeb82f963e284ea5b2195be3cc6cf2f331adfeb93dd4cd5066103a 6378650456bc2bba3bbbcc80a2b948aed45b117f055acd9c77fe42a6cf843c92 +1442500 cec826c204c0605f364f60ec6dd2f70659a234a25865228ddf4aed06bca6a1cb 1307e0e6807f145440022ab47b15a96001dc9a8a7b20e33952e129295c20f64d 781ba7480b062d4fe959f33482aa087ab65c23a9bd5f2ba0b4694ec2d40c90d9 +1443000 dc5cdda49ad2d94cc9eca875b760d9cc8233fab867b980fa3ce87ee90fd1fe93 8ccb9f0fd3b4ef99e1795b68d6b5f73574a0d1ddde2dbb5ece5b7adb0539b4e7 bcb0780aacc7c1369fb4b1beccdd9e464aa5513148544221423d5e52ab0762be +1443500 cb846a0e2f0a0f9a69ef0c76ca60af5692af0d8328b43f22a87dcd37be25c2da c920304395e59e42024d17f7877ccfde35d8ce35f49f2ef4e3e985694d9cc32f b20a45f237ea4d47ded5d5dd63d93c3f675cae6de668c831bbd2d2ba9790e579 +1444000 aa3a8de70f1e4e852afb0e90352d6aefe5b42f3eac4ff4cfb71ca92d135648bd 43f5f5ad40ad815e9c798db6ccd1d8ea2bc94407cae7460c3fd0006693cdd386 babc698fbfa13248d167469f0086bb75a03defb83a71b2d6dd485096d2c9ec64 +1444500 0ff67b6e4e9d1c0bb33ca5f3a43f56a82b5f45973d0812322bf05acdd4e5604e 668d19fb710af5c8f13ef3ffd28edc631b2d7627173af78f115f86962706dbf3 c9e7111ff2e456b5e395d9679f90d207de4c3d7d7d9b01fe5df2d5354079182a +1445000 1930b895a740c93416b3c6d802965d5d0c9e4d44dd3ed0f31c5b810f4aa83488 8f9cf32c5da053670c0982865e492d4b56dc98060f1224737e392078b702946e 42d1f85c05c3d56382f56f2cf8aab1b3714b912f3d6d4b7ca373290cc7fff9e5 +1445500 135506a1ae975620e84a06a32b8c2f0bd00101301f547dfad1a3dbed4b794c06 c46ae77684802b14265a435e01a8815ef5f81d0fde51ba73853ad98082e50b7b acf00c3faa9095374e3d450b940f27d616baed7af45961565a769faed73fd1a0 +1446000 59b4c849d502a373134e553937eae7a06282fd430ef663f7c1c66338ddd68115 a48ff15ca965a7252a1c16e1b71a9a10e3e7b4cff8577c2baf1c3fac05ae421c 2235874e873e8990be9ad9a69df26072a590a7f59931075b195327d5cb20d88b +1446500 3a44611ab88a8e45c1e07228579459a85e88b20f04cdda43dc042525cdc5c21d 612c304274d04872a016d6427392b2e17772d15f0af3e123bff3657d0f6493bd 0d60f1452b342ff50c82c216edea74ee24fdf400e088f392de4cd40e4ad9712d +1447000 fa0e200d7f2face36826dd931290057922a3fae9e468cf4cfd59e43cef8fd97e 1c20b859faf1eb7c6f4549a1fa4cd1f0ebbf4c66c4e9fdb2c20e171e3a22a1f9 59230c440d0cea4c0621aa57629e289504b3b50bb6b5281cb9d70cef050217ed +1447500 892b8087a0af4907ce50e37290c902d3fd3c7f4453de8a5d842e57412852e6f1 bc3b1a6ed6db8dd325e00cb676731b6811a0f3358851002ffd1f9d5ed242a015 2cfeb723a4d05c20f38cccb137b5120cbb0e88948f9fb925f8da924b594701db +1448000 71725cab11e0a0e8c31b97a06609ff541322b0a8970f899ecd0718fdae8b52f9 3c0a8edb5ddda9d62807bd06a67de8d001a9c2485025ae2dd56720491145ea33 204bc388b8afd2acc05f1638c29cd5385aadfd45ec3776c0c3435ecd16f6282e +1448500 610d22cc89262dd749799c6999bcff9478e8edbb61902a88c7243da67fb5219e 8cc5a3b721e12c5d184ecdfe56ebe8e60ae72e827afafd3b6772f347904b5d40 d18d25311815106e8fd97e064ff1f60a9fb65117b401db354775ffdae9f03d77 +1449000 885c07a7d369e0a501ff5451c1cc22e514d8c5c7c2b629f0296d0de417112240 356d776ff481d2f667e2f90b07d81328fffe2934aefbe69c5156246b02eeeca6 42342ab0ca63305e2aeece9f93dc341b9f1b2f8a50c8e8fe48caab72823b45ad +1449500 9efe905ffde45ecf996158c405bde9466da88eea15031f63078b8d5308a5ad76 e6b77d33ca9cf3f31f71d4802e4f47f11bad18d8ba1567f581797e391faad29d 3b791ddbf51f3c726e36c6651dd07772cb8f17237e90d42c939f75f8e4a8a1d0 +1450000 2d032563393786ad62c94a24b0a53e98c5fcd91f01d6f386b2e5e0f5d6ba3d88 07b1e5181e550a276597d022bceb27ffa95920e1140d7b311cd134aa0155d938 a6148036f071a156c2ef7baef40eecaea74032b2e616991472351a7447858849 +1450500 c15c9b4a1421f05a82beefe9aedab9cfb439b3abca5234d541876599a6d36747 19bd9f655d61c83dfdf15f68cbc4839b84177fe77c798b8f9d69c5ea2a051fdf 3e46288a1040ea22328bac7a10ec33272a0acb23d713cd7f0c6cc9efef99bc29 +1451000 5f4e425cecead82f6dd0563c07eb341cca9471ef30a84b9a246b01294f10ea17 diff --git a/iguana/dPoW.h b/iguana/dPoW.h index 8572f2393..b0a933f02 100755 --- a/iguana/dPoW.h +++ b/iguana/dPoW.h @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -19,13 +19,13 @@ #define DPOW_FIRSTRATIFY 1000 #define DPOW_CHECKPOINTFREQ 10 -#define DPOW_MINSIGS 17 //((height < 90000) ? 7 : 11) +#define DPOW_MINSIGS 17 //#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 0x0771 +#define DPOW_VERSION 0x0779 #define DPOW_UTXOSIZE 10000 #define DPOW_MINOUTPUT 6000 -#define DPOW_DURATION 300 +#define DPOW_DURATION 600 #define DPOW_RATIFYDURATION (3600 * 24) //#define DPOW_ENTRIESCHANNEL ('e' | ('n' << 8) | ('t' << 16) | ('r' << 24)) @@ -45,12 +45,14 @@ #define DPOW_MAXRELAYS 64 #define DPOW_MAXSIGLEN 128 -#define DEX_VERSION 0x0101 +#define DEX_VERSION 0x0103 #define DPOW_SOCK 7775 #define DEX_SOCK 7774 #define PUB_SOCK 7773 #define REP_SOCK 7772 +#define DPOW_EPOCHDURATION 600 + struct dpow_coinentry { bits256 prev_hash; @@ -70,7 +72,7 @@ struct dpow_entry { bits256 commit,beacon,ratifysrcutxo,ratifydestutxo; uint64_t masks[2][DPOW_MAXRELAYS],recvmask,othermask,bestmask,ratifyrecvmask,ratifybestmask; - int32_t height; uint32_t pendingcrcs[2]; + int32_t height; uint32_t pendingcrcs[2],paxwdcrc; uint16_t ratifysrcvout,ratifydestvout; int8_t bestk,ratifybestk; uint8_t pubkey[33],ratifysigs[2][DPOW_MAXSIGLEN],ratifysiglens[2]; @@ -106,7 +108,7 @@ struct dpow_block uint64_t destsigsmasks[DPOW_MAXRELAYS],srcsigsmasks[DPOW_MAXRELAYS]; uint64_t recvmask,bestmask,ratifybestmask,ratifyrecvmask,pendingbestmask,pendingratifybestmask,ratifysigmasks[2]; struct dpow_entry notaries[DPOW_MAXRELAYS]; - uint32_t state,starttime,timestamp,waiting,sigcrcs[2],txidcrcs[2],utxocrcs[2],lastepoch; + uint32_t state,starttime,timestamp,waiting,sigcrcs[2],txidcrcs[2],utxocrcs[2],lastepoch,paxwdcrc; int32_t rawratifiedlens[2],height,numnotaries,numerrors,completed,minsigs,duration,numratified,isratify,require0,scores[DPOW_MAXRELAYS]; int8_t myind,bestk,ratifybestk,pendingbestk,pendingratifybestk; cJSON *ratified; @@ -134,10 +136,47 @@ struct dpow_info uint32_t SRCREALTIME,destupdated,srcconfirms,numdesttx,numsrctx,lastsplit,cancelratify; int32_t lastheight,maxblocks,SRCHEIGHT,SHORTFLAG,ratifying; struct pax_transaction *PAX; - portable_mutex_t mutex; + portable_mutex_t paxmutex,dexmutex; uint32_t ipbits[64],numipbits; struct dpow_block **blocks; }; - +uint64_t dpow_notarybestk(uint64_t refmask,struct dpow_block *bp,int8_t *lastkp); +int32_t dpow_paxpending(uint8_t *hex,uint32_t *paxwdcrcp); +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); +int32_t dpow_getchaintip(struct supernet_info *myinfo,bits256 *blockhashp,uint32_t *blocktimep,bits256 *txs,uint32_t *numtxp,struct iguana_info *coin); +void dpow_send(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp,bits256 srchash,bits256 desthash,uint32_t channel,uint32_t msgbits,uint8_t *data,int32_t datalen); +int32_t dpow_nanomsg_update(struct supernet_info *myinfo); +int32_t dpow_haveutxo(struct supernet_info *myinfo,struct iguana_info *coin,bits256 *txidp,int32_t *voutp,char *coinaddr); +void komodo_assetcoins(int32_t fullnode); +int32_t iguana_isnotarychain(char *symbol); + +cJSON *dpow_getinfo(struct supernet_info *myinfo,struct iguana_info *coin); +cJSON *dpow_gettransaction(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid); +cJSON *dpow_getblock(struct supernet_info *myinfo,struct iguana_info *coin,bits256 blockhash); +bits256 dpow_getblockhash(struct supernet_info *myinfo,struct iguana_info *coin,int32_t height); +bits256 dpow_getbestblockhash(struct supernet_info *myinfo,struct iguana_info *coin); +char *dpow_sendrawtransaction(struct supernet_info *myinfo,struct iguana_info *coin,char *signedtx); +cJSON *dpow_gettxout(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid,int32_t vout); +char *dpow_importaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *address); +char *dpow_validateaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *address); +cJSON *dpow_listunspent(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr); +cJSON *dpow_listtransactions(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr,int32_t count,int32_t skip); +char *dpow_alladdresses(struct supernet_info *myinfo,struct iguana_info *coin); +void init_alladdresses(struct supernet_info *myinfo,struct iguana_info *coin); + +char *_dex_getinfo(struct supernet_info *myinfo,char *symbol); +char *_dex_getrawtransaction(struct supernet_info *myinfo,char *symbol,bits256 txid); +char *_dex_getblock(struct supernet_info *myinfo,char *symbol,bits256 hash2); +char *_dex_getblockhash(struct supernet_info *myinfo,char *symbol,int32_t height); +char *_dex_getbestblockhash(struct supernet_info *myinfo,char *symbol); +char *_dex_sendrawtransaction(struct supernet_info *myinfo,char *symbol,char *signedtx); +char *_dex_gettxout(struct supernet_info *myinfo,char *symbol,bits256 txid,int32_t vout); +char *_dex_importaddress(struct supernet_info *myinfo,char *symbol,char *address); +char *_dex_validateaddress(struct supernet_info *myinfo,char *symbol,char *address); +char *_dex_listunspent(struct supernet_info *myinfo,char *symbol,char *address); +char *_dex_listtransactions(struct supernet_info *myinfo,char *symbol,char *coinaddr,int32_t count,int32_t skip); +char *_dex_alladdresses(struct supernet_info *myinfo,char *symbol); #endif diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 031e5787c..3a6bf95a3 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -36,7 +36,7 @@ void dpow_utxo2entry(struct dpow_block *bp,struct dpow_entry *ep,struct dpow_utx bp->notaries[i].othermask |= up->othermasks[i]; ep->commit = up->commit; ep->height = up->height; - ep->recvmask = up->recvmask; + ep->recvmask |= up->recvmask; ep->bestk = up->bestk; ep->src.prev_hash = up->srchash; ep->dest.prev_hash = up->desthash; @@ -89,7 +89,7 @@ int32_t dpow_datahandler(struct supernet_info *myinfo,struct dpow_info *dp,struc if ( bits256_cmp(txid,srchash) == 0 ) { //printf("verify (%s) it is properly signed! set ht.%d signedtxid to %s\n",coin->symbol,height,bits256_str(str,txid)); - if ( src_or_dest != 0 ) + /*if ( channel == DPOW_BTCTXIDCHANNEL ) { if ( bp->state < 1000 ) { @@ -108,7 +108,7 @@ int32_t dpow_datahandler(struct supernet_info *myinfo,struct dpow_info *dp,struc printf("set state elapsed %d COMPLETED %s.(%s) %s.(%s)\n",(int32_t)(time(NULL) - bp->starttime),dp->symbol,bits256_str(str,bp->desttxid),dp->dest,bits256_str(str2,txid)); bp->state = 0xffffffff; } - } + }*/ } else { @@ -158,7 +158,7 @@ void dpow_statemachinestart(void *ptr) { void **ptrs = ptr; struct supernet_info *myinfo; struct dpow_info *dp; struct dpow_checkpoint checkpoint; - int32_t i,j,ht,destprevvout0,srcprevvout0,numratified=0,kmdheight,myind = -1; uint8_t pubkeys[64][33]; cJSON *ratified=0,*item; struct iguana_info *src,*dest; char *jsonstr,*handle,*hexstr,str[65],str2[65],srcaddr[64],destaddr[64]; bits256 zero,srchash,destprevtxid0,srcprevtxid0; struct dpow_block *bp; struct dpow_entry *ep = 0; uint32_t duration,minsigs,starttime,srctime; + int32_t i,j,ht,extralen,destprevvout0,srcprevvout0,numratified=0,kmdheight,myind = -1; uint8_t extras[10000],pubkeys[64][33]; cJSON *ratified=0,*item; struct iguana_info *src,*dest; char *jsonstr,*handle,*hexstr,str[65],str2[65],srcaddr[64],destaddr[64]; bits256 zero,srchash,destprevtxid0,srcprevtxid0; struct dpow_block *bp; struct dpow_entry *ep = 0; uint32_t duration,minsigs,starttime,srctime; memset(&zero,0,sizeof(zero)); srcprevtxid0 = destprevtxid0 = zero; srcprevvout0 = destprevvout0 = -1; @@ -292,6 +292,8 @@ void dpow_statemachinestart(void *ptr) // printf("%02x",pubkeys[i][j]); //printf(" <= pubkey[%d]\n",i); memcpy(bp->notaries[i].pubkey,pubkeys[i],33); + if ( strcmp("KMD",src->symbol) == 0 ) + memcpy(myinfo->notaries[i].pubkey,pubkeys[i],33); if ( memcmp(bp->notaries[i].pubkey,dp->minerkey33,33) == 0 ) { myind = i; @@ -301,6 +303,8 @@ void dpow_statemachinestart(void *ptr) printf(" MYIND.%d <<<<<<<<<<<<<<<<<<<<<<\n",myind); } } + if ( strcmp("KMD",src->symbol) == 0 ) + myinfo->numnotaries = bp->numnotaries; if ( myind < 0 || ep == 0 ) { printf("minerkey33-> "); @@ -387,9 +391,15 @@ void dpow_statemachinestart(void *ptr) } sleep(1); } - if ( bp->isratify == 0 || (starttime= checkpoint.timestamp) == 0 ) - bp->starttime = starttime = (uint32_t)time(NULL); - printf("myind.%d isratify.%d DPOW.%s statemachine checkpoint.%d %s start.%u\n",bp->myind,bp->isratify,src->symbol,checkpoint.blockhash.height,bits256_str(str,checkpoint.blockhash.hash),checkpoint.timestamp); + starttime = (uint32_t)time(NULL); + if ( bp->isratify == 0 ) + { + //if ( (starttime= checkpoint.timestamp) == 0 ) + bp->starttime = starttime; + extralen = dpow_paxpending(extras,&bp->paxwdcrc); + 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\n",bp->paxwdcrc,bp->myind,bp->isratify,src->symbol,checkpoint.blockhash.height,bits256_str(str,checkpoint.blockhash.hash),starttime,bp->duration,time(NULL)); for (i=0; iminerkey33[i+1]; //printf("start utxosync start.%u %u\n",starttime,(uint32_t)time(NULL)); @@ -397,9 +407,17 @@ void dpow_statemachinestart(void *ptr) //printf("done utxosync start.%u %u\n",starttime,(uint32_t)time(NULL)); while ( time(NULL) < starttime+bp->duration && src != 0 && dest != 0 && bp->state != 0xffffffff ) { - if ( bp->isratify == 0 && myinfo->DPOWS[0].ratifying != 0 ) - break; - sleep(1); + if ( bp->isratify == 0 ) + { + if ( myinfo->DPOWS[0].ratifying != 0 ) + { + printf("break due to already ratifying\n"); + break; + } + extralen = dpow_paxpending(extras,&bp->paxwdcrc); + bp->notaries[bp->myind].paxwdcrc = bp->paxwdcrc; + } + sleep(13); if ( dp->checkpoint.blockhash.height > checkpoint.blockhash.height ) { if ( bp->isratify == 0 ) @@ -426,6 +444,7 @@ void dpow_statemachinestart(void *ptr) if ( bp->state != 0xffffffff ) { dpow_send(myinfo,dp,bp,srchash,bp->hashmsg,0,bp->height,(void *)"ping",0); + dpow_nanomsg_update(myinfo); } if ( 0 && dp->cancelratify != 0 && bp->isratify != 0 ) { @@ -433,9 +452,11 @@ void dpow_statemachinestart(void *ptr) break; } } - printf("isratify.%d bestk.%d %llx sigs.%llx state machine ht.%d completed state.%x %s.%s %s.%s recvmask.%llx\n",bp->isratify,bp->bestk,(long long)bp->bestmask,(long long)(bp->bestk>=0?bp->destsigsmasks[bp->bestk]:0),bp->height,bp->state,dp->dest,bits256_str(str,bp->desttxid),dp->symbol,bits256_str(str2,bp->srctxid),(long long)bp->recvmask); + printf("END isratify.%d:%d bestk.%d %llx sigs.%llx state.%x machine ht.%d completed state.%x %s.%s %s.%s recvmask.%llx paxwdcrc.%x %p %p\n",bp->isratify,dp->ratifying,bp->bestk,(long long)bp->bestmask,(long long)(bp->bestk>=0?bp->destsigsmasks[bp->bestk]:0),bp->state,bp->height,bp->state,dp->dest,bits256_str(str,bp->desttxid),dp->symbol,bits256_str(str2,bp->srctxid),(long long)bp->recvmask,bp->paxwdcrc,src,dest); + bp->state = 0xffffffff; dp->lastrecvmask = bp->recvmask; dp->ratifying -= bp->isratify; + dp->blocks[bp->height] = 0; free(ptr); } diff --git a/iguana/dpow/dpow_network.c b/iguana/dpow/dpow_network.c index e8955e412..86c81a22e 100755 --- a/iguana/dpow/dpow_network.c +++ b/iguana/dpow/dpow_network.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -16,12 +16,115 @@ // 1. add rpc hooks, debug // 2. sig validate in fsm +struct signed_nnpacket +{ + uint8_t sig64[64]; + bits256 packethash; + uint32_t nonce,packetlen; + uint8_t packet[]; +} PACKED; + +int32_t signed_nn_send(void *ctx,bits256 privkey,int32_t sock,void *packet,int32_t size) +{ + int32_t i,sentbytes,siglen = 0; uint8_t sig[65],pubkey33[33]; struct signed_nnpacket *sigpacket; + if ( (sigpacket= calloc(1,size + sizeof(*sigpacket))) != 0 ) + { + sigpacket->packetlen = size; + memcpy(sigpacket->packet,packet,size); + for (i=0; i<10000; i++) + { + sigpacket->nonce = i; + vcalc_sha256(0,sigpacket->packethash.bytes,(void *)&sigpacket->nonce,(int32_t)(size+sizeof(sigpacket->nonce)+sizeof(sigpacket->packetlen))); + if ( sigpacket->packethash.bytes[0] == 0 ) + break; + } + bitcoin_pubkey33(ctx,pubkey33,privkey); + if ( i < 10000 && (siglen= bitcoin_sign(ctx,"nnsend",sig,sigpacket->packethash,privkey,1)) > 0 && siglen == 65 ) + { + //for (i=0; i<33; i++) + // printf("%02x",pubkey33[i]); + //printf(" signed pubkey\n"); + memcpy(sigpacket->sig64,sig+1,64); + sentbytes = nn_send(sock,sigpacket,size + sizeof(*sigpacket),0); + return(sentbytes - siglen); + } else printf("couldnt find nonce\n"); + free(sigpacket); + } + return(-1); +} + +int32_t signed_nn_recv(void **freeptrp,void *ctx,struct dpow_entry *notaries,int32_t n,int32_t sock,void *packetp) +{ + int32_t i,recvbytes; uint8_t pubkey33[33]; bits256 packethash; struct signed_nnpacket *sigpacket=0; + *(void **)packetp = 0; + *freeptrp = 0; + recvbytes = nn_recv(sock,&sigpacket,NN_MSG,0); + if ( sigpacket != 0 && recvbytes > sizeof(*sigpacket) && sigpacket->packetlen == recvbytes-sizeof(*sigpacket) ) + { + vcalc_sha256(0,packethash.bytes,(void *)&sigpacket->nonce,(int32_t)(sigpacket->packetlen+sizeof(sigpacket->nonce)+sizeof(sigpacket->packetlen))); + if ( bits256_cmp(packethash,sigpacket->packethash) == 0 && sigpacket->packethash.bytes[0] == 0 ) + { + if ( bitcoin_recoververify(ctx,"nnrecv",sigpacket->sig64,sigpacket->packethash,pubkey33,33) == 0 ) + { + for (i=0; inonce,sigpacket->packetlen); + } else printf("hash mismatch or bad nonce.%u packetlen.%d\n",sigpacket->nonce,sigpacket->packetlen); + } //else printf("recvbytes.%d mismatched packetlen.%d + %ld\n",recvbytes,sigpacket!=0?sigpacket->packetlen:-1,sizeof(*sigpacket)); + //printf("free sigpacket.%p freeptrp.%p packetp.%p\n",sigpacket,*freeptrp,*(void **)packetp); + if ( sigpacket != 0 ) + nn_freemsg(sigpacket), sigpacket = 0; + *freeptrp = sigpacket; + *(void **)packetp = sigpacket; + return(0); +} + struct dex_nanomsghdr { - uint32_t size,datalen,crc32; + uint32_t crc32,size,datalen,timestamp; + char handler[8]; uint8_t version0,version1,packet[]; } PACKED; +struct dex_request { bits256 hash; int32_t intarg; uint16_t shortarg; char name[15]; uint8_t func; }; + +int32_t dex_rwrequest(int32_t rwflag,uint8_t *serialized,struct dex_request *dexreq) +{ + int32_t len = 0; + len += iguana_rwbignum(rwflag,&serialized[len],sizeof(dexreq->hash),dexreq->hash.bytes); + len += iguana_rwnum(rwflag,&serialized[len],sizeof(dexreq->intarg),&dexreq->intarg); + len += iguana_rwnum(rwflag,&serialized[len],sizeof(dexreq->shortarg),&dexreq->shortarg); + if ( rwflag != 0 ) + { + memcpy(&serialized[len],dexreq->name,sizeof(dexreq->name)), len += sizeof(dexreq->name); + serialized[len++] = dexreq->func; + } + else + { + memcpy(dexreq->name,&serialized[len],sizeof(dexreq->name)), len += sizeof(dexreq->name); + dexreq->func = serialized[len++]; + } + return(len); +} + void dex_init(struct supernet_info *myinfo) { strcpy(myinfo->dexseed_ipaddr,"78.47.196.146"); @@ -30,8 +133,13 @@ void dex_init(struct supernet_info *myinfo) portable_mutex_init(&myinfo->dexmutex); } -char *nanomsg_tcpname(char *str,char *ipaddr,uint16_t port) +char *nanomsg_tcpname(struct supernet_info *myinfo,char *str,char *ipaddr,uint16_t port) { + if ( myinfo != 0 ) // bind path) + { + if ( myinfo->bindaddr[0] != 0 && strcmp(ipaddr,myinfo->ipaddr) == 0 ) + ipaddr = myinfo->bindaddr; + } sprintf(str,"tcp://%s:%u",ipaddr,port); return(str); } @@ -51,80 +159,498 @@ static int _increasing_ipbits(const void *a,const void *b) void dex_packet(struct supernet_info *myinfo,struct dex_nanomsghdr *dexp,int32_t size) { - printf("DEX_PACKET.[%d]\n",size); + char *retstr; int32_t datalen; struct iguana_info *coin; struct dex_request dexreq; + //for (i=0; ipacket,dexp->datalen),(int32_t)(time(NULL)-dexp->timestamp),dexp->size,dexp->datalen); + if ( strcmp(dexp->handler,"DEX") == 0 )//dexp->datalen > BASILISK_KEYSIZE ) + { + if ( (retstr= basilisk_respond_addmessage(myinfo,dexp->packet,BASILISK_KEYSIZE,&dexp->packet[BASILISK_KEYSIZE],dexp->datalen-BASILISK_KEYSIZE,0,BASILISK_DEXDURATION)) != 0 ) + free(retstr); + } + else if ( strcmp(dexp->handler,"request") == 0 ) + { + datalen = dex_rwrequest(0,dexp->packet,&dexreq); + if ( myinfo->IAMNOTARY != 0 && dexreq.func == 'A' && (coin= iguana_coinfind(dexreq.name)) != 0 ) + { + if ( (retstr= dpow_importaddress(myinfo,coin,(char *)&dexp->packet[datalen])) != 0 ) + free(retstr); + printf("process broadcast importaddress.(%s) [%s]\n",(char *)&dexp->packet[datalen],dexreq.name); + } + } } -void dex_reqsend(struct supernet_info *myinfo,uint8_t *data,int32_t datalen) +char *_dex_reqsend(struct supernet_info *myinfo,char *handler,uint8_t *data,int32_t datalen) { - struct dex_nanomsghdr *dexp; char ipaddr[64],str[128]; int32_t timeout,i,n,size,recvbytes,sentbytes = 0; uint32_t crc32,*retptr,ipbits; - if ( myinfo->reqsock < 0 && (myinfo->reqsock= nn_socket(AF_SP,NN_REQ)) >= 0 ) + struct dex_nanomsghdr *dexp; cJSON *retjson; char ipaddr[64],str[128]; int32_t timeout,i,n,size,recvbytes,sentbytes = 0,reqsock,subsock; uint32_t *retptr,ipbits; void *freeptr; char *retstr = 0; + portable_mutex_lock(&myinfo->dexmutex); + subsock = myinfo->subsock; + reqsock = myinfo->reqsock; + if ( reqsock < 0 && (reqsock= nn_socket(AF_SP,NN_REQ)) >= 0 ) { - if ( nn_connect(myinfo->reqsock,nanomsg_tcpname(str,myinfo->dexseed_ipaddr,REP_SOCK)) < 0 ) + if ( nn_connect(reqsock,nanomsg_tcpname(0,str,myinfo->dexseed_ipaddr,REP_SOCK)) < 0 ) { - nn_close(myinfo->reqsock); - myinfo->reqsock = -1; + nn_close(reqsock); + reqsock = -1; } else { - if ( myinfo->subsock < 0 && (myinfo->subsock= nn_socket(AF_SP,NN_SUB)) >= 0 ) + timeout = 100; + nn_setsockopt(reqsock,NN_SOL_SOCKET,NN_SNDTIMEO,&timeout,sizeof(timeout)); + timeout = 1000; + nn_setsockopt(reqsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout)); + //nn_setsockopt(reqsock,NN_TCP,NN_RECONNECT_IVL,&timeout,sizeof(timeout)); + if ( myinfo->IAMNOTARY == 0 && subsock < 0 && (subsock= nn_socket(AF_SP,NN_SUB)) >= 0 ) { - if ( nn_connect(myinfo->subsock,nanomsg_tcpname(str,myinfo->dexseed_ipaddr,PUB_SOCK)) < 0 ) + if ( nn_connect(subsock,nanomsg_tcpname(0,str,myinfo->dexseed_ipaddr,PUB_SOCK)) < 0 ) { - nn_close(myinfo->reqsock); - myinfo->reqsock = -1; - nn_close(myinfo->subsock); - myinfo->subsock = -1; + nn_close(reqsock); + reqsock = -1; + nn_close(subsock); + subsock = -1; } else { - timeout = 1000; - nn_setsockopt(myinfo->reqsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout)); - nn_setsockopt(myinfo->subsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout)); - nn_setsockopt(myinfo->subsock,NN_SUB,NN_SUB_SUBSCRIBE,"",0); - printf("DEXINIT req.%d sub.%d\n",myinfo->reqsock,myinfo->subsock); + timeout = 100; + nn_setsockopt(subsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout)); + nn_setsockopt(subsock,NN_SUB,NN_SUB_SUBSCRIBE,"",0); + printf("CLIENT sockets req.%d sub.%d\n",reqsock,subsock); } } } } + if ( myinfo->subsock != subsock ) + myinfo->subsock = subsock; + if ( myinfo->reqsock != reqsock ) + myinfo->reqsock = reqsock; + portable_mutex_unlock(&myinfo->dexmutex); if ( myinfo->reqsock >= 0 ) { - crc32 = calc_crc32(0,data,datalen); size = (int32_t)(sizeof(*dexp) + datalen); dexp = calloc(1,size); // endian dependent! + safecopy(dexp->handler,handler,sizeof(dexp->handler)); dexp->size = size; dexp->datalen = datalen; - dexp->crc32 = crc32; + dexp->timestamp = (uint32_t)time(NULL); dexp->version0 = DEX_VERSION & 0xff; dexp->version1 = (DEX_VERSION >> 8) & 0xff; memcpy(dexp->packet,data,datalen); - sentbytes = nn_send(myinfo->reqsock,dexp,size,0); - if ( (recvbytes= nn_recv(myinfo->reqsock,&retptr,NN_MSG,0)) >= 0 ) + dexp->crc32 = calc_crc32(0,data,datalen); + for (i=0; i<100; i++) + { + struct nn_pollfd pfd; + pfd.fd = myinfo->reqsock; + pfd.events = NN_POLLOUT; + if ( nn_poll(&pfd,1,100) > 0 ) + { + sentbytes = signed_nn_send(myinfo->ctx,myinfo->persistent_priv,myinfo->reqsock,dexp,size); + //printf(" sent.%d:%d datalen.%d\n",sentbytes,size,datalen); + break; + } + usleep(1000); + } + //for (i=0; ictx,myinfo->notaries,myinfo->numnotaries,myinfo->reqsock,&retptr)) >= 0 ) { + //printf("req returned.[%d]\n",recvbytes); portable_mutex_lock(&myinfo->dexmutex); - ipbits = *retptr; - expand_ipbits(ipaddr,ipbits); - printf("req returned.[%d] %08x %s\n",recvbytes,*retptr,ipaddr); - n = myinfo->numdexipbits; - for (i=0; idexipbits[i] ) - break; - if ( i == n && n < 64 ) + ipbits = 0; + if ( strcmp(handler,"DEX") == 0 ) + ipbits = *retptr; + else { - myinfo->dexipbits[n++] = ipbits; - qsort(myinfo->dexipbits,n,sizeof(uint32_t),_increasing_ipbits); - if ( (myinfo->numdexipbits= n) < 3 ) + retstr = clonestr((char *)retptr); + if ( (retjson= cJSON_Parse(retstr)) != 0 ) { - if ( myinfo->subsock >= 0 ) - nn_connect(myinfo->subsock,nanomsg_tcpname(str,ipaddr,PUB_SOCK)); + ipbits = juint(retjson,"randipbits"); + free_json(retjson); + if ( 0 && ipbits != 0 ) + printf("GOT randipbits.%08x\n",ipbits); } } + if ( ipbits != 0 ) + { + expand_ipbits(ipaddr,ipbits); + n = myinfo->numdexipbits; + for (i=0; idexipbits[i] ) + break; + if ( i == n && n < 64 ) + { + myinfo->dexipbits[n++] = ipbits; + qsort(myinfo->dexipbits,n,sizeof(uint32_t),_increasing_ipbits); + if ( (myinfo->numdexipbits= n) < 3 ) + { + if ( myinfo->IAMNOTARY == 0 && myinfo->subsock >= 0 ) + { + nn_connect(myinfo->subsock,nanomsg_tcpname(0,str,ipaddr,PUB_SOCK)); + printf("%d: subscribe connect (%s)\n",myinfo->numdexipbits,str); + } + } + nn_connect(myinfo->reqsock,nanomsg_tcpname(0,str,ipaddr,REP_SOCK)); + printf("%d: req connect (%s)\n",myinfo->numdexipbits,str); + } + } + if ( freeptr != 0 ) + nn_freemsg(freeptr), freeptr = 0, retptr = 0; portable_mutex_unlock(&myinfo->dexmutex); - nn_connect(myinfo->reqsock,nanomsg_tcpname(str,ipaddr,REP_SOCK)); - nn_freemsg(retptr); } + else + { + //retval = -2; + //printf("no rep return? recvbytes.%d\n",recvbytes); + } + //printf("DEXREQ.[%d] crc32.%08x datalen.%d sent.%d recv.%d timestamp.%u\n",size,dexp->crc32,datalen,sentbytes,recvbytes,dexp->timestamp); free(dexp); - //printf("DEXREQ.[%d] crc32.%08x datalen.%d sent.%d\n",size,dexp->crc32,datalen,sentbytes); + } //else retval = -1; + return(retstr); +} + +void dpow_randipbits(struct supernet_info *myinfo,struct iguana_info *coin,cJSON *retjson) +{ + int32_t m; uint32_t ipbits; char *coinstr; + if ( is_cJSON_Array(retjson) == 0 ) + { + if ( (m= myinfo->numdpowipbits) > 0 ) + { + ipbits = myinfo->dpowipbits[(uint32_t)rand() % m]; + jaddnum(retjson,"randipbits",ipbits); + //printf("add randipbits.%08x\n",ipbits); + } + if ( (coinstr= jstr(retjson,"coin")) == 0 ) + jaddstr(retjson,"coin",coin->symbol); + } +} + +char *dex_response(int32_t *broadcastflagp,struct supernet_info *myinfo,struct dex_nanomsghdr *dexp) +{ + char buf[65],*retstr = 0; int32_t datalen; bits256 hash2; cJSON *retjson; struct iguana_info *coin; struct dex_request dexreq; + *broadcastflagp = 0; + if ( strcmp(dexp->handler,"request") == 0 ) + { + datalen = dex_rwrequest(0,dexp->packet,&dexreq); + //printf("dex_response.%s (%c)\n",dexreq.name,dexreq.func); + if ( (coin= iguana_coinfind(dexreq.name)) != 0 ) + { + if ( dexreq.func == 'T' ) + { + if ( (retjson= dpow_gettransaction(myinfo,coin,dexreq.hash)) != 0 ) + { + dpow_randipbits(myinfo,coin,retjson); + retstr = jprint(retjson,1); + } + } + else if ( dexreq.func == 'O' ) + { + if ( (retjson= dpow_gettxout(myinfo,coin,dexreq.hash,dexreq.shortarg)) != 0 ) + { + dpow_randipbits(myinfo,coin,retjson); + retstr = jprint(retjson,1); + } + } + else if ( dexreq.func == 'H' ) + { + hash2 = dpow_getblockhash(myinfo,coin,dexreq.intarg); + //printf("getblockhash %d -> (%s)\n",dexreq.intarg,bits256_str(buf,hash2)); + bits256_str(buf,hash2); + retstr = clonestr(buf); + } + else if ( dexreq.func == 'B' ) + { + if ( (retjson= dpow_getblock(myinfo,coin,dexreq.hash)) != 0 ) + { + dpow_randipbits(myinfo,coin,retjson); + retstr = jprint(retjson,1); + } + } + else if ( dexreq.func == 'I' ) + { + if ( (retjson= dpow_getinfo(myinfo,coin)) != 0 ) + { + dpow_randipbits(myinfo,coin,retjson); + retstr = jprint(retjson,1); + } + } + else if ( dexreq.func == 'U' ) + { + if ( (retjson= dpow_listunspent(myinfo,coin,(char *)&dexp->packet[datalen])) != 0 ) + { + dpow_randipbits(myinfo,coin,retjson); + retstr = jprint(retjson,1); + } + } + else if ( dexreq.func == 'P' ) + { + hash2 = dpow_getbestblockhash(myinfo,coin); + bits256_str(buf,hash2); + retstr = clonestr(buf); + } + else if ( dexreq.func == 'S' ) + { + retstr = dpow_sendrawtransaction(myinfo,coin,(char *)&dexp->packet[datalen]); + } + else if ( dexreq.func == '*' ) + { + retstr = dpow_alladdresses(myinfo,coin); + } + else if ( dexreq.func == 'L' ) + { + //printf("call list.(%s %d %d)\n",(char *)&dexp->packet[datalen],dexreq.shortarg,dexreq.intarg); + if ( (retjson= dpow_listtransactions(myinfo,coin,(char *)&dexp->packet[datalen],dexreq.shortarg,dexreq.intarg)) != 0 ) + { + dpow_randipbits(myinfo,coin,retjson); + retstr = jprint(retjson,1); + } + } + else if ( dexreq.func == 'A' ) + { + retstr = dpow_importaddress(myinfo,coin,(char *)&dexp->packet[datalen]); + if ( retstr == 0 ) + { + *broadcastflagp = 1; + retstr = dpow_validateaddress(myinfo,coin,(char *)&dexp->packet[datalen]); + } + else + { + printf("funcA.(%s)\n",retstr); + } + if ( retstr != 0 && (retjson= cJSON_Parse(retstr)) != 0 ) + { + dpow_randipbits(myinfo,coin,retjson); + free(retstr); + retstr = jprint(retjson,1); + } + } + else if ( dexreq.func == 'V' ) + { + retstr = dpow_validateaddress(myinfo,coin,(char *)&dexp->packet[datalen]); + if ( retstr != 0 && (retjson= cJSON_Parse(retstr)) != 0 ) + { + dpow_randipbits(myinfo,coin,retjson); + free(retstr); + retstr = jprint(retjson,1); + } + } + } else printf("(%s) not active\n",dexreq.name); + if ( retstr == 0 ) + return(clonestr("{\"error\":\"null return\"}")); + } + return(retstr); +} + +char *dex_reqsend(struct supernet_info *myinfo,char *handler,uint8_t *data,int32_t datalen,int32_t M,char *field) +{ + char *retstrs[64],*origretstr0 = 0; cJSON *retjson; int32_t err,i,j,max = myinfo->numdexipbits; + memset(retstrs,0,sizeof(retstrs)); + for (i=j=0; i<=max; i++) + { + if ( (retstrs[j]= _dex_reqsend(myinfo,handler,data,datalen)) != 0 ) + { + //printf("j.%d of max.%d (%s)\n",j,max,retstrs[j]); + if ( strncmp(retstrs[j],"{\"error\":\"null return\"}",strlen("{\"error\":\"null return\"}")) != 0 && strncmp(retstrs[j],"[]",strlen("[]")) != 0 && strcmp("0",retstrs[j]) != 0 ) + { + if ( ++j == M ) + break; + } + else if ( i < max ) + free(retstrs[j]); + } + //printf("automatic retry.%d of %d\n",i,max); } + if ( j == 1 ) + return(retstrs[0]); + else if ( j >= M ) + { + origretstr0 = retstrs[0]; + err = 0; + if ( strcmp(field,"*") != 0 ) + { + for (i=0; iname) >= 0 ) + { + datalen = dex_rwrequest(1,packet,dexreq); + return(dex_reqsend(myinfo,"request",packet,datalen,M,field)); + } else return(clonestr("{\"error\":\"not notarychain\"}")); +} + +char *_dex_sendrequeststr(struct supernet_info *myinfo,struct dex_request *dexreq,char *str,int32_t M,char *field) +{ + uint8_t *packet; int32_t datalen,slen; char *retstr; + if ( iguana_isnotarychain(dexreq->name) >= 0 ) + { + slen = (int32_t)strlen(str)+1; + packet = calloc(1,sizeof(*dexreq)+slen); + datalen = dex_rwrequest(1,packet,dexreq); + strcpy((char *)&packet[datalen],str); + datalen += slen; + retstr = dex_reqsend(myinfo,"request",packet,datalen,M,field); + free(packet); + return(retstr); + } else return(clonestr("{\"error\":\"not notarychain\"}")); +} + +char *_dex_getrawtransaction(struct supernet_info *myinfo,char *symbol,bits256 txid) +{ + struct dex_request dexreq; + memset(&dexreq,0,sizeof(dexreq)); + safecopy(dexreq.name,symbol,sizeof(dexreq.name)); + dexreq.hash = txid; + dexreq.func = 'T'; + return(_dex_sendrequest(myinfo,&dexreq,1,"")); +} + +char *_dex_gettxout(struct supernet_info *myinfo,char *symbol,bits256 txid,int32_t vout) +{ + struct dex_request dexreq; + //char str[65]; printf("gettxout(%s %s %d)\n",symbol,bits256_str(str,txid),vout); + memset(&dexreq,0,sizeof(dexreq)); + safecopy(dexreq.name,symbol,sizeof(dexreq.name)); + dexreq.hash = txid; + dexreq.shortarg = vout; + dexreq.func = 'O'; + return(_dex_sendrequest(myinfo,&dexreq,3,"value")); +} + +char *_dex_getinfo(struct supernet_info *myinfo,char *symbol) +{ + struct dex_request dexreq; + memset(&dexreq,0,sizeof(dexreq)); + safecopy(dexreq.name,symbol,sizeof(dexreq.name)); + dexreq.func = 'I'; + return(_dex_sendrequest(myinfo,&dexreq,1,"")); +} + +char *_dex_alladdresses(struct supernet_info *myinfo,char *symbol) +{ + struct dex_request dexreq; + memset(&dexreq,0,sizeof(dexreq)); + safecopy(dexreq.name,symbol,sizeof(dexreq.name)); + dexreq.func = '*'; + return(_dex_sendrequest(myinfo,&dexreq,1,"")); +} + +char *_dex_getblock(struct supernet_info *myinfo,char *symbol,bits256 hash2) +{ + struct dex_request dexreq; + memset(&dexreq,0,sizeof(dexreq)); + safecopy(dexreq.name,symbol,sizeof(dexreq.name)); + dexreq.hash = hash2; + dexreq.func = 'B'; + return(_dex_sendrequest(myinfo,&dexreq,1,"")); +} + +char *_dex_getblockhash(struct supernet_info *myinfo,char *symbol,int32_t height) +{ + struct dex_request dexreq; + memset(&dexreq,0,sizeof(dexreq)); + safecopy(dexreq.name,symbol,sizeof(dexreq.name)); + dexreq.intarg = height; + dexreq.func = 'H'; + return(_dex_sendrequest(myinfo,&dexreq,3,"*")); +} + +char *_dex_getbestblockhash(struct supernet_info *myinfo,char *symbol) +{ + struct dex_request dexreq; + memset(&dexreq,0,sizeof(dexreq)); + safecopy(dexreq.name,symbol,sizeof(dexreq.name)); + dexreq.func = 'P'; + return(_dex_sendrequest(myinfo,&dexreq,1,"")); +} + +char *_dex_sendrawtransaction(struct supernet_info *myinfo,char *symbol,char *signedtx) +{ + struct dex_request dexreq; + memset(&dexreq,0,sizeof(dexreq)); + safecopy(dexreq.name,symbol,sizeof(dexreq.name)); + dexreq.func = 'S'; + return(_dex_sendrequeststr(myinfo,&dexreq,signedtx,3,"*")); +} + +char *_dex_importaddress(struct supernet_info *myinfo,char *symbol,char *address) +{ + struct dex_request dexreq; + memset(&dexreq,0,sizeof(dexreq)); + safecopy(dexreq.name,symbol,sizeof(dexreq.name)); + dexreq.func = 'A'; + return(_dex_sendrequeststr(myinfo,&dexreq,address,1,"")); +} + +char *_dex_validateaddress(struct supernet_info *myinfo,char *symbol,char *address) +{ + struct dex_request dexreq; + memset(&dexreq,0,sizeof(dexreq)); + safecopy(dexreq.name,symbol,sizeof(dexreq.name)); + dexreq.func = 'V'; + return(_dex_sendrequeststr(myinfo,&dexreq,address,1,"")); +} + +char *_dex_listunspent(struct supernet_info *myinfo,char *symbol,char *address) +{ + struct dex_request dexreq; + memset(&dexreq,0,sizeof(dexreq)); + safecopy(dexreq.name,symbol,sizeof(dexreq.name)); + dexreq.func = 'U'; + return(_dex_sendrequeststr(myinfo,&dexreq,address,1,"")); +} + +char *_dex_listtransactions(struct supernet_info *myinfo,char *symbol,char *address,int32_t count,int32_t skip) +{ + struct dex_request dexreq; + memset(&dexreq,0,sizeof(dexreq)); + safecopy(dexreq.name,symbol,sizeof(dexreq.name)); + dexreq.intarg = skip; + dexreq.shortarg = count; + dexreq.func = 'L'; + return(_dex_sendrequeststr(myinfo,&dexreq,address,1,"")); } int32_t dex_crc32find(struct supernet_info *myinfo,uint32_t crc32) @@ -153,7 +679,7 @@ int32_t dex_packetcheck(struct supernet_info *myinfo,struct dex_nanomsghdr *dexp { if ( dexp->datalen == (size - sizeof(*dexp)) ) { - crc32 = calc_crc32(0,dexp->packet,dexp->datalen); + crc32 = calc_crc32(0,dexp->packet,dexp->datalen);//(void *)((long)dexp + sizeof(dexp->crc32)),(int32_t)(size - sizeof(dexp->crc32))); if ( dexp->crc32 == crc32 && (firstz= dex_crc32find(myinfo,crc32)) >= 0 ) return(0); } @@ -161,33 +687,42 @@ int32_t dex_packetcheck(struct supernet_info *myinfo,struct dex_nanomsghdr *dexp return(-1); } -void dex_subsock_poll(struct supernet_info *myinfo) +int32_t dex_subsock_poll(struct supernet_info *myinfo) { - int32_t size,n=0; struct dex_nanomsghdr *dexp; - while ( (size= nn_recv(myinfo->subsock,&dexp,NN_MSG,0)) >= 0 ) + int32_t size= -1; struct dex_nanomsghdr *dexp; void *freeptr; + if ( myinfo->subsock >= 0 && (size= signed_nn_recv(&freeptr,myinfo->ctx,myinfo->notaries,myinfo->numnotaries,myinfo->subsock,&dexp)) >= 0 ) { - n++; + //printf("SUBSOCK.%08x recv.%d datalen.%d\n",dexp->crc32,size,dexp->datalen); if ( dex_packetcheck(myinfo,dexp,size) == 0 ) { - printf("SUBSOCK.%08x",dexp->crc32); + //printf("SUBSOCK.%08x ",dexp->crc32); dex_packet(myinfo,dexp,size); } - if ( dexp != 0 ) - nn_freemsg(dexp), dexp = 0; - if ( size == 0 || n++ > 100 ) - break; + if ( freeptr != 0 ) + nn_freemsg(freeptr), dexp = 0, freeptr = 0; } + return(size); } -#if ISNOTARYNODE +void dex_updateclient(struct supernet_info *myinfo) +{ + int32_t i; + if ( myinfo->IAMNOTARY == 0 ) + { + for (i=0; i<100; i++) + if ( dex_subsock_poll(myinfo) <= 0 ) + break; + } +} +#if ISNOTARYNODE struct dpow_nanoutxo { bits256 srcutxo,destutxo; uint64_t bestmask,recvmask; - uint32_t pendingcrcs[2]; + uint32_t pendingcrcs[2],paxwdcrc; uint16_t srcvout,destvout; - uint8_t sigs[2][DPOW_MAXSIGLEN],siglens[2],bestk,pad; + uint8_t sigs[2][DPOW_MAXSIGLEN],siglens[2],pad,bestk; } PACKED; struct dpow_nanomsghdr @@ -208,9 +743,11 @@ void dpow_sigscheck(struct supernet_info *myinfo,struct dpow_info *dp,struct dpo int32_t dpow_addnotary(struct supernet_info *myinfo,struct dpow_info *dp,char *ipaddr) { char str[512]; uint32_t ipbits,*ptr; int32_t i,iter,n,retval = -1; - if ( myinfo->dpowsock >= 0 ) + if ( myinfo->IAMNOTARY == 0 ) + return(-1); + portable_mutex_lock(&myinfo->notarymutex); + if ( myinfo->dpowsock >= 0 && myinfo->dexsock >= 0 ) { - portable_mutex_lock(&myinfo->dpowmutex); ipbits = (uint32_t)calc_ipbits(ipaddr); for (iter=0; iter<2; iter++) { @@ -232,8 +769,9 @@ int32_t dpow_addnotary(struct supernet_info *myinfo,struct dpow_info *dp,char *i ptr[n] = ipbits; if ( iter == 0 && strcmp(ipaddr,myinfo->ipaddr) != 0 ) { - retval = nn_connect(myinfo->dpowsock,nanomsg_tcpname(str,ipaddr,DPOW_SOCK)); - retval = nn_connect(myinfo->dexsock,nanomsg_tcpname(str,ipaddr,DEX_SOCK)); + retval = nn_connect(myinfo->dpowsock,nanomsg_tcpname(0,str,ipaddr,DPOW_SOCK)); + printf("NN_CONNECT to (%s)\n",str); + retval = nn_connect(myinfo->dexsock,nanomsg_tcpname(0,str,ipaddr,DEX_SOCK)); } n++; qsort(ptr,n,sizeof(uint32_t),_increasing_ipbits); @@ -247,98 +785,230 @@ int32_t dpow_addnotary(struct supernet_info *myinfo,struct dpow_info *dp,char *i if ( dp == 0 ) break; } - portable_mutex_unlock(&myinfo->dpowmutex); } + portable_mutex_unlock(&myinfo->notarymutex); return(retval); } void dpow_nanomsginit(struct supernet_info *myinfo,char *ipaddr) { - char str[512]; int32_t timeout,retval; + char str[512]; int32_t timeout,retval,maxsize,dpowsock,dexsock,repsock,pubsock; if ( myinfo->ipaddr[0] == 0 ) { printf("need to set ipaddr before nanomsg\n"); return; } - if ( myinfo->dpowsock < 0 && (myinfo->dpowsock= nn_socket(AF_SP,NN_BUS)) >= 0 ) + if ( myinfo->IAMNOTARY == 0 ) + return; + portable_mutex_lock(&myinfo->notarymutex); + dpowsock = myinfo->dpowsock; + dexsock = myinfo->dexsock; + repsock = myinfo->repsock; + pubsock = myinfo->pubsock; + if ( dpowsock < 0 && (dpowsock= nn_socket(AF_SP,NN_BUS)) >= 0 ) { - if ( nn_bind(myinfo->dpowsock,nanomsg_tcpname(str,myinfo->ipaddr,DPOW_SOCK)) < 0 ) + if ( nn_bind(dpowsock,nanomsg_tcpname(myinfo,str,myinfo->ipaddr,DPOW_SOCK)) < 0 ) { - printf("error binding to dpowsock (%s)\n",nanomsg_tcpname(str,myinfo->ipaddr,DPOW_SOCK)); - nn_close(myinfo->dpowsock); - myinfo->dpowsock = -1; + printf("error binding to dpowsock (%s)\n",nanomsg_tcpname(myinfo,str,myinfo->ipaddr,DPOW_SOCK)); + nn_close(dpowsock); + dpowsock = -1; } else { - if ( myinfo->dexsock < 0 && (myinfo->dexsock= nn_socket(AF_SP,NN_BUS)) >= 0 ) + printf("NN_BIND to %s\n",str); + if ( dexsock < 0 && (dexsock= nn_socket(AF_SP,NN_BUS)) >= 0 ) { - if ( nn_bind(myinfo->dexsock,nanomsg_tcpname(str,myinfo->ipaddr,DEX_SOCK)) < 0 ) + if ( nn_bind(dexsock,nanomsg_tcpname(myinfo,str,myinfo->ipaddr,DEX_SOCK)) < 0 ) { - printf("error binding to dexsock (%s)\n",nanomsg_tcpname(str,myinfo->ipaddr,DEX_SOCK)); - nn_close(myinfo->dexsock); - myinfo->dexsock = -1; - nn_close(myinfo->dpowsock); - myinfo->dpowsock = -1; + printf("error binding to dexsock (%s)\n",nanomsg_tcpname(myinfo,str,myinfo->ipaddr,DEX_SOCK)); + nn_close(dexsock); + dexsock = -1; + nn_close(dpowsock); + dpowsock = -1; } else { - if ( myinfo->pubsock < 0 && (myinfo->pubsock= nn_socket(AF_SP,NN_PUB)) >= 0 ) + if ( pubsock < 0 && (pubsock= nn_socket(AF_SP,NN_PUB)) >= 0 ) { - if ( nn_bind(myinfo->pubsock,nanomsg_tcpname(str,myinfo->ipaddr,PUB_SOCK)) < 0 ) + if ( nn_bind(pubsock,nanomsg_tcpname(myinfo,str,myinfo->ipaddr,PUB_SOCK)) < 0 ) { - printf("error binding to pubsock (%s)\n",nanomsg_tcpname(str,myinfo->ipaddr,PUB_SOCK)); - nn_close(myinfo->pubsock); - myinfo->pubsock = -1; - nn_close(myinfo->dexsock); - myinfo->dexsock = -1; - nn_close(myinfo->dpowsock); - myinfo->dpowsock = -1; + printf("error binding to pubsock (%s)\n",nanomsg_tcpname(myinfo,str,myinfo->ipaddr,PUB_SOCK)); + nn_close(pubsock); + pubsock = -1; + nn_close(dexsock); + dexsock = -1; + nn_close(dpowsock); + dpowsock = -1; } else { - if ( myinfo->repsock < 0 && (myinfo->repsock= nn_socket(AF_SP,NN_REP)) >= 0 ) + if ( repsock < 0 && (repsock= nn_socket(AF_SP,NN_REP)) >= 0 ) { - if ( nn_bind(myinfo->repsock,nanomsg_tcpname(str,myinfo->ipaddr,REP_SOCK)) < 0 ) + if ( nn_bind(repsock,nanomsg_tcpname(myinfo,str,myinfo->ipaddr,REP_SOCK)) < 0 ) { - printf("error binding to repsock (%s)\n",nanomsg_tcpname(str,myinfo->ipaddr,REP_SOCK)); - nn_close(myinfo->repsock); - myinfo->repsock = -1; - nn_close(myinfo->pubsock); - myinfo->pubsock = -1; - nn_close(myinfo->dexsock); - myinfo->dexsock = -1; - nn_close(myinfo->dpowsock); - myinfo->dpowsock = -1; + printf("error binding to repsock (%s)\n",nanomsg_tcpname(myinfo,str,myinfo->ipaddr,REP_SOCK)); + nn_close(repsock); + repsock = -1; + nn_close(pubsock); + pubsock = -1; + nn_close(dexsock); + dexsock = -1; + nn_close(dpowsock); + dpowsock = -1; } else { - myinfo->dpowipbits[0] = (uint32_t)calc_ipbits(myinfo->ipaddr); - myinfo->numdpowipbits = 1; - timeout = 1000; - nn_setsockopt(myinfo->dpowsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout)); - nn_setsockopt(myinfo->dexsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout)); - nn_setsockopt(myinfo->repsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout)); - printf("DEXINIT dex.%d rep.%d\n",myinfo->dexsock,myinfo->repsock); + timeout = 500; + nn_setsockopt(repsock,NN_SOL_SOCKET,NN_SNDTIMEO,&timeout,sizeof(timeout)); + nn_setsockopt(dexsock,NN_SOL_SOCKET,NN_SNDTIMEO,&timeout,sizeof(timeout)); + timeout = 10; + nn_setsockopt(dexsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout)); + timeout = 500; + nn_setsockopt(repsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout)); + maxsize = 1024 * 1024; + printf("RCVBUF.%d\n",nn_setsockopt(dexsock,NN_SOL_SOCKET,NN_RCVBUF,&maxsize,sizeof(maxsize))); + printf("RCVBUF.%d\n",nn_setsockopt(repsock,NN_SOL_SOCKET,NN_RCVBUF,&maxsize,sizeof(maxsize))); + printf("DEXINIT dpow.%d dex.%d rep.%d\n",dpowsock,dexsock,repsock); } } } } } } + myinfo->dpowipbits[0] = (uint32_t)calc_ipbits(myinfo->ipaddr); + myinfo->numdpowipbits = 1; + timeout = 10; + nn_setsockopt(dpowsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout)); + maxsize = 1024 * 1024; + printf("RCVBUF.%d\n",nn_setsockopt(dpowsock,NN_SOL_SOCKET,NN_RCVBUF,&maxsize,sizeof(maxsize))); + + myinfo->nanoinit = (uint32_t)time(NULL); } - } + } //else printf("error creating nanosocket\n"); + if ( myinfo->dpowsock != dpowsock ) + myinfo->dpowsock = dpowsock; + if ( myinfo->dexsock != dexsock ) + myinfo->dexsock = dexsock; + if ( myinfo->repsock != repsock ) + myinfo->repsock = repsock; + if ( myinfo->pubsock != pubsock ) + myinfo->pubsock = pubsock; + portable_mutex_unlock(&myinfo->notarymutex); dpow_addnotary(myinfo,0,ipaddr); } -void dpow_nanoutxoset(struct dpow_nanoutxo *np,struct dpow_block *bp,int32_t isratify) +void dpow_bestconsensus(struct dpow_block *bp) { - int32_t i; + int8_t bestks[64]; int32_t counts[64],i,j,numcrcs=0,numdiff,besti,best,bestmatches = 0,matches = 0; uint64_t masks[64],matchesmask,recvmask; uint32_t crcval=0; char srcaddr[64],destaddr[64]; + memset(masks,0,sizeof(masks)); + memset(bestks,0xff,sizeof(bestks)); + memset(counts,0,sizeof(counts)); + recvmask = 0; + for (numdiff=i=0; inumnotaries; i++) + { + if ( bits256_nonz(bp->notaries[i].src.prev_hash) != 0 && bits256_nonz(bp->notaries[i].dest.prev_hash) != 0 ) + recvmask |= (1LL << i); + if ( bp->notaries[i].bestk < 0 || bp->notaries[i].bestmask == 0 ) + continue; + //if ( bp->require0 != 0 && (bp->notaries[i].bestmask & 1) == 0 ) + // continue; + for (j=0; jnotaries[i].bestk == bestks[j] && bp->notaries[i].bestmask == masks[j] ) + { + counts[j]++; + break; + } + if ( j == numdiff && bp->notaries[i].bestk >= 0 && bp->notaries[i].bestmask != 0 ) + { + masks[numdiff] = bp->notaries[i].bestmask; + bestks[numdiff] = bp->notaries[i].bestk; + counts[numdiff]++; + //printf("j.%d numdiff.%d (%d %llx).%d\n",j,numdiff,bp->notaries[i].bestk,(long long)bp->notaries[i].bestmask,counts[numdiff]); + numdiff++; + } + } + besti = -1, best = 0; + for (i=0; i best && bitweight(masks[i]) >= bp->minsigs ) + { + best = counts[i]; + besti = i; + } + } + if ( besti >= 0 && bestks[besti] >= 0 && masks[besti] != 0 && (recvmask & masks[besti]) == masks[besti] ) + { + bp->notaries[bp->myind].bestmask = bp->bestmask = masks[besti]; + bp->notaries[bp->myind].bestk = bp->bestk = bestks[besti]; + //printf("set best.%d to (%d %llx) recv.%llx\n",best,bp->bestk,(long long)bp->bestmask,(long long)recvmask); + } + bp->recvmask |= recvmask; + if ( bp->bestmask == 0 )//|| (time(NULL) / 180) != bp->lastepoch ) + { + bp->bestmask = dpow_notarybestk(bp->recvmask,bp,&bp->bestk); + if ( 0 && (time(NULL) / 180) != bp->lastepoch ) + { + bp->lastepoch = (uint32_t)(time(NULL) / 180); + printf("epoch %u\n",bp->lastepoch % bp->numnotaries); + sleep(1 + (rand() % 3)); + } + } +} + +void dpow_nanoutxoset(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_nanoutxo *np,struct dpow_block *bp,int32_t isratify) +{ + int32_t i,err,vout; cJSON *ujson; char coinaddr[64],str[65]; + if ( bp->myind < 0 ) + return; if ( isratify != 0 ) { np->srcutxo = bp->notaries[bp->myind].ratifysrcutxo; np->srcvout = bp->notaries[bp->myind].ratifysrcvout; np->destutxo = bp->notaries[bp->myind].ratifydestutxo; np->destvout = bp->notaries[bp->myind].ratifydestvout; + if ( bp->myind != 0 ) + { + err = 0; + if ( (ujson= dpow_gettxout(myinfo,bp->srccoin,np->srcutxo,np->srcvout)) != 0 ) + { + if ( (uint64_t)(jdouble(ujson,"value") * SATOSHIDEN) == 0 ) + { + //printf("(%s)\n",jprint(ujson,0)); + err = 1; + } + free_json(ujson); + } else err = 1; + if ( err != 0 ) + { + bitcoin_address(coinaddr,bp->srccoin->chain->pubtype,dp->minerkey33,33); + if ( dpow_haveutxo(myinfo,bp->srccoin,&bp->notaries[bp->myind].ratifysrcutxo,&vout,coinaddr) > 0 ) + { + bp->notaries[bp->myind].ratifysrcvout = vout; + np->srcutxo = bp->notaries[bp->myind].ratifysrcutxo; + np->srcvout = bp->notaries[bp->myind].ratifysrcvout; + printf("Replace UTXO.%s < %s/v%d\n",bp->srccoin->symbol,bits256_str(str,np->srcutxo),vout); + } else printf("cant find utxo.%s\n",bp->srccoin->symbol); + } + err = 0; + if ( (ujson= dpow_gettxout(myinfo,bp->destcoin,np->destutxo,np->destvout)) != 0 ) + { + if ( (uint64_t)(jdouble(ujson,"value") * SATOSHIDEN) == 0 ) + err = 1; + free_json(ujson); + } else err = 1; + if ( err != 0 ) + { + bitcoin_address(coinaddr,bp->destcoin->chain->pubtype,dp->minerkey33,33); + if ( dpow_haveutxo(myinfo,bp->destcoin,&bp->notaries[bp->myind].ratifydestutxo,&vout,coinaddr) > 0 ) + { + bp->notaries[bp->myind].ratifydestvout = vout; + np->destutxo = bp->notaries[bp->myind].ratifydestutxo; + np->destvout = bp->notaries[bp->myind].ratifydestvout; + printf("Replace UTXO.%s < %s/v%d\n",bp->destcoin->symbol,bits256_str(str,np->destutxo),vout); + } else printf("cant find utxo.%s\n",bp->destcoin->symbol); + } + } np->bestmask = bp->ratifybestmask; np->recvmask = bp->ratifyrecvmask; //printf("send ratify best.(%d %llx) siglens.(%d %d)\n", bp->ratifybestk,(long long)bp->ratifybestmask,bp->ratifysiglens[0],bp->ratifysiglens[1]); @@ -353,13 +1023,20 @@ void dpow_nanoutxoset(struct dpow_nanoutxo *np,struct dpow_block *bp,int32_t isr } else { + dpow_bestconsensus(bp); np->srcutxo = bp->notaries[bp->myind].src.prev_hash; np->srcvout = bp->notaries[bp->myind].src.prev_vout; np->destutxo = bp->notaries[bp->myind].dest.prev_hash; np->destvout = bp->notaries[bp->myind].dest.prev_vout; - np->bestmask = bp->bestmask; - np->recvmask = bp->recvmask; - if ( (np->bestk= bp->bestk) >= 0 ) + if ( (np->recvmask= bp->recvmask) == 0 ) + np->recvmask = bp->notaries[bp->myind].recvmask; + if ( (np->bestmask= bp->pendingbestmask) == 0 ) + { + if ( (np->bestmask= bp->notaries[bp->myind].bestmask) == 0 ) + np->bestmask = bp->bestmask, np->bestk = bp->bestk; + else np->bestk = bp->notaries[bp->myind].bestk; + } else np->bestk = bp->pendingbestk; + if ( (int8_t)np->bestk >= 0 ) { if ( (np->siglens[0]= bp->notaries[bp->myind].src.siglens[bp->bestk]) > 0 ) memcpy(np->sigs[0],bp->notaries[bp->myind].src.sigs[bp->bestk],np->siglens[0]); @@ -374,6 +1051,8 @@ void dpow_ratify_update(struct supernet_info *myinfo,struct dpow_info *dp,struct int8_t bestks[64]; int32_t counts[64],i,j,numcrcs=0,numdiff,besti,best,bestmatches = 0,matches = 0; uint64_t masks[64],matchesmask; uint32_t crcval=0; char srcaddr[64],destaddr[64]; //char str[65],str2[65]; //printf("senderind.%d num.%d %s %s\n",senderind,bp->numnotaries,bits256_str(str,srcutxo),bits256_str(str2,destutxo)); + if ( bp->myind < 0 ) + return; if ( bp->isratify != 0 && senderind >= 0 && senderind < bp->numnotaries && bits256_nonz(srcutxo) != 0 && bits256_nonz(destutxo) != 0 ) { memset(masks,0,sizeof(masks)); @@ -403,7 +1082,7 @@ void dpow_ratify_update(struct supernet_info *myinfo,struct dpow_info *dp,struct } } //printf("RECV from %d best.(%d %llx) sigs.(%d %d) %llx %llx\n",senderind,bestk,(long long)bestmask,siglens[0],siglens[1],(long long)bp->ratifysigmasks[0],(long long)bp->ratifysigmasks[1]); - bp->ratifyrecvmask = 0;//|= (1LL << senderind) | (1LL << bp->myind); + bp->ratifyrecvmask = 0; bp->ratifybestmask = 0; bp->ratifybestk = -1; for (numdiff=i=0; inumnotaries; i++) @@ -442,12 +1121,12 @@ void dpow_ratify_update(struct supernet_info *myinfo,struct dpow_info *dp,struct if ( besti >= 0 && bestks[besti] >= 0 && masks[besti] != 0 && (bp->ratifyrecvmask & masks[besti]) == masks[besti] ) bp->ratifybestmask = masks[besti], bp->ratifybestk = bestks[besti]; //printf("numdiff.%d besti.%d numbest.%d (%d %llx) vs (%d %llx)\n",numdiff,besti,best,besti>=0?bestks[besti]:-1,(long long)(besti>=0?masks[besti]:0),bestk,(long long)bestmask); - if ( bp->ratifybestmask == 0 || (time(NULL) / 100) != bp->lastepoch ) + if ( bp->ratifybestmask == 0 || (time(NULL) / DPOW_EPOCHDURATION) != bp->lastepoch ) { bp->ratifybestmask = dpow_ratifybest(bp->ratifyrecvmask,bp,&bp->ratifybestk); - if ( (time(NULL) / 100) != bp->lastepoch ) + if ( (time(NULL) / DPOW_EPOCHDURATION) != bp->lastepoch ) { - bp->lastepoch = (uint32_t)(time(NULL) / 100); + bp->lastepoch = (uint32_t)(time(NULL) / DPOW_EPOCHDURATION); printf("epoch %u\n",bp->lastepoch % bp->numnotaries); sleep(2 + (rand() % 7)); } @@ -475,6 +1154,8 @@ void dpow_ratify_update(struct supernet_info *myinfo,struct dpow_info *dp,struct { if ( ((1LL << i) & matchesmask) != 0 ) { + if ( bp->notaries[i].pendingcrcs[bp->state < 1000] == 0 ) + continue; if ( numcrcs == 0 ) numcrcs++, crcval = bp->notaries[i].pendingcrcs[bp->state < 1000]; else if ( numcrcs > 0 && crcval == bp->notaries[i].pendingcrcs[bp->state < 1000] ) @@ -482,11 +1163,11 @@ void dpow_ratify_update(struct supernet_info *myinfo,struct dpow_info *dp,struct } } //printf("crcval.%x numcrcs.%d bestmatches.%d matchesmask.%llx\n",crcval,numcrcs,bestmatches,(long long)matchesmask); - if ( bestmatches >= bp->minsigs ) + if ( bestmatches >= bp->minsigs )//&& numcrcs >= bp->minsigs ) { if ( bp->pendingratifybestk != bp->ratifybestk || bp->pendingratifybestmask != bp->ratifybestmask ) { - printf("new PENDING RATIFY BESTK (%d %llx)\n",bp->ratifybestk,(long long)bp->ratifybestmask); + printf("new PENDING RATIFY BESTK (%d %llx) crcval.%08x num.%d\n",bp->ratifybestk,(long long)bp->ratifybestmask,crcval,numcrcs); bp->pendingratifybestk = bp->ratifybestk; bp->pendingratifybestmask = bp->ratifybestmask; memset(bp->notaries[bp->myind].ratifysigs,0,sizeof(bp->notaries[bp->myind].ratifysigs)); @@ -545,17 +1226,31 @@ void dpow_ratify_update(struct supernet_info *myinfo,struct dpow_info *dp,struct } } -void dpow_notarize_update(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp,uint8_t senderind,int8_t bestk,uint64_t bestmask,uint64_t recvmask,bits256 srcutxo,uint16_t srcvout,bits256 destutxo,uint16_t destvout,uint8_t siglens[2],uint8_t sigs[2][DPOW_MAXSIGLEN]) +void dpow_notarize_update(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp,uint8_t senderind,int8_t bestk,uint64_t bestmask,uint64_t recvmask,bits256 srcutxo,uint16_t srcvout,bits256 destutxo,uint16_t destvout,uint8_t siglens[2],uint8_t sigs[2][DPOW_MAXSIGLEN],uint32_t paxwdcrc) { - int32_t i,bestmatches = 0,matches = 0; + bits256 srchash; int32_t i,flag,bestmatches = 0,matches = 0,paxmatches = 0,paxbestmatches = 0; + if ( bp->myind < 0 ) + return; if ( bp->isratify == 0 && bp->state != 0xffffffff && senderind >= 0 && senderind < bp->numnotaries && bits256_nonz(srcutxo) != 0 && bits256_nonz(destutxo) != 0 ) { - bp->notaries[senderind].src.prev_hash = srcutxo; - bp->notaries[senderind].src.prev_vout = srcvout; - bp->notaries[senderind].dest.prev_hash = destutxo; - bp->notaries[senderind].dest.prev_vout = destvout; - bp->notaries[senderind].bestmask = bestmask; - bp->notaries[senderind].recvmask = recvmask; + if ( bits256_nonz(srcutxo) != 0 ) + { + bp->notaries[senderind].src.prev_hash = srcutxo; + bp->notaries[senderind].src.prev_vout = srcvout; + } + if ( bits256_nonz(destutxo) != 0 ) + { + bp->notaries[senderind].dest.prev_hash = destutxo; + bp->notaries[senderind].dest.prev_vout = destvout; + } + if ( bestmask != 0 ) + bp->notaries[senderind].bestmask = bestmask; + if ( recvmask != 0 ) + bp->notaries[senderind].recvmask |= recvmask; + if ( (bp->notaries[senderind].paxwdcrc= paxwdcrc) != 0 ) + { + //fprintf(stderr,"{%d %x} ",senderind,paxwdcrc); + } if ( (bp->notaries[senderind].bestk= bestk) >= 0 ) { if ( (bp->notaries[senderind].src.siglens[bestk]= siglens[0]) != 0 ) @@ -573,30 +1268,61 @@ void dpow_notarize_update(struct supernet_info *myinfo,struct dpow_info *dp,stru else bp->destsigsmasks[bestk] &= ~(1LL << senderind); } } - bp->recvmask |= (1LL << senderind) | (1LL << bp->myind); - bp->bestmask = dpow_maskmin(bp->recvmask,bp,&bp->bestk); - bp->notaries[bp->myind].bestk = bp->bestk; - bp->notaries[bp->myind].bestmask = bp->bestmask; - bp->notaries[bp->myind].recvmask = bp->recvmask; + bp->notaries[bp->myind].paxwdcrc = bp->paxwdcrc; + if ( bp->bestmask == 0 ) + { + bp->recvmask |= (1LL << senderind) | (1LL << bp->myind); + bp->bestmask = dpow_maskmin(bp->recvmask,bp,&bp->bestk); + } + dpow_bestconsensus(bp); + if ( bp->bestk >= 0 ) + bp->notaries[bp->myind].bestk = bp->bestk; + if ( bp->bestmask != 0 ) + bp->notaries[bp->myind].bestmask = bp->bestmask; + if ( bp->recvmask != 0 ) + bp->notaries[bp->myind].recvmask = bp->recvmask; if ( bp->bestk >= 0 ) { + flag = -1; for (i=0; inumnotaries; i++) { + if ( bp->paxwdcrc == bp->notaries[i].paxwdcrc ) + paxmatches++; if ( bp->bestk >= 0 && bp->notaries[i].bestk == bp->bestk && bp->notaries[i].bestmask == bp->bestmask ) { matches++; if ( ((1LL << i) & bp->bestmask) != 0 ) - bestmatches++; - } // else printf("mismatch.%d (%d %llx) ",i,bp->notaries[i].bestk,(long long)bp->notaries[i].bestmask); + { + if ( bp->paxwdcrc == bp->notaries[i].paxwdcrc ) + { + bestmatches++; + paxbestmatches++; + } //else printf("?%x ",bp->notaries[i].paxwdcrc); + } + } + else if ( i == senderind && ((1LL << bp->myind) & bp->bestmask) != 0 && ((1LL << i) & bp->bestmask) != 0 && ((1LL << bp->myind) & bp->notaries[i].recvmask) == 0 ) + flag = senderind; + if ( 0 && bp->myind <= 1 && bp->notaries[i].paxwdcrc != 0 ) + printf("%d.(%x %d %llx r%llx) ",i,bp->notaries[i].paxwdcrc,bp->notaries[i].bestk,(long long)bp->notaries[i].bestmask,(long long)bp->notaries[i].recvmask); + } + if ( flag >= 0 ) + { + //printf("flag.%d -> send\n",flag); + for (i=0; iminerkey33[i+1]; + dpow_send(myinfo,dp,bp,srchash,bp->hashmsg,0,bp->height,(void *)"ping",0); } - if ( bestmatches >= bp->minsigs ) + if ( 0 && bp->myind <= 1 ) + printf("recv.%llx best.(%d %llx) m.%d p.%d:%d b.%d\n",(long long)bp->recvmask,bp->bestk,(long long)bp->bestmask,matches,paxmatches,paxbestmatches,bestmatches); + if ( bestmatches >= bp->minsigs && paxbestmatches >= bp->minsigs ) { if ( bp->pendingbestk != bp->bestk || bp->pendingbestmask != bp->bestmask ) { - //printf("new PENDING BESTK (%d %llx) state.%d\n",bp->bestk,(long long)bp->bestmask,bp->state); + printf("new PENDING BESTK (%d %llx) state.%d\n",bp->bestk,(long long)bp->bestmask,bp->state); bp->pendingbestk = bp->bestk; bp->pendingbestmask = bp->bestmask; dpow_signedtxgen(myinfo,dp,bp->destcoin,bp,bp->bestk,bp->bestmask,bp->myind,DPOW_SIGBTCCHANNEL,1,0); + printf("finished signing\n"); } if ( bp->destsigsmasks[bp->bestk] == bp->bestmask ) // have all sigs { @@ -610,27 +1336,45 @@ void dpow_notarize_update(struct supernet_info *myinfo,struct dpow_info *dp,stru } //else printf("destmask.%llx != bestmask.%llx\n",(long long)bp->destsigsmasks[bp->bestk],(long long)bp->bestmask); } } - if ( (rand() % 100) == 0 ) - printf("[%d] ips.%d %s NOTARIZE.%d matches.%d bestmatches.%d bestk.%d %llx recv.%llx sigmasks.(%llx %llx) senderind.%d state.%x (%x %x %x)\n",bp->myind,dp->numipbits,dp->symbol,bp->minsigs,matches,bestmatches,bp->bestk,(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]); + else + { + for (i=0; inumnotaries; i++) + { + if ( bp->paxwdcrc == bp->notaries[i].paxwdcrc ) + paxmatches++; + else if ( 0 && bp->myind <= 1 ) + printf("%x.%d ",bp->notaries[i].paxwdcrc,i); + } + if ( 0 && bp->myind <= 1 ) + printf("mypaxcrc.%x\n",bp->paxwdcrc); + } + if ( (rand() % 130) == 0 ) + printf("%p ht.%d [%d] ips.%d %s NOTARIZE.%d matches.%d paxmatches.%d bestmatches.%d bestk.%d %llx recv.%llx sigmasks.(%llx %llx) senderind.%d state.%x (%x %x %x) pax.%x\n",bp,bp->height,bp->myind,dp->numipbits,dp->symbol,bp->minsigs,matches,paxmatches,bestmatches,bp->bestk,(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],bp->paxwdcrc); } } -void dpow_nanoutxoget(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp,struct dpow_nanoutxo *np,int32_t isratify,int8_t senderind) +void dpow_nanoutxoget(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp,struct dpow_nanoutxo *np,int32_t isratify,int8_t senderind,uint32_t channel) { if ( isratify != 0 ) { - dpow_ratify_update(myinfo,dp,bp,senderind,np->bestk,np->bestmask,np->recvmask,np->srcutxo,np->srcvout,np->destutxo,np->destvout,np->siglens,np->sigs,np->pendingcrcs); + dpow_ratify_update(myinfo,dp,bp,senderind,(int8_t)np->bestk,np->bestmask,np->recvmask,np->srcutxo,np->srcvout,np->destutxo,np->destvout,np->siglens,np->sigs,np->pendingcrcs); } else { - dpow_notarize_update(myinfo,dp,bp,senderind,np->bestk,np->bestmask,np->recvmask,np->srcutxo,np->srcvout,np->destutxo,np->destvout,np->siglens,np->sigs); + dpow_notarize_update(myinfo,dp,bp,senderind,(int8_t)np->bestk,np->bestmask,np->recvmask,np->srcutxo,np->srcvout,np->destutxo,np->destvout,np->siglens,np->sigs,np->paxwdcrc); + if ( 0 && bp->myind <= 2 ) + printf("lag.[%d] RECV.%d r%llx (%d %llx) %llx/%llx\n",(int32_t)(time(NULL)-channel),senderind,(long long)np->recvmask,(int8_t)np->bestk,(long long)np->bestmask,(long long)np->srcutxo.txid,(long long)np->destutxo.txid); } //dpow_bestmask_update(myinfo,dp,bp,nn_senderind,nn_bestk,nn_bestmask,nn_recvmask); } void dpow_send(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp,bits256 srchash,bits256 desthash,uint32_t channel,uint32_t msgbits,uint8_t *data,int32_t datalen) { - struct dpow_nanomsghdr *np; int32_t i,size,sentbytes = 0; uint32_t crc32; + struct dpow_nanomsghdr *np; int32_t i,size,extralen=0,sentbytes = 0; uint32_t crc32,paxwdcrc; uint8_t extras[10000]; + if ( bp->myind < 0 ) + return; + if ( time(NULL) < myinfo->nanoinit+5 ) + return; crc32 = calc_crc32(0,data,datalen); //dp->crcs[firstz] = crc32; size = (int32_t)(sizeof(*np) + datalen); @@ -646,8 +1390,17 @@ void dpow_send(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_blo // printf("%08x ",np->ipbits[i]); //printf(" dpow_send.(%d) size.%d numipbits.%d myind.%d\n",datalen,size,np->numipbits,bp->myind); if ( bp->isratify == 0 ) - dpow_nanoutxoset(&np->notarize,bp,0); - else dpow_nanoutxoset(&np->ratify,bp,1); + { + extralen = dpow_paxpending(extras,&paxwdcrc); + bp->paxwdcrc = bp->notaries[bp->myind].paxwdcrc = np->notarize.paxwdcrc = paxwdcrc; + //dpow_bestconsensus(bp); + dpow_nanoutxoset(myinfo,dp,&np->notarize,bp,0); + } + else + { + bp->paxwdcrc = bp->notaries[bp->myind].paxwdcrc = np->notarize.paxwdcrc = 0; + dpow_nanoutxoset(myinfo,dp,&np->ratify,bp,1); + } np->size = size; np->datalen = datalen; np->crc32 = crc32; @@ -655,18 +1408,32 @@ void dpow_send(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_blo np->ratify.pendingcrcs[i] = bp->pendingcrcs[i]; for (i=0; i<32; i++) np->srchash.bytes[i] = dp->minerkey33[i+1]; - //np->srchash = srchash; np->desthash = desthash; np->channel = channel; - np->height = msgbits; + np->height = bp->height;//msgbits; np->myipbits = myinfo->myaddr.myipbits; strcpy(np->symbol,dp->symbol); np->version0 = DPOW_VERSION & 0xff; np->version1 = (DPOW_VERSION >> 8) & 0xff; memcpy(np->packet,data,datalen); - sentbytes = nn_send(myinfo->dpowsock,np,size,0); + sentbytes = -1; + // deadlocks! portable_mutex_lock(&myinfo->dpowmutex); + for (i=0; i<100; i++) + { + struct nn_pollfd pfd; + pfd.fd = myinfo->dpowsock; + pfd.events = NN_POLLOUT; + if ( nn_poll(&pfd,1,100) > 0 ) + { + sentbytes = signed_nn_send(myinfo->ctx,myinfo->persistent_priv,myinfo->dpowsock,np,size); + break; + } + usleep(1000); + } + //portable_mutex_unlock(&myinfo->dpowmutex); free(np); - //printf("NANOSEND ht.%d channel.%08x (%d) crc32.%08x datalen.%d\n",np->height,np->channel,size,np->crc32,datalen); + if ( 0 && bp->myind <= 2 ) + printf("%d NANOSEND.%d ht.%d channel.%08x (%d) pax.%08x datalen.%d (%d %llx) (%d %llx) recv.%llx\n",i,sentbytes,np->height,np->channel,size,np->notarize.paxwdcrc,datalen,(int8_t)np->notarize.bestk,(long long)np->notarize.bestmask,bp->notaries[bp->myind].bestk,(long long)bp->notaries[bp->myind].bestmask,(long long)bp->recvmask); } void dpow_ipbitsadd(struct supernet_info *myinfo,struct dpow_info *dp,uint32_t *ipbits,int32_t numipbits,int32_t fromid,uint32_t senderipbits) @@ -711,14 +1478,27 @@ void dpow_ipbitsadd(struct supernet_info *myinfo,struct dpow_info *dp,uint32_t * //printf("recv numips.(%d %d)\n",myinfo->numdpowipbits,dp->numipbits); } -void dpow_nanomsg_update(struct supernet_info *myinfo) +int32_t dpow_nanomsg_update(struct supernet_info *myinfo) { - int32_t i,n=0,num=0,size,firstz = -1; uint32_t crc32,r,m; struct dpow_nanomsghdr *np=0; struct dpow_info *dp; struct dpow_block *bp; struct dex_nanomsghdr *dexp = 0; - while ( (size= nn_recv(myinfo->dpowsock,&np,NN_MSG,0)) >= 0 ) + int32_t i,n=0,num=0,size,broadcastflag,firstz = -1; char *retstr; uint32_t crc32,r,m; struct dpow_nanomsghdr *np=0; struct dpow_info *dp; struct dpow_block *bp; struct dex_nanomsghdr *dexp = 0; void *freeptr; + if ( time(NULL) < myinfo->nanoinit+5 || (myinfo->dpowsock < 0 && myinfo->dexsock < 0 && myinfo->repsock < 0) ) + return(-1); + portable_mutex_lock(&myinfo->dpowmutex); + /*for (i=0; i<100; i++) + { + struct nn_pollfd pfd; + pfd.fd = myinfo->dpowsock; + pfd.events = NN_POLLIN; + if ( nn_poll(&pfd,1,100) > 0 ) + break; + usleep(1000); + }*/ + while ( (size= signed_nn_recv(&freeptr,myinfo->ctx,myinfo->notaries,myinfo->numnotaries,myinfo->dpowsock,&np)) >= 0 && num < 100 ) { num++; - if ( size >= 0 ) + if ( size > 0 ) { + //fprintf(stderr,"%d ",size); if ( np->version0 == (DPOW_VERSION & 0xff) && np->version1 == ((DPOW_VERSION >> 8) & 0xff) ) { //printf("v.%02x %02x datalen.%d size.%d %d vs %d\n",np->version0,np->version1,np->datalen,size,np->datalen,(int32_t)(size - sizeof(*np))); @@ -736,85 +1516,103 @@ void dpow_nanomsg_update(struct supernet_info *myinfo) } if ( dp != 0 && crc32 == np->crc32 ) { - //char str[65]; printf("%s RECV ht.%d ch.%08x (%d) crc32.%08x:%08x datalen.%d:%d firstz.%d\n",bits256_str(str,np->srchash),np->height,np->channel,size,np->crc32,crc32,np->datalen,(int32_t)(size - sizeof(*np)),firstz); if ( i == myinfo->numdpows ) printf("received nnpacket for (%s)\n",np->symbol); else { dpow_ipbitsadd(myinfo,dp,np->ipbits,np->numipbits,np->senderind,np->myipbits); - if ( (bp= dpow_heightfind(myinfo,dp,np->height)) != 0 && bp->state != 0xffffffff ) + if ( (bp= dpow_heightfind(myinfo,dp,np->height)) != 0 && bp->state != 0xffffffff && bp->myind >= 0 ) { - if ( np->senderind >= 0 && np->senderind < bp->numnotaries && memcmp(bp-> notaries[np->senderind].pubkey+1,np->srchash.bytes,32) == 0 && bits256_nonz(np->srchash) != 0 ) + //char str[65]; printf("%s RECV ht.%d ch.%08x (%d) crc32.%08x:%08x datalen.%d:%d firstz.%d i.%d senderind.%d myind.%d\n",bits256_str(str,np->srchash),np->height,np->channel,size,np->crc32,crc32,np->datalen,(int32_t)(size - sizeof(*np)),firstz,i,np->senderind,bp->myind); + if ( np->senderind >= 0 && np->senderind < bp->numnotaries ) { - if ( bp->isratify == 0 ) - dpow_nanoutxoget(myinfo,dp,bp,&np->notarize,0,np->senderind); - else dpow_nanoutxoget(myinfo,dp,bp,&np->ratify,1,np->senderind); - dpow_datahandler(myinfo,dp,bp,np->senderind,np->channel,np->height,np->packet,np->datalen); - dex_reqsend(myinfo,np->packet,np->datalen); + if ( memcmp(bp->notaries[np->senderind].pubkey+1,np->srchash.bytes,32) == 0 && bits256_nonz(np->srchash) != 0 ) + { + if ( bp->isratify == 0 ) + dpow_nanoutxoget(myinfo,dp,bp,&np->notarize,0,np->senderind,np->channel); + else dpow_nanoutxoget(myinfo,dp,bp,&np->ratify,1,np->senderind,np->channel); + dpow_datahandler(myinfo,dp,bp,np->senderind,np->channel,np->height,np->packet,np->datalen); + } else printf("wrong senderind.%d\n",np->senderind); } - } + } //else printf("height.%d bp.%p state.%x senderind.%d\n",np->height,bp,bp!=0?bp->state:0,np->senderind); //dp->crcs[firstz] = crc32; } - } - } //else printf("ignore np->datalen.%d %d (size %d - %ld)\n",np->datalen,(int32_t)(size-sizeof(*np)),size,sizeof(*np)); - } - } - if ( np != 0 ) - nn_freemsg(np), np = 0; - if ( size == 0 || n++ > 100 ) - break; - } - if ( 0 && n != 0 ) - printf("nanoupdates.%d\n",n); + } //else printf("crc error from.%d %x vs %x or no dp.%p [%s]\n",np->senderind,crc32,np->crc32,dp,np->symbol); + } else printf("ignore.%d np->datalen.%d %d (size %d - %ld) [%s]\n",np->senderind,np->datalen,(int32_t)(size-sizeof(*np)),size,sizeof(*np),np->symbol); + } //else printf("wrong version from.%d %02x %02x size.%d [%s]\n",np->senderind,np->version0,np->version1,size,np->symbol); + } //else printf("illegal size.%d\n",size); + if ( freeptr != 0 ) + nn_freemsg(freeptr), np = 0, freeptr = 0; + } //else printf("no packets\n"); n = 0; - while ( (size= nn_recv(myinfo->dexsock,&dexp,NN_MSG,0)) >= 0 ) + if ( myinfo->dexsock >= 0 ) // from servers { - num++; - if ( dex_packetcheck(myinfo,dexp,size) == 0 ) + if ( (size= signed_nn_recv(&freeptr,myinfo->ctx,myinfo->notaries,myinfo->numnotaries,myinfo->dexsock,&dexp)) > 0 ) { - printf("FROM BUS.%08x -> pub\n",dexp->crc32); - nn_send(myinfo->pubsock,dexp,size,0); - dex_packet(myinfo,dexp,size); + //fprintf(stderr,"%d ",size); + num++; + if ( dex_packetcheck(myinfo,dexp,size) == 0 ) + { + //printf("FROM BUS.%08x -> pub\n",dexp->crc32); + signed_nn_send(myinfo->ctx,myinfo->persistent_priv,myinfo->pubsock,dexp,size); + dex_packet(myinfo,dexp,size); + } + //printf("GOT DEX bus PACKET.%d\n",size); + if ( freeptr != 0 ) + nn_freemsg(freeptr), dexp = 0, freeptr = 0; } - if ( dexp != 0 ) - nn_freemsg(dexp), dexp = 0; - if ( size == 0 || n++ > 100 ) - break; } - n = 0; - if ( num == 0 ) + if ( myinfo->repsock >= 0 ) // from clients { - while ( (size= nn_recv(myinfo->repsock,&dexp,NN_MSG,0)) >= 0 ) + if ( (size= signed_nn_recv(&freeptr,myinfo->ctx,myinfo->notaries,myinfo->numnotaries,myinfo->repsock,&dexp)) > 0 ) { num++; - if ( dex_packetcheck(myinfo,dexp,size) == 0 ) + //fprintf(stderr,"%d ",size); + //printf("REP got %d\n",size); + if ( (retstr= dex_response(&broadcastflag,myinfo,dexp)) != 0 ) + { + signed_nn_send(myinfo->ctx,myinfo->persistent_priv,myinfo->repsock,retstr,(int32_t)strlen(retstr)+1); + free(retstr); + if ( broadcastflag != 0 ) + { + printf("BROADCAST dexp request.[%d]\n",size); + signed_nn_send(myinfo->ctx,myinfo->persistent_priv,myinfo->dexsock,dexp,size); + } + } + else { - nn_send(myinfo->dexsock,dexp,size,0); if ( (m= myinfo->numdpowipbits) > 0 ) { r = myinfo->dpowipbits[rand() % m]; - nn_send(myinfo->repsock,&r,sizeof(r),0); - printf("REP.%08x -> dexbus, rep.%08x",dexp->crc32,r); + signed_nn_send(myinfo->ctx,myinfo->persistent_priv,myinfo->repsock,&r,sizeof(r)); + //printf("REP.%08x <- rand ip m.%d %x\n",dexp->crc32,m,r); + } else printf("illegal state without dpowipbits?\n"); + if ( dex_packetcheck(myinfo,dexp,size) == 0 ) + { + signed_nn_send(myinfo->ctx,myinfo->persistent_priv,myinfo->dexsock,dexp,size); + signed_nn_send(myinfo->ctx,myinfo->persistent_priv,myinfo->pubsock,dexp,size); + //printf("REP.%08x -> dexbus and pub, t.%d lag.%d\n",dexp->crc32,dexp->timestamp,(int32_t)(time(NULL)-dexp->timestamp)); + dex_packet(myinfo,dexp,size); } - dex_packet(myinfo,dexp,size); } - if ( dexp != 0 ) - nn_freemsg(dexp), dexp = 0; - if ( size == 0 || n++ > 100 ) - break; + //printf("GOT DEX rep PACKET.%d\n",size); + if ( freeptr != 0 ) + nn_freemsg(freeptr), dexp = 0, freeptr = 0; } } + portable_mutex_unlock(&myinfo->dpowmutex); + return(num); } #else void dpow_nanomsginit(struct supernet_info *myinfo,char *ipaddr) { } -uint32_t dpow_send(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp,bits256 srchash,bits256 desthash,uint32_t channel,uint32_t msgbits,uint8_t *data,int32_t datalen) +void dpow_send(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp,bits256 srchash,bits256 desthash,uint32_t channel,uint32_t msgbits,uint8_t *data,int32_t datalen) { - return(0); + return; } -void dpow_nanomsg_update(struct supernet_info *myinfo) { } +int32_t dpow_nanomsg_update(struct supernet_info *myinfo) { return(0); } #endif @@ -878,6 +1676,7 @@ int32_t dpow_rwopret(int32_t rwflag,uint8_t *opret,bits256 *hashmsg,int32_t *hei { memcpy(&opret[opretlen],extras,extralen); opretlen += extralen; + printf("added extra.%d opreturn for withdraws paxwdcrc.%08x\n",extralen,calc_crc32(0,extras,extralen)); } } else @@ -929,6 +1728,8 @@ int32_t dpow_rwsigentry(int32_t rwflag,uint8_t *data,struct dpow_sigentry *dsig) void dpow_sigsend(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp,int32_t myind,int8_t bestk,uint64_t bestmask,bits256 srchash,uint32_t sigchannel) { struct dpow_sigentry dsig; int32_t i,len; uint8_t data[4096]; struct dpow_entry *ep; + if ( bp->myind < 0 ) + return; if ( ((1LL << myind) & bestmask) == 0 ) return; ep = &bp->notaries[myind]; @@ -997,7 +1798,7 @@ uint16_t komodo_port(char *symbol,uint64_t supply,uint32_t *magicp) #define MAX_CURRENCIES 32 extern char CURRENCIES[][8]; -void komodo_assetcoins() +void komodo_assetcoins(int32_t fullnode) { uint16_t extract_userpass(char *serverport,char *userpass,char *coinstr,char *userhome,char *coindir,char *confname); int32_t i,j; uint32_t magic; cJSON *json; uint16_t port; long filesize; char *userhome,confstr[16],jsonstr[512],magicstr[9],path[512]; struct iguana_info *coin; @@ -1014,7 +1815,7 @@ void komodo_assetcoins() for (j=0; j<4; j++) sprintf(&magicstr[j*2],"%02x",((uint8_t *)&magic)[j]); magicstr[j*2] = 0; - sprintf(jsonstr,"{\"newcoin\":\"%s\",\"RELAY\":-1,\"VALIDATE\":0,\"portp2p\":%u,\"rpcport\":%u,\"netmagic\":\"%s\"}",CURRENCIES[i],port,port+1,magicstr); + sprintf(jsonstr,"{\"newcoin\":\"%s\",\"RELAY\":%d,\"VALIDATE\":0,\"portp2p\":%u,\"rpcport\":%u,\"netmagic\":\"%s\"}",CURRENCIES[i],fullnode,port,port+1,magicstr); if ( (json= cJSON_Parse(jsonstr)) != 0 ) { if ( (coin= iguana_coinadd(CURRENCIES[i],CURRENCIES[i],json,0)) == 0 ) @@ -1023,14 +1824,17 @@ void komodo_assetcoins() return; } free_json(json); - coin->FULLNODE = -1; + coin->FULLNODE = fullnode; coin->chain->rpcport = port + 1; coin->chain->pubtype = 60; coin->chain->p2shtype = 85; coin->chain->wiftype = 188; - sprintf(confstr,"%s.conf",CURRENCIES[i]); - sprintf(path,"%s/.komodo/%s",userhome,CURRENCIES[i]); - extract_userpass(coin->chain->serverport,coin->chain->userpass,CURRENCIES[i],coin->chain->userhome,path,confstr); + if ( fullnode < 0 ) + { + sprintf(confstr,"%s.conf",CURRENCIES[i]); + sprintf(path,"%s/.komodo/%s",userhome,CURRENCIES[i]); + extract_userpass(coin->chain->serverport,coin->chain->userpass,CURRENCIES[i],coin->chain->userhome,path,confstr); + } } printf("(%s %u) ",CURRENCIES[i],port); } diff --git a/iguana/dpow/dpow_prices.c b/iguana/dpow/dpow_prices.c index fe62ef314..eae61f44b 100755 --- a/iguana/dpow/dpow_prices.c +++ b/iguana/dpow/dpow_prices.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -1462,7 +1462,7 @@ void PAX_update(struct PAX_data *dp,double *btcusdp,double *kmdbtcp) } else { - for (iter=0; iter<2; iter++) + for (iter=1; iter<2; iter++) { kmdhist = url_json(iter == 0 ? url : url2); //{"date":1406160000,"high":0.01,"low":0.00125,"open":0.01,"close":0.001375,"volume":1.50179994,"quoteVolume":903.58818412,"weightedAverage":0.00166204}, @@ -1890,7 +1890,7 @@ int32_t PAX_idle(struct supernet_info *myinfo)//struct PAX_data *argdp,int32_t i splineval = PAX_splineval(&dp->splines[i],timestamp,0); pvals[6+i] = PAX_val32(splineval); if ( dispflag != 0 ) - printf("%d ",pvals[6+i]); + printf("%u ",pvals[6+i]); } if ( pvals[6+CNY] != 0 && pvals[6+USD] != 0 ) dp->CNYUSD = ((double)pvals[6 + CNY] / pvals[6 + USD]) * MINDENOMS[USD] / MINDENOMS[CNY]; diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 684bc82cc..b81d1dcf1 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -86,9 +86,10 @@ bits256 dpow_getbestblockhash(struct supernet_info *myinfo,struct iguana_info *c return(blockhash); } -int32_t dpow_paxpending(uint8_t *hex) +int32_t dpow_paxpending(uint8_t *hex,uint32_t *paxwdcrcp) { - struct iguana_info *coin; char *retstr,*hexstr; cJSON *retjson; int32_t n=0; + struct iguana_info *coin; char *retstr,*hexstr; cJSON *retjson; int32_t n=0; uint32_t paxwdcrc; + paxwdcrc = 0; if ( (coin= iguana_coinfind("KMD")) != 0 ) { if ( coin->FULLNODE < 0 ) @@ -100,15 +101,19 @@ int32_t dpow_paxpending(uint8_t *hex) if ( (hexstr= jstr(retjson,"withdraws")) != 0 && (n= is_hexstr(hexstr,0)) > 1 ) { n >>= 1; - printf("PAXPENDING.(%s)\n",retstr); + //printf("PAXPENDING.(%s)\n",hexstr); decode_hex(hex,n,hexstr); + paxwdcrc = calc_crc32(0,hex,n) & 0xffffff00; + paxwdcrc |= (n & 0xff); } free_json(retjson); - } + } else printf("dpow_paxpending: parse error.(%s)\n",retstr); free(retstr); } else printf("dpow_paxpending: paxwithdraw null return\n"); } else printf("dpow_paxpending: KMD FULLNODE.%d\n",coin->FULLNODE); } else printf("dpow_paxpending: cant find KMD\n"); + if ( *paxwdcrcp != paxwdcrc ) + *paxwdcrcp = paxwdcrc; return(n); } @@ -141,6 +146,31 @@ bits256 dpow_getblockhash(struct supernet_info *myinfo,struct iguana_info *coin, return(blockhash); } +cJSON *dpow_getinfo(struct supernet_info *myinfo,struct iguana_info *coin) +{ + char buf[128],*retstr=0; cJSON *json = 0; + if ( coin->FULLNODE < 0 ) + { + buf[0] = 0; + retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"getinfo",buf); + usleep(10000); + } + else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 ) + { + retstr = bitcoinrpc_getinfo(myinfo,coin,0,0); + } + else + { + return(0); + } + if ( retstr != 0 ) + { + json = cJSON_Parse(retstr); + free(retstr); + } + return(json); +} + cJSON *dpow_getblock(struct supernet_info *myinfo,struct iguana_info *coin,bits256 blockhash) { char buf[128],str[65],*retstr=0; cJSON *json = 0; @@ -168,9 +198,9 @@ cJSON *dpow_getblock(struct supernet_info *myinfo,struct iguana_info *coin,bits2 return(json); } -int32_t dpow_validateaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *address) +char *dpow_validateaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *address) { - char buf[128],*retstr=0; cJSON *ismine,*json = 0; int32_t retval = -1; + char buf[128],*retstr=0; if ( coin->FULLNODE < 0 ) { sprintf(buf,"\"%s\"",address); @@ -185,16 +215,7 @@ int32_t dpow_validateaddress(struct supernet_info *myinfo,struct iguana_info *co { return(0); } - if ( retstr != 0 ) - { - json = cJSON_Parse(retstr); - if ( (ismine= jobj(json,"ismine")) != 0 && is_cJSON_True(ismine) != 0 ) - retval = 1; - else retval = 0; - free(retstr); - - } - return(retval); + return(retstr); } cJSON *dpow_gettxout(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid,int32_t vout) @@ -249,14 +270,12 @@ char *dpow_decoderawtransaction(struct supernet_info *myinfo,struct iguana_info cJSON *dpow_gettransaction(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid) { - char buf[128],str[65],*retstr=0,*rawtx=0; cJSON *json = 0; + char buf[128],str[65],*retstr=0; cJSON *json = 0; if ( coin->FULLNODE < 0 ) { sprintf(buf,"[\"%s\", 1]",bits256_str(str,txid)); - if ( (rawtx= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"getrawtransaction",buf)) != 0 ) + if ( (retstr= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"getrawtransaction",buf)) != 0 ) { - retstr = dpow_decoderawtransaction(myinfo,coin,rawtx); - free(rawtx); } usleep(10000); } @@ -278,7 +297,7 @@ cJSON *dpow_gettransaction(struct supernet_info *myinfo,struct iguana_info *coin cJSON *dpow_listunspent(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr) { - char buf[128],*retstr; cJSON *json = 0; + char buf[128],*retstr; cJSON *array,*json = 0; if ( coin->FULLNODE < 0 ) { sprintf(buf,"0, 99999999, [\"%s\"]",coinaddr); @@ -291,7 +310,10 @@ cJSON *dpow_listunspent(struct supernet_info *myinfo,struct iguana_info *coin,ch } else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 ) { - json = iguana_listunspents(myinfo,coin,0,1,coin->longestchain,""); + array = cJSON_CreateArray(); + jaddistr(array,coinaddr); + json = iguana_listunspents(myinfo,coin,array,1,coin->longestchain,""); + free_json(array); } else { @@ -300,6 +322,25 @@ cJSON *dpow_listunspent(struct supernet_info *myinfo,struct iguana_info *coin,ch return(json); } +cJSON *dpow_listtransactions(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr,int32_t count,int32_t skip) +{ + char buf[128],*retstr; cJSON *json = 0; + if ( coin->FULLNODE < 0 ) + { + if ( count == 0 ) + count = 100; + sprintf(buf,"[\"%s\", %d, %d, true]",coinaddr,count,skip); + if ( (retstr= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"listtransactions",buf)) != 0 ) + { + //printf("LIST.(%s)\n",retstr); + json = cJSON_Parse(retstr); + free(retstr); + return(json); + } else printf("%s null retstr from (%s)n",coin->symbol,buf); + } + return(0); +} + char *dpow_signrawtransaction(struct supernet_info *myinfo,struct iguana_info *coin,char *rawtx,cJSON *vins) { cJSON *array,*privkeys,*item; char *wifstr,*str,*paramstr,*retstr; uint8_t script[256]; int32_t i,n,len,hashtype; struct vin_info V; struct iguana_waddress *waddr; struct iguana_waccount *wacct; @@ -368,7 +409,7 @@ char *dpow_sendrawtransaction(struct supernet_info *myinfo,struct iguana_info *c jaddistr(array,signedtx); paramstr = jprint(array,1); retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"sendrawtransaction",paramstr); - printf(">>>>>>>>>>> %s sendrawtransaction.(%s) -> %s\n",coin->symbol,paramstr,retstr); + //printf(">>>>>>>>>>> %s sendrawtransaction.(%s) -> %s\n",coin->symbol,paramstr,retstr); free(paramstr); return(retstr); } @@ -385,6 +426,97 @@ char *dpow_sendrawtransaction(struct supernet_info *myinfo,struct iguana_info *c } } +char *dpow_alladdresses(struct supernet_info *myinfo,struct iguana_info *coin) +{ + char *retstr,fname[1024]; long filesize; + sprintf(fname,"%s/alladdresses.%s",GLOBAL_CONFSDIR,coin->symbol), OS_compatible_path(fname); + retstr = OS_filestr(&filesize,fname); + return(retstr); +} + +void update_alladdresses(struct supernet_info *myinfo,struct iguana_info *coin,char *address) +{ + struct hashstr_item *hashstr,*tmp; cJSON *alljson; char *outstr,fname[1024]; int32_t saveflag = 0; + HASH_FIND(hh,coin->alladdresses,address,strlen(address),hashstr); + if ( hashstr == 0 ) + { + hashstr = calloc(1,sizeof(*hashstr)); + strncpy(hashstr->address,address,sizeof(hashstr->address)); + HASH_ADD_KEYPTR(hh,coin->alladdresses,hashstr->address,strlen(address),hashstr); + saveflag = 1; + } + if ( saveflag != 0 ) + { + FILE *fp; + alljson = cJSON_CreateArray(); + HASH_ITER(hh,coin->alladdresses,hashstr,tmp) + { + jaddistr(alljson,hashstr->address); + } + outstr = jprint(alljson,0); + sprintf(fname,"%s/alladdresses.%s",GLOBAL_CONFSDIR,coin->symbol), OS_compatible_path(fname); + if ( (fp= fopen(fname,"wb")) != 0 ) + { + fwrite(outstr,1,strlen(outstr)+1,fp); + fclose(fp); + printf("importaddress.(%s) -> alladdresses.%s\n",address,coin->symbol); + } + free(outstr); + } +} + +char *dpow_importaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *address) +{ + char buf[1024],*retstr; cJSON *validatejson; int32_t isvalid=0,doneflag = 0; + if ( (retstr= dpow_validateaddress(myinfo,coin,address)) != 0 ) + { + if ( (validatejson= cJSON_Parse(retstr)) != 0 ) + { + if ( (isvalid= is_cJSON_True(jobj(validatejson,"isvalid")) != 0) != 0 ) + { + if ( is_cJSON_True(jobj(validatejson,"iswatchonly")) != 0 || is_cJSON_True(jobj(validatejson,"ismine")) != 0 ) + doneflag = 1; + } + free_json(validatejson); + } + free(retstr); + retstr = 0; + } + if ( isvalid == 0 ) + return(clonestr("{\"isvalid\":false}")); + update_alladdresses(myinfo,coin,address); + if ( doneflag != 0 ) + return(0); // success + if ( coin->FULLNODE < 0 ) + { + sprintf(buf,"[\"%s\", \"%s\", false]",address,address); + retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"importaddress",buf); + printf("%s importaddress.(%s) -> (%s)\n",coin->symbol,address,retstr); + return(retstr); + } + else return(0); +} + +void init_alladdresses(struct supernet_info *myinfo,struct iguana_info *coin) +{ + char *alladdresses,*retstr; cJSON *alljson; int32_t i,n; + if ( (alladdresses= dpow_alladdresses(myinfo,coin)) != 0 ) + { + printf("(%s) ALL.(%s)\n",coin->symbol,alladdresses); + if ( (alljson= cJSON_Parse(alladdresses)) != 0 ) + { + if ( is_cJSON_Array(alljson) != 0 && (n= cJSON_GetArraySize(alljson)) > 0 ) + { + for (i=0; ilastbestheight = height; if ( height > coin->longestchain ) coin->longestchain = height; - if ( (array= jarray(&n,json,"tx")) != 0 ) + if ( txs != 0 && numtxp != 0 && (array= jarray(&n,json,"tx")) != 0 ) { for (i=0; imutex); + pthread_mutex_lock(&dp->paxmutex); /*if ( dp->PAX != 0 ) { tmp = 0; @@ -630,25 +765,25 @@ uint64_t dpow_paxtotal(struct dpow_info *dp) if ( pax->marked == 0 ) total += pax->komodoshis; } - pthread_mutex_unlock(&dp->mutex); + pthread_mutex_unlock(&dp->paxmutex); return(total); } struct pax_transaction *dpow_paxfind(struct dpow_info *dp,struct pax_transaction *space,bits256 txid,uint16_t vout) { struct pax_transaction *pax; - pthread_mutex_lock(&dp->mutex); + pthread_mutex_lock(&dp->paxmutex); HASH_FIND(hh,dp->PAX,&txid,sizeof(txid),pax); if ( pax != 0 ) memcpy(space,pax,sizeof(*pax)); - pthread_mutex_unlock(&dp->mutex); + pthread_mutex_unlock(&dp->paxmutex); return(pax); } struct pax_transaction *dpow_paxmark(struct dpow_info *dp,struct pax_transaction *space,bits256 txid,uint16_t vout,int32_t mark) { struct pax_transaction *pax; - pthread_mutex_lock(&dp->mutex); + pthread_mutex_lock(&dp->paxmutex); HASH_FIND(hh,dp->PAX,&txid,sizeof(txid),pax); if ( pax == 0 ) { @@ -665,14 +800,14 @@ struct pax_transaction *dpow_paxmark(struct dpow_info *dp,struct pax_transaction printf(" paxmark.ht %d vout%d\n",mark,vout); memcpy(space,pax,sizeof(*pax)); } - pthread_mutex_unlock(&dp->mutex); + pthread_mutex_unlock(&dp->paxmutex); return(pax); } cJSON *dpow_withdraws_pending(struct dpow_info *dp) { struct pax_transaction *pax,*tmp; cJSON *retjson = cJSON_CreateArray(); - pthread_mutex_lock(&dp->mutex); + pthread_mutex_lock(&dp->paxmutex); /*if ( dp->PAX != 0 ) { tmp = 0; @@ -690,14 +825,14 @@ cJSON *dpow_withdraws_pending(struct dpow_info *dp) if ( pax->marked == 0 ) jaddi(retjson,dpow_paxjson(pax)); } - pthread_mutex_unlock(&dp->mutex); + pthread_mutex_unlock(&dp->paxmutex); return(retjson); } void dpow_issuer_withdraw(struct dpow_info *dp,char *coinaddr,uint64_t fiatoshis,int32_t shortflag,char *symbol,uint64_t komodoshis,uint8_t *rmd160,bits256 txid,uint16_t vout,int32_t kmdheight,int32_t height) // assetchain context { struct pax_transaction *pax; - pthread_mutex_lock(&dp->mutex); + pthread_mutex_lock(&dp->paxmutex); HASH_FIND(hh,dp->PAX,&txid,sizeof(txid),pax); if ( pax == 0 ) { @@ -706,7 +841,7 @@ void dpow_issuer_withdraw(struct dpow_info *dp,char *coinaddr,uint64_t fiatoshis pax->vout = vout; HASH_ADD_KEYPTR(hh,dp->PAX,&pax->txid,sizeof(pax->txid),pax); } - pthread_mutex_unlock(&dp->mutex); + pthread_mutex_unlock(&dp->paxmutex); if ( coinaddr != 0 ) { strcpy(pax->coinaddr,coinaddr); @@ -895,7 +1030,7 @@ int32_t dpow_issuer_block(struct dpow_info *dp,struct iguana_info *coin,int32_t int32_t dpow_issuer_iteration(struct dpow_info *dp,struct iguana_info *coin,int32_t height,uint32_t *isrealtimep) { - char *retstr; int32_t i,kmdheight; cJSON *infoobj,*result; uint16_t port = coin->chain->rpcport; + char *retstr; int32_t i,currentheight=0; cJSON *infoobj,*result; uint16_t port = coin->chain->rpcport; if ( height <= 0 ) height = 1; *isrealtimep = 0; @@ -903,9 +1038,9 @@ int32_t dpow_issuer_iteration(struct dpow_info *dp,struct iguana_info *coin,int3 { if ( (infoobj= cJSON_Parse(retstr)) != 0 ) { - if ( (result= jobj(infoobj,(char *)"result")) != 0 && (kmdheight= jint(result,(char *)"blocks")) != 0 ) + if ( (result= jobj(infoobj,(char *)"result")) != 0 && (currentheight= jint(result,(char *)"blocks")) != 0 ) { - for (i=0; i<1000 && height<=kmdheight; i++,height++) + for (i=0; i<100 && height<=currentheight; i++,height++) { /*fprintf(stderr,"%s.%d ",coin->symbol,height); if ( (height % 10) == 0 ) @@ -922,7 +1057,7 @@ int32_t dpow_issuer_iteration(struct dpow_info *dp,struct iguana_info *coin,int3 } usleep(10000); } - if ( height >= kmdheight ) + if ( height >= currentheight ) *isrealtimep = (uint32_t)time(NULL); } free_json(infoobj); @@ -932,8 +1067,8 @@ int32_t dpow_issuer_iteration(struct dpow_info *dp,struct iguana_info *coin,int3 } else { - //printf("error from %s\n",coin->symbol); - sleep(3); + printf("error from %s height.%d currentheight.%d\n",coin->symbol,height,currentheight); + usleep(100000); } return(height); } diff --git a/iguana/dpow/dpow_tx.c b/iguana/dpow/dpow_tx.c index 18fea41e4..7e2064550 100755 --- a/iguana/dpow/dpow_tx.c +++ b/iguana/dpow/dpow_tx.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -22,7 +22,7 @@ void dpow_bestmask_update(struct supernet_info *myinfo,struct dpow_info *dp,stru return; bp->notaries[nn_senderind].bestk = nn_bestk; bp->notaries[nn_senderind].bestmask = nn_bestmask; - bp->notaries[nn_senderind].recvmask = nn_recvmask; + bp->notaries[nn_senderind].recvmask |= nn_recvmask; startscore = bp->scores[nn_senderind]; if ( bp->bestk >= 0 ) { @@ -82,7 +82,7 @@ uint64_t dpow_ratifybest(uint64_t refmask,struct dpow_block *bp,int8_t *lastkp) *lastkp = -1; for (m=j=0; jnumnotaries; j++) { - k = (j + ((uint32_t)time(NULL) / 100)) % bp->numnotaries;//DPOW_MODIND(bp,j); + k = (j + ((uint32_t)time(NULL) / DPOW_EPOCHDURATION)) % bp->numnotaries;//DPOW_MODIND(bp,j); if ( bp->require0 != 0 && k == 0 ) continue; if ( bits256_nonz(bp->notaries[k].ratifysrcutxo) != 0 && bits256_nonz(bp->notaries[k].ratifydestutxo) != 0 ) @@ -99,6 +99,31 @@ uint64_t dpow_ratifybest(uint64_t refmask,struct dpow_block *bp,int8_t *lastkp) return(bestmask); } +uint64_t dpow_notarybestk(uint64_t refmask,struct dpow_block *bp,int8_t *lastkp) +{ + int32_t m,j,k; uint64_t bestmask,mask = 0;//bp->require0; + bestmask = 0; + *lastkp = -1; + for (m=j=0; jnumnotaries; j++) + { + //k = (j + ((uint32_t)time(NULL) / 180)) % bp->numnotaries; + k = (j + (bp->height/DPOW_CHECKPOINTFREQ)) % bp->numnotaries; + //if ( bp->require0 != 0 && k == 0 ) + // 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 ) + { + *lastkp = k; + bestmask = mask;// | bp->require0; + //printf("m.%d == minsigs.%d (%d %llx)\n",m,bp->minsigs,k,(long long)bestmask); + } + } + } + return(bestmask); +} + uint64_t dpow_maskmin(uint64_t refmask,struct dpow_block *bp,int8_t *lastkp) { int32_t j,m,k; uint64_t bestmask,mask = 0;//bp->require0; @@ -110,7 +135,7 @@ uint64_t dpow_maskmin(uint64_t refmask,struct dpow_block *bp,int8_t *lastkp) k = DPOW_MODIND(bp,j); //if ( (bp->require0 == 0 || k != 0) && bp->scores[k] < DPOW_BLACKLIST ) // continue; - if ( bits256_nonz(bp->notaries[k].src.prev_hash) != 0 && bits256_nonz(bp->notaries[k].dest.prev_hash) != 0 ) + 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 ) @@ -160,12 +185,14 @@ struct dpow_block *dpow_heightfind(struct supernet_info *myinfo,struct dpow_info return(bp); } } + if ( bp != 0 && bp->state == 0xffffffff ) + bp = 0; 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) { - uint32_t 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; 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 ) { @@ -197,20 +224,20 @@ int32_t dpow_voutstandard(struct dpow_block *bp,uint8_t *serialized,int32_t m,in } printf("numvouts.%d len.%d RATIFY vouts\n",numvouts,len); } - if ( (src_or_dest == 0 || strcmp(bp->destcoin->symbol,"BTC") != 0) && (n= dpow_paxpending(extras)) > 0 ) + if ( (src_or_dest == 0 || strcmp(bp->destcoin->symbol,"BTC") != 0) && (n= dpow_paxpending(extras,&paxwdcrc)) > 0 ) { for (i=0; ihashmsg,&bp->height,bp->srccoin->symbol,extras,n,bp,src_or_dest); + if ( bp->isratify != 0 ) + opretlen = dpow_rwopret(1,opret,&bp->hashmsg,&bp->height,bp->srccoin->symbol,0,0,bp,src_or_dest); else opretlen = dpow_rwopret(1,opret,&bp->hashmsg,&bp->height,bp->srccoin->symbol,extras,n,bp,src_or_dest); if ( opretlen < 0 ) { - printf("negative opretlen src_or_dest.%d\n",src_or_dest); + printf("negative opretlen.%d src_or_dest.%d\n",opretlen,src_or_dest); return(-1); } opretlen = dpow_opreturnscript(data,opret,opretlen); @@ -229,7 +256,7 @@ int32_t dpow_voutstandard(struct dpow_block *bp,uint8_t *serialized,int32_t m,in 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) { - uint32_t k,m,numsigs,version,vout,sequenceid = 0xffffffff; bits256 zero; int32_t n,siglen,len; uint8_t serialized[32768],*sig; bits256 txid; struct dpow_entry *ep; struct dpow_coinentry *cp; + 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; *numsigsp = 0; memset(zero.bytes,0,sizeof(zero)); @@ -309,6 +336,16 @@ bits256 dpow_notarytx(char *signedtx,int32_t *numsigsp,int32_t isPoS,struct dpow len += n; init_hexbytes_noT(signedtx,serialized,len); //printf("notarytx.(%s) opretlen.%d\n",signedtx,opretlen); + if ( usesigs == 0 && bestk >= 0 ) + { + crcval = calc_crc32(0,bp->ratifyrawtx[src_or_dest],bp->rawratifiedlens[src_or_dest]); + if ( crcval != bp->pendingcrcs[src_or_dest] ) + { + printf("new crcval.[%d] %x != %x\n",src_or_dest,crcval,bp->pendingcrcs[src_or_dest]); + bp->pendingcrcs[src_or_dest] = crcval; + } + bp->notaries[bp->myind].pendingcrcs[src_or_dest] = bp->pendingcrcs[src_or_dest]; + } *numsigsp = numsigs; return(bits256_doublesha256(0,serialized,len)); } @@ -411,7 +448,7 @@ void dpow_rawtxsign(struct supernet_info *myinfo,struct dpow_info *dp,struct igu vinitem = jitem(vins,j); if ( (sobj= jobj(item,"scriptSig")) != 0 && (sigstr= jstr(sobj,"hex")) != 0 && strlen(sigstr) > 32 ) { - valid = 1; + valid = 0; if ( dp->ratifying != 0 && j == 0 && bp->myind == 0 ) valid = 1; else if ( (pubstr= jstr(vinitem,"scriptPubKey")) != 0 && is_hexstr(pubstr,0) == 70 ) @@ -459,7 +496,7 @@ void dpow_rawtxsign(struct supernet_info *myinfo,struct dpow_info *dp,struct igu int32_t dpow_signedtxgen(struct supernet_info *myinfo,struct dpow_info *dp,struct iguana_info *coin,struct dpow_block *bp,int8_t bestk,uint64_t bestmask,int32_t myind,uint32_t deprec,int32_t src_or_dest,int32_t useratified) { - int32_t j,m,numsigs,len,siglen,retval=-1; uint32_t crcval; char rawtx[32768],*jsonstr,*rawtx2,*signedtx,*sigstr; cJSON *item,*sobj,*vins,*vin,*txobj2,*signobj; bits256 txid,srchash,zero; struct dpow_entry *ep; + int32_t j,m,numsigs,len,siglen,retval=-1; char rawtx[32768],*jsonstr,*rawtx2,*signedtx,*sigstr; cJSON *item,*sobj,*vins,*vin,*txobj2,*signobj; bits256 txid,srchash,zero; struct dpow_entry *ep; ep = &bp->notaries[myind]; memset(&zero,0,sizeof(zero)); if ( bestk < 0 ) @@ -475,16 +512,9 @@ int32_t dpow_signedtxgen(struct supernet_info *myinfo,struct dpow_info *dp,struc if ( useratified != 0 ) { len = (int32_t)strlen(rawtx) >> 1; - if ( len <= sizeof(bp->ratifyrawtx[0]) ) + if ( len <= sizeof(bp->ratifyrawtx[src_or_dest]) ) { - decode_hex(bp->ratifyrawtx[src_or_dest],len,rawtx), bp->rawratifiedlens[src_or_dest] = len; - crcval = calc_crc32(0,bp->ratifyrawtx[src_or_dest],bp->rawratifiedlens[src_or_dest]); - if ( crcval != bp->pendingcrcs[src_or_dest] ) - { - printf("new crcval.[%d] %x != %x\n",src_or_dest,crcval,bp->pendingcrcs[src_or_dest]); - bp->pendingcrcs[src_or_dest] = crcval; - } - bp->notaries[bp->myind].pendingcrcs[src_or_dest] = bp->pendingcrcs[src_or_dest]; + decode_hex(bp->ratifyrawtx[src_or_dest],len,rawtx),bp->rawratifiedlens[src_or_dest] = len; } if ( (jsonstr= dpow_signrawtransaction(myinfo,coin,rawtx,vins)) != 0 ) { @@ -531,12 +561,13 @@ int32_t dpow_signedtxgen(struct supernet_info *myinfo,struct dpow_info *dp,struc void dpow_sigscheck(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp,int32_t myind,int32_t src_or_dest,int8_t bestk,uint64_t bestmask,uint8_t pubkeys[64][33],int32_t numratified) { - bits256 txid,srchash,zero,signedtxid; struct iguana_info *coin; int32_t j,len,numsigs; char *retstr=0,str[65],str2[65]; uint8_t txdata[32768]; uint32_t channel; + bits256 txid,srchash,zero,signedtxid; struct iguana_info *coin; int32_t j,len,numsigs; char *retstr=0,str[65],str2[65]; uint8_t txdata[32768]; uint32_t channel,state; coin = (src_or_dest != 0) ? bp->destcoin : bp->srccoin; memset(zero.bytes,0,sizeof(zero)); 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); //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; @@ -544,7 +575,7 @@ void dpow_sigscheck(struct supernet_info *myinfo,struct dpow_info *dp,struct dpo { if ( (retstr= dpow_sendrawtransaction(myinfo,coin,bp->signedtx)) != 0 ) { - printf("sendrawtransaction.(%s)\n",retstr); + //printf("sendrawtransaction.(%s)\n",retstr); if ( is_hexstr(retstr,0) == sizeof(txid)*2 ) { decode_hex(txid.bytes,sizeof(txid),retstr); @@ -559,11 +590,20 @@ void dpow_sigscheck(struct supernet_info *myinfo,struct dpow_info *dp,struct dpo decode_hex(txdata+32,len,bp->signedtx); for (j=0; jhashmsg,(src_or_dest != 0) ? DPOW_BTCTXIDCHANNEL : DPOW_TXIDCHANNEL,bp->height,txdata,len+32); - bp->state = src_or_dest != 0 ? 1000 : 0xffffffff; - printf("complete statemachine.%s ht.%d state.%d (%x %x)\n",coin->symbol,bp->height,bp->state,bp->hashmsg.uints[0],txid.uints[0]); + state = src_or_dest != 0 ? 1000 : 0xffffffff; + if ( bp->state < state ) + { + bp->state = state; + dpow_send(myinfo,dp,bp,txid,bp->hashmsg,(src_or_dest != 0) ? DPOW_BTCTXIDCHANNEL : DPOW_TXIDCHANNEL,bp->height,txdata,len+32); + printf("complete statemachine.%s ht.%d state.%d (%x %x)\n",coin->symbol,bp->height,bp->state,bp->hashmsg.uints[0],txid.uints[0]); + } } else printf("sendtxid mismatch got %s instead of %s\n",bits256_str(str,txid),bits256_str(str2,signedtxid)); } + else + { + bp->state = 0xffffffff; + printf("dpow_sigscheck: mismatched txid.%s vs %s\n",bits256_str(str,txid),retstr); + } free(retstr); retstr = 0; } diff --git a/iguana/dpowassets b/iguana/dpowassets new file mode 100755 index 000000000..e0690e019 --- /dev/null +++ b/iguana/dpowassets @@ -0,0 +1,52 @@ +#!/bin/bash +set -x +source pubkey.txt +echo $pubkey + + +curl --url "http://127.0.0.1:7776" --data "{\"timeout\":60000,\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"REVS\",\"pubkey\":\"$pubkey\"}" + +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"SUPERNET\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"DEX\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"PANGEA\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"JUMBLR\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"BET\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CRYPTO\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"HODL\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"SHARK\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"BOTS\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MGW\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"USD\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"EUR\",\"pubkey\":\"$pubkey\"}" + +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"JPY\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"GBP\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"AUD\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CAD\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CHF\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"NZD\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CNY\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"RUB\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MXN\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"BRL\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"INR\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"HKD\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"TRY\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"ZAR\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"PLN\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"NOK\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"SEK\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"DKK\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CZK\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"HUF\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"ILS\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"KRW\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MYR\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"PHP\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"RON\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"SGD\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"THB\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"BGN\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"IDR\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"HRK\",\"pubkey\":\"$pubkey\"}" + diff --git a/iguana/exchanges/bitcoin.c b/iguana/exchanges/bitcoin.c index 90d4d4fef..5f8c3ec7b 100755 --- a/iguana/exchanges/bitcoin.c +++ b/iguana/exchanges/bitcoin.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * diff --git a/iguana/exchanges/bitcoin.h b/iguana/exchanges/bitcoin.h index 2a5cf651e..ad362a5a2 100755 --- a/iguana/exchanges/bitcoin.h +++ b/iguana/exchanges/bitcoin.h @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * diff --git a/iguana/exchanges/bitfinex.c b/iguana/exchanges/bitfinex.c index 764167ca3..6643fff89 100755 --- a/iguana/exchanges/bitfinex.c +++ b/iguana/exchanges/bitfinex.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * diff --git a/iguana/exchanges/bitstamp.c b/iguana/exchanges/bitstamp.c index 30c9b9a5a..36e928a34 100755 --- a/iguana/exchanges/bitstamp.c +++ b/iguana/exchanges/bitstamp.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * diff --git a/iguana/exchanges/bittrex.c b/iguana/exchanges/bittrex.c index f032b764b..155de4cfa 100755 --- a/iguana/exchanges/bittrex.c +++ b/iguana/exchanges/bittrex.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -77,7 +77,7 @@ double UPDATE(struct exchange_info *exchange,char *base,char *rel,struct exchang { cJSON *json,*obj; char *jsonstr,market[128],url[1024]; double hbla = 0.; sprintf(market,"%s-%s",rel,base); - sprintf(url,"https://bittrex.com/api/v1.1/public/getorderbook?market=%s&type=both&depth=%d",market,maxdepth); + sprintf(url,"http://bittrex.com/api/v1.1/public/getorderbook?market=%s&type=both&depth=%d",market,maxdepth); jsonstr = issue_curl(url); if ( jsonstr != 0 ) { @@ -166,8 +166,11 @@ uint64_t TRADE(int32_t dotrade,char **retstrp,struct exchange_info *exchange,cha return(0); } sprintf(payload,"https://bittrex.com/api/v1.1/market/%slimit?apikey=%s&nonce=%llu&market=%s&rate=%.8f&quantity=%.8f",dir>0?"buy":"sell",exchange->apikey,(long long)exchange_nonce(exchange),pairstr,price,volume); - if ( CHECKBALANCE(retstrp,dotrade,exchange,dir,base,rel,price,volume,argjson) == 0 && (json= SIGNPOST(&exchange->cHandle,dotrade,retstrp,exchange,payload,payload)) != 0 ) + if ( //CHECKBALANCE(retstrp,dotrade,exchange,dir,base,rel,price,volume,argjson) == 0 && + (json= SIGNPOST(&exchange->cHandle,dotrade,retstrp,exchange,payload,payload)) != 0 ) { + if ( *retstrp != 0 ) + printf("SIGNPOST returned.(%s) %s\n",*retstrp,jprint(json,0)); if ( is_cJSON_True(cJSON_GetObjectItem(json,"success")) != 0 && (resultobj= cJSON_GetObjectItem(json,"result")) != 0 ) { copy_cJSON(&uuidstr,cJSON_GetObjectItem(resultobj,"uuid")); diff --git a/iguana/exchanges/btc38.c b/iguana/exchanges/btc38.c index 268dce776..493d3fa0d 100755 --- a/iguana/exchanges/btc38.c +++ b/iguana/exchanges/btc38.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * diff --git a/iguana/exchanges/btce.c b/iguana/exchanges/btce.c index c7a255b06..b1d5a1291 100755 --- a/iguana/exchanges/btce.c +++ b/iguana/exchanges/btce.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * diff --git a/iguana/exchanges/coinbase.c b/iguana/exchanges/coinbase.c index 1a0fd190d..528df90a2 100755 --- a/iguana/exchanges/coinbase.c +++ b/iguana/exchanges/coinbase.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * diff --git a/iguana/exchanges/exchange_supports.h b/iguana/exchanges/exchange_supports.h index 083630bc1..fc7c854d2 100755 --- a/iguana/exchanges/exchange_supports.h +++ b/iguana/exchanges/exchange_supports.h @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * diff --git a/iguana/exchanges/exchange_undefs.h b/iguana/exchanges/exchange_undefs.h index 20862bce8..6d115147d 100755 --- a/iguana/exchanges/exchange_undefs.h +++ b/iguana/exchanges/exchange_undefs.h @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * diff --git a/iguana/exchanges/fxcm.c b/iguana/exchanges/fxcm.c index 42807a46f..ac39cbbd1 100755 --- a/iguana/exchanges/fxcm.c +++ b/iguana/exchanges/fxcm.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * diff --git a/iguana/exchanges/huobi.c b/iguana/exchanges/huobi.c index 402049a7c..02cc6f941 100755 --- a/iguana/exchanges/huobi.c +++ b/iguana/exchanges/huobi.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * diff --git a/iguana/exchanges/instaforex.c b/iguana/exchanges/instaforex.c index 3efa2a0e4..babcec86f 100755 --- a/iguana/exchanges/instaforex.c +++ b/iguana/exchanges/instaforex.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * diff --git a/iguana/exchanges/jumblr.c b/iguana/exchanges/jumblr.c index ba3cb4209..9803bbc05 100755 --- a/iguana/exchanges/jumblr.c +++ b/iguana/exchanges/jumblr.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * diff --git a/iguana/exchanges/lakebtc.c b/iguana/exchanges/lakebtc.c index 992665a07..3542ac9ba 100755 --- a/iguana/exchanges/lakebtc.c +++ b/iguana/exchanges/lakebtc.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * diff --git a/iguana/exchanges/nxtae.c b/iguana/exchanges/nxtae.c index 592532f30..03e2c1eee 100755 --- a/iguana/exchanges/nxtae.c +++ b/iguana/exchanges/nxtae.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * diff --git a/iguana/exchanges/okcoin.c b/iguana/exchanges/okcoin.c index 793fa38e6..af2fe5184 100755 --- a/iguana/exchanges/okcoin.c +++ b/iguana/exchanges/okcoin.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * diff --git a/iguana/exchanges/poloniex.c b/iguana/exchanges/poloniex.c index ffcd1481a..a45c3e343 100755 --- a/iguana/exchanges/poloniex.c +++ b/iguana/exchanges/poloniex.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -72,20 +72,29 @@ int32_t SUPPORTS(struct exchange_info *exchange,char *base,char *rel,cJSON *argj { //char *baserels[][2] = { {"btc","usd"} }; //return(baserel_polarity(baserels,(int32_t)(sizeof(baserels)/sizeof(*baserels)),base,rel)); - if ( strlen(base) > 5 || strlen(rel) > 5 || strcmp(rel,"CNY") == 0 || strcmp(base,"CNY") == 0 || strcmp(rel,"USD") == 0 || strcmp(base,"USD") == 0 ) + if ( strlen(base) > 5 || strlen(rel) > 5 || strcmp(rel,"CNY") == 0 || strcmp(base,"CNY") == 0 ) return(0); - if ( strcmp(rel,"BTC") == 0 ) + if ( strcmp(base,"BTC") == 0 && strcmp(rel,"USD") == 0 ) + return(1); + else if ( strcmp(rel,"BTC") == 0 && strcmp(base,"USD") == 0 ) + return(-1); + else if ( strcmp(rel,"BTC") == 0 ) return(1); else if ( strcmp(base,"BTC") == 0 ) return(-1); else return(0); } -double UPDATE(struct exchange_info *exchange,char *base,char *rel,struct exchange_quote *quotes,int32_t maxdepth,double commission,cJSON *argjson,int32_t invert) +double UPDATE(struct exchange_info *exchange,char *_base,char *_rel,struct exchange_quote *quotes,int32_t maxdepth,double commission,cJSON *argjson,int32_t invert) { - char market[128],url[1024]; - sprintf(market,"%s_%s",rel,base); + char market[128],url[1024],base[16],rel[16]; + strcpy(base,_base), touppercase(base); + strcpy(rel,_rel), touppercase(rel); + if ( strcmp(rel,"USD") == 0 ) + sprintf(market,"USDT_%s",base); + else sprintf(market,"%s_%s",rel,base); sprintf(url,"https://poloniex.com/public?command=returnOrderBook¤cyPair=%s&depth=%d",market,maxdepth); + //printf("URL.(%s)\n",url); return(exchanges777_standardprices(exchange,commission,base,rel,url,quotes,0,0,maxdepth,0,invert)); } @@ -157,10 +166,11 @@ uint64_t TRADE(int32_t dotrade,char **retstrp,struct exchange_info *exchange,cha typestr = (dir > 0) ? "marginBuy":"marginSell"; else typestr = (dir > 0) ? "buy":"sell"; sprintf(payload,"command=%s&nonce=%lld¤cyPair=%s&rate=%.8f&amount=%.8f",typestr,(long long)nonce,pairstr,price,volume); - if ( CHECKBALANCE(retstrp,dotrade,exchange,dir,base,rel,price,volume,argjson) == 0 && (json= SIGNPOST(&exchange->cHandle,dotrade,retstrp,exchange,EXCHANGE_AUTHURL,payload)) != 0 ) + if ( //CHECKBALANCE(retstrp,dotrade,exchange,dir,base,rel,price,volume,argjson) == 0 && + (json= SIGNPOST(&exchange->cHandle,dotrade,retstrp,exchange,EXCHANGE_AUTHURL,payload)) != 0 ) { txid = (get_API_nxt64bits(cJSON_GetObjectItem(json,"orderNumber")) << 32) | get_API_nxt64bits(cJSON_GetObjectItem(json,"tradeID")); - printf("poloniex.%llu (%s)\n",(long long)txid,jprint(json,0)); + printf("poloniex.%llu (%s) %s\n",(long long)txid,jprint(json,0),*retstrp!=0?*retstrp:""); free_json(json); } return(txid); diff --git a/iguana/exchanges/quadriga.c b/iguana/exchanges/quadriga.c index 6347c5118..e686c9787 100755 --- a/iguana/exchanges/quadriga.c +++ b/iguana/exchanges/quadriga.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * diff --git a/iguana/exchanges/truefx.c b/iguana/exchanges/truefx.c index 331eb71d6..1d0049543 100755 --- a/iguana/exchanges/truefx.c +++ b/iguana/exchanges/truefx.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * diff --git a/iguana/exchanges/unconf.c b/iguana/exchanges/unconf.c index d0cea56ab..951b6419d 100755 --- a/iguana/exchanges/unconf.c +++ b/iguana/exchanges/unconf.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * diff --git a/iguana/exchanges777.h b/iguana/exchanges777.h index b1b632660..fdefd98b5 100755 --- a/iguana/exchanges777.h +++ b/iguana/exchanges777.h @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -46,7 +46,7 @@ #define EXCHANGES777_MINPOLLGAP 1 #define EXCHANGES777_MAXDEPTH 200 -#define EXCHANGES777_DEFAULT_TIMEOUT 30 +#define EXCHANGES777_DEFAULT_TIMEOUT 60 typedef void CURL; struct exchange_info; struct exchange_quote; @@ -179,7 +179,7 @@ char *exchanges777_Qtrade(struct exchange_info *exchange,char *base,char *rel,in struct exchange_request *exchanges777_baserelfind(struct exchange_info *exchange,char *base,char *rel,int32_t func); struct exchange_info *exchanges777_find(char *exchangestr); -void prices777_processprice(struct exchange_info *exchange,char *base,char *rel,struct exchange_quote *bidasks,int32_t maxdepth); +void tradebots_processprices(struct supernet_info *myinfo,struct exchange_info *exchange,char *base,char *rel,struct exchange_quote *bidasks,int32_t numbids,int32_t numasks); double truefx_price(struct exchange_info *exchange,char *base,char *rel,struct exchange_quote *bidasks,int32_t maxdepth,double commission,cJSON *argjson,int32_t invert); double fxcm_price(struct exchange_info *exchange,char *base,char *rel,struct exchange_quote *bidasks,int32_t maxdepth,double commission,cJSON *argjson,int32_t invert); diff --git a/iguana/iguana777.c b/iguana/iguana777.c index 8f730bfa0..03c6de357 100755 --- a/iguana/iguana777.c +++ b/iguana/iguana777.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -27,10 +27,10 @@ struct iguana_info *iguana_coinfind(char *symbol) struct iguana_info *coin=0; uint32_t symbolcrc; struct supernet_info *myinfo = SuperNET_MYINFO(0); while ( myinfo->allcoins_being_added != 0 ) { - sleep(3); + sleep(1); if ( myinfo->allcoins_being_added != 0 ) printf("wait for coinadd to complete, OK if rare\n"); - sleep(3); + sleep(1); } symbolcrc = calc_crc32(0,symbol,(int32_t)strlen(symbol)); //portable_mutex_lock(&myinfo->allcoins_mutex); @@ -58,6 +58,8 @@ struct iguana_info *iguana_coinadd(char *symbol,char *name,cJSON *argjson,int32_ else { coin->chain = iguana_chainfind(myinfo,(char *)symbol,argjson,1); + //if ( coin->FULLNODE >= 0 ) + // coin->chain->userpass[0] = 0; coin->peers = calloc(1,sizeof(*coin->peers)); for (j=0; jchain->genesis_hashdata,zero,1)) != 0 ) bp->bundleheight = 0; + if ( coin->FULLNODE != 0 ) + coin->notarychain = -1; addr = &coin->peers->active[IGUANA_MAXPEERS-2]; iguana_initpeer(coin,addr,(uint32_t)calc_ipbits(coin->seedipaddr)); - printf("SEED_IPADDR initpeer.(%s)\n",addr->ipaddr); + printf("SEED_IPADDR initpeer.(%s) notarychain.%d\n",addr->ipaddr,coin->notarychain); iguana_launch(coin,"connection",iguana_startconnection,addr,IGUANA_CONNTHREAD); } @@ -891,13 +895,19 @@ void iguana_coinloop(void *arg) { if ( (coin= coins[i]) != 0 ) { - if ( coin->FULLNODE < 0 ) + if ( coin->didaddresses == 0 ) + { + coin->didaddresses = 1; + if ( coin->notarychain >= 0 && myinfo->IAMNOTARY != 0 ) + init_alladdresses(myinfo,coin); + } + if ( coin->FULLNODE < 0 || coin->notarychain >= 0 ) continue; - if ( strcmp(coin->symbol,"RELAY") == 0 ) + /*if ( strcmp(coin->symbol,"RELAY") == 0 ) { if ( myinfo->expiration != 0 && (myinfo->IAMLP != 0 || myinfo->DEXactive > now) ) basilisk_requests_poll(myinfo); - } + }*/ if ( n > 1 && coin->RTheight > 0 && (rand() % 10) != 0 ) continue; if ( coin->peers == 0 ) @@ -1128,7 +1138,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("BTC",coin->symbol) != 0); + coin->enableCACHE = 0;//(strcmp("BTCD",coin->symbol) == 0); if ( jobj(json,"cache") != 0 ) coin->enableCACHE = juint(json,"cache"); if ( (coin->polltimeout= juint(json,"poll")) <= 0 ) @@ -1136,13 +1146,6 @@ struct iguana_info *iguana_setcoin(char *symbol,void *launched,int32_t maxpeers, coin->active = juint(json,"active"); if ( (coin->minconfirms= minconfirms) == 0 ) coin->minconfirms = (strcmp(symbol,"BTC") == 0) ? 3 : 10; - if ( coin->chain == 0 && (coin->chain= iguana_createchain(json)) == 0 ) - { - printf("cant initialize chain.(%s)\n",jstr(json,0)); - strcpy(coin->name,"illegalcoin"); - coin->symbol[0] = 0; - return(0); - } if ( jobj(json,"RELAY") != 0 ) coin->FULLNODE = jint(json,"RELAY"); else coin->FULLNODE = (strcmp(coin->symbol,"BTCD") == 0); @@ -1151,6 +1154,15 @@ struct iguana_info *iguana_setcoin(char *symbol,void *launched,int32_t maxpeers, else coin->VALIDATENODE = (strcmp(coin->symbol,"BTCD") == 0); if ( coin->VALIDATENODE > 0 || coin->FULLNODE > 0 ) SuperNET_MYINFO(0)->IAMRELAY++; + if ( coin->chain == 0 && (coin->chain= iguana_createchain(json)) == 0 ) + { + printf("cant initialize chain.(%s)\n",jstr(json,0)); + strcpy(coin->name,"illegalcoin"); + //if ( coin->FULLNODE >= 0 ) + // coin->chain->userpass[0] = 0; + coin->symbol[0] = 0; + return(0); + } #ifdef __PNACL coin->VALIDATENODE = coin->FULLNODE = 0; #endif @@ -1194,10 +1206,13 @@ int32_t iguana_launchcoin(struct supernet_info *myinfo,char *symbol,cJSON *json, coins = mycalloc('A',1+1,sizeof(*coins)); if ( (coin= iguana_setcoin(symbol,coins,maxpeers,maxrecvcache,services,initialheight,maphash,minconfirms,maxrequests,maxbundles,json,virtcoin)) != 0 ) { - coins[0] = (void *)((long)1); - coins[1] = coin; - printf("launch.%p coinloop for.%s services.%llx started.%p peers.%p\n",coin,coin->symbol,(long long)services,coin->started,coin->peers); - coin->launched = iguana_launch(coin,"iguana_coinloop",iguana_coinloop,coins,IGUANA_PERMTHREAD); + if ( iguana_isnotarychain(coin->symbol) < 0 ) + { + coins[0] = (void *)((long)1); + coins[1] = coin; + printf("launch.%p coinloop for.%s services.%llx started.%p peers.%p\n",coin,coin->symbol,(long long)services,coin->started,coin->peers); + coin->launched = iguana_launch(coin,"iguana_coinloop",iguana_coinloop,coins,IGUANA_PERMTHREAD); + } coin->active = 1; coin->started = 0; return(1); diff --git a/iguana/iguana777.h b/iguana/iguana777.h index 313046c03..dfa7132b2 100755 --- a/iguana/iguana777.h +++ b/iguana/iguana777.h @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -39,6 +39,9 @@ #endif #endif +#define LOCKTIME_THRESHOLD 500000000 +#define KOMODO_INTEREST ((uint64_t)(0.05 * SATOSHIDEN)) // 5% + //#define BTC2_VERSION #define BTC2_HARDFORK_HEIGHT 444444 #define BTC2_SIGHASH_FORKID 0xcf @@ -51,13 +54,20 @@ #include "nn.h" #include "bus.h" #else*/ -//#if ISNOTARYNODE +//#ifdef __APPLE__ +#if defined(__APPLE__) || defined(WIN32) || defined(USE_STATIC_NANOMSG) #include "../crypto777/nanosrc/nn.h" #include "../crypto777/nanosrc/bus.h" #include "../crypto777/nanosrc/pubsub.h" #include "../crypto777/nanosrc/reqrep.h" -//#endif -//#endif +#include "../crypto777/nanosrc/tcp.h" +#else +#include "/usr/local/include/nanomsg/nn.h" +#include "/usr/local/include/nanomsg/bus.h" +#include "/usr/local/include/nanomsg/pubsub.h" +#include "/usr/local/include/nanomsg/reqrep.h" +#include "/usr/local/include/nanomsg/tcp.h" +#endif struct supernet_info; struct exchange_info; @@ -78,7 +88,13 @@ struct supernet_address char NXTADDR[32],BTC[64],BTCD[64]; }; -struct liquidity_info { char base[64],rel[64]; double profit,refprice; }; +struct liquidity_info +{ + char base[16],rel[16],exchange[16]; + uint64_t assetid; + double profit,refprice,bid,ask,minvol,maxvol,totalvol; +}; + struct message_info { int32_t msgcount; bits256 refhash,msghashes[64]; uint32_t timestamps[64]; }; struct supernet_info @@ -88,8 +104,10 @@ struct supernet_info uint8_t persistent_pubkey33[33]; char ipaddr[64],NXTAPIURL[512],secret[4096],password[4096],rpcsymbol[64],handle[1024],permanentfile[1024]; char *decryptstr; + void (*liquidity_command)(struct supernet_info *myinfo,char *base,bits256 hash,cJSON *vals); + double (*liquidity_active)(struct supernet_info *myinfo,double *refpricep,char *exchange,char *base,char *rel,double volume); int32_t maxdelay,IAMRELAY,IAMNOTARY,IAMLP,publicRPC,basilisk_busy,genesisresults,remoteorigin; - uint32_t expiration,dirty,DEXactive,DEXpoll,totalcoins,dexcrcs[1024]; + uint32_t expiration,dirty,DEXactive,DEXpoll,totalcoins,nanoinit,dexcrcs[1024]; uint16_t argport,rpcport; struct basilisk_info basilisks; struct exchange_info *tradingexchanges[SUPERNET_MAXEXCHANGES]; int32_t numexchanges; @@ -101,20 +119,25 @@ struct supernet_info struct basilisk_message *messagetable; portable_mutex_t messagemutex; queue_t msgQ,p2pQ; void *ctx; uint8_t *pingbuf; + struct basilisk_request DEXaccept; FILE *dexfp; - struct dpow_info DPOWS[64]; int32_t numdpows,dpowsock,dexsock,pubsock,repsock,subsock,reqsock; + struct dpow_info DPOWS[128]; int32_t numdpows,dpowsock,dexsock,pubsock,repsock,subsock,reqsock; struct delayedPoW_info dPoW; struct basilisk_spend *spends; int32_t numspends; - //struct peggy_info *PEGS; + char bindaddr[64]; + // fadedreamz + struct peggy_info *PEGS; void *PAXDATA; - struct liquidity_info linfos[64]; + struct liquidity_info linfos[512]; struct komodo_notaries NOTARY; - char seedipaddr[64]; uint32_t dpowipbits[128]; int32_t numdpowipbits; portable_mutex_t dpowmutex; + char seedipaddr[64]; uint32_t dpowipbits[128]; int32_t numdpowipbits; portable_mutex_t notarymutex,dpowmutex; char dexseed_ipaddr[64]; uint32_t dexipbits[128]; int32_t numdexipbits; portable_mutex_t dexmutex; // compatibility bits256 pangea_category,instantdex_category; uint8_t logs[256],exps[510]; struct message_info msgids[8192]; + double *svmfeatures; + struct dpow_entry notaries[64]; int32_t numnotaries; }; #include "../includes/iguana_funcs.h" diff --git a/iguana/iguana_accept.c b/iguana/iguana_accept.c index 835e68828..869d0f3bb 100755 --- a/iguana/iguana_accept.c +++ b/iguana/iguana_accept.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -13,6 +13,19 @@ * * ******************************************************************************/ + /** + * - we need to include WinSock2.h header to correctly use windows structure + * as the application is still using 32bit structure from mingw so, we need to + * add the include based on checking + * @author - fadedreamz@gmail.com + * @remarks - #if (defined(_M_X64) || defined(__amd64__)) && defined(WIN32) + * is equivalent to #if defined(_M_X64) as _M_X64 is defined for MSVC only + */ +#if defined(_M_X64) +#define WIN32_LEAN_AND_MEAN +#include +#endif + #include "iguana777.h" #include "exchanges777.h" @@ -20,10 +33,28 @@ struct iguana_accept { struct queueitem DL; char ipaddr[64]; uint32_t ipbits; in int32_t iguana_acceptspoll(uint8_t *buf,int32_t bufsize,struct iguana_accept *accepts,int32_t num,int32_t timeout) { + /** + * This solution is for win64 + * 2^11*sizeof(struct fd) for win64 bit gives a very big number + * for that reason it cannot allocate memory from stack + * so the solution is to allocate memory from heap, instead of stack + * @author - fadedreamz@gmail.com + */ +#if defined(_M_X64) + struct pollfd * fds; + int32_t i, j, n, r, nonz, flag; struct iguana_accept *ptr; + if (num == 0) + return(0);; + fds = (struct pollfd *) malloc(sizeof(struct pollfd) * IGUANA_MAXPEERS); + if (NULL == fds) + return -1; + memset(fds, 0, sizeof(struct pollfd) * IGUANA_MAXPEERS); +#else struct pollfd fds[IGUANA_MAXPEERS]; int32_t i,j,n,r,nonz,flag; struct iguana_accept *ptr; if ( num == 0 ) return(0);; memset(fds,0,sizeof(fds)); +#endif flag = 0; r = (rand() % num); for (j=n=nonz=0; jchain->debug != 0 || coin->chain->zcash != 0 ) { *validp = 1; return(0); } *validp = 0; - if ( iguana_serialize_block(myinfo,coin->chain,&hash2,serialized,block) < 0 ) + if ( (len= iguana_serialize_block(myinfo,coin->chain,&hash2,serialized,block)) < 0 ) return(-1); *validp = (memcmp(hash2.bytes,block->RO.hash2.bytes,sizeof(hash2)) == 0); block->valid = *validp; @@ -354,8 +367,10 @@ int32_t iguana_blockvalidate(struct supernet_info *myinfo,struct iguana_info *co if ( dispflag != 0 ) { static uint32_t counter; - if ( (counter++ % 10000) == 9999 ) - printf("iguana_blockvalidate.%d: %s miscompare.%d (%s) vs (%s)\n",block->height,coin->symbol,counter,bits256_str(str,hash2),bits256_str(str2,block->RO.hash2)); + //for (i=0; iheight,coin->symbol,counter,bits256_str(str,hash2),bits256_str(str2,block->RO.hash2)); //getchar(); } return(-1); @@ -688,7 +703,7 @@ struct iguana_block *_iguana_chainlink(struct supernet_info *myinfo,struct iguan bp->hashes[bundlei] = block->RO.hash2; iguana_bundlehash2add(coin,0,bp,bundlei,block->RO.hash2); } - if ( coin->started != 0 && bundlei == coin->minconfirms && (block->height > coin->longestchain-coin->chain->bundlesize*2 || ((block->height / coin->chain->bundlesize) % 100) == 9) ) + if ( coin->started != 0 && bundlei == coin->minconfirms && (block->height > coin->longestchain-coin->chain->bundlesize*2 || ((block->height / coin->chain->bundlesize) % 10) == 9) ) { //printf("savehdrs.[%d] ht.%d\n",bp->hdrsi,block->height); iguana_savehdrs(coin); @@ -709,9 +724,11 @@ struct iguana_block *_iguana_chainlink(struct supernet_info *myinfo,struct iguan iguana_RTnewblock(myinfo,coin,block); block->hdrsi = hdrsi; block->bundlei = bundlei; - bp = coin->bundles[hdrsi]; - if ( bp->blocks[bundlei] != block || bits256_cmp(bp->hashes[bundlei],block->RO.hash2) != 0 ) - printf("new hwm [%d:%d] mismatched bundle block\n",hdrsi,bundlei); + if ( 0 && (bp= coin->bundles[hdrsi]) != 0 ) + { + if ( bp->blocks[bundlei] != block || bits256_cmp(bp->hashes[bundlei],block->RO.hash2) != 0 ) + printf("new hwm [%d:%d] mismatched bundle block\n",hdrsi,bundlei); + } return(block); } } diff --git a/iguana/iguana_bundles.c b/iguana/iguana_bundles.c index be66da25f..d4ad7a81e 100755 --- a/iguana/iguana_bundles.c +++ b/iguana/iguana_bundles.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -271,7 +271,7 @@ int32_t iguana_bundlehash2add(struct iguana_info *coin,struct iguana_block **blo { if ( block->bundlei >= 0 && ((block->hdrsi != bp->hdrsi || block->bundlei != bundlei) && (block->hdrsi != 0 || block->bundlei != 0)) ) { - char str[65]; printf("blockadd warning: %d[%d] main.%d prevent <- %d[%d] %s\n",block->hdrsi,block->bundlei,block->mainchain,bp->hdrsi,bundlei,bits256_str(str,hash2)); + //char str[65]; printf("blockadd warning: %d[%d] main.%d prevent <- %d[%d] %s\n",block->hdrsi,block->bundlei,block->mainchain,bp->hdrsi,bundlei,bits256_str(str,hash2)); //iguana_blockunmark(coin,block,bp,bundlei,block->mainchain != 0); err |= 2; return(-1); @@ -435,7 +435,11 @@ struct iguana_txid *iguana_bundletx(struct iguana_info *coin,struct iguana_bundl iguana_peerfname(coin,&hdrsi,iter==0?"DB/ro":"DB",fname,0,bp->hashes[0],zero,bp->n,1); if ( (fp= fopen(fname,"rb")) != 0 ) { +#if defined(_M_X64) + fseek(fp, (uint64_t)&rdata.Toffset - (uint64_t)&rdata, SEEK_SET); +#else fseek(fp,(long)&rdata.Toffset - (long)&rdata,SEEK_SET); +#endif if ( fread(&Toffset,1,sizeof(Toffset),fp) == sizeof(Toffset) ) { fseek(fp,Toffset + sizeof(struct iguana_txid) * txidind,SEEK_SET); diff --git a/iguana/iguana_chains.c b/iguana/iguana_chains.c index 7a2b1f370..927fc0752 100755 --- a/iguana/iguana_chains.c +++ b/iguana/iguana_chains.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * diff --git a/iguana/iguana_exchanges.c b/iguana/iguana_exchanges.c index dadfd3b59..d8d678004 100755 --- a/iguana/iguana_exchanges.c +++ b/iguana/iguana_exchanges.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -22,16 +22,20 @@ //char *Exchange_names[] = { "poloniex", "bittrex", "btc38", "huobi", "bitstamp", "bitfinex", "btce", "coinbase", "okcoin", "lakebtc", "quadriga", "truefx", "ecb", "instaforex", "fxcm", "yahoo" }; -int32_t instantdex_updatesources(struct exchange_info *exchange,struct exchange_quote *sortbuf,int32_t n,int32_t max,int32_t ind,int32_t dir,struct exchange_quote *quotes,int32_t numquotes) +int32_t instantdex_updatesources(struct exchange_info *exchange,struct exchange_quote *sortbuf,int32_t n,int32_t max,int32_t ind,int32_t dir,struct exchange_quote *quotes,int32_t numquotes,double offset,double factor) { int32_t i; struct exchange_quote *quote; - //printf("instantdex_updatesources.%s update dir.%d numquotes.%d\n",exchange->name,dir,numquotes); + //printf("instantdex_updatesources.%s update dir.%d numquotes.%d offset %.6f\n",exchange->name,dir,numquotes,offset); for (i=0; iprice,quote->volume); if ( quote->price > SMALLVAL ) { + //printf("%s n.%d ind.%d i.%d dir.%d price %.8f vol %.8f offset %.6f\n",exchange->name,n,ind,i,dir,quote->price+offset,quote->volume,offset); + quote->price += offset; + quote->price /= factor; + quote->volume *= factor; + quote->satoshis = quote->price * SATOSHIDEN; sortbuf[n] = *quote; sortbuf[n].val = ind; sortbuf[n].exchangebits = exchange->exchangebits; @@ -45,7 +49,7 @@ int32_t instantdex_updatesources(struct exchange_info *exchange,struct exchange_ double instantdex_aveprice(struct supernet_info *myinfo,struct exchange_quote *sortbuf,int32_t max,double *totalvolp,char *base,char *rel,double basevolume,cJSON *argjson) { - char *str; double totalvol,pricesum; uint32_t timestamp; + char *str; double totalvol,pricesum,hblas[64][2],refbid,refask,factor = 1.; uint32_t timestamp; struct exchange_quote quote; int32_t i,n,dir,num,depth = 100; struct exchange_info *exchange; struct exchange_request *req,*active[64]; if ( myinfo == 0 ) @@ -64,6 +68,10 @@ double instantdex_aveprice(struct supernet_info *myinfo,struct exchange_quote *s memset(sortbuf,0,sizeof(*sortbuf) * max); if ( base != 0 && rel != 0 && basevolume > SMALLVAL ) { + if ( strcmp(base,"KMD") == 0 ) + base = "BTCD", factor = 50; + else if ( strcmp(rel,"KMD") == 0 ) + rel = "BTCD", factor = 0.02; for (i=num=0; inumexchanges && num < sizeof(active)/sizeof(*active); i++) { if ( (exchange= myinfo->tradingexchanges[i]) != 0 ) @@ -86,26 +94,55 @@ double instantdex_aveprice(struct supernet_info *myinfo,struct exchange_quote *s } } } + memset(hblas,0,sizeof(hblas)); + refbid = refask = 0.; + if ( strcmp(rel,"USD") == 0 ) + { + for (i=0; inumbids > 0 && active[i]->numasks > 0 ) + { + hblas[i][0] = active[i]->bidasks[0].price; + hblas[i][1] = active[i]->bidasks[1].price; + if ( active[i]->exchange != 0 && strcmp("poloniex",active[i]->exchange->name) == 0 ) + refbid = active[i]->bidasks[0].price, refask = active[i]->bidasks[1].price; + //printf("(%6f %.6f) ",hblas[i][0],hblas[i][1]); + } + } + //printf(" refbid %.6f refask %.7f\n",refbid,refask); + if ( refbid != 0. && refask != 0. ) + { + for (i=0; inumbids > 0 ) - n = instantdex_updatesources(active[i]->exchange,sortbuf,n,max,i,1,active[i]->bidasks,active[i]->numbids); + n = instantdex_updatesources(active[i]->exchange,sortbuf,n,max,i,1,active[i]->bidasks,active[i]->numbids,hblas[i][0],factor); else if ( dir > 0 && active[i]->numasks > 0 ) - n = instantdex_updatesources(active[i]->exchange,sortbuf,n,max,i,-1,&active[i]->bidasks[1],active[i]->numasks); + n = instantdex_updatesources(active[i]->exchange,sortbuf,n,max,i,-1,&active[i]->bidasks[1],active[i]->numasks,hblas[i][1],factor); } //printf("numexchanges.%d dir.%d %s/%s numX.%d n.%d\n",myinfo->numexchanges,dir,base,rel,num,n); if ( dir < 0 ) revsort64s(&sortbuf[0].satoshis,n,sizeof(*sortbuf)); else sort64s(&sortbuf[0].satoshis,n,sizeof(*sortbuf)); + //for (i=0; iexchange->name,pricesum/totalvol,totalvol); + //printf("dir.%d i.%d of %d %12.8f vol %.8f %s | aveprice %.8f total vol %.8f\n",dir,i,n,sortbuf[i].price,quote.volume,active[quote.val]->exchange->name,pricesum/totalvol,totalvol); } } if ( totalvol > 0. ) @@ -147,11 +184,6 @@ double instantdex_avehbla(struct supernet_info *myinfo,double retvals[4],char *_ else return(0); } -void prices777_processprice(struct exchange_info *exchange,char *base,char *rel,struct exchange_quote *bidasks,int32_t maxdepth) -{ - -} - cJSON *exchanges777_allpairs(char *baserels[][2],int32_t num) { int32_t i; char str[32]; cJSON *json,*item,*array = cJSON_CreateArray(); @@ -302,11 +334,11 @@ double exchange_setquote(struct exchange_quote *bidasks,int32_t *numbidsp,int32_ } if ( commission != 0. ) { - //printf("price %f fee %f -> ",price,prices->commission * price); + printf("price %f fee %f -> ",price,commission * price); if ( bidask == 0 ) price -= commission * price; else price += commission * price; - //printf("%f\n",price); + printf("%f\n",price); } quote = (bidask == 0) ? &bidasks[(*numbidsp)<<1] : &bidasks[((*numasksp)<<1) + 1]; quote->price = price, quote->volume = volume, quote->timestamp = timestamp, quote->orderid = orderid, quote->offerNXT = offerNXT; @@ -363,6 +395,7 @@ void exchanges777_json_quotes(struct exchange_info *exchange,double commission,c if ( strcmp(exchange->name,"kraken") == 0 ) timestamp = juint(jitem(item,2),0); else orderid = j64bits(jitem(item,2),0); + //printf("{%s} (%.8f %.8f) %f\n",jprint(item,0),price,volume,commission); } else { @@ -419,7 +452,7 @@ double exchanges777_standardprices(struct exchange_info *exchange,double commiss if ( (jsonstr= issue_curl(url)) != 0 ) { //if ( strcmp(exchangestr,"btc38") == 0 ) - //printf("(%s) -> (%s)\n",url,jsonstr); + //printf("%f (%s) -> (%s)\n",commission,url,jsonstr); if ( (json= cJSON_Parse(jsonstr)) != 0 ) { hbla = exchanges777_json_orderbook(exchange,commission,base,rel,quotes,maxdepth,json,field,"bids","asks",price,volume,invert); @@ -821,8 +854,8 @@ void exchanges777_loop(void *ptr) for (i=req->numasks=0; idepth; i++) if ( req->bidasks[(i << 1) + 1].price > SMALLVAL ) req->numasks++; - //printf("%-10s %s/%s numbids.%d numasks.%d\n",exchange->name,req->base,req->rel,req->numbids,req->numasks); - prices777_processprice(exchange,req->base,req->rel,req->bidasks,req->depth); +//printf("%-10s %s/%s numbids.%d numasks.%d\n",exchange->name,req->base,req->rel,req->numbids,req->numasks); + tradebots_processprices(myinfo,exchange,req->base,req->rel,req->bidasks,req->numbids,req->numasks); } queue_enqueue("pricesQ",&exchange->pricesQ,&req->DL); } @@ -917,7 +950,7 @@ char *exchanges777_Qprices(struct exchange_info *exchange,char *base,char *rel,i } if ( base[0] == 0 || rel[0] == 0 || (polarity= (*exchange->issue.supports)(exchange,base,rel,argjson)) == 0 ) { - //printf("%s invalid (%s) or (%s)\n",exchange->name,base,rel); + printf("%s invalid (%s) or (%s)\n",exchange->name,base,rel); return(clonestr("{\"error\":\"invalid base or rel\"}")); } if ( depth <= 0 ) @@ -940,7 +973,7 @@ char *exchanges777_Qprices(struct exchange_info *exchange,char *base,char *rel,i req->commission = exchange->commission; if ( monitor == 0 ) { - printf("%s submit (%s) (%s)\n",exchange->name,base,rel); + //printf("%s submit (%s) (%s)\n",exchange->name,base,rel); return(exchanges777_submit(exchange,req,'Q',maxseconds)); } else diff --git a/iguana/iguana_init.c b/iguana/iguana_init.c index 8623626d6..47da77bd1 100755 --- a/iguana/iguana_init.c +++ b/iguana/iguana_init.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -15,6 +15,16 @@ #include "iguana777.h" +/* + To add a new dPoW'ed assetchain with DEX* API support: + 1. add to komodo/src: assetchains, dpowassets, fiat-cli + 2. add to end of NOTARY_CURRENCIES[] array in fundnotaries (iguana_notary.c) + 3. create fiat/ + 4. add to m_notary coins/ get gen_acname from where komodod was launched, change RELAY:-1 and port to 7776 and make _7776 variant + 5. launch from a single node with -gen, launch a second node using -addnode= but without -gen + 6. from a single node, fundnotaries to get notaries able to dPoW + */ + void iguana_initQ(queue_t *Q,char *name) { struct stritem *tst,*item; @@ -74,6 +84,7 @@ void iguana_initcoin(struct iguana_info *coin,cJSON *argjson) iguana_meminit(&coin->blockMEM,"blockMEM",coin->blockspace,coin->blockspacesize,0); iguana_initQs(coin); coin->bindsock = -1; + coin->notarychain = -1; OS_randombytes((unsigned char *)&coin->instance_nonce,sizeof(coin->instance_nonce)); coin->startutc = (uint32_t)time(NULL); while ( time(NULL) == coin->startutc ) @@ -514,6 +525,29 @@ void iguana_coinpurge(struct iguana_info *coin) coin->active = saved; } +int32_t iguana_isnotarychain(char *symbol) +{ + int32_t i,n,notarychain = -1; char *jsonstr; cJSON *chains; + if ( (jsonstr= dpow_notarychains(0,0,0,0)) != 0 ) + { + if ( (chains= cJSON_Parse(jsonstr)) != 0 ) + { + if ( (n= cJSON_GetArraySize(chains)) > 0 ) + { + for (i=0; isymbol,coin->chain->rpcport); } } + } + if ( (coin->notarychain= iguana_isnotarychain(coin->symbol)) >= 0 ) + { + printf("SET %s NOTARYCHAIN.%d\n",coin->symbol,coin->notarychain); + return(coin); } //coin->firstblock = coin->blocks.parsedblocks + 1; iguana_genesis(myinfo,coin,coin->chain); @@ -612,7 +651,16 @@ struct iguana_info *iguana_coinstart(struct supernet_info *myinfo,struct iguana_ fpos = -1; for (j=0; j<2; j++) { + + /** + * macro switch for easy debug from Visual Studio IDE + * @author-fadedreamz@gmail.com + */ +#if defined(WIN32) && defined(_DEBUG) + sprintf(fname, "%s/%s/%s_%s%s.txt", "iguana", GLOBAL_CONFSDIR, coin->symbol, j == 0 ? "" : "old", (iter == 0) ? "peers" : "hdrs"), OS_compatible_path(fname); +#else sprintf(fname,"%s/%s_%s%s.txt",GLOBAL_CONFSDIR,coin->symbol,j==0?"":"old",(iter == 0) ? "peers" : "hdrs"), OS_compatible_path(fname); +#endif //sprintf(fname,"confs/%s_%s.txt",coin->symbol,(iter == 0) ? "peers" : "hdrs"); //sprintf(fname,"tmp/%s/%s.txt",coin->symbol,(iter == 0) ? "peers" : "hdrs"); OS_compatible_path(fname); diff --git a/iguana/iguana_interpreter.c b/iguana/iguana_interpreter.c index 4ed277649..d98ac46a8 100755 --- a/iguana/iguana_interpreter.c +++ b/iguana/iguana_interpreter.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * diff --git a/iguana/iguana_json.c b/iguana/iguana_json.c index 431e1954f..6ca3c0074 100755 --- a/iguana/iguana_json.c +++ b/iguana/iguana_json.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -128,6 +128,7 @@ cJSON *SuperNET_helpjson() #define IGUANA_HELP_HH(agent,name,hash,hash2) array = helpjson(IGUANA_ARGS,#agent,#name,helparray2(cJSON_CreateArray(),helpitem(#hash,"hash"),helpitem(#hash2,"hash"))) #define IGUANA_HELP_HA(agent,name,hash,obj) array = helpjson(IGUANA_ARGS,#agent,#name,helparray2(cJSON_CreateArray(),helpitem(#hash,"hash"),helpitem(#obj,"array"))) #define IGUANA_HELP_HS(agent,name,hash,str) array = helpjson(IGUANA_ARGS,#agent,#name,helparray2(cJSON_CreateArray(),helpitem(#hash,"hash"),helpitem(#str,"str"))) +#define IGUANA_HELP_HSI(agent,name,hash,str,val) array = helpjson(IGUANA_ARGS,#agent,#name,helparray3(cJSON_CreateArray(),helpitem(#hash,"hash"),helpitem(#str,"str"),helpitem(#val,"int"))) #define IGUANA_HELP_HII(agent,name,hash,val,val2) array = helpjson(IGUANA_ARGS,#agent,#name,helparray3(cJSON_CreateArray(),helpitem(#hash,"hash"),helpitem(#val,"int"),helpitem(#val2,"int"))) #define IGUANA_HELP_HHS(agent,name,hash,hash2,str) array = helpjson(IGUANA_ARGS,#agent,#name,helparray3(cJSON_CreateArray(),helpitem(#hash,"hash"),helpitem(#hash2,"hash"),helpitem(#str,"str"))) #define IGUANA_HELP_HAS(agent,name,hash,obj,str) array = helpjson(IGUANA_ARGS,#agent,#name,helparray3(cJSON_CreateArray(),helpitem(#hash,"hash"),helpitem(#obj,"array"),helpitem(#str,"str"))) @@ -152,6 +153,7 @@ cJSON *SuperNET_helpjson() #define STRING_AND_INT IGUANA_HELP_SI #define STRING_AND_TWOINTS IGUANA_HELP_SII #define HASH_AND_STRING IGUANA_HELP_HS +#define HASH_AND_STRING_AND_INT IGUANA_HELP_HSI #define HASH_AND_INT IGUANA_HELP_HI #define HASH_AND_TWOINTS IGUANA_HELP_HII #define DOUBLE_ARG IGUANA_HELP_D @@ -263,7 +265,11 @@ int32_t template_emit(char *retbuf,int32_t maxsize,char *template,char *varname, varnamelen = (int32_t)strlen(varname); while ( (match= strstr(varname,&template[offset])) != 0 ) { +#if defined(_M_X64) + position = (int32_t)((uint64_t)match - (uint64_t)&template[offset]); +#else position = (int32_t)((long)match - (long)&template[offset]); +#endif printf("found match.(%s) at %d offset.%d\n",varname,position,offset); if ( size + (valuelen + position) > maxsize ) return(-1); @@ -956,6 +962,7 @@ char *SuperNET_parser(struct supernet_info *myinfo,char *agentstr,char *method,c #define IGUANA_DISPATCH_HH(agent,name,hash,hash2) else if ( strcmp(#agent,agentstr) == 0 && strcmp(method,#name) == 0 ) return(agent ## _ ## name(IGUANA_ARGS,jbits256(json,#hash),jbits256(json,#hash2))) #define IGUANA_DISPATCH_HA(agent,name,hash,array) else if ( strcmp(#agent,agentstr) == 0 && strcmp(method,#name) == 0 ) return(agent ## _ ## name(IGUANA_ARGS,jbits256(json,#hash),jobj(json,#array))) #define IGUANA_DISPATCH_HS(agent,name,hash,str) else if ( strcmp(#agent,agentstr) == 0 && strcmp(method,#name) == 0 ) return(agent ## _ ## name(IGUANA_ARGS,jbits256(json,#hash),jstr(json,#str))) +#define IGUANA_DISPATCH_HSI(agent,name,hash,str,val) else if ( strcmp(#agent,agentstr) == 0 && strcmp(method,#name) == 0 ) return(agent ## _ ## name(IGUANA_ARGS,jbits256(json,#hash),jstr(json,#str),jint(json,#val))) #define IGUANA_DISPATCH_HII(agent,name,hash,val,val2) else if ( strcmp(#agent,agentstr) == 0 && strcmp(method,#name) == 0 ) return(agent ## _ ## name(IGUANA_ARGS,jbits256(json,#hash),juint(json,#val),juint(json,#val2))) #define IGUANA_DISPATCH_HHS(agent,name,hash,hash2,str) else if ( strcmp(#agent,agentstr) == 0 && strcmp(method,#name) == 0 ) return(agent ## _ ## name(IGUANA_ARGS,jbits256(json,#hash),jbits256(json,#hash2),jstr(json,#str))) #define IGUANA_DISPATCH_HAS(agent,name,hash,array,str) else if ( strcmp(#agent,agentstr) == 0 && strcmp(method,#name) == 0 ) return(agent ## _ ## name(IGUANA_ARGS,jbits256(json,#hash),jobj(json,#array),jstr(json,#str))) @@ -981,6 +988,7 @@ char *SuperNET_parser(struct supernet_info *myinfo,char *agentstr,char *method,c #define STRING_AND_TWOINTS IGUANA_DISPATCH_SII #define HASH_AND_INT IGUANA_DISPATCH_HI #define HASH_AND_STRING IGUANA_DISPATCH_HS +#define HASH_AND_STRING_AND_INT IGUANA_DISPATCH_HSI #define HASH_AND_TWOINTS IGUANA_DISPATCH_HII #define DOUBLE_ARG IGUANA_DISPATCH_D #define STRING_AND_ARRAY IGUANA_DISPATCH_SA diff --git a/iguana/iguana_mofn.c b/iguana/iguana_mofn.c index ab094bf5d..4cca28947 100755 --- a/iguana/iguana_mofn.c +++ b/iguana/iguana_mofn.c @@ -309,7 +309,7 @@ int maingen(int argc,char **argv) } /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -563,10 +563,17 @@ int32_t test_mofn256(struct supernet_info *myinfo,int32_t M,int32_t N) if ( m >= M ) printf("%s %s error m.%d vs M.%d N.%d\n",bits256_str(str,secret),bits256_str(str2,recover),m,mofn->M,mofn->N); } +#if defined(_M_X64) + if (((uint64_t)mofn - (uint64_t)space) >= sizeof(space) || ((uint64_t)mofn - (uint64_t)space) < 0) + free(mofn); + if (((uint64_t)cmp - (uint64_t)space) >= sizeof(space) || ((uint64_t)cmp - (uint64_t)space) < 0) + free(cmp); +#else if ( ((long)mofn - (long)space) >= sizeof(space) || ((long)mofn - (long)space) < 0 ) free(mofn); if ( ((long)cmp - (long)space) >= sizeof(space) || ((long)cmp - (long)space) < 0 ) free(cmp); +#endif return(retval); } diff --git a/iguana/iguana_msg.c b/iguana/iguana_msg.c index 5f9e5543e..4b7a497d9 100755 --- a/iguana/iguana_msg.c +++ b/iguana/iguana_msg.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -209,8 +209,8 @@ int32_t iguana_rwblock(struct supernet_info *myinfo,char *symbol,uint8_t zcash,u if ( rwflag == 1 ) { if ( zcash == 0 ) - x = zmsg->txn_count; - else x = msg->txn_count; + x = msg->txn_count; + else x = zmsg->txn_count; } //char str[65],str2[65]; printf("zcash.%d len.%d: block version.%d timestamp.%u bits.%x nonce.%u prev.(%s) %llx hash2.%s zlen.%d\n",zcash,len,msg->H.version,msg->H.timestamp,msg->H.bits,msg->H.nonce,bits256_str(str,msg->H.prev_block),(long long)msg->H.merkle_root.txid,bits256_str(str2,*hash2p),(int32_t)sizeof(struct iguana_msgzblockhdr)); len += iguana_rwvarint(rwflag,&serialized[len],&x); @@ -242,7 +242,7 @@ int32_t iguana_serialize_block(struct supernet_info *myinfo,struct iguana_chain msg->H.bits = block->RO.bits; msg->H.nonce = block->RO.nonce; msg->txn_count = block->RO.txn_count; - len = iguana_rwblock(myinfo,chain->symbol,chain->zcash,chain->auxpow,chain->hashalgo,1,hash2p,serialized,&zmsg,IGUANA_MAXPACKETSIZE); + len = iguana_rwblock(myinfo,chain->symbol,chain->zcash,chain->auxpow,chain->hashalgo,1,hash2p,serialized,(void *)msg,IGUANA_MAXPACKETSIZE); } else { @@ -325,7 +325,7 @@ int32_t iguana_rwmsgalert(struct iguana_info *coin,int32_t rwflag,uint8_t *seria printf("%02x",coin->chain->alertpubkey[i]); char str[65]; printf(" alertpubkey.%d, alerthash2.%s\n",plen,bits256_str(str,alerthash2)); } else msg->siglen = 0; - printf(" ALERT v.%d relay.%lld expires.%lld ID.%d cancel.%d numlist.%d minver.%d maxver.%d subver.(%s) priority.%d comment.(%s) STATUS.(%s) reserved.(%s)\n",msg->version,(long long)msg->relayuntil,(long long)msg->expiration,msg->ID,msg->cancel,msg->numcancellist,msg->minver,msg->maxver,msg->subver,msg->priority,msg->comment,msg->statusbar,msg->reserved); + //printf(" ALERT v.%d relay.%lld expires.%lld ID.%d cancel.%d numlist.%d minver.%d maxver.%d subver.(%s) priority.%d comment.(%s) STATUS.(%s) reserved.(%s)\n",msg->version,(long long)msg->relayuntil,(long long)msg->expiration,msg->ID,msg->cancel,msg->numcancellist,msg->minver,msg->maxver,msg->subver,msg->priority,msg->comment,msg->statusbar,msg->reserved); return(len); } @@ -1251,7 +1251,7 @@ int32_t iguana_msgparser(struct supernet_info *myinfo,struct iguana_info *coin,s //printf("error.(%s) (%s): len.%d != recvlen.%d\n",H->command,addr->ipaddr,len,recvlen); //for (i=0; icommand,"addr") != 0 && (coin->chain->auxpow == 0 || strcmp(H->command,"headers") != 0) ) + if ( len != 0 && strcmp(H->command,"addr") != 0 && (coin->chain->auxpow == 0 || strcmp(H->command,"headers") != 0) && strcmp(H->command,"alert") != 0 ) printf("%s %s.%s len mismatch %d != %d\n",coin->symbol,addr!=0?addr->ipaddr:"local",H->command,len,recvlen); } else if ( len != recvlen && recvlen > 1 ) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index 117df13f3..5f98f1bb8 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -71,14 +71,17 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he else { freq = 1; - minsigs = 7;//(komodo_notaries(dp->symbol,pubkeys,height) >> 1) + 1; + //minsigs = 7;//(komodo_notaries(dp->symbol,pubkeys,height) >> 1) + 1; //if ( minsigs < DPOW_MINSIGS ) - // minsigs = DPOW_MINSIGS; + minsigs = DPOW_MINSIGS; } printf("%s/%s src ht.%d dest.%u nonz.%d %s minsigs.%d\n",dp->symbol,dp->dest,checkpoint.blockhash.height,dp->destupdated,bits256_nonz(checkpoint.blockhash.hash),bits256_str(str,dp->last.blockhash.hash),minsigs); dpow_fifoupdate(myinfo,dp->srcfifo,dp->last); + if ( dp->SRCREALTIME == 0 && strcmp(dp->dest,"KMD") == 0 ) + return; if ( bits256_nonz(checkpoint.blockhash.hash) != 0 && (checkpoint.blockhash.height % freq) == 0 ) { + dpow_heightfind(myinfo,dp,checkpoint.blockhash.height + 1000); ptrs = calloc(1,sizeof(void *)*5 + sizeof(struct dpow_checkpoint)); ptrs[0] = (void *)myinfo; ptrs[1] = (void *)dp; @@ -142,17 +145,23 @@ void dpow_destupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t h void iguana_dPoWupdate(struct supernet_info *myinfo,struct dpow_info *dp) { - int32_t height; uint32_t blocktime; bits256 blockhash; struct iguana_info *src,*dest; - dpow_nanomsg_update(myinfo); + int32_t height,num; uint32_t blocktime; bits256 blockhash; struct iguana_info *src,*dest; + //fprintf(stderr,"dp.%p dPoWupdate (%s -> %s)\n",dp,dp!=0?dp->symbol:"",dp!=0?dp->dest:""); + if ( strcmp(dp->symbol,"KMD") == 0 ) + { + num = dpow_nanomsg_update(myinfo); + //fprintf(stderr,"%d ",num); + } src = iguana_coinfind(dp->symbol); dest = iguana_coinfind(dp->dest); - //fprintf(stderr,"dp.%p dPoWupdate (%s -> %s)\n",dp,dp!=0?dp->symbol:"",dp!=0?dp->dest:""); if ( src != 0 && dest != 0 ) { dp->numdesttx = sizeof(dp->desttx)/sizeof(*dp->desttx); if ( (height= dpow_getchaintip(myinfo,&blockhash,&blocktime,dp->desttx,&dp->numdesttx,dest)) != dp->destchaintip.blockhash.height && height >= 0 ) { - //printf("%s %s height.%d vs last.%d\n",dp->dest,bits256_str(str,blockhash),height,dp->destchaintip.blockhash.height); + char str[65]; + if ( strcmp(dp->symbol,"KMD") == 0 || height != dp->destchaintip.blockhash.height+1 ) + printf("[%s].%d %s %s height.%d vs last.%d\n",dp->symbol,dp->SRCHEIGHT,dp->dest,bits256_str(str,blockhash),height,dp->destchaintip.blockhash.height); if ( height <= dp->destchaintip.blockhash.height ) { printf("iguana_dPoWupdate dest.%s reorg detected %d vs %d\n",dp->dest,height,dp->destchaintip.blockhash.height); @@ -164,8 +173,12 @@ void iguana_dPoWupdate(struct supernet_info *myinfo,struct dpow_info *dp) if ( (height= dpow_getchaintip(myinfo,&blockhash,&blocktime,dp->srctx,&dp->numsrctx,src)) != dp->last.blockhash.height && height >= 0 ) { if ( strcmp(dp->dest,"KMD") == 0 ) + { + //fprintf(stderr,"[I "); dp->SRCHEIGHT = dpow_issuer_iteration(dp,src,dp->SRCHEIGHT,&dp->SRCREALTIME); - char str[65]; printf("%s %s height.%d vs last.%d\n",dp->symbol,bits256_str(str,blockhash),height,dp->last.blockhash.height); + //fprintf(stderr," %d] ",dp->SRCHEIGHT); + } + char str[65]; printf("[%s].%d %s %s height.%d vs last.%d\n",dp->dest,dp->SRCHEIGHT,dp->symbol,bits256_str(str,blockhash),height,dp->last.blockhash.height); if ( dp->lastheight == 0 ) dp->lastheight = height-1; if ( height < dp->last.blockhash.height ) @@ -213,7 +226,7 @@ void dpow_addresses() TWO_STRINGS(iguana,dpow,symbol,pubkey) { - char *retstr,srcaddr[64],destaddr[64]; struct iguana_info *src,*dest; int32_t i,srcvalid,destvalid; struct dpow_info *dp = &myinfo->DPOWS[myinfo->numdpows]; + char *retstr,srcaddr[64],destaddr[64]; struct iguana_info *src,*dest; cJSON *ismine; int32_t i,srcvalid,destvalid; struct dpow_info *dp = &myinfo->DPOWS[myinfo->numdpows]; if ( myinfo->NOTARY.RELAYID < 0 ) { if ( (retstr= basilisk_addrelay_info(myinfo,0,(uint32_t)calc_ipbits(myinfo->ipaddr),myinfo->myaddr.persistent)) != 0 ) @@ -230,8 +243,8 @@ TWO_STRINGS(iguana,dpow,symbol,pubkey) return(clonestr("{\"error\":\"need 33 byte pubkey\"}")); if ( symbol == 0 || symbol[0] == 0 ) symbol = "KMD"; - if ( myinfo->numdpows == 1 ) - komodo_assetcoins(); + //if ( myinfo->numdpows == 1 ) + // komodo_assetcoins(-1); if ( iguana_coinfind(symbol) == 0 ) return(clonestr("{\"error\":\"cant dPoW an inactive coin\"}")); if ( strcmp(symbol,"KMD") == 0 && iguana_coinfind("BTC") == 0 ) @@ -276,9 +289,25 @@ TWO_STRINGS(iguana,dpow,symbol,pubkey) safecopy(tmp,pubkey,sizeof(tmp)); decode_hex(dp->minerkey33,33,tmp); bitcoin_address(srcaddr,src->chain->pubtype,dp->minerkey33,33); - srcvalid = dpow_validateaddress(myinfo,src,srcaddr); + if ( (retstr= dpow_validateaddress(myinfo,src,srcaddr)) != 0 ) + { + json = cJSON_Parse(retstr); + if ( (ismine= jobj(json,"ismine")) != 0 && is_cJSON_True(ismine) != 0 ) + srcvalid = 1; + else srcvalid = 0; + free(retstr); + retstr = 0; + } bitcoin_address(destaddr,dest->chain->pubtype,dp->minerkey33,33); - destvalid = dpow_validateaddress(myinfo,dest,destaddr); + if ( (retstr= dpow_validateaddress(myinfo,dest,destaddr)) != 0 ) + { + json = cJSON_Parse(retstr); + if ( (ismine= jobj(json,"ismine")) != 0 && is_cJSON_True(ismine) != 0 ) + destvalid = 1; + else destvalid = 0; + free(retstr); + retstr = 0; + } for (i=0; i<33; i++) printf("%02x",dp->minerkey33[i]); printf(" DPOW with pubkey.(%s) %s.valid%d %s -> %s %s.valid%d\n",tmp,srcaddr,srcvalid,dp->symbol,dp->dest,destaddr,destvalid); @@ -294,15 +323,16 @@ TWO_STRINGS(iguana,dpow,symbol,pubkey) } if ( dp->blocks == 0 ) { - dp->maxblocks = 100000; + dp->maxblocks = 1000000; dp->blocks = calloc(dp->maxblocks,sizeof(*dp->blocks)); } - if ( myinfo->numdpows++ == 0 ) - portable_mutex_init(&dp->mutex); + portable_mutex_init(&dp->paxmutex); + portable_mutex_init(&dp->dexmutex); PAX_init(); //printf(">>>>>>>>>>>>>>> call paxpending\n"); //uint8_t buf[32768]; //dpow_paxpending(buf); + myinfo->numdpows++; return(clonestr("{\"result\":\"success\"}")); } @@ -341,6 +371,22 @@ THREE_STRINGS(iguana,passthru,asset,function,hex) else return(clonestr("{\"error\":\"assetchain not active, start in bitcoind mode\"}")); } + +TWO_STRINGS(dex,send,hex,handler) +{ + uint8_t data[8192]; int32_t datalen; char *retstr; + if ( hex != 0 && (datalen= is_hexstr(hex,0)) > 0 && (datalen>>1) < sizeof(data) ) + { + datalen >>= 1; + decode_hex(data,datalen,hex); + if ( handler == 0 || handler[0] == 0 ) + handler = "DEX"; + if ( (retstr= dex_reqsend(myinfo,handler,data,datalen,1,"")) == 0 ) + return(clonestr("{\"result\":\"success\"}")); + else return(retstr); + } else return(clonestr("{\"error\":\"dex send: invalid hex\"}")); +} + STRING_ARG(dpow,pending,fiat) { struct dpow_info *dp; char base[64]; int32_t i; @@ -359,6 +405,21 @@ STRING_ARG(dpow,pending,fiat) return(clonestr("[]")); } +STRING_ARG(dpow,bindaddr,ipaddr) +{ + uint32_t ipbits; char checkbuf[64]; + if ( ipaddr != 0 && ipaddr[0] != 0 ) + { + ipbits = (uint32_t)calc_ipbits(ipaddr); + expand_ipbits(checkbuf,ipbits); + if ( strcmp(ipaddr,checkbuf) == 0 ) + { + strcpy(myinfo->bindaddr,ipaddr); + return(clonestr("{\"result\":\"success\"}")); + } else return(clonestr("{\"error\":\"invalid bind ipaddr\"}")); + } else return(clonestr("{\"error\":\"no bind ipaddr\"}")); +} + STRING_ARG(iguana,addnotary,ipaddr) { static int32_t didinit; @@ -372,10 +433,96 @@ STRING_ARG(iguana,addnotary,ipaddr) return(clonestr("{\"result\":\"notary node added\"}")); } +char NOTARY_CURRENCIES[][16] = { "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", + "REVS", "SUPERNET", "DEX", "PANGEA", "JUMBLR", "BET", "CRYPTO", "HODL", "SHARK", "BOTS", "MGW", "MVP" }; + +ZERO_ARGS(dpow,notarychains) +{ + int32_t i; cJSON *array = cJSON_CreateArray(); + jaddistr(array,"KMD"); + jaddistr(array,"BTC"); + for (i=0; i current - numblocks ) + { + printf("ht.%d %llx vs current.%d - %d\n",height,(long long)signedmask,current,numblocks); + for (j=0; j<64; j++) + if ( ((1LL << j) & signedmask) != 0 ) + vals[j] += (double)DPOW_UTXOSIZE / SATOSHIDEN; + } + } else break; + } + fclose(fp); + } else return(clonestr("{\"error\":\"cant open signedmasks\"}")); + for (sum=j=0; j 0. ) + { + bitcoin_address(coinaddr,60,pubkeys[j],33); + sprintf(cmd,"bicoin-cli sendtoaddress %s %f\n",coinaddr,val); + if ( sendflag != 0 && system(cmd) != 0 ) + printf("ERROR with (%s)\n",cmd); + else + { + printf("(%d %f) ",j,val); + sum += val; + } + } + } + printf("%s sent %.8f BTC\n",sendflag!=0?"":"would have",sum); + return(clonestr("{\"result\":\"success\"}")); + } + else return(clonestr("{\"error\":\"cant find BTC\"}")); + } + for (i=0; iDPOWS[0].lastrecvmask; @@ -449,6 +596,66 @@ TWOINTS_AND_ARRAY(dpow,ratify,minsigs,timestamp,ratified) } return(clonestr("{\"result\":\"started ratification\"}")); } + +HASH_AND_STRING(dex,gettransaction,txid,symbol) +{ + return(_dex_getrawtransaction(myinfo,symbol,txid)); +} + +HASH_AND_STRING_AND_INT(dex,gettxout,txid,symbol,vout) +{ + return(_dex_gettxout(myinfo,symbol,txid,vout)); +} + +STRING_ARG(dex,getinfo,symbol) +{ + return(_dex_getinfo(myinfo,symbol)); +} + +STRING_ARG(dex,getbestblockhash,symbol) +{ + return(_dex_getbestblockhash(myinfo,symbol)); +} + +STRING_ARG(dex,alladdresses,symbol) +{ + return(_dex_alladdresses(myinfo,symbol)); +} + +STRING_AND_INT(dex,getblockhash,symbol,height) +{ + return(_dex_getblockhash(myinfo,symbol,height)); +} + +HASH_AND_STRING(dex,getblock,hash,symbol) +{ + return(_dex_getblock(myinfo,symbol,hash)); +} + +TWO_STRINGS(dex,sendrawtransaction,symbol,signedtx) +{ + return(_dex_sendrawtransaction(myinfo,symbol,signedtx)); +} + +TWO_STRINGS(dex,importaddress,symbol,address) +{ + return(_dex_importaddress(myinfo,symbol,address)); +} + +TWO_STRINGS(dex,validateaddress,symbol,address) +{ + return(_dex_validateaddress(myinfo,symbol,address)); +} + +TWO_STRINGS(dex,listunspent,symbol,address) +{ + return(_dex_listunspent(myinfo,symbol,address)); +} + +TWO_STRINGS_AND_TWO_DOUBLES(dex,listtransactions,symbol,address,count,skip) +{ + return(_dex_listtransactions(myinfo,symbol,address,count,skip)); +} #include "../includes/iguana_apiundefs.h" diff --git a/iguana/iguana_payments.c b/iguana/iguana_payments.c index f5d7a7300..9e6d7831a 100755 --- a/iguana/iguana_payments.c +++ b/iguana/iguana_payments.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -172,7 +172,7 @@ int32_t iguana_RTbestunspent(struct supernet_info *myinfo,struct iguana_info *co continue; if ( iguana_RTunspent_check(myinfo,coin,unspents[i]) != 0 ) { - printf("(%d u%d) %.8f already used\n",unspents[i].hdrsi,unspents[i].unspentind,dstr(atx_value)); + //printf("(%d u%d) %.8f already used\n",unspents[i].hdrsi,unspents[i].unspentind,dstr(atx_value)); continue; } if ( maxmode == 0 ) @@ -288,11 +288,32 @@ char *iguana_signrawtx(struct supernet_info *myinfo,struct iguana_info *coin,int bits256 iguana_sendrawtransaction(struct supernet_info *myinfo,struct iguana_info *coin,char *signedtx) { - bits256 txid; uint8_t *serialized; int32_t i,len,n; struct iguana_peer *addr; cJSON *vals; char *str; + bits256 txid,checktxid; uint8_t *serialized; int32_t i,len,n; struct iguana_peer *addr; cJSON *vals; char *str; len = (int32_t)strlen(signedtx) >> 1; serialized = calloc(1,sizeof(struct iguana_msghdr) + len); decode_hex(&serialized[sizeof(struct iguana_msghdr)],len,signedtx); txid = bits256_doublesha256(0,&serialized[sizeof(struct iguana_msghdr)],len); + if ( coin->FULLNODE < 0 || coin->notarychain >= 0 ) + { + if ( coin->FULLNODE < 0 || coin->notarychain >= 0 ) + str = dpow_sendrawtransaction(myinfo,coin,signedtx); + else str = _dex_sendrawtransaction(myinfo,coin->symbol,signedtx); + if ( str != 0 ) + { + if ( is_hexstr(str,0) == sizeof(checktxid)*2 ) + { + decode_hex(checktxid.bytes,sizeof(checktxid),str); + if ( bits256_cmp(txid,checktxid) == 0 ) + { + free(str); + return(txid); + } + } + free(str); + memset(txid.bytes,0,sizeof(txid)); + return(txid); + } + } if ( coin->peers != 0 && (n= coin->peers->numranked) > 0 ) { for (i=0; i<8 && iFULLNODE < 0 ) // komodod is running + { + if ( (retjson= dpow_gettxout(myinfo,coin,txid,vout)) != 0 ) + { + interest = jdouble(retjson,"interest") * SATOSHIDEN; + free_json(retjson); + } + } + else if ( coin->FULLNODE == 0 ) // basilisk mode -> use DEX* API + { + if ( (retstr= _dex_gettxout(myinfo,coin->symbol,txid,vout)) != 0 ) + { + if ( (retjson= cJSON_Parse(retstr)) != 0 ) + { + interest = jdouble(retjson,"interest") * SATOSHIDEN; + free_json(retjson); + } + free(retstr); + } + } + else // we have it local + { + if ( (tx= iguana_txidfind(coin,&height,&T,txid,coin->bundlescount)) != 0 && tx->locktime >LOCKTIME_THRESHOLD ) + { + if ( (minutes= ((uint32_t)time(NULL) - 60 - tx->locktime) / 60) >= 60 ) + { + numerator = (value * KOMODO_INTEREST); + denominator = (((uint64_t)365 * 24 * 60) / minutes); + if ( denominator == 0 ) + denominator = 1; // max KOMODO_INTEREST per transfer, do it at least annually! + interest = (numerator / denominator) / SATOSHIDEN; + fprintf(stderr,"komodo_interest %lld %.8f nLockTime.%u tiptime.%u minutes.%d interest %lld %.8f (%llu / %llu)\n",(long long)value,(double)value/SATOSHIDEN,tx->locktime,(uint32_t)time(NULL),minutes,(long long)interest,(double)interest/SATOSHIDEN,(long long)numerator,(long long)denominator); + } + } + } + char str[65]; printf("interest for %s.v%d %.8f %.8f\n",bits256_str(str,txid),vout,dstr(value),dstr(interest)); + return(interest); +} + +uint64_t iguana_interests(struct supernet_info *myinfo,struct iguana_info *coin,cJSON *vins) +{ + int32_t i,n; cJSON *item; uint64_t value,interest = 0; + if ( is_cJSON_Array(vins) != 0 && (n= cJSON_GetArraySize(vins)) > 0 ) + { + for (i=0; isymbol,"KMD") == 0 ) + total += iguana_interests(myinfo,coin,vins); if ( total < (satoshis + txfee) ) { free_json(vins); @@ -645,6 +727,7 @@ HASH_AND_TWOINTS(bitcoinrpc,gettxout,txid,vout,mempool) jaddnum(retjson,"height",height); jaddnum(retjson,"confirmations",coin->blocks.hwmchain.height - height + 1); jaddnum(retjson,"value",dstr(value)); + jaddnum(retjson,"amount",dstr(value)); if ( (height % coin->chain->bundlesize) == 0 && vout == 0 ) jadd(retjson,"coinbase",jtrue()); else jadd(retjson,"coinbase",jfalse()); @@ -769,7 +852,7 @@ THREE_STRINGS(bitcoinrpc,verifymessage,address,sig,message) // printf("%02x",sigbuf[i]); //printf(" siglen.%d [%d] address.(%s) sig.(%s) message.(%s)\n",len,sigbuf[0],address,sig,message); hash2 = iguana_messagehash2(message,coin->chain->messagemagic); - if ( bitcoin_recoververify(myinfo->ctx,coin->symbol,sigbuf,hash2,pubkey) == 0 ) + if ( bitcoin_recoververify(myinfo->ctx,coin->symbol,sigbuf,hash2,pubkey,0) == 0 ) jadd(retjson,"result",jtrue()); else jadd(retjson,"result",jfalse()); jaddstr(retjson,"coin",coin->symbol); @@ -1153,7 +1236,7 @@ ARRAY_OBJ_INT(bitcoinrpc,createrawtransaction,vins,vouts,locktime) bits256 txid; int32_t offset,spendlen=0,n; uint8_t addrtype,rmd160[20],spendscript[IGUANA_MAXSCRIPTSIZE]; uint64_t satoshis; char *hexstr,*field,*txstr; cJSON *txobj,*item,*obj,*retjson = cJSON_CreateObject(); if ( remoteaddr != 0 ) return(clonestr("{\"error\":\"no remote\"}")); - if ( coin != 0 && (txobj= bitcoin_txcreate(coin->chain->isPoS,locktime,1,0)) != 0 ) + if ( coin != 0 && (txobj= bitcoin_txcreate(coin->symbol,coin->chain->isPoS,locktime,1,0)) != 0 ) { iguana_createvins(myinfo,coin,txobj,vins); if ( (n= cJSON_GetArraySize(vouts)) > 0 ) @@ -1238,7 +1321,7 @@ cJSON *iguana_listunspents(struct supernet_info *myinfo,struct iguana_info *coin { array = iguana_getaddressesbyaccount(myinfo,coin,"*"); flag = 1; - printf("listunspent.(%s)\n",jprint(array,0)); + //printf("listunspent.(%s)\n",jprint(array,0)); } if ( minconf == 0 ) minconf = 1; diff --git a/iguana/iguana_peers.c b/iguana/iguana_peers.c index e5f1e9f15..bedda833f 100755 --- a/iguana/iguana_peers.c +++ b/iguana/iguana_peers.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -13,6 +13,19 @@ * * ******************************************************************************/ + /** + * - we need to include WinSock2.h header to correctly use windows structure + * as the application is still using 32bit structure from mingw so, we need to + * add the include based on checking + * @author - fadedreamz@gmail.com + * @remarks - #if (defined(_M_X64) || defined(__amd64__)) && defined(WIN32) + * is equivalent to #if defined(_M_X64) as _M_X64 is defined for MSVC only + */ +#if defined(_M_X64) +#define WIN32_LEAN_AND_MEAN +#include +#endif + #include "iguana777.h" #define _iguana_hashfind(coin,ipbits) _iguana_hashset(coin,ipbits,-1) @@ -357,20 +370,70 @@ int32_t iguana_socket(int32_t bindflag,char *hostname,uint16_t port) struct sockaddr_in saddr; socklen_t addrlen,slen; addrlen = sizeof(saddr); struct hostent *hostent; + + /** + * gethostbyname() is deprecated and cause crash on x64 windows + * the solution is to implement similar functionality by using getaddrinfo() + * it is standard posix function and is correctly supported in win32/win64/linux + * @author - fadedreamz@gmail.com + */ +#if defined(_M_X64) + struct addrinfo *addrresult = NULL; + struct addrinfo *returnptr = NULL; + struct addrinfo hints; + struct sockaddr_in * sockaddr_ipv4; + int retVal; + int found = 0; + memset(&hints, 0, sizeof(hints)); + hints.ai_family = AF_INET; + hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = IPPROTO_TCP; +#endif + if ( parse_ipaddr(ipaddr,hostname) != 0 ) port = parse_ipaddr(ipaddr,hostname); + +#if defined(_M_X64) + retVal = getaddrinfo(ipaddr, NULL, &hints, &addrresult); + for (returnptr = addrresult; returnptr != NULL && found == 0; returnptr = returnptr->ai_next) { + switch (returnptr->ai_family) { + case AF_INET: + sockaddr_ipv4 = (struct sockaddr_in *) returnptr->ai_addr; + // we want to break from the loop after founding the first ipv4 address + found = 1; + break; + } + } + + // if we iterate through the loop and didn't find anything, + // that means we failed in the dns lookup + if (found == 0) { + printf("getaddrinfo(%s) returned error\n", hostname); + freeaddrinfo(addrresult); + return(-1); + } +#else hostent = gethostbyname(ipaddr); if ( hostent == NULL ) { printf("gethostbyname(%s) returned error: %d port.%d ipaddr.(%s)\n",hostname,errno,port,ipaddr); return(-1); } +#endif saddr.sin_family = AF_INET; saddr.sin_port = htons(port); //#ifdef WIN32 // saddr.sin_addr.s_addr = (uint32_t)calc_ipbits("127.0.0.1"); //#else + +#if defined(_M_X64) + saddr.sin_addr.s_addr = sockaddr_ipv4->sin_addr.s_addr; + // graceful cleanup + sockaddr_ipv4 = NULL; + freeaddrinfo(addrresult); +#else memcpy(&saddr.sin_addr.s_addr,hostent->h_addr_list[0],hostent->h_length); +#endif expand_ipbits(checkipaddr,saddr.sin_addr.s_addr); if ( strcmp(ipaddr,checkipaddr) != 0 ) printf("bindflag.%d iguana_socket mismatch (%s) -> (%s)?\n",bindflag,checkipaddr,ipaddr); @@ -1242,7 +1305,8 @@ void iguana_dedicatedloop(struct supernet_info *myinfo,struct iguana_info *coin, memset(&fds,0,sizeof(fds)); fds.fd = addr->usock; fds.events |= (POLLOUT | POLLIN); - if ( poll(&fds,1,timeout) > 0 && (fds.revents & POLLOUT) != 0 ) + + if ( poll(&fds,1,timeout) > 0 && (fds.revents & POLLOUT) != 0 ) { flag += iguana_pollsendQ(coin,addr); if ( addr->dead != 0 ) diff --git a/iguana/iguana_ramchain.c b/iguana/iguana_ramchain.c index 024da170e..7ed8867fc 100755 --- a/iguana/iguana_ramchain.c +++ b/iguana/iguana_ramchain.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -1326,7 +1326,16 @@ int32_t iguana_Xspendmap(struct iguana_info *coin,struct iguana_ramchain *ramcha sprintf(fname,"%s/%s%s/spends/%s.%d",GLOBAL_DBDIR,iter==0?"ro/":"",coin->symbol,bits256_str(str,bp->hashes[0]),bp->bundleheight); if ( (ptr= OS_mapfile(fname,&filesize,0)) != 0 ) { +#if defined(_M_X64) + /* + * calculate the address in a portable manner + * in all platform sizeof(char) / sizeof(uchar) == 1 + * @author - fadedreamz@gmail.com + */ + ramchain->Xspendinds = (void *)((unsigned char *)ptr + sizeof(sha256)); +#else ramchain->Xspendinds = (void *)((long)ptr + sizeof(sha256)); +#endif if ( bp->Xvalid == 0 ) vcalc_sha256(0,sha256.bytes,(void *)ramchain->Xspendinds,(int32_t)(filesize - sizeof(sha256))); ramchain->from_roX = (iter == 0); @@ -1399,7 +1408,17 @@ struct iguana_ramchain *_iguana_ramchain_map(struct supernet_info *myinfo,struct if ( ramchain->fileptr != 0 && ramchain->filesize > 0 ) { // verify hashes + + /* + * calculate the address in a portable manner + * in all platform sizeof(char) / sizeof(uchar) == 1 + * @author - fadedreamz@gmail.com + */ +#if defined(_M_X64) + ramchain->H.data = rdata = (void *)((unsigned char *)ramchain->fileptr + fpos); +#else ramchain->H.data = rdata = (void *)(long)((long)ramchain->fileptr + fpos); +#endif ramchain->H.ROflag = 1; ramchain->expanded = expanded; ramchain->numblocks = (bp == 0) ? 1 : bp->n; @@ -2421,7 +2440,17 @@ int32_t iguana_mapchaininit(char *fname,struct iguana_info *coin,struct iguana_r memset(mapchain,0,sizeof(*mapchain)); mapchain->fileptr = ptr; mapchain->filesize = filesize; + + /* + * calculate the address in a portable manner + * in all platform sizeof(char) / sizeof(uchar) == 1 + * @author - fadedreamz@gmail.com + */ +#if defined(_M_X64) + mapchain->H.data = (void *)((unsigned char *)ptr + block->fpos); +#else mapchain->H.data = (void *)(long)((long)ptr + block->fpos); +#endif mapchain->H.ROflag = 1; if ( ptr == 0 || block->fpos > filesize ) { diff --git a/iguana/iguana_realtime.c b/iguana/iguana_realtime.c index cc97c39c6..bedc4b911 100755 --- a/iguana/iguana_realtime.c +++ b/iguana/iguana_realtime.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -717,7 +717,7 @@ int32_t iguana_RTiterate(struct supernet_info *myinfo,struct iguana_info *coin,i if ( block->height > coin->maxRTheight ) { coin->maxRTheight = block->height; - printf("%s %.8f [%.8f %.8f] RTiterate.%lld %d tx.%d len.%d %s\n",coin->symbol,dstr(coin->histbalance)+dstr(coin->RTcredits)-dstr(coin->RTdebits),dstr(coin->RTcredits),dstr(coin->RTdebits),(long long)polarity,offset,coin->RTnumtx[offset],coin->RTrecvlens[offset],bits256_str(str,block->RO.hash2)); + printf("%s.%d %.8f [%.8f %.8f] RTiterate.%lld %d tx.%d len.%d %s\n",coin->symbol,block->height,dstr(coin->histbalance)+dstr(coin->RTcredits)-dstr(coin->RTdebits),dstr(coin->RTcredits),dstr(coin->RTdebits),(long long)polarity,offset,coin->RTnumtx[offset],coin->RTrecvlens[offset],bits256_str(str,block->RO.hash2)); } if ( coin->RTrawmem.ptr == 0 ) iguana_meminit(&coin->RTrawmem,"RTrawmem",0,IGUANA_MAXPACKETSIZE * 2,0); diff --git a/iguana/iguana_recv.c b/iguana/iguana_recv.c index 5c7224e5e..d64beb07f 100755 --- a/iguana/iguana_recv.c +++ b/iguana/iguana_recv.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -823,7 +823,7 @@ void iguana_gotblockM(struct supernet_info *myinfo,struct iguana_info *coin,stru block->bundlei = bundlei; block->height = bp->hdrsi*coin->chain->bundlesize + bundlei; block->txvalid = block->valid = 1; - block->RO.txn_count = origtxdata->zblock.RO.txn_count; + block->RO = origtxdata->zblock.RO; if ( block->fpipbits != 0 && block->fpos >= 0 ) { static int32_t numredundant; static double redundantsize; static uint32_t lastdisp; @@ -1291,31 +1291,33 @@ struct iguana_bundle *iguana_bundleset(struct supernet_info *myinfo,struct iguan iguana_bundlespeculate(coin,bp,bundlei,hash2,1); } prevbp = 0, prevbundlei = -2; - iguana_bundlefind(coin,&prevbp,&prevbundlei,prevhash2); - //if ( 0 && block->blockhashes != 0 ) - // fprintf(stderr,"has blockhashes bp.%p[%d] prevbp.%p[%d]\n",bp,bundlei,prevbp,prevbundlei); - if ( prevbp != 0 && prevbundlei >= 0 && (prevblock= iguana_blockfind("bundleset2",coin,prevhash2)) != 0 ) - { - if ( prevbundlei < coin->chain->bundlesize ) - { - if ( prevbp->hdrsi+1 == coin->bundlescount && prevbundlei == coin->chain->bundlesize-1 ) - { - printf("%s AUTOCREATE.%d\n",coin->symbol,prevbp->bundleheight + coin->chain->bundlesize); - if ( (bp= iguana_bundlecreate(coin,bundleip,prevbp->bundleheight + coin->chain->bundlesize,hash2,zero,0)) != 0 ) - { - if ( bp->queued == 0 ) - iguana_bundleQ(myinfo,coin,bp,1000); - } - } - if ( prevbundlei < coin->chain->bundlesize-1 ) - { - //printf("bundlehash2add next %d\n",prevbundlei); - iguana_bundlehash2add(coin,0,prevbp,prevbundlei+1,hash2); - } - if ( 1 && strcmp("BTC",coin->symbol) != 0 ) - iguana_bundlespeculate(coin,prevbp,prevbundlei,prevhash2,2); - } - } + if (bits256_nonz(prevhash2)) { + iguana_bundlefind(coin, &prevbp, &prevbundlei, prevhash2); + //if ( 0 && block->blockhashes != 0 ) + // fprintf(stderr,"has blockhashes bp.%p[%d] prevbp.%p[%d]\n",bp,bundlei,prevbp,prevbundlei); + if (prevbp != 0 && prevbundlei >= 0 && (prevblock = iguana_blockfind("bundleset2", coin, prevhash2)) != 0) + { + if (prevbundlei < coin->chain->bundlesize) + { + if (prevbp->hdrsi + 1 == coin->bundlescount && prevbundlei == coin->chain->bundlesize - 1) + { + printf("%s AUTOCREATE.%d\n", coin->symbol, prevbp->bundleheight + coin->chain->bundlesize); + if ((bp = iguana_bundlecreate(coin, bundleip, prevbp->bundleheight + coin->chain->bundlesize, hash2, zero, 0)) != 0) + { + if (bp->queued == 0) + iguana_bundleQ(myinfo, coin, bp, 1000); + } + } + if (prevbundlei < coin->chain->bundlesize - 1) + { + //printf("bundlehash2add next %d\n",prevbundlei); + iguana_bundlehash2add(coin, 0, prevbp, prevbundlei + 1, hash2); + } + if (1 && strcmp("BTC", coin->symbol) != 0) + iguana_bundlespeculate(coin, prevbp, prevbundlei, prevhash2, 2); + } + } + } } else printf("iguana_bundleset: error adding blockhash\n"); bp = 0, *bundleip = -2; return(iguana_bundlefind(coin,&bp,bundleip,hash2)); diff --git a/iguana/iguana_rpc.c b/iguana/iguana_rpc.c index bb7161f29..c36a6bce7 100755 --- a/iguana/iguana_rpc.c +++ b/iguana/iguana_rpc.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -18,20 +18,30 @@ #include "iguana777.h" //#include "SuperNET.h" -#define RPCARGS struct supernet_info *myinfo,uint16_t port,struct iguana_info *coin,cJSON *params[],int32_t n,cJSON *json,char *remoteaddr,cJSON *array -#define GLUEARGS cJSON *json,struct supernet_info *myinfo,uint16_t port,struct iguana_info *coin,char *remoteaddr,cJSON *params[] +#define RPCARGS struct supernet_info *myinfo,uint16_t port,struct iguana_info *coin,cJSON *params[],int32_t n,cJSON *json,char *remoteaddr,cJSON *array,char *userpass +#define GLUEARGS cJSON *json,struct supernet_info *myinfo,uint16_t port,struct iguana_info *coin,char *remoteaddr,cJSON *params[],char *userpass -#define CALLGLUE myinfo,port,coin,remoteaddr,params +#define CALLGLUE myinfo,port,coin,remoteaddr,params,userpass char *sglue(GLUEARGS,char *agent,char *method) { char *retstr,*rpcretstr,*walletstr,checkstr[65],dcheckstr[65]; cJSON *retjson,*tmpjson,*result,*error,*wallet; int32_t i,j,len; int64_t val; double dval; if ( json == 0 ) json = cJSON_CreateObject(); - //printf("sglue.(%s)\n",jprint(json,0)); +//printf("userpass.(%s)\n",userpass); jaddstr(json,"agent",agent); jaddstr(json,"method",method); jaddstr(json,"coin",coin->symbol); + if ( userpass != 0 ) + jaddstr(json,"userpass",userpass); + if ( coin != 0 && coin->FULLNODE >= 0 && coin->chain->userpass[0] != 0 ) + { + if ( userpass == 0 || strcmp(userpass,coin->chain->userpass) != 0 ) + { + printf("iguana authentication error {%s} (%s) != (%s)\n",jprint(json,0),userpass,coin->chain->userpass); + return(clonestr("{\"error\":\"authentication error\"}")); + } + } if ( myinfo->expiration != 0 && time(NULL) > myinfo->expiration ) iguana_walletlock(myinfo,0); if ( (retstr= SuperNET_JSON(myinfo,coin,json,remoteaddr,port)) != 0 ) @@ -42,7 +52,6 @@ char *sglue(GLUEARGS,char *agent,char *method) { if ( (wallet= iguana_walletjson(myinfo)) != 0 ) { - //printf("WALLETSTR.(%s)\n",jprint(wallet,0)); if ( (walletstr= SuperNET_login(myinfo,coin,json,remoteaddr,myinfo->handle,myinfo->secret,myinfo->permanentfile,0)) != 0 ) { free(walletstr); @@ -667,7 +676,7 @@ char *iguana_bitcoinrpc(struct supernet_info *myinfo,uint16_t port,struct iguana for (i=0; irpcsymbol[0] == 0 ) strcpy(myinfo->rpcsymbol,symbol); @@ -842,8 +852,8 @@ cJSON *SuperNET_urlconv(char *value,int32_t bufsize,char *urlstr) char *SuperNET_rpcparse(struct supernet_info *myinfo,char *retbuf,int32_t bufsize,int32_t *jsonflagp,int32_t *postflagp,char *urlstr,char *remoteaddr,char *filetype,uint16_t port) { - cJSON *tokens,*argjson,*origargjson,*json = 0; long filesize; struct iguana_info *coin = 0; - char symbol[64],buf[4096],*originstr,*fieldstr,urlmethod[16],*data,url[8192],furl[8192],*retstr,*filestr,*token = 0; int32_t i,j,n,iter,num=0; + cJSON *tokens,*argjson,*origargjson,*tmpjson=0,*json = 0; long filesize; struct iguana_info *coin = 0; + char symbol[64],buf[4096],*originstr,*fieldstr,*userpass=0,urlmethod[16],*data,url[8192],furl[8192],*retstr,*filestr,*token = 0; int32_t i,j,n,iter,num=0; //printf("rpcparse.(%s)\n",urlstr); if ( myinfo->remoteorigin == 0 ) { @@ -857,9 +867,11 @@ char *SuperNET_rpcparse(struct supernet_info *myinfo,char *retbuf,int32_t bufsiz originstr = &urlstr[i + strlen(fieldstr)]; if ( strncmp(originstr,"http://127.0.0.",strlen("http://127.0.0.")) == 0 ) originstr = "http://127.0.0.1:"; - if ( strncmp(originstr,"file://127.0.0.",strlen("file://127.0.0.")) == 0 ) + else if ( strncmp(originstr,"file://127.0.0.",strlen("file://127.0.0.")) == 0 ) + originstr = "http://127.0.0.1:"; + else if ( strncmp(originstr,"chrome-extension://",strlen("chrome-extension://")) == 0 ) originstr = "http://127.0.0.1:"; - if ( strncmp("null",originstr,strlen("null")) != 0 && strncmp("http://localhost:",originstr,strlen("http://localhost:")) != 0 && strncmp("http://127.0.0.1:",originstr,strlen("http://127.0.0.1:")) != 0 && strncmp("http://easydex.supernet.org",originstr,strlen("http://easydex.supernet.org")) != 0 ) + else if ( strncmp("null",originstr,strlen("null")) != 0 && strncmp("http://localhost:",originstr,strlen("http://localhost:")) != 0 && strncmp("http://127.0.0.1:",originstr,strlen("http://127.0.0.1:")) != 0 && strncmp("http://easydex.supernet.org",originstr,strlen("http://easydex.supernet.org")) != 0 ) { printf("remote %s REJECT.(%s)\n",fieldstr,urlstr); return(clonestr("{\"error\":\"remote origin not enabled\"}")); @@ -965,13 +977,14 @@ char *SuperNET_rpcparse(struct supernet_info *myinfo,char *retbuf,int32_t bufsiz jaddstr(argjson,"agent",jstri(tokens,0)); if ( num > 1 ) jaddstr(argjson,"method",jstri(tokens,1)); - //printf("urlstr.(%s)\n",urlstr+n); if ( (json= SuperNET_urlconv(retbuf,bufsize,urlstr+n)) != 0 ) { jadd(json,"tokens",tokens); jaddstr(json,"urlmethod",urlmethod); if ( (data= jstr(json,"POST")) == 0 || (argjson= cJSON_Parse(data)) == 0 ) { + userpass = jstr(argjson,"userpass"); + printf("userpass.(%s)\n",userpass); if ( (n= cJSON_GetArraySize(tokens)) > 0 ) { if ( n > 1 ) @@ -1064,6 +1077,8 @@ char *SuperNET_rpcparse(struct supernet_info *myinfo,char *retbuf,int32_t bufsiz for (i=0; i N || N > 3 ) return(clonestr("{\"error\":\"illegal M or N\"}")); memset(&V,0,sizeof(V)); - txobj = bitcoin_txcreate(active->chain->isPoS,0,coin->chain->normal_txversion,0); + txobj = bitcoin_txcreate(active->symbol,active->chain->isPoS,0,coin->chain->normal_txversion,0); if ( destaddress[0] != 0 && destamount > 0. ) bitcoin_txaddspend(active,txobj,destaddress,destamount * SATOSHIDEN); if ( destaddress2[0] != 0 && destamount2 > 0. ) diff --git a/iguana/iguana_spendvectors.c b/iguana/iguana_spendvectors.c index 0667d429e..e1d9a9479 100755 --- a/iguana/iguana_spendvectors.c +++ b/iguana/iguana_spendvectors.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * diff --git a/iguana/iguana_tradebots.c b/iguana/iguana_tradebots.c index f6755e71d..8134c9125 100755 --- a/iguana/iguana_tradebots.c +++ b/iguana/iguana_tradebots.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * diff --git a/iguana/iguana_tx.c b/iguana/iguana_tx.c index 3bfc95324..36972a0c6 100755 --- a/iguana/iguana_tx.c +++ b/iguana/iguana_tx.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -15,14 +15,28 @@ #include "iguana777.h" -int32_t iguana_scriptdata(struct iguana_info *coin,uint8_t *scriptspace,long fileptr[2],char *fname,uint64_t scriptpos,int32_t scriptlen) +#if defined(_M_X64) + /* + * because we have no choice but to pass the value as parameters + * we need 64bit to hold 64bit memory address, thus changing + * to uint64_t instead of long in win x64 + * @author - fadedreamz@gmail.com + */ +int32_t iguana_scriptdata(struct iguana_info *coin,uint8_t *scriptspace,uint64_t fileptr[2],char *fname,uint64_t scriptpos,int32_t scriptlen) +#else +int32_t iguana_scriptdata(struct iguana_info *coin, uint8_t *scriptspace, long fileptr[2], char *fname, uint64_t scriptpos, int32_t scriptlen) +#endif { FILE *fp; long err; int32_t retval = scriptlen; #ifndef __PNACL__ if ( scriptpos < 0xffffffff ) { if ( fileptr[0] == 0 ) - fileptr[0] = (long)OS_mapfile(fname,&fileptr[1],0); +#if defined(_M_X64) + fileptr[0] = (uint64_t)OS_mapfile(fname,&fileptr[1],0); +#else + fileptr[0] = (long)OS_mapfile(fname, &fileptr[1], 0); +#endif if ( fileptr[0] != 0 ) { if ( (scriptpos + scriptlen) <= fileptr[1] ) @@ -249,7 +263,17 @@ int32_t iguana_ramtxbytes(struct iguana_info *coin,uint8_t *serialized,int32_t m int32_t iguana_peerblockrequest(struct supernet_info *myinfo,struct iguana_info *coin,uint8_t *blockspace,int32_t max,struct iguana_peer *addr,bits256 hash2,int32_t validatesigs) { +#if defined(_M_X64) + /* + * because we have no choice but to access the memory address + * we need 64bit to correctly hold 64bit memory address, thus changing + * to uint64_t instead of long in win x64 + * @author - fadedreamz@gmail.com + */ + struct iguana_txid *tx, T; bits256 checktxid; int32_t i, len, total, bundlei = -2; struct iguana_block *block; struct iguana_msgzblock zmsgB; bits256 *tree, checkhash2, merkle_root; struct iguana_bundle *bp = 0; uint64_t tmp; char str[65]; struct iguana_ramchaindata *rdata; +#else struct iguana_txid *tx,T; bits256 checktxid; int32_t i,len,total,bundlei=-2; struct iguana_block *block; struct iguana_msgzblock zmsgB; bits256 *tree,checkhash2,merkle_root; struct iguana_bundle *bp=0; long tmp; char str[65]; struct iguana_ramchaindata *rdata; +#endif if ( (bp= iguana_bundlefind(coin,&bp,&bundlei,hash2)) != 0 && bundlei >= 0 && bundlei < bp->n ) { if ( (rdata= bp->ramchain.H.data) == 0 )//&& bp == coin->current ) @@ -298,7 +322,17 @@ int32_t iguana_peerblockrequest(struct supernet_info *myinfo,struct iguana_info } if ( i == block->RO.txn_count ) { +#if defined(_M_X64) + /* + * because we have no choice but to access the memory address + * we need 64bit to correctly hold 64bit memory address, thus changing + * to uint64_t instead of long in win x64 + * @author - fadedreamz@gmail.com + */ + tmp = (uint64_t)&blockspace[sizeof(struct iguana_msghdr) + total + sizeof(bits256)]; +#else tmp = (long)&blockspace[sizeof(struct iguana_msghdr) + total + sizeof(bits256)]; +#endif tmp &= ~(sizeof(bits256) - 1); tree = (void *)tmp; for (i=0; iRO.txn_count; i++) diff --git a/iguana/iguana_txidfind.c b/iguana/iguana_txidfind.c index d8cec460f..6db6d03ed 100755 --- a/iguana/iguana_txidfind.c +++ b/iguana/iguana_txidfind.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -193,7 +193,17 @@ uint32_t iguana_sparseadd(uint8_t *bits,uint32_t ind,int32_t width,uint32_t tabl // ramchain->sparsemax = i; return(setind); } + // fadedreamz@gmail.com +#if defined(_M_X64) + /* + * calculate the address in a portable manner + * in all platform sizeof(char) / sizeof(uchar) == 1 + * @author - fadedreamz@gmail.com + */ + else if (x < maxitems && memcmp((void *)((unsigned char *)refdata + x*refsize), key, keylen) == 0) +#else else if ( x < maxitems && memcmp((void *)(long)((long)refdata + x*refsize),key,keylen) == 0 ) +#endif { if ( setind == 0 ) ramchain->sparsehits++; diff --git a/iguana/iguana_unspents.c b/iguana/iguana_unspents.c index fcbe8b8b6..5e53c357d 100755 --- a/iguana/iguana_unspents.c +++ b/iguana/iguana_unspents.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -585,6 +585,7 @@ int64_t iguana_RTpkhashbalance(struct supernet_info *myinfo,struct iguana_info * return(deposits - spent); } +// jl777: todo support notarychain iterate listunspent int32_t iguana_RTpkhasharray(struct supernet_info *myinfo,struct iguana_info *coin,cJSON *array,int32_t minconf,int32_t maxconf,uint64_t *totalp,struct iguana_pkhash *P,int32_t max,uint8_t rmd160[20],char *coinaddr,uint8_t *pubkey33,int32_t lastheight,struct iguana_outpoint *unspents,int32_t *numunspentsp,int32_t maxunspents,char *remoteaddr,int32_t includespent) { int32_t i,n,m,numunspents; uint64_t spent,deposits,netbalance,total; struct iguana_outpoint lastpt; struct iguana_pkhash *p,_p; struct iguana_ramchain *ramchain; struct iguana_bundle *bp; @@ -1071,7 +1072,7 @@ int32_t iguana_unspentfindjson(cJSON *destarray,cJSON *item) cJSON *iguana_RTlistunspent(struct supernet_info *myinfo,struct iguana_info *coin,cJSON *argarray,int32_t minconf,int32_t maxconf,char *remoteaddr,int32_t includespends) { uint64_t total = 0; int32_t i,j,m,n,numrmds,numunspents=0; char *coinaddr,*retstr; uint8_t *rmdarray; cJSON *vals,*unspents,*item,*array,*retjson,*retarray; bits256 hash; - if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 ) + if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 || coin->notarychain >= 0 ) { retjson = cJSON_CreateArray(); rmdarray = iguana_rmdarray(myinfo,coin,&numrmds,argarray,0); @@ -1168,7 +1169,7 @@ int32_t iguana_RTunspentslists(struct supernet_info *myinfo,struct iguana_info * } memset(pubkey,0,sizeof(pubkey)); //remains = required * 1.1 + coin->txfee; - if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 ) + if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 || (coin->FULLNODE == 0 && coin->notarychain >= 0) ) { for (i=numunspents=0; iutxoaddrfileptr+sizeof(uint64_t)),sizeof(last)); memcpy(&coin->utxoaddrind,(void *)((long)coin->utxoaddrfileptr+sizeof(uint64_t)+sizeof(uint32_t)),sizeof(coin->utxoaddrind)); memcpy(&coin->utxoaddrhash.bytes,(void *)((long)coin->utxoaddrfileptr+sizeof(uint64_t)+2*sizeof(uint32_t)),sizeof(coin->utxoaddrhash)); +#if defined(_M_X64) + coin->utxoaddroffsets = (void *)((unsigned char *)coin->utxoaddrfileptr + sizeof(uint64_t) + 2 * sizeof(uint32_t) + sizeof(bits256)); +#else coin->utxoaddroffsets = (void *)((long)coin->utxoaddrfileptr + sizeof(uint64_t) + 2*sizeof(uint32_t) + sizeof(bits256)); +#endif for (ind=total=count=0; ind<0x10000; ind++) { if ( (offset= coin->utxoaddroffsets[ind]) != 0 ) diff --git a/iguana/iguana_volatiles.c b/iguana/iguana_volatiles.c index 5ea221167..8bf4923f1 100755 --- a/iguana/iguana_volatiles.c +++ b/iguana/iguana_volatiles.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * diff --git a/iguana/iguana_wallet.c b/iguana/iguana_wallet.c index b55e3e4fa..9eb8e558b 100755 --- a/iguana/iguana_wallet.c +++ b/iguana/iguana_wallet.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -1098,9 +1098,18 @@ double _max100(double val) cJSON *iguana_getinfo(struct supernet_info *myinfo,struct iguana_info *coin) { - int32_t i; struct iguana_peer *addr; cJSON *array,*retjson = cJSON_CreateObject(); + int32_t i; char *retstr; struct iguana_peer *addr; cJSON *array,*retjson = cJSON_CreateObject(); if ( coin != 0 ) { + if ( coin->notarychain >= 0 ) + { + if ( (retstr= _dex_getinfo(myinfo,coin->symbol)) != 0 ) + { + retjson = cJSON_Parse(retstr); + free(retstr); + return(retjson); + } else return(cJSON_Parse("{\"error\":\"null return\"}")); + } jaddstr(retjson,"result","success"); jaddnum(retjson,"protocolversion",PROTOCOL_VERSION); jaddnum(retjson,"kbfee",dstr(coin->txfee_perkb)); @@ -1146,7 +1155,7 @@ ZERO_ARGS(bitcoinrpc,getinfo) struct basilisk_item Lptr,*ptr; int32_t incr,i,j,m,n,longest; cJSON *valsobj,*getinfoobj=0,*array,*item,*fullnodes; if ( remoteaddr != 0 ) return(clonestr("{\"error\":\"no remote\"}")); - if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 ) + if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 || coin->notarychain >= 0 ) return(jprint(iguana_getinfo(myinfo,coin),1)); else { @@ -1358,7 +1367,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; + char *retstr,buf[128],wifstr[128],*dexstr; cJSON *retjson,*dexjson; int32_t need_KMD = 0,need_BTC = 0; if ( remoteaddr != 0 || coin == 0 ) return(clonestr("{\"error\":\"no remote encrypt or no coin\"}")); iguana_walletlock(myinfo,coin); @@ -1405,6 +1414,12 @@ THREE_STRINGS(bitcoinrpc,encryptwallet,passphrase,password,permanentfile) bitcoin_priv2wif(wifstr,waddr.privkey,128); jaddstr(retjson,"BTCwif",wifstr); } + if ( (dexstr= _dex_importaddress(myinfo,coin->symbol,waddr.coinaddr)) != 0 ) + { + if ( (dexjson= cJSON_Parse(dexstr)) != 0 ) + jadd(retjson,"deximport",dexjson); + free(dexstr); + } retstr = jprint(retjson,1); } //iguana_walletinitcheck(myinfo,coin); @@ -1496,12 +1511,10 @@ TWOSTRINGS_AND_INT(bitcoinrpc,importprivkey,wif,account,rescan) { free(retstr); retstr = myinfo->decryptstr, myinfo->decryptstr = 0; - //printf("DECRYPT.(%s)\n",retstr); iguana_waddresscalc(myinfo,coin->chain->pubtype,coin->chain->wiftype,waddr,privkey); iguana_waccountswitch(myinfo,coin,account,waddr->coinaddr,0); waddr->privkey = privkey; retjson = iguana_walletadd(myinfo,0,coin,retstr,account,waddr,0,0); - //printf("AFTERADD.(%s)\n",jprint(retjson,0)); if ( retstr != 0 ) scrubfree(retstr); return(jprint(retjson,1)); diff --git a/iguana/m_LP b/iguana/m_LP index fdd45659b..d09ee9373 100755 --- a/iguana/m_LP +++ b/iguana/m_LP @@ -4,6 +4,6 @@ rm -f ../agents/iguana *.o git pull cd secp256k1; ./m_unix; cd .. cd ../crypto777; ./m_LP; cd ../iguana -gcc -g -fno-aggressive-loop-optimizations -Wno-deprecated -c -O2 -DLIQUIDITY_PROVIDER=1 *.c ../basilisk/basilisk.c ../gecko/gecko.c ../datachain/datachain.c -gcc -g -fno-aggressive-loop-optimizations -Wno-deprecated -c -DLIQUIDITY_PROVIDER=1 main.c iguana777.c iguana_bundles.c ../basilisk/basilisk.c -gcc -g -o ../agents/iguana *.o ../agents/libcrypto777.a -lnanomsg -lcurl -lssl -lcrypto -lpthread -lz -lm +clang -g -Wno-deprecated -c -O2 -DLIQUIDITY_PROVIDER=1 *.c ../basilisk/basilisk.c ../gecko/gecko.c ../datachain/datachain.c +clang -g -Wno-deprecated -c -DLIQUIDITY_PROVIDER=1 main.c iguana777.c iguana_bundles.c ../basilisk/basilisk.c +clang -g -o ../agents/iguana *.o ../agents/libcrypto777.a /usr/local/lib/libnanomsg.so -lcurl -lssl -lcrypto -lpthread -lz -lm diff --git a/iguana/m_LP_StaticNanoMsg b/iguana/m_LP_StaticNanoMsg new file mode 100755 index 000000000..b88e05e45 --- /dev/null +++ b/iguana/m_LP_StaticNanoMsg @@ -0,0 +1,12 @@ +#!/bin/bash +#./configure --enable-endomorphism --enable-module-ecdh --enable-module-schnorr --enable-module-rangeproof --enable-experimental --enable-module_recovery +rm -f ../agents/iguana *.o +git pull +cd secp256k1; ./m_unix; cd .. +cd ../crypto777; make -f m_LP_StaticNanoMsg all; make -f m_LP_StaticNanoMsg clean; cd ../iguana + +clang -g -Wno-deprecated -c -O2 -DLIQUIDITY_PROVIDER=1 -DUSE_STATIC_NANOMSG *.c ../basilisk/basilisk.c ../gecko/gecko.c ../datachain/datachain.c +clang -g -Wno-deprecated -c -DLIQUIDITY_PROVIDER=1 -DUSE_STATIC_NANOMSG main.c iguana777.c iguana_bundles.c ../basilisk/basilisk.c + + +clang -g -o ../agents/iguana *.o ../agents/libcrypto777.a ../OSlibs/linux/$(uname -m)/libnanomsg-static.a -lcurl -lssl -lcrypto -lpthread -lz -lm -lanl -lrt -lnsl diff --git a/iguana/m_notary b/iguana/m_notary index dd0794507..34ee8b878 100755 --- a/iguana/m_notary +++ b/iguana/m_notary @@ -4,9 +4,11 @@ rm -f ../agents/iguana *.o git pull cd secp256k1; ./m_unix; cd .. cd ../crypto777; ./m_LP; cd ../iguana -gcc -g -fno-aggressive-loop-optimizations -Wno-deprecated -c -O2 -DISNOTARYNODE=1 -DLIQUIDITY_PROVIDER=1 *.c ../basilisk/basilisk.c ../gecko/gecko.c ../datachain/datachain.c -gcc -g -fno-aggressive-loop-optimizations -Wno-deprecated -c -DISNOTARYNODE=1 -DLIQUIDITY_PROVIDER=1 main.c iguana777.c iguana_bundles.c ../basilisk/basilisk.c -gcc -g -o ../agents/iguana *.o ../agents/libcrypto777.a -lnanomsg -lcurl -lssl -lcrypto -lpthread -lz -lm +#gcc -g -fno-aggressive-loop-optimizations -Wno-deprecated -c -O2 -DISNOTARYNODE=1 -DLIQUIDITY_PROVIDER=1 *.c ../basilisk/basilisk.c ../gecko/gecko.c ../datachain/datachain.c +clang -g -Wno-deprecated -c -O2 -DISNOTARYNODE=1 -DLIQUIDITY_PROVIDER=1 *.c ../basilisk/basilisk.c ../gecko/gecko.c ../datachain/datachain.c +#gcc -g -fno-aggressive-loop-optimizations -Wno-deprecated -c -DISNOTARYNODE=1 -DLIQUIDITY_PROVIDER=1 main.c iguana777.c iguana_bundles.c ../basilisk/basilisk.c +clang -g -Wno-deprecated -c -DISNOTARYNODE=1 -DLIQUIDITY_PROVIDER=1 main.c iguana777.c iguana_bundles.c ../basilisk/basilisk.c +clang -g -o ../agents/iguana *.o ../agents/libcrypto777.a -lnanomsg -lcurl -lssl -lcrypto -lpthread -lz -lm ../agents/iguana notary & #> iguana.log 2> error.log & @@ -32,6 +34,8 @@ coins/jumblr_7776 coins/crypto_7776 coins/pangea_7776 coins/mgw_7776 +coins/mvp_7776 +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"passthru\",\"method\":\"paxfiats\",\"timeout\":900000}" #curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"$myip\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"KMD\",\"pubkey\":\"$pubkey\"}" diff --git a/iguana/main.c b/iguana/main.c index 43d8cfd50..0dfeabc7e 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -326,8 +326,8 @@ char *SuperNET_processJSON(struct supernet_info *myinfo,struct iguana_info *coin char *SuperNET_JSON(struct supernet_info *myinfo,struct iguana_info *coin,cJSON *json,char *remoteaddr,uint16_t port) { - int32_t autologin = 0; uint32_t timestamp; char *retstr=0,*agent=0,*method=0,*jsonstr=0; uint64_t tag; - //printf("SuperNET_JSON.(%s)\n",jprint(json,0)); + int32_t autologin = 0; uint32_t timestamp; char *retstr=0,*agent=0,*method=0,*userpass; uint64_t tag; +//printf("SuperNET_JSON.(%s)\n",jprint(json,0)); if ( remoteaddr != 0 && strcmp(remoteaddr,"127.0.0.1") == 0 ) remoteaddr = 0; if ( (agent = jstr(json,"agent")) == 0 ) @@ -351,10 +351,16 @@ char *SuperNET_JSON(struct supernet_info *myinfo,struct iguana_info *coin,cJSON OS_randombytes((uint8_t *)&tag,sizeof(tag)); jadd64bits(json,"tag",tag); } + if ( coin != 0 && coin->FULLNODE >= 0 && coin->chain->userpass[0] != 0 ) + { + if ( (userpass= jstr(json,"userpass")) == 0 || strcmp(userpass,coin->chain->userpass) != 0 ) + { + printf("iguana authentication error {%s} (%s) != (%s)\n",jprint(json,0),userpass,coin->chain->userpass); + return(clonestr("{\"error\":\"authentication error\"}")); + } + } if ( (retstr= SuperNET_processJSON(myinfo,coin,json,remoteaddr,port)) == 0 ) printf("null retstr from SuperNET_JSON\n"); - if ( jsonstr != 0 ) - free(jsonstr); if ( autologin != 0 ) SuperNET_logout(myinfo,0,json,remoteaddr); return(retstr); @@ -670,6 +676,9 @@ void iguana_ensuredirs() sprintf(dirname,"%s/ECB",GLOBAL_DBDIR), OS_ensure_directory(dirname); sprintf(dirname,"%s/BTC",GLOBAL_VALIDATEDIR), OS_ensure_directory(dirname); sprintf(dirname,"%s/BTCD",GLOBAL_VALIDATEDIR), OS_ensure_directory(dirname); + sprintf(dirname,"SVM"), OS_ensure_directory(dirname); + sprintf(dirname,"SVM/rawfeatures"), OS_ensure_directory(dirname); + sprintf(dirname,"SVM/models"), OS_ensure_directory(dirname); } void iguana_Qinit() @@ -1552,10 +1561,8 @@ FOUR_STRINGS(SuperNET,login,handle,password,permanentfile,passphrase) if ( (str= SuperNET_encryptjson(myinfo,coin,argjson,remoteaddr,password,myinfo->permanentfile,myinfo->decryptstr == 0 ? "" : myinfo->decryptstr)) != 0 ) free(str); myinfo->expiration = (uint32_t)(time(NULL) + 3600); - printf("(%s) logged into (%s) %s %s\n",password,myinfo->myaddr.NXTADDR,myinfo->myaddr.BTC,myinfo->myaddr.BTCD); return(SuperNET_activehandle(IGUANA_CALLARGS)); } else return(clonestr("{\"error\":\"need passphrase\"}")); - printf("(%s) logged into (%s) %s %s\n",password,myinfo->myaddr.NXTADDR,myinfo->myaddr.BTC,myinfo->myaddr.BTCD); return(SuperNET_activehandle(IGUANA_CALLARGS)); } @@ -1587,6 +1594,7 @@ void iguana_main(void *arg) libgfshare_init(myinfo,myinfo->logs,myinfo->exps); myinfo->rpcport = IGUANA_RPCPORT; myinfo->dpowsock = myinfo->dexsock = myinfo->pubsock = myinfo->subsock = myinfo->reqsock = myinfo->repsock = -1; + dex_init(myinfo); if ( arg != 0 ) { if ( strcmp((char *)arg,"OStests") == 0 ) @@ -1595,7 +1603,6 @@ void iguana_main(void *arg) { myinfo->rpcport = IGUANA_NOTARYPORT; myinfo->IAMNOTARY = 1; - dex_init(myinfo); } } #ifdef IGUANA_OSTESTS @@ -1611,21 +1618,23 @@ void iguana_main(void *arg) strcpy(myinfo->rpcsymbol,"BTCD"); iguana_urlinit(myinfo,ismainnet,usessl); portable_mutex_init(&myinfo->dpowmutex); - if ( myinfo->IAMNOTARY == 0 ) - { + portable_mutex_init(&myinfo->notarymutex); #if LIQUIDITY_PROVIDER - myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("bitcoin"),0); - myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("poloniex"),0); - myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("bittrex"),0); - myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("btc38"),0); - myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("huobi"),0); - myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("coinbase"),0); - myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("lakebtc"),0); - myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("quadriga"),0); - myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("okcoin"),0); - myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("btce"),0); - myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("bitstamp"),0); + myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("nxtae"),0); + myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("bitcoin"),0); + myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("poloniex"),0); + myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("bittrex"),0); + myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("btc38"),0); + myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("huobi"),0); + myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("coinbase"),0); + myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("lakebtc"),0); + myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("quadriga"),0); + // prices reversed? myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("okcoin"),0); + myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("btce"),0); + myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("bitstamp"),0); #endif + if ( myinfo->IAMNOTARY == 0 ) + { if ( iguana_commandline(myinfo,arg) == 0 ) { iguana_helpinit(myinfo); @@ -1652,25 +1661,6 @@ void iguana_main(void *arg) } } else printf("couldnt parse.(%s)\n",jsonstr); } - if ( 0 ) - { - int32_t komodo_notaries(char *symbol,uint8_t pubkeys[64][33],int32_t height); - char CURRENCIES[][8] = { "USD", "EUR", "JPY", "GBP", "AUD", "CAD", "CHF", "NZD", // major currencies - "CNY", "RUB", "MXN", "BRL", "INR", "HKD", "TRY", "ZAR", "PLN", "NOK", "SEK", "DKK", "CZK", "HUF", "ILS", "KRW", "MYR", "PHP", "RON", "SGD", "THB", "BGN", "IDR", "HRK", - "REVS" }; - uint8_t pubkeys[64][33]; char coinaddr[64]; int32_t i,j; double val = 0.01; - //n = komodo_notaries("KMD",pubkeys,0); -#include "notaries.h" - for (i=0; i<=32; i++) - { - for (j=0; joffset)) +#else #define RAMCHAIN_PTR(rdata,offset) ((void *)(long)((long)(rdata) + (long)(rdata)->offset)) +#endif + struct iguana_ramchaindata { bits256 sha256; @@ -454,6 +464,8 @@ struct iguana_RTtxid struct iguana_RTspend *spends[]; }; +struct hashstr_item { UT_hash_handle hh; char address[40]; }; + struct iguana_info { UT_hash_handle hh; @@ -461,7 +473,17 @@ struct iguana_info struct iguana_peers *peers; struct iguana_peer internaladdr; //basilisk_func basilisk_rawtx,basilisk_balances,basilisk_value; //basilisk_metricfunc basilisk_rawtxmetric,basilisk_balancesmetric,basilisk_valuemetric; +#if defined(_M_X64) + /* + * because we have no choice but to pass the value as parameters + * we need 64bit to hold 64bit memory address, thus changing + * to uint64_t instead of long in win x64 + * @author - fadedreamz@gmail.com + */ + uint64_t vinptrs[IGUANA_MAXPEERS + 1][2], voutptrs[IGUANA_MAXPEERS + 1][2]; +#else long vinptrs[IGUANA_MAXPEERS+1][2],voutptrs[IGUANA_MAXPEERS+1][2]; +#endif uint32_t fastfind; FILE *fastfps[0x100]; uint8_t *fast[0x100]; int32_t *fasttables[0x100]; long fastsizes[0x100]; uint64_t instance_nonce,myservices,totalsize,totalrecv,totalpackets,sleeptime; int64_t mining,totalfees,TMPallocated,MAXRECVCACHE,MAXMEM,PREFETCHLAG,estsize,activebundles; @@ -497,6 +519,7 @@ struct iguana_info char lastdispstr[2048]; double txidfind_totalmillis,txidfind_num,spendtxid_totalmillis,spendtxid_num; struct iguana_monitorinfo monitoring[256]; + int32_t notarychain,didaddresses; struct datachain_info dPoW; struct iguana_zblock newblock; char *newblockstr; int32_t relay_RTheights[BASILISK_MAXRELAYS]; @@ -512,6 +535,7 @@ struct iguana_info uint32_t lastbesthashtime; bits256 lastbesthash; int32_t lastbestheight; struct iguana_block *RTblocks[65536]; uint8_t *RTrawdata[65536]; int32_t RTrecvlens[65536],RTnumtx[65536]; struct iguana_RTtxid *RTdataset; struct iguana_RTaddr *RTaddrs; + struct hashstr_item *alladdresses; }; struct vin_signer { bits256 privkey; char coinaddr[64]; uint8_t siglen,sig[80],rmd160[20],pubkey[66]; }; diff --git a/includes/iguana_types.h b/includes/iguana_types.h index 7b953cea1..4a1b4647e 100755 --- a/includes/iguana_types.h +++ b/includes/iguana_types.h @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2016 The SuperNET Developers. * + * Copyright © 2014-2017 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright *