diff --git a/basilisk/basilisk.c b/basilisk/basilisk.c index 4f3260190..62cc3e8d1 100755 --- a/basilisk/basilisk.c +++ b/basilisk/basilisk.c @@ -15,8 +15,9 @@ #include "../iguana/iguana777.h" -typedef char *basilisk_remotefunc(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_peer *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen); -extern basilisk_remotefunc _basilisk_rawtx,_basilisk_balances,_basilisk_value,_basilisk_result; +typedef char *basilisk_coinfunc(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_peer *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen); +typedef char *basilisk_servicefunc(struct supernet_info *myinfo,char *CMD,struct iguana_peer *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 pubkey); +typedef struct basilisk_item *basilisk_requestfunc(struct basilisk_item *Lptr,struct supernet_info *myinfo,bits256 pubkey,cJSON *valsobj,uint8_t *data,int32_t datalen); char *basilisk_finish(struct basilisk_item *ptr,int32_t besti,char *errstr) { @@ -40,7 +41,7 @@ char *basilisk_finish(struct basilisk_item *ptr,int32_t besti,char *errstr) return(retstr); } -struct basilisk_item *basilisk_itemcreate(struct supernet_info *myinfo,char *symbol,uint32_t basilisktag,int32_t minresults,cJSON *vals,int32_t timeoutmillis,void *metricfunc) +struct basilisk_item *basilisk_itemcreate(struct supernet_info *myinfo,char *CMD,char *symbol,uint32_t basilisktag,int32_t minresults,cJSON *vals,int32_t timeoutmillis,void *metricfunc) { struct basilisk_item *ptr; ptr = calloc(1,sizeof(*ptr)); @@ -49,67 +50,15 @@ struct basilisk_item *basilisk_itemcreate(struct supernet_info *myinfo,char *sym ptr->numrequired = 1; if ( (ptr->metricfunc= metricfunc) != 0 ) ptr->vals = jduplicate(vals); + strcpy(ptr->CMD,CMD); safecopy(ptr->symbol,symbol,sizeof(ptr->symbol)); ptr->expiration = OS_milliseconds() + timeoutmillis; - queue_enqueue("submitQ",&myinfo->basilisks.submitQ,&ptr->DL,0); return(ptr); } -void basilisk_msgprocess(struct supernet_info *myinfo,struct iguana_peer *addr,uint32_t senderipbits,char *type,uint32_t basilisktag,uint8_t *data,int32_t datalen) -{ - cJSON *valsobj; char *retstr=0,remoteaddr[64]; int32_t i,jsonlen; struct iguana_info *coin=0; - static basilisk_remotefunc *basilisk_services[][2] = - { - { (void *)"RAW", &_basilisk_rawtx }, - { (void *)"VAL", &_basilisk_value }, - { (void *)"BAL", &_basilisk_balances }, - }; - printf("MSGPROCESS.(%s)\n",(char *)data); - if ( (valsobj= cJSON_Parse((char *)data)) != 0 ) - { - jsonlen = (int32_t)strlen((char *)data) + 1; - if ( datalen > jsonlen ) - data += jsonlen, datalen -= jsonlen; - else data = 0, datalen = 0; - if ( jobj(valsobj,"coin") != 0 ) - coin = iguana_coinfind(jstr(valsobj,"coin")); - printf("coin.%p ipbits.%x\n",coin,senderipbits); - if ( coin != 0 ) - { - if ( senderipbits != 0 ) - expand_ipbits(remoteaddr,senderipbits); - else remoteaddr[0] = 0; - if ( coin->RELAYNODE != 0 || coin->VALIDATENODE != 0 ) // iguana node - { - for (i=0; i BASILISK_MAXFANOUT ) @@ -128,7 +77,17 @@ int32_t basilisk_sendcmd(struct supernet_info *myinfo,char *destipaddr,char *typ else if ( strcmp(destipaddr,"127.0.0.1") == 0 ) { printf("return after locally basilisk_msgprocess\n"); - basilisk_msgprocess(myinfo,0,0,type,basilisktag,data,datalen); + pubkey = GENESIS_PUBKEY; + if ( datalen > 0 ) + { + if ( (havepubkey= *data) != 0 ) + { + for (i=0; i<32; i++) + pubkey.bytes[i] = data[i + 1]; + } + } + offset = (int32_t)(havepubkey * (1 + sizeof(bits256))); + basilisk_msgprocess(myinfo,0,0,type,basilisktag,data+offset,datalen-offset,pubkey); return(0); } } @@ -142,6 +101,9 @@ int32_t basilisk_sendcmd(struct supernet_info *myinfo,char *destipaddr,char *typ j = (r2 + k) % IGUANA_MAXCOINS; if ( (coin= Coins[j]) == 0 ) continue; + if ( coin->RELAYNODE == 0 && coin->VALIDATENODE == 0 ) + cmd[0] = 's'; + else cmd[0] = 'S'; for (l=0; l= datalen ) n++; } - if ( destipaddr != 0 || n >= fanout ) + if ( destipaddr != 0 || (fanout > 0 && n >= fanout) ) return(val); else if ( val > retval ) retval = val; @@ -182,10 +144,11 @@ int32_t basilisk_sendcmd(struct supernet_info *myinfo,char *destipaddr,char *typ void basilisk_p2p(void *_myinfo,void *_addr,int32_t *delaymillisp,char *senderip,uint8_t *data,int32_t datalen,char *type,int32_t encrypted) { - uint32_t ipbits,basilisktag; int32_t msglen,len=0; void *ptr = 0; uint8_t space[8192]; bits256 senderpub; struct supernet_info *myinfo = _myinfo; - printf("basilisk_p2p.(%s) from %s\n",type,senderip!=0?senderip:"?"); + uint32_t ipbits,basilisktag; int32_t i,havepubkey,msglen,len=0; void *ptr = 0; uint8_t space[8192]; bits256 senderpub,pubkey; struct supernet_info *myinfo = _myinfo; + pubkey = GENESIS_PUBKEY; if ( encrypted != 0 ) { + printf("encrypted basilisk_p2p.(%s) from %s\n",type,senderip!=0?senderip:"?"); memset(senderpub.bytes,0,sizeof(senderpub)); if ( (data= SuperNET_deciphercalc(&ptr,&msglen,myinfo->privkey,senderpub,data,datalen,space,sizeof(space))) == 0 ) { @@ -197,27 +160,71 @@ void basilisk_p2p(void *_myinfo,void *_addr,int32_t *delaymillisp,char *senderip ipbits = (uint32_t)calc_ipbits(senderip); else ipbits = 0; len += iguana_rwnum(0,&data[len],sizeof(basilisktag),&basilisktag); - basilisk_msgprocess(myinfo,_addr,ipbits,type,basilisktag,&data[len],datalen - len); + if ( datalen > len && (havepubkey= data[len]) != 0 ) + { + for (i=0; i<32; i++) + pubkey.bytes[i] = data[len + i + 1]; + } + if ( bits256_nonz(pubkey) == 0 ) + pubkey = GENESIS_PUBKEY; + basilisk_msgprocess(myinfo,_addr,ipbits,type,basilisktag,&data[len],datalen - len,pubkey); if ( ptr != 0 ) free(ptr); } -#include "basilisk_bitcoin.c" -#include "basilisk_nxt.c" -#include "basilisk_ether.c" -#include "basilisk_waves.c" -#include "basilisk_lisk.c" +uint8_t *basilisk_jsondata(void **ptrp,uint8_t *space,int32_t spacesize,int32_t *datalenp,char *symbol,cJSON *sendjson,uint32_t basilisktag) +{ + char *sendstr,*hexstr; uint8_t *data; bits256 pubkey; int32_t i,datalen,hexlen=0,extrasize,havepubkey=1; + if ( jobj(sendjson,"coin") == 0 ) + jaddstr(sendjson,"coin",symbol); + if ( jobj(sendjson,"pubkey") != 0 ) + { + havepubkey = 1; + pubkey = jbits256(sendjson,"pubkey"); + } + if ( (hexstr= jstr(sendjson,"data")) != 0 && (hexlen= is_hexstr(hexstr,0)) > 0 ) + hexlen >>= 1; + extrasize = (int32_t)(sizeof(struct iguana_msghdr) + sizeof(basilisktag)); + *ptrp = 0; + sendstr = jprint(sendjson,0); + datalen = (int32_t)strlen(sendstr) + 1; + if ( (datalen + extrasize + hexlen + havepubkey*(sizeof(pubkey)+1)) <= spacesize ) + data = space; + else + { + data = calloc(1,datalen + extrasize + hexlen + havepubkey*(sizeof(pubkey)+1)); + *ptrp = data; + } + data += extrasize; + memcpy(data,sendstr,datalen); + free(sendstr); + if ( havepubkey != 0 || hexlen != 0 ) + { + if ( (data[datalen++]= havepubkey) != 0 ) + { + for (i=0; i<32; i++) + data[datalen++] = pubkey.bytes[i]; + } + } + if ( hexlen > 0 ) + { + decode_hex(&data[datalen],hexlen,hexstr); + datalen += hexlen; + } + *datalenp = datalen; + return(data); +} -struct basilisk_item *basilisk_issueremote(struct supernet_info *myinfo,char *symbol,char *type,cJSON *valsobj,int32_t fanout,int32_t minresults,uint32_t basilisktag,int32_t timeoutmillis,void *_metricfunc,char *retstr) +struct basilisk_item *basilisk_issueremote(struct supernet_info *myinfo,int32_t *numsentp,char *CMD,char *symbol,cJSON *valsobj,int32_t fanout,int32_t minresults,uint32_t basilisktag,int32_t timeoutmillis,void *_metricfunc,char *retstr,int32_t encryptflag,int32_t delaymillis) { - struct basilisk_item *ptr; void *allocptr; uint8_t *data,space[4096]; int32_t datalen,delaymillis=0,encryptflag=0; basilisk_metricfunc metricfunc = _metricfunc; + struct basilisk_item *ptr; void *allocptr; uint8_t *data,space[4096]; int32_t datalen; basilisk_metricfunc metricfunc = _metricfunc; if ( basilisktag == 0 ) basilisktag = rand(); - ptr = basilisk_itemcreate(myinfo,symbol,basilisktag,minresults,valsobj,timeoutmillis,metricfunc); + ptr = basilisk_itemcreate(myinfo,CMD,symbol,basilisktag,minresults,valsobj,timeoutmillis,metricfunc); + *numsentp = 0; if ( retstr != 0 ) { - ptr->retstr = retstr; - ptr->results[0] = retstr; + ptr->results[0] = ptr->retstr = retstr; ptr->numresults = ptr->numrequired; ptr->metrics[0] = (*metricfunc)(myinfo,ptr,retstr); ptr->finished = (uint32_t)time(NULL); @@ -225,13 +232,119 @@ struct basilisk_item *basilisk_issueremote(struct supernet_info *myinfo,char *sy else { data = basilisk_jsondata(&allocptr,space,sizeof(space),&datalen,symbol,valsobj,basilisktag); - basilisk_sendcmd(myinfo,0,type,basilisktag,encryptflag,delaymillis,data,datalen,0); + *numsentp = ptr->numsent = basilisk_sendcmd(myinfo,0,CMD,basilisktag,encryptflag,delaymillis,data,datalen,0); if ( allocptr != 0 ) free(allocptr); } + if ( timeoutmillis > 0 ) + queue_enqueue("submitQ",&myinfo->basilisks.submitQ,&ptr->DL,0); return(ptr); } +struct basilisk_item *basilisk_requestservice(struct basilisk_item *Lptr,struct supernet_info *myinfo,char *CMD,uint32_t basilisktag,cJSON *valsobj,bits256 pubkey) +{ + int32_t minresults,timeoutmillis,numsent,delaymillis,encryptflag; + if ( basilisktag == 0 ) + OS_randombytes((void *)&basilisktag,sizeof(basilisktag)); + if ( jobj(valsobj,"pubkey") != 0 ) + jdelete(valsobj,"pubkey"); + if ( bits256_cmp(pubkey,GENESIS_PUBKEY) != 0 ) + jaddbits256(valsobj,"pubkey",pubkey); + if ( (minresults= jint(valsobj,"minresults")) <= 0 ) + minresults = 1; + if ( (timeoutmillis= jint(valsobj,"timeout")) == 0 ) + timeoutmillis = BASILISK_TIMEOUT; + encryptflag = jint(valsobj,"encrypt"); + delaymillis = jint(valsobj,"delay"); + return(basilisk_issueremote(myinfo,&numsent,CMD,"",valsobj,1,minresults,basilisktag,timeoutmillis,0,0,encryptflag,delaymillis)); +} + +void basilisk_sendback(struct supernet_info *myinfo,char *symbol,char *remoteaddr,uint32_t basilisktag,char *retstr) +{ + uint8_t *data,space[4096]; void *allocptr; cJSON *valsobj; int32_t datalen,encryptflag=0,delaymillis=0; + if ( retstr != 0 && remoteaddr != 0 && remoteaddr[0] != 0 && strcmp(remoteaddr,"127.0.0.1") != 0 ) + { + if ( (valsobj= cJSON_Parse(retstr)) != 0 ) + { + data = basilisk_jsondata(&allocptr,space,sizeof(space),&datalen,symbol,valsobj,basilisktag); + basilisk_sendcmd(myinfo,remoteaddr,"RET",basilisktag,encryptflag,delaymillis,data,datalen,0); + if ( allocptr != 0 ) + free(allocptr); + free_json(valsobj); + } + } +} + +char *basilisk_block(struct supernet_info *myinfo,char *CMD,char *symbol,char *remoteaddr,struct basilisk_item *Lptr,struct basilisk_item *ptr) +{ + char *retstr = 0; + if ( ptr == Lptr ) + { + if ( (retstr= Lptr->retstr) == 0 ) + retstr = clonestr("{\"result\":\"null return from local basilisk_issuecmd\"}"); + ptr = basilisk_itemcreate(myinfo,CMD,symbol,Lptr->basilisktag,Lptr->numrequired,Lptr->vals,OS_milliseconds() - Lptr->expiration,Lptr->metricfunc); + queue_enqueue("submitQ",&myinfo->basilisks.submitQ,&ptr->DL,0); + } + else + { + queue_enqueue("submitQ",&myinfo->basilisks.submitQ,&ptr->DL,0); + while ( OS_milliseconds() < ptr->expiration ) + { + //if ( (retstr= basilisk_iscomplete(ptr)) != 0 ) + if ( (retstr= ptr->retstr) != 0 ) + break; + usleep(50000); + } + if ( retstr == 0 ) + retstr = basilisk_finish(ptr,-1,"{\"error\":\"basilisk timeout\"}"); + } + basilisk_sendback(myinfo,symbol,remoteaddr,ptr->basilisktag,retstr); + return(retstr); +} + +uint8_t *get_dataptr(void **ptrp,int32_t *datalenp,uint8_t *space,int32_t spacesize,char *hexstr) +{ + *ptrp = 0; uint8_t *data = 0; + if ( hexstr != 0 && (*datalenp= is_hexstr(hexstr,0)) > 0 ) + { + *datalenp >>= 1; + if ( *datalenp <= spacesize ) + data = space; + else *ptrp = data = calloc(1,*datalenp); + decode_hex(data,*datalenp,hexstr); + } + return(data); +} + +char *basilisk_standardservice(char *CMD,basilisk_requestfunc *func,struct supernet_info *myinfo,bits256 pubkey,cJSON *vals,char *hexstr,int32_t blockflag) +{ + uint8_t space[8192],*data = 0; struct basilisk_item *ptr,Lptr; void *allocptr = 0; int32_t datalen = 0; cJSON *retjson= cJSON_CreateObject(); + data = get_dataptr(&allocptr,&datalen,space,sizeof(space),hexstr); + ptr = (*func)(&Lptr,myinfo,pubkey,vals,data,datalen); + if ( allocptr != 0 ) + free(allocptr); + if ( blockflag != 0 ) + { + ptr->vals = jduplicate(vals); + strcpy(ptr->symbol,""); + strcpy(ptr->CMD,CMD); + return(basilisk_block(myinfo,CMD,"",0,&Lptr,ptr)); + } + else if ( ptr->numsent > 0 ) + { + jaddstr(retjson,"result","success"); + jaddnum(retjson,"numsent",ptr->numsent); + } else jaddstr(retjson,"error","didnt find any nodes to send to"); + return(jprint(retjson,1)); +} + +#include "basilisk_bitcoin.c" +#include "basilisk_nxt.c" +#include "basilisk_ether.c" +#include "basilisk_waves.c" +#include "basilisk_lisk.c" +#include "basilisk_CMD.c" + void basilisk_functions(struct iguana_info *coin,int32_t protocol) { coin->protocol = protocol; @@ -319,72 +432,6 @@ char *basilisk_iscomplete(struct basilisk_item *ptr) return(retstr); } -uint8_t *basilisk_jsondata(void **ptrp,uint8_t *space,int32_t spacesize,int32_t *datalenp,char *symbol,cJSON *sendjson,uint32_t basilisktag) -{ - char *sendstr,*hexstr; uint8_t *data; int32_t datalen,hexlen=0,extrasize; - if ( jobj(sendjson,"coin") == 0 ) - jaddstr(sendjson,"coin",symbol); - if ( (hexstr= jstr(sendjson,"data")) != 0 && (hexlen= is_hexstr(hexstr,0)) > 0 ) - hexlen >>= 1; - extrasize = (int32_t)(sizeof(struct iguana_msghdr) + sizeof(basilisktag)); - *ptrp = 0; - sendstr = jprint(sendjson,0); - datalen = (int32_t)strlen(sendstr) + 1; - if ( (datalen + extrasize + hexlen) <= spacesize ) - data = space; - else - { - data = calloc(1,datalen + extrasize + hexlen); - *ptrp = data; - } - data += extrasize; - memcpy(data,sendstr,datalen); - free(sendstr); - if ( hexlen > 0 ) - { - decode_hex(&data[datalen],hexlen,hexstr); - datalen += hexlen; - } - *datalenp = datalen; - return(data); -} - -char *basilisk_block(struct supernet_info *myinfo,struct iguana_info *coin,char *remoteaddr,struct basilisk_item *Lptr,struct basilisk_item *ptr) -{ - char *retstr = 0; uint8_t *data,space[4096]; void *allocptr; cJSON *valsobj; int32_t datalen,encryptflag=0,delaymillis=0; - if ( ptr == Lptr ) - { - if ( (retstr= Lptr->retstr) == 0 ) - retstr = clonestr("{\"result\":\"null return from local basilisk_issuecmd\"}"); - ptr = basilisk_itemcreate(myinfo,coin->symbol,Lptr->basilisktag,Lptr->numrequired,Lptr->vals,OS_milliseconds() - Lptr->expiration,Lptr->metricfunc); - //printf("block got local.(%s)\n",retstr); - } - else - { - while ( OS_milliseconds() < ptr->expiration ) - { - //if ( (retstr= basilisk_iscomplete(ptr)) != 0 ) - if ( (retstr= ptr->retstr) != 0 ) - break; - usleep(50000); - } - if ( retstr == 0 ) - retstr = basilisk_finish(ptr,-1,"{\"error\":\"basilisk timeout\"}"); - } - if ( retstr != 0 && remoteaddr != 0 && remoteaddr[0] != 0 && strcmp(remoteaddr,"127.0.0.1") != 0 ) - { - if ( (valsobj= cJSON_Parse(retstr)) != 0 ) - { - data = basilisk_jsondata(&allocptr,space,sizeof(space),&datalen,coin->symbol,valsobj,ptr->basilisktag); - basilisk_sendcmd(myinfo,remoteaddr,"RET",ptr->basilisktag,encryptflag,delaymillis,data,datalen,0); - if ( allocptr != 0 ) - free(allocptr); - free_json(valsobj); - } - } - return(retstr); -} - struct basilisk_item *basilisk_issuecmd(struct basilisk_item *Lptr,basilisk_func func,basilisk_metricfunc metricfunc,struct supernet_info *myinfo,char *remoteaddr,uint32_t basilisktag,char *symbol,int32_t timeoutmillis,cJSON *vals) { struct iguana_info *coin; struct basilisk_item *ptr; @@ -401,8 +448,7 @@ struct basilisk_item *basilisk_issuecmd(struct basilisk_item *Lptr,basilisk_func ptr->basilisktag = basilisktag; ptr->expiration = OS_milliseconds() + timeoutmillis; return(ptr); - } - else Lptr->retstr = clonestr("{\"error\":\"error issuing basilisk command\"}"); + } else Lptr->retstr = clonestr("{\"error\":\"error issuing basilisk command\"}"); } else Lptr->retstr = clonestr("{\"error\":\"null basilisk function\"}"); } else Lptr->retstr = clonestr("{\"error\":\"error missing coin\"}"); return(Lptr); @@ -420,7 +466,7 @@ char *basilisk_check(int32_t *timeoutmillisp,uint32_t *basilisktagp,char *symbol } else return(clonestr("{\"error\":\"missing activecoin or vals\"}")); } -char *basilisk_standardcmd(struct supernet_info *myinfo,char *activecoin,char *remoteaddr,uint32_t basilisktag,cJSON *vals,basilisk_func func,basilisk_metricfunc metric) +char *basilisk_standardcmd(struct supernet_info *myinfo,char *CMD,char *activecoin,char *remoteaddr,uint32_t basilisktag,cJSON *vals,basilisk_func func,basilisk_metricfunc metric) { char *retstr; struct basilisk_item *ptr,Lptr; int32_t timeoutmillis; struct iguana_info *coin; if ( (retstr= basilisk_check(&timeoutmillis,&basilisktag,activecoin,vals)) == 0 ) @@ -428,7 +474,7 @@ char *basilisk_standardcmd(struct supernet_info *myinfo,char *activecoin,char *r if ( (coin= iguana_coinfind(activecoin)) != 0 ) { if ( (ptr= basilisk_issuecmd(&Lptr,func,metric,myinfo,remoteaddr,basilisktag,activecoin,timeoutmillis,vals)) != 0 ) - return(basilisk_block(myinfo,coin,remoteaddr,&Lptr,ptr)); + return(basilisk_block(myinfo,CMD,coin->symbol,remoteaddr,&Lptr,ptr)); else return(clonestr("{\"error\":\"null return from basilisk_issuecmd\"}")); } else return(clonestr("{\"error\":\"couldnt get coin\"}")); } else return(retstr); @@ -436,12 +482,12 @@ char *basilisk_standardcmd(struct supernet_info *myinfo,char *activecoin,char *r char *_basilisk_value(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_peer *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen) { - return(basilisk_standardcmd(myinfo,coin->symbol,remoteaddr,basilisktag,valsobj,coin->basilisk_value,coin->basilisk_valuemetric)); + return(basilisk_standardcmd(myinfo,"VAL",coin->symbol,remoteaddr,basilisktag,valsobj,coin->basilisk_value,coin->basilisk_valuemetric)); } char *_basilisk_balances(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_peer *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen) { - return(basilisk_standardcmd(myinfo,coin->symbol,remoteaddr,basilisktag,valsobj,coin->basilisk_balances,coin->basilisk_balancesmetric)); + return(basilisk_standardcmd(myinfo,"BAL",coin->symbol,remoteaddr,basilisktag,valsobj,coin->basilisk_balances,coin->basilisk_balancesmetric)); } char *_basilisk_rawtx(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_peer *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen) @@ -504,12 +550,12 @@ char *basilisk_checkrawtx(int32_t *timeoutmillisp,uint32_t *basilisktagp,char *s INT_ARRAY_STRING(basilisk,balances,basilisktag,vals,activecoin) { - return(basilisk_standardcmd(myinfo,activecoin,remoteaddr,basilisktag,vals,coin->basilisk_balances,coin->basilisk_balancesmetric)); + return(basilisk_standardcmd(myinfo,"BAL",activecoin,remoteaddr,basilisktag,vals,coin->basilisk_balances,coin->basilisk_balancesmetric)); } INT_ARRAY_STRING(basilisk,value,basilisktag,vals,activecoin) { - return(basilisk_standardcmd(myinfo,activecoin,remoteaddr,basilisktag,vals,coin->basilisk_value,coin->basilisk_valuemetric)); + return(basilisk_standardcmd(myinfo,"VAL",activecoin,remoteaddr,basilisktag,vals,coin->basilisk_value,coin->basilisk_valuemetric)); } INT_ARRAY_STRING(basilisk,rawtx,basilisktag,vals,activecoin) @@ -524,7 +570,7 @@ INT_ARRAY_STRING(basilisk,rawtx,basilisktag,vals,activecoin) ptr->numrequired = 1; ptr->uniqueflag = 1; ptr->metricdir = -1; - return(basilisk_block(myinfo,coin,remoteaddr,&Lptr,ptr)); + return(basilisk_block(myinfo,"RAW",coin->symbol,remoteaddr,&Lptr,ptr)); } else return(clonestr("{\"error\":\"error issuing basilisk rawtx\"}")); } else return(retstr); } @@ -543,8 +589,187 @@ INT_AND_ARRAY(basilisk,result,basilisktag,vals) } else printf("null vals.(%s) or no hexmsg.%p\n",jprint(vals,0),vals); return(clonestr("{\"error\":\"no hexmsg to return\"}")); } + +HASH_ARRAY_STRING(basilisk,addrelay,pubkey,vals,hexstr) +{ + return(basilisk_standardservice("ADD",&basilisk_request_addrelay,myinfo,pubkey,vals,hexstr,0)); +} + +HASH_ARRAY_STRING(basilisk,dispatch,pubkey,vals,hexstr) +{ + return(basilisk_standardservice("RUN",&basilisk_request_dispatch,myinfo,pubkey,vals,hexstr,0)); +} + +HASH_ARRAY_STRING(basilisk,publish,pubkey,vals,hexstr) +{ + return(basilisk_standardservice("PUB",&basilisk_request_publish,myinfo,pubkey,vals,hexstr,0)); +} + +HASH_ARRAY_STRING(basilisk,subscribe,pubkey,vals,hexstr) +{ + return(basilisk_standardservice("SUB",&basilisk_request_subscribe,myinfo,pubkey,vals,hexstr,0)); +} + +HASH_ARRAY_STRING(basilisk,setfield,pubkey,vals,hexstr) +{ + return(basilisk_standardservice("SET",&basilisk_request_setfield,myinfo,pubkey,vals,hexstr,0)); +} + +HASH_ARRAY_STRING(basilisk,getfield,pubkey,vals,hexstr) +{ + return(basilisk_standardservice("GET",&basilisk_request_getfield,myinfo,pubkey,vals,hexstr,0)); +} + +HASH_ARRAY_STRING(basilisk,forward,pubkey,vals,hexstr) +{ + return(basilisk_standardservice("HOP",&basilisk_request_forward,myinfo,pubkey,vals,hexstr,0)); +} + +HASH_ARRAY_STRING(basilisk,mailbox,pubkey,vals,hexstr) +{ + return(basilisk_standardservice("BOX",&basilisk_request_mailbox,myinfo,pubkey,vals,hexstr,0)); +} + +HASH_ARRAY_STRING(basilisk,VPNcreate,pubkey,vals,hexstr) +{ + return(basilisk_standardservice("HUB",&basilisk_request_VPNcreate,myinfo,pubkey,vals,hexstr,0)); +} + +HASH_ARRAY_STRING(basilisk,VPNjoin,pubkey,vals,hexstr) +{ + return(basilisk_standardservice("ARC",&basilisk_request_VPNjoin,myinfo,pubkey,vals,hexstr,0)); +} + +HASH_ARRAY_STRING(basilisk,VPNmessage,pubkey,vals,hexstr) +{ + return(basilisk_standardservice("GAB",&basilisk_request_VPNmessage,myinfo,pubkey,vals,hexstr,0)); +} + +HASH_ARRAY_STRING(basilisk,VPNbroadcast,pubkey,vals,hexstr) +{ + return(basilisk_standardservice("SAY",&basilisk_request_VPNbroadcast,myinfo,pubkey,vals,hexstr,0)); +} + +HASH_ARRAY_STRING(basilisk,VPNreceive,pubkey,vals,hexstr) +{ + return(basilisk_standardservice("EAR",&basilisk_request_VPNreceive,myinfo,pubkey,vals,hexstr,0)); +} + +HASH_ARRAY_STRING(basilisk,VPNlogout,pubkey,vals,hexstr) +{ + return(basilisk_standardservice("END",&basilisk_request_VPNlogout,myinfo,pubkey,vals,hexstr,0)); +} + #include "../includes/iguana_apiundefs.h" +void basilisk_msgprocess(struct supernet_info *myinfo,void *addr,uint32_t senderipbits,char *type,uint32_t basilisktag,uint8_t *data,int32_t datalen,bits256 pubkey) +{ + cJSON *valsobj; char *symbol,*retstr=0,remoteaddr[64],CMD[4],cmd[4]; int32_t origlen,basilisk_request,i,timeoutmillis,numrequired,jsonlen; uint8_t *origdata; struct iguana_info *coin=0; + static basilisk_servicefunc *basilisk_services[][2] = + { + { (void *)"RUN", &basilisk_respond_dispatch }, // higher level protocol handler, pass through + { (void *)"BYE", &basilisk_respond_goodbye }, // disconnect + + // unencrypted low level functions, used by higher level protocols and virtual network funcs + { (void *)"ADD", &basilisk_respond_addrelay }, // relays register with each other and make a bus + { (void *)"PUB", &basilisk_respond_publish }, // adds to global list of published items + { (void *)"SUB", &basilisk_respond_subscribe }, // subscribes to one or all published items + { (void *)"SET", &basilisk_respond_setfield }, // adding field to one relay propagates to all others + { (void *)"GET", &basilisk_respond_getfield }, // any relay can be queried + + // encrypted data for jumblr + { (void *)"HOP", &basilisk_respond_forward }, // message forwarding + { (void *)"BOX", &basilisk_respond_mailbox }, // create/send/check mailbox pubkey + + // small virtual private network + { (void *)"HUB", &basilisk_respond_VPNcreate }, // create virtual network's hub via privkey + { (void *)"ARC", &basilisk_respond_VPNjoin }, // join + { (void *)"GAB", &basilisk_respond_VPNmessage }, // private message + { (void *)"SAY", &basilisk_respond_VPNbroadcast }, // broadcast + { (void *)"EAR", &basilisk_respond_VPNreceive }, // network receive (via poll) + { (void *)"END", &basilisk_respond_VPNlogout }, // logout + }; + static basilisk_coinfunc *basilisk_coinservices[][2] = + { + { (void *)"RAW", &_basilisk_rawtx }, + { (void *)"VAL", &_basilisk_value }, + { (void *)"BAL", &_basilisk_balances }, + }; + strncpy(CMD,type,3), CMD[3] = cmd[3] = 0; + if ( isupper((int32_t)CMD[0]) != 0 && isupper((int32_t)CMD[1]) != 0 && isupper((int32_t)CMD[2]) != 0 ) + basilisk_request = 1; + else basilisk_request = 0; + origdata = data; + origlen = datalen; + for (i=0; i<3; i++) + { + CMD[i] = toupper((int32_t)CMD[i]); + cmd[i] = tolower((int32_t)cmd[i]); + } + //printf("MSGPROCESS.(%s)\n",(char *)data); + if ( (valsobj= cJSON_Parse((char *)data)) != 0 ) + { + jsonlen = (int32_t)strlen((char *)data) + 1; + if ( datalen > jsonlen ) + { + data += jsonlen, datalen -= jsonlen; + if ( *data++ != 0 ) + data += sizeof(pubkey), datalen -= sizeof(pubkey); + } else data = 0, datalen = 0; + if ( (symbol= jstr(valsobj,"coin")) == 0 ) + symbol = ""; + timeoutmillis = jint(valsobj,"timeout"); + if ( (numrequired= jint(valsobj,"numrequired")) == 0 ) + numrequired = 1; + if ( jobj(valsobj,"coin") != 0 ) + coin = iguana_coinfind(jstr(valsobj,"coin")); + if ( senderipbits != 0 ) + expand_ipbits(remoteaddr,senderipbits); + else remoteaddr[0] = 0; + for (i=0; iIAMRELAY != 0 ) // iguana node + { + if ( basilisk_request != 0 ) + basilisk_sendcmd(myinfo,0,cmd,rand(),0,0,origdata,origlen,-1); + if ( (retstr= (*basilisk_services[i][1])(myinfo,type,addr,remoteaddr,basilisktag,valsobj,data,datalen,pubkey)) != 0 ) + { + if ( basilisk_request != 0 ) + basilisk_sendback(myinfo,symbol,remoteaddr,basilisktag,retstr); + if ( retstr != 0 ) + free(retstr); + } + } else printf("non-relay got unexpected.(%s)\n",type); + free_json(valsobj); + return; + } + } + if ( coin != 0 ) + { + if ( coin->RELAYNODE != 0 || coin->VALIDATENODE != 0 ) + { + for (i=0; idead = (uint32_t)time(NULL); + addr->rank = 0; + return(0); +} + +void basilisk_request_goodbye(struct supernet_info *myinfo) +{ + struct basilisk_item Lptr; cJSON *valsobj = cJSON_CreateObject(); + jaddnum(valsobj,"timeout",-1); + basilisk_requestservice(&Lptr,myinfo,"BYE",0,valsobj,GENESIS_PUBKEY); + free_json(valsobj); +} + +char *basilisk_respond_publish(struct supernet_info *myinfo,char *CMD,struct iguana_peer *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 pubkey) +{ + char *retstr=0; + printf("from.(%s) PUB.(%s) datalen.%d\n",remoteaddr,jprint(valsobj,0),datalen); + return(retstr); +} + +struct basilisk_item *basilisk_request_publish(struct basilisk_item *Lptr,struct supernet_info *myinfo,bits256 pubkey,cJSON *valsobj,uint8_t *data,int32_t datalen) +{ + return(basilisk_requestservice(Lptr,myinfo,"PUB",0,valsobj,pubkey)); +} + +char *basilisk_respond_subscribe(struct supernet_info *myinfo,char *CMD,struct iguana_peer *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 pubkey) +{ + char *retstr=0; + return(retstr); +} +struct basilisk_item *basilisk_request_subscribe(struct basilisk_item *Lptr,struct supernet_info *myinfo,bits256 pubkey,cJSON *valsobj,uint8_t *data,int32_t datalen) +{ + return(basilisk_requestservice(Lptr,myinfo,"SUB",0,valsobj,pubkey)); +} + +char *basilisk_respond_setfield(struct supernet_info *myinfo,char *CMD,struct iguana_peer *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 pubkey) +{ + char *retstr=0; + printf("from.(%s) SET.(%s) datalen.%d\n",remoteaddr,jprint(valsobj,0),datalen); + return(retstr); +} + +struct basilisk_item *basilisk_request_setfield(struct basilisk_item *Lptr,struct supernet_info *myinfo,bits256 pubkey,cJSON *valsobj,uint8_t *data,int32_t datalen) +{ + return(basilisk_requestservice(Lptr,myinfo,"SET",0,valsobj,pubkey)); +} + +char *basilisk_respond_getfield(struct supernet_info *myinfo,char *CMD,struct iguana_peer *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 pubkey) +{ + char *retstr=0; + printf("from.(%s) GET.(%s) datalen.%d\n",remoteaddr,jprint(valsobj,0),datalen); + return(retstr); +} + +struct basilisk_item *basilisk_request_getfield(struct basilisk_item *Lptr,struct supernet_info *myinfo,bits256 pubkey,cJSON *valsobj,uint8_t *data,int32_t datalen) +{ + return(basilisk_requestservice(Lptr,myinfo,"GET",0,valsobj,pubkey)); +} + +char *basilisk_respond_dispatch(struct supernet_info *myinfo,char *CMD,struct iguana_peer *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 pubkey) +{ + char *retstr=0; + return(retstr); +} + +struct basilisk_item *basilisk_request_dispatch(struct basilisk_item *Lptr,struct supernet_info *myinfo,bits256 pubkey,cJSON *valsobj,uint8_t *data,int32_t datalen) +{ + return(basilisk_requestservice(Lptr,myinfo,"RUN",0,valsobj,pubkey)); +} + +char *basilisk_respond_addrelay(struct supernet_info *myinfo,char *CMD,struct iguana_peer *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 pubkey) +{ + char *retstr=0; + return(retstr); +} + +struct basilisk_item *basilisk_request_addrelay(struct basilisk_item *Lptr,struct supernet_info *myinfo,bits256 pubkey,cJSON *valsobj,uint8_t *data,int32_t datalen) +{ + return(basilisk_requestservice(Lptr,myinfo,"ADD",0,valsobj,pubkey)); +} + +char *basilisk_respond_forward(struct supernet_info *myinfo,char *CMD,struct iguana_peer *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 pubkey) +{ + char *retstr=0; + return(retstr); +} + +struct basilisk_item *basilisk_request_forward(struct basilisk_item *Lptr,struct supernet_info *myinfo,bits256 pubkey,cJSON *valsobj,uint8_t *data,int32_t datalen) +{ + return(basilisk_requestservice(Lptr,myinfo,"HOP",0,valsobj,pubkey)); +} + +char *basilisk_respond_mailbox(struct supernet_info *myinfo,char *CMD,struct iguana_peer *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 pubkey) +{ + char *retstr=0; + return(retstr); +} + +struct basilisk_item *basilisk_request_mailbox(struct basilisk_item *Lptr,struct supernet_info *myinfo,bits256 pubkey,cJSON *valsobj,uint8_t *data,int32_t datalen) +{ + return(basilisk_requestservice(Lptr,myinfo,"BOX",0,valsobj,pubkey)); +} + +char *basilisk_respond_VPNcreate(struct supernet_info *myinfo,char *CMD,struct iguana_peer *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 pubkey) +{ + char *retstr=0; + return(retstr); +} + +struct basilisk_item *basilisk_request_VPNcreate(struct basilisk_item *Lptr,struct supernet_info *myinfo,bits256 pubkey,cJSON *valsobj,uint8_t *data,int32_t datalen) +{ + return(basilisk_requestservice(Lptr,myinfo,"HUB",0,valsobj,pubkey)); +} + +char *basilisk_respond_VPNjoin(struct supernet_info *myinfo,char *CMD,struct iguana_peer *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 pubkey) +{ + char *retstr=0; + return(retstr); +} + +struct basilisk_item *basilisk_request_VPNjoin(struct basilisk_item *Lptr,struct supernet_info *myinfo,bits256 pubkey,cJSON *valsobj,uint8_t *data,int32_t datalen) +{ + return(basilisk_requestservice(Lptr,myinfo,"ARC",0,valsobj,pubkey)); +} + +char *basilisk_respond_VPNlogout(struct supernet_info *myinfo,char *CMD,struct iguana_peer *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 pubkey) +{ + char *retstr=0; + return(retstr); +} + +struct basilisk_item *basilisk_request_VPNlogout(struct basilisk_item *Lptr,struct supernet_info *myinfo,bits256 pubkey,cJSON *valsobj,uint8_t *data,int32_t datalen) +{ + return(basilisk_requestservice(Lptr,myinfo,"END",0,valsobj,pubkey)); +} + +char *basilisk_respond_VPNbroadcast(struct supernet_info *myinfo,char *CMD,struct iguana_peer *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 pubkey) +{ + char *retstr=0; + return(retstr); +} + +struct basilisk_item *basilisk_request_VPNbroadcast(struct basilisk_item *Lptr,struct supernet_info *myinfo,bits256 pubkey,cJSON *valsobj,uint8_t *data,int32_t datalen) +{ + return(basilisk_requestservice(Lptr,myinfo,"SAY",0,valsobj,pubkey)); +} + +char *basilisk_respond_VPNreceive(struct supernet_info *myinfo,char *CMD,struct iguana_peer *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 pubkey) +{ + char *retstr=0; + return(retstr); +} + +struct basilisk_item *basilisk_request_VPNreceive(struct basilisk_item *Lptr,struct supernet_info *myinfo,bits256 pubkey,cJSON *valsobj,uint8_t *data,int32_t datalen) +{ + return(basilisk_requestservice(Lptr,myinfo,"EAR",0,valsobj,pubkey)); +} + +char *basilisk_respond_VPNmessage(struct supernet_info *myinfo,char *CMD,struct iguana_peer *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 pubkey) +{ + char *retstr=0; + return(retstr); +} + +struct basilisk_item *basilisk_request_VPNmessage(struct basilisk_item *Lptr,struct supernet_info *myinfo,bits256 pubkey,cJSON *valsobj,uint8_t *data,int32_t datalen) +{ + return(basilisk_requestservice(Lptr,myinfo,"GAP",0,valsobj,pubkey)); +} + + diff --git a/basilisk/basilisk_bitcoin.c b/basilisk/basilisk_bitcoin.c index 49949e011..ece76a18d 100755 --- a/basilisk/basilisk_bitcoin.c +++ b/basilisk/basilisk_bitcoin.c @@ -336,7 +336,7 @@ double basilisk_bitcoin_valuemetric(struct supernet_info *myinfo,struct basilisk void *basilisk_bitcoinvalue(struct basilisk_item *Lptr,struct supernet_info *myinfo,struct iguana_info *coin,char *remoteaddr,uint32_t basilisktag,int32_t timeoutmillis,cJSON *valsobj) { - int32_t i,height,vout; char *coinaddr; struct basilisk_value *v; uint64_t value = 0; bits256 txid; + int32_t i,height,vout,numsent; char *coinaddr; struct basilisk_value *v; uint64_t value = 0; bits256 txid; txid = jbits256(valsobj,"txid"); vout = jint(valsobj,"vout"); coinaddr = jstr(valsobj,"address"); @@ -362,12 +362,12 @@ void *basilisk_bitcoinvalue(struct basilisk_item *Lptr,struct supernet_info *myi if ( v->vout == vout && bits256_cmp(txid,v->txid) == 0 && strcmp(v->coinaddr,coinaddr) == 0 ) { printf("bitcoinvalue local ht.%d %s %.8f\n",v->height,v->coinaddr,dstr(v->value)); - return(basilisk_issueremote(myinfo,coin->symbol,"VAL",valsobj,juint(valsobj,"fanout"),juint(valsobj,"minresults"),basilisktag,timeoutmillis,coin->basilisk_valuemetric,basilisk_valuestr(coin,v->coinaddr,v->value,v->height,txid,vout))); + return(basilisk_issueremote(myinfo,&numsent,"VAL",coin->symbol,valsobj,juint(valsobj,"fanout"),juint(valsobj,"minresults"),basilisktag,timeoutmillis,coin->basilisk_valuemetric,basilisk_valuestr(coin,v->coinaddr,v->value,v->height,txid,vout),0,0)); } } } printf("bitcoinvalue issue remote\n"); - return(basilisk_issueremote(myinfo,coin->symbol,"VAL",valsobj,juint(valsobj,"fanout"),juint(valsobj,"minresults"),basilisktag,timeoutmillis,coin->basilisk_valuemetric,0)); + return(basilisk_issueremote(myinfo,&numsent,"VAL",coin->symbol,valsobj,juint(valsobj,"fanout"),juint(valsobj,"minresults"),basilisktag,timeoutmillis,coin->basilisk_valuemetric,0,0,0)); } double basilisk_bitcoin_rawtxmetric_dependents(struct supernet_info *myinfo,struct iguana_info *coin,struct basilisk_item *ptr,struct bitcoin_rawtxdependents *dependents) @@ -571,7 +571,7 @@ double basilisk_bitcoin_rawtxmetric(struct supernet_info *myinfo,struct basilisk void *basilisk_bitcoinrawtx(struct basilisk_item *Lptr,struct supernet_info *myinfo,struct iguana_info *coin,char *remoteaddr,uint32_t basilisktag,int32_t timeoutmillis,cJSON *valsobj) { - uint8_t buf[IGUANA_MAXSCRIPTSIZE]; int32_t minconf,spendlen; cJSON *vins,*addresses,*txobj = 0; uint32_t locktime; char *spendscriptstr,*changeaddr,*rawtx = 0; int64_t amount,txfee; + uint8_t buf[IGUANA_MAXSCRIPTSIZE]; int32_t numsent,minconf,spendlen; cJSON *vins,*addresses,*txobj = 0; uint32_t locktime; char *spendscriptstr,*changeaddr,*rawtx = 0; int64_t amount,txfee; vins = 0; changeaddr = jstr(valsobj,"changeaddr"); spendscriptstr = jstr(valsobj,"spendscript"); @@ -628,6 +628,6 @@ void *basilisk_bitcoinrawtx(struct basilisk_item *Lptr,struct supernet_info *myi Lptr->retstr = clonestr("{\"error\":\"couldnt create rawtx\"}"); return(Lptr); } - return(basilisk_issueremote(myinfo,coin->symbol,"RAW",valsobj,juint(valsobj,"fanout"),juint(valsobj,"minresults"),basilisktag,timeoutmillis,coin->basilisk_rawtxmetric,0)); + return(basilisk_issueremote(myinfo,&numsent,"RAW",coin->symbol,valsobj,juint(valsobj,"fanout"),juint(valsobj,"minresults"),basilisktag,timeoutmillis,coin->basilisk_rawtxmetric,0,0,0)); } diff --git a/iguana/SuperNET.c b/iguana/SuperNET.c index 77bd28f53..18f980b3c 100755 --- a/iguana/SuperNET.c +++ b/iguana/SuperNET.c @@ -220,6 +220,7 @@ uint8_t *SuperNET_ciphercalc(void **ptrp,int32_t *cipherlenp,bits256 *privkeyp,b return(origptr); } +#ifdef oldway int32_t SuperNET_copybits(int32_t reverse,uint8_t *dest,uint8_t *src,int32_t len) { int32_t i; uint8_t *tmp; @@ -845,6 +846,37 @@ char *SuperNET_p2p(struct iguana_info *coin,struct iguana_peer *addr,int32_t *de free(ptr); return(retstr); } +#else +char *SuperNET_JSON(struct supernet_info *myinfo,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)); + if ( remoteaddr != 0 && strcmp(remoteaddr,"127.0.0.1") == 0 ) + remoteaddr = 0; + if ( (agent = jstr(json,"agent")) == 0 ) + agent = "bitcoinrpc"; + method = jstr(json,"method"); + if ( remoteaddr == 0 ) + { + if ( jobj(json,"timestamp") != 0 ) + jdelete(json,"timestamp"); + timestamp = (uint32_t)time(NULL); + jaddnum(json,"timestamp",timestamp); + } + if ( (tag= j64bits(json,"tag")) == 0 ) + { + OS_randombytes((uint8_t *)&tag,sizeof(tag)); + jadd64bits(json,"tag",tag); + } + if ( (retstr= SuperNET_processJSON(myinfo,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); +} +#endif cJSON *SuperNET_peerarray(struct iguana_info *coin,int32_t max,int32_t supernetflag) { @@ -1208,14 +1240,14 @@ STRING_ARG(SuperNET,getpeers,activecoin) return(jprint(retjson,1)); } -TWOSTRINGS_AND_TWOHASHES_AND_TWOINTS(SuperNET,DHT,hexmsg,destip,categoryhash,subhash,maxdelay,broadcast) +/*TWOSTRINGS_AND_TWOHASHES_AND_TWOINTS(SuperNET,DHT,hexmsg,destip,categoryhash,subhash,maxdelay,broadcast) { if ( remoteaddr != 0 ) return(clonestr("{\"error\":\"cant remote DHT\"}")); else if ( hexmsg == 0 || is_hexstr(hexmsg,(int32_t)strlen(hexmsg)) <= 0 ) return(clonestr("{\"error\":\"hexmsg missing or not in hex\"}")); return(SuperNET_DHTencode(myinfo,destip,categoryhash,subhash,hexmsg,maxdelay,broadcast,juint(json,"plaintext")!=0)); -} +}*/ HASH_AND_STRING(SuperNET,saveconf,wallethash,confjsonstr) { diff --git a/iguana/SuperNET.h b/iguana/SuperNET.h index 585efe9c5..dd8ef38c2 100755 --- a/iguana/SuperNET.h +++ b/iguana/SuperNET.h @@ -90,7 +90,7 @@ struct supernet_info //struct nn_pollfd pfd[SUPERNET_MAXAGENTS]; //struct relay_info active; struct supernet_agent agents[SUPERNET_MAXAGENTS]; queue_t acceptQ; struct basilisk_info basilisks; - int32_t numagents,numexchanges; + int32_t numagents,numexchanges,IAMRELAY; struct exchange_info *tradingexchanges[SUPERNET_MAXEXCHANGES]; struct iguana_waccount *wallet; void *ctx; char handle[1024],*decryptstr; diff --git a/iguana/SuperNET_category.c b/iguana/SuperNET_category.c index 4fa9329f4..fef1491ca 100755 --- a/iguana/SuperNET_category.c +++ b/iguana/SuperNET_category.c @@ -188,7 +188,7 @@ char *SuperNET_categorymulticast(struct supernet_info *myinfo,int32_t surveyflag plaintext = category_plaintext(myinfo,categoryhash,subhash,plaintext); broadcastflag = category_broadcastflag(myinfo,categoryhash,subhash,broadcastflag); maxdelay = category_maxdelay(myinfo,categoryhash,subhash,maxdelay); - retstr = SuperNET_DHTsend(myinfo,0,categoryhash,subhash,hexmsg,maxdelay,broadcastflag,plaintext); + retstr = 0;//SuperNET_DHTsend(myinfo,0,categoryhash,subhash,hexmsg,maxdelay,broadcastflag,plaintext); //if ( 0 && argjson != 0 ) // SuperNET_hexmsgprocess(myinfo,retjson,argjson,hexmsg,remoteaddr); if ( hexmsg != message) diff --git a/iguana/coins/basilisk b/iguana/coins/basilisk index 3f4d43858..eedabcbdc 100755 --- a/iguana/coins/basilisk +++ b/iguana/coins/basilisk @@ -1,4 +1,4 @@ curl --url "http://127.0.0.1:7778" --data "{\"poll\":100,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"newcoin\":\"BTCD\",\"startpend\":1,\"endpend\":1,\"services\":128,\"maxpeers\":16,\"RELAY\":0,\"VALIDATE\":0,\"portp2p\":14631}" curl --url "http://127.0.0.1:7778" --data "{\"prefetchlag\":5,\"poll\":100,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"newcoin\":\"BTC\",\"startpend\":1,\"endpend\":1,\"services\":128,\"maxpeers\":16,\"RELAY\":0,\"VALIDATE\":0,\"portp2p\":8333}" -curl --url "http://127.0.0.1:7778" --data "{\"RELAY\":0,\"VALIDATE\":0,\"prefetchlag\":11,\"poll\":100,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":1,\"endpend\":1,\"services\":128,\"maxpeers\":16,\"newcoin\":\"LTC\",\"name\":\"Litecoin\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"fbc0b6db\",\"p2p\":9333,\"rpc\":9334,\"pubval\":48,\"p2shval\":5,\"wifval\":176,\"txfee_satoshis\":\"100000\",\"txhastimestamp\":0,\"minoutput\":10000,\"minconfirms\":2,\"genesishash\":\"12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2\",\"genesis\":{\"version\":1,\"timestamp\":1317972665,\"nBits\":\"1e0ffff0\",\"nonce\":2084524493,\"merkle_root\":\"97ddfbbae6be97fd6cdf3e7ca13232a3afff2353e29badfab7f73011edd4ced9\"},\"alertpubkey\":\"040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9\",\"protover\":70002}" +curl --url "http://127.0.0.1:7778" --data "{\"RELAY\":0,\"VALIDATE\":0,\"prefetchlag\":11,\"poll\":100,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":1,\"endpend\":1,\"services\":128,\"maxpeers\":16,\"newcoin\":\"LTC\",\"name\":\"Litecoin\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"fbc0b6db\",\"p2p\":9333,\"rpc\":9334,\"pubval\":48,\"p2shval\":5,\"wifval\":176,\"txfee_satoshis\":\"100000\",\"isPoS\":0,\"minoutput\":10000,\"minconfirms\":2,\"genesishash\":\"12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2\",\"genesis\":{\"version\":1,\"timestamp\":1317972665,\"nBits\":\"1e0ffff0\",\"nonce\":2084524493,\"merkle_root\":\"97ddfbbae6be97fd6cdf3e7ca13232a3afff2353e29badfab7f73011edd4ced9\"},\"alertpubkey\":\"040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9\",\"protover\":70002}" diff --git a/iguana/coins/genltc b/iguana/coins/genltc index 745ab5434..9d56d05c5 100755 --- a/iguana/coins/genltc +++ b/iguana/coins/genltc @@ -1,2 +1,2 @@ -curl --url "http://127.0.0.1:7778" --data "{\"RELAY\":1,\"VALIDATE\":1,\"prefetchlag\":-1,\"poll\":10,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":8,\"endpend\":8,\"services\":129,\"maxpeers\":256,\"newcoin\":\"LTC\",\"name\":\"Litecoin\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"fbc0b6db\",\"p2p\":9333,\"rpc\":9334,\"pubval\":48,\"p2shval\":5,\"wifval\":176,\"txfee_satoshis\":\"100000\",\"txhastimestamp\":0,\"minoutput\":10000,\"minconfirms\":2,\"genesishash\":\"12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2\",\"genesis\":{\"version\":1,\"timestamp\":1317972665,\"nBits\":\"1e0ffff0\",\"nonce\":2084524493,\"merkle_root\":\"97ddfbbae6be97fd6cdf3e7ca13232a3afff2353e29badfab7f73011edd4ced9\"},\"alertpubkey\":\"040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9\",\"protover\":70002}" +curl --url "http://127.0.0.1:7778" --data "{\"RELAY\":1,\"VALIDATE\":1,\"prefetchlag\":-1,\"poll\":10,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":8,\"endpend\":8,\"services\":129,\"maxpeers\":256,\"newcoin\":\"LTC\",\"name\":\"Litecoin\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"fbc0b6db\",\"p2p\":9333,\"rpc\":9334,\"pubval\":48,\"p2shval\":5,\"wifval\":176,\"txfee_satoshis\":\"100000\",\"isPoS\":0,\"minoutput\":10000,\"minconfirms\":2,\"genesishash\":\"12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2\",\"genesis\":{\"version\":1,\"timestamp\":1317972665,\"nBits\":\"1e0ffff0\",\"nonce\":2084524493,\"merkle_root\":\"97ddfbbae6be97fd6cdf3e7ca13232a3afff2353e29badfab7f73011edd4ced9\"},\"alertpubkey\":\"040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9\",\"protover\":70002}" diff --git a/iguana/coins/gensys b/iguana/coins/gensys index 83d51dec2..209e33213 100755 --- a/iguana/coins/gensys +++ b/iguana/coins/gensys @@ -1,2 +1,2 @@ -curl --url "http://127.0.0.1:7778" --data "{\"RELAY\":1,\"VALIDATE\":1,\"prefetchlag\":-1,\"poll\":10,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":18,\"endpend\":18,\"services\":129,\"maxpeers\":256,\"newcoin\":\"SYS\",\"name\":\"SYScoin\",\"hasheaders\":0,\"useaddmultisig\":0,\"netmagic\":\"f9beb4d9\",\"p2p\":8369,\"rpc\":8370,\"pubval\":0,\"p2shval\":5,\"wifval\":128,\"txfee_satoshis\":\"100000\",\"txhastimestamp\":0,\"minoutput\":10000,\"minconfirms\":2,\"genesishash\":\"0000072d66e51ab87de265765cc8bdd2d229a4307c672a1b3d5af692519cf765\",\"genesis\":{\"version\":1,\"timestamp\":1450473723,\"nBits\":\"1e0ffff0\",\"nonce\":5258726,\"merkle_root\":\"5215c5a2af9b63f2550b635eb2b354bb13645fd8fa31275394eb161944303065\"},\"protover\":70012,\"auxpow\":1}" +curl --url "http://127.0.0.1:7778" --data "{\"RELAY\":1,\"VALIDATE\":1,\"prefetchlag\":-1,\"poll\":10,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":18,\"endpend\":18,\"services\":129,\"maxpeers\":256,\"newcoin\":\"SYS\",\"name\":\"SYScoin\",\"hasheaders\":0,\"useaddmultisig\":0,\"netmagic\":\"f9beb4d9\",\"p2p\":8369,\"rpc\":8370,\"pubval\":0,\"p2shval\":5,\"wifval\":128,\"txfee_satoshis\":\"100000\",\"isPoS\":0,\"minoutput\":10000,\"minconfirms\":2,\"genesishash\":\"0000072d66e51ab87de265765cc8bdd2d229a4307c672a1b3d5af692519cf765\",\"genesis\":{\"version\":1,\"timestamp\":1450473723,\"nBits\":\"1e0ffff0\",\"nonce\":5258726,\"merkle_root\":\"5215c5a2af9b63f2550b635eb2b354bb13645fd8fa31275394eb161944303065\"},\"protover\":70012,\"auxpow\":1}" diff --git a/iguana/coins/genvpn b/iguana/coins/genvpn index faed7e94a..6c3ef4a23 100755 --- a/iguana/coins/genvpn +++ b/iguana/coins/genvpn @@ -1 +1 @@ - curl --url "http://127.0.0.1:7778" --data "{\"RELAY\":1,\"VALIDATE\":1,\"prefetchlag\":-1,\"poll\":10,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":8,\"endpend\":8,\"services\":129,\"maxpeers\":256,\"newcoin\":\"VPN\",\"name\":\"VPNcoin\",\"hasheaders\":1,\"useaddmultisig\":0,\"txhastimestamp\":1,\"minoutput\":10000,\"minconfirms\":2,\"txfee_satoshis\":\"10000\",\"genesishash\":\"00000ac7d764e7119da60d3c832b1d4458da9bc9ef9d5dd0d91a15f690a46d99\",\"genesis\":{\"version\":1,\"timestamp\":1409839200,\"nBits\":\"1e0fffff\",\"nonce\":64881664,\"merkle_root\":\"698a93a1cacd495a7a4fb3864ad8d06ed4421dedbc57f9aaad733ea53b1b5828\"},\"protover\":70002,\"netmagic\":\"fbc0b6db\",\"p2p\":1920,\"rpc\":1921,\"pubval\":71,\"p2shval\":5,\"wifval\":199}" + curl --url "http://127.0.0.1:7778" --data "{\"RELAY\":1,\"VALIDATE\":1,\"prefetchlag\":-1,\"poll\":10,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":8,\"endpend\":8,\"services\":129,\"maxpeers\":256,\"newcoin\":\"VPN\",\"name\":\"VPNcoin\",\"hasheaders\":1,\"useaddmultisig\":0,\"isPoS\":1,\"minoutput\":10000,\"minconfirms\":2,\"txfee_satoshis\":\"10000\",\"genesishash\":\"00000ac7d764e7119da60d3c832b1d4458da9bc9ef9d5dd0d91a15f690a46d99\",\"genesis\":{\"version\":1,\"timestamp\":1409839200,\"nBits\":\"1e0fffff\",\"nonce\":64881664,\"merkle_root\":\"698a93a1cacd495a7a4fb3864ad8d06ed4421dedbc57f9aaad733ea53b1b5828\"},\"protover\":70002,\"netmagic\":\"fbc0b6db\",\"p2p\":1920,\"rpc\":1921,\"pubval\":71,\"p2shval\":5,\"wifval\":199}" diff --git a/iguana/coins/ltc b/iguana/coins/ltc index e6cfcc87d..ae7dc09ba 100755 --- a/iguana/coins/ltc +++ b/iguana/coins/ltc @@ -1,2 +1,2 @@ -curl --url "http://127.0.0.1:7778" --data "{\"RELAY\":0,\"VALIDATE\":0,\"prefetchlag\":11,\"poll\":100,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":1,\"endpend\":1,\"services\":128,\"maxpeers\":16,\"newcoin\":\"LTC\",\"name\":\"Litecoin\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"fbc0b6db\",\"p2p\":9333,\"rpc\":9334,\"pubval\":48,\"p2shval\":5,\"wifval\":176,\"txfee_satoshis\":\"100000\",\"txhastimestamp\":0,\"minoutput\":10000,\"minconfirms\":2,\"genesishash\":\"12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2\",\"genesis\":{\"version\":1,\"timestamp\":1317972665,\"nBits\":\"1e0ffff0\",\"nonce\":2084524493,\"merkle_root\":\"97ddfbbae6be97fd6cdf3e7ca13232a3afff2353e29badfab7f73011edd4ced9\"},\"alertpubkey\":\"040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9\",\"protover\":70002}" +curl --url "http://127.0.0.1:7778" --data "{\"RELAY\":0,\"VALIDATE\":0,\"prefetchlag\":11,\"poll\":100,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":1,\"endpend\":1,\"services\":128,\"maxpeers\":16,\"newcoin\":\"LTC\",\"name\":\"Litecoin\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"fbc0b6db\",\"p2p\":9333,\"rpc\":9334,\"pubval\":48,\"p2shval\":5,\"wifval\":176,\"txfee_satoshis\":\"100000\",\"isPoS\":0,\"minoutput\":10000,\"minconfirms\":2,\"genesishash\":\"12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2\",\"genesis\":{\"version\":1,\"timestamp\":1317972665,\"nBits\":\"1e0ffff0\",\"nonce\":2084524493,\"merkle_root\":\"97ddfbbae6be97fd6cdf3e7ca13232a3afff2353e29badfab7f73011edd4ced9\"},\"alertpubkey\":\"040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9\",\"protover\":70002}" diff --git a/iguana/coins/sys b/iguana/coins/sys index 0b9abc4d5..7b3afa4b7 100755 --- a/iguana/coins/sys +++ b/iguana/coins/sys @@ -1,2 +1,2 @@ -curl --url "http://127.0.0.1:7778" --data "{\"RELAY\":0,\"VALIDATE\":0,\"prefetchlag\":11,\"poll\":100,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":64,\"endpend\":64,\"services\":128,\"maxpeers\":256,\"newcoin\":\"SYS\",\"name\":\"SYScoin\",\"hasheaders\":0,\"useaddmultisig\":0,\"netmagic\":\"f9beb4d9\",\"p2p\":8369,\"rpc\":8370,\"pubval\":0,\"p2shval\":5,\"wifval\":128,\"txfee_satoshis\":\"100000\",\"txhastimestamp\":0,\"minoutput\":10000,\"minconfirms\":2,\"genesishash\":\"0000072d66e51ab87de265765cc8bdd2d229a4307c672a1b3d5af692519cf765\",\"genesis\":{\"version\":1,\"timestamp\":1450473723,\"nBits\":\"1e0ffff0\",\"nonce\":5258726,\"merkle_root\":\"5215c5a2af9b63f2550b635eb2b354bb13645fd8fa31275394eb161944303065\"},\"protover\":70012,\"auxpow\":1}" +curl --url "http://127.0.0.1:7778" --data "{\"RELAY\":0,\"VALIDATE\":0,\"prefetchlag\":11,\"poll\":100,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":64,\"endpend\":64,\"services\":128,\"maxpeers\":256,\"newcoin\":\"SYS\",\"name\":\"SYScoin\",\"hasheaders\":0,\"useaddmultisig\":0,\"netmagic\":\"f9beb4d9\",\"p2p\":8369,\"rpc\":8370,\"pubval\":0,\"p2shval\":5,\"wifval\":128,\"txfee_satoshis\":\"100000\",\"isPoS\":0,\"minoutput\":10000,\"minconfirms\":2,\"genesishash\":\"0000072d66e51ab87de265765cc8bdd2d229a4307c672a1b3d5af692519cf765\",\"genesis\":{\"version\":1,\"timestamp\":1450473723,\"nBits\":\"1e0ffff0\",\"nonce\":5258726,\"merkle_root\":\"5215c5a2af9b63f2550b635eb2b354bb13645fd8fa31275394eb161944303065\"},\"protover\":70012,\"auxpow\":1}" diff --git a/iguana/confs/BTCD_hdrs.h b/iguana/confs/BTCD_hdrs.h deleted file mode 100644 index 876c1cbf9..000000000 --- a/iguana/confs/BTCD_hdrs.h +++ /dev/null @@ -1,4 +0,0 @@ - -char *BTCD_hdrs[][4] = { - { "0", "0000044966f40703b516c5af180582d53f783bfd319bb045e2dc3e05ea695d46", "a5d211145f8e6ba0920b2893d307c5d7c207ae0800a80955299678d1706ea8ac", "000000000c4682089c916de89eb080a877566494d4009c0089baf35fe94de22f"}, -}; \ No newline at end of file diff --git a/iguana/confs/BTCD_peers.txt b/iguana/confs/BTCD_peers.txt old mode 100755 new mode 100644 index b38f61f7a..cb4ad81f0 --- a/iguana/confs/BTCD_peers.txt +++ b/iguana/confs/BTCD_peers.txt @@ -1,61 +1,35 @@ -148.251.68.48 -5.9.102.210 -89.248.160.236 -89.248.160.237 -89.248.160.238 -89.248.160.239 -89.248.160.240 -89.248.160.241 -89.248.160.242 -89.248.160.243 -89.248.160.244 -89.248.160.245 -78.47.58.62 -67.212.70.88 -94.102.50.69 -50.179.58.158 -194.135.94.30 -109.236.85.42 -104.236.127.154 -68.45.147.145 -37.59.14.7 -78.47.115.250 -188.40.138.8 -62.75.143.120 -82.241.71.230 -217.23.6.2 -73.28.172.128 -45.55.149.34 -192.0.242.54 -81.181.155.53 -91.66.185.97 +162.210.92.46 85.25.217.233 -144.76.239.66 -95.80.9.112 -80.162.193.118 173.65.129.85 -2.26.173.58 -78.14.250.69 -188.226.253.77 -58.107.67.39 -124.191.37.212 -176.226.137.238 -69.145.25.85 -24.168.14.28 -73.201.180.47 -76.188.171.53 -63.247.147.166 -121.108.241.247 -36.74.36.125 -106.186.119.171 -188.166.91.37 -223.134.228.208 -89.248.160.244 -178.33.209.212 -71.53.156.38 -88.198.10.165 -24.117.221.0 -74.14.104.57 -158.69.27.82 +176.9.13.13 +88.198.15.19 +78.47.58.62 +51.255.38.28 110.174.129.213 -75.130.163.51 +178.62.185.131 +88.110.115.93 +45.55.149.34 +2.239.61.146 +82.8.59.60 +77.123.252.71 +71.1.13.122 +89.212.19.49 +90.154.170.235 +100.3.29.33 +5.9.20.83 +5.147.161.160 +72.133.226.130 +2.26.169.114 +81.181.155.180 +24.168.17.50 +156.57.141.221 +92.26.172.201 +151.80.206.105 +96.41.29.70 +68.43.220.127 +73.211.90.130 +71.53.153.7 +68.45.147.145 +110.200.66.172 +89.248.160.241 +69.243.23.0 diff --git a/iguana/iguana777.c b/iguana/iguana777.c index 2bf2fd20c..874e6fe92 100755 --- a/iguana/iguana777.c +++ b/iguana/iguana777.c @@ -787,7 +787,7 @@ void iguana_coinargs(char *symbol,int64_t *maxrecvcachep,int32_t *minconfirmsp,i *servicesp = j64bits(json,"services"); } -struct iguana_info *iguana_setcoin(char *symbol,void *launched,int32_t maxpeers,int64_t maxrecvcache,uint64_t services,int32_t initialheight,int32_t maphash,int32_t minconfirms,int32_t maxrequests,int32_t maxbundles,cJSON *json) +struct iguana_info *iguana_setcoin(struct supernet_info *myinfo,char *symbol,void *launched,int32_t maxpeers,int64_t maxrecvcache,uint64_t services,int32_t initialheight,int32_t maphash,int32_t minconfirms,int32_t maxrequests,int32_t maxbundles,cJSON *json) { struct iguana_chain *iguana_createchain(cJSON *json); struct iguana_info *coin; int32_t j,m,mult,maxval,mapflags; char dirname[512]; cJSON *peers; @@ -888,6 +888,8 @@ struct iguana_info *iguana_setcoin(char *symbol,void *launched,int32_t maxpeers, if ( jobj(json,"VALIDATE") != 0 ) coin->VALIDATENODE = juint(json,"VALIDATE"); else coin->VALIDATENODE = 1; + if ( coin->VALIDATENODE != 0 || coin->RELAYNODE != 0 ) + myinfo->IAMRELAY = 1; #ifdef __PNACL coin->VALIDATENODE = coin->RELAYNODE = 0; #endif @@ -927,7 +929,7 @@ int32_t iguana_launchcoin(struct supernet_info *myinfo,char *symbol,cJSON *json) else maphash = 0; iguana_coinargs(symbol,&maxrecvcache,&minconfirms,&maxpeers,&initialheight,&services,&maxrequests,&maxbundles,json); coins = mycalloc('A',1+1,sizeof(*coins)); - if ( (coin= iguana_setcoin(symbol,coins,maxpeers,maxrecvcache,services,initialheight,maphash,minconfirms,maxrequests,maxbundles,json)) != 0 ) + if ( (coin= iguana_setcoin(myinfo,symbol,coins,maxpeers,maxrecvcache,services,initialheight,maphash,minconfirms,maxrequests,maxbundles,json)) != 0 ) { coins[0] = (void *)((long)1); coins[1] = coin; @@ -951,7 +953,8 @@ void iguana_coins(void *arg) { struct iguana_info **coins,*coin; char *jsonstr,*symbol; cJSON *array,*item,*json; int32_t i,n,maxpeers,maphash,initialheight,minconfirms,maxrequests,maxbundles; - int64_t maxrecvcache; uint64_t services; struct vin_info V; + int64_t maxrecvcache; uint64_t services; struct vin_info V; struct supernet_info *myinfo; + myinfo = SuperNET_MYINFO(0); memset(&V,0,sizeof(V)); if ( (jsonstr= arg) != 0 && (json= cJSON_Parse(jsonstr)) != 0 ) { @@ -960,7 +963,7 @@ void iguana_coins(void *arg) if ( (symbol= jstr(json,"coin")) != 0 && strncmp(symbol,"BTC",3) == 0 ) { coins = mycalloc('A',1+1,sizeof(*coins)); - if ( (coins[1]= iguana_setcoin(symbol,coins,0,0,0,0,0,0,0,0,json)) != 0 ) + if ( (coins[1]= iguana_setcoin(myinfo,symbol,coins,0,0,0,0,0,0,0,0,json)) != 0 ) { _iguana_calcrmd160(coins[1],&V); coins[0] = (void *)((long)1); @@ -988,7 +991,7 @@ void iguana_coins(void *arg) continue; } iguana_coinargs(symbol,&maxrecvcache,&minconfirms,&maxpeers,&initialheight,&services,&maxrequests,&maxbundles,item); - coins[1 + i] = coin = iguana_setcoin(symbol,coins,maxpeers,maxrecvcache,services,initialheight,maphash,minconfirms,maxrequests,maxbundles,item); + coins[1 + i] = coin = iguana_setcoin(myinfo,symbol,coins,maxpeers,maxrecvcache,services,initialheight,maphash,minconfirms,maxrequests,maxbundles,item); if ( coin == 0 ) { printf("iguana_coins: couldnt initialize.(%s)\n",symbol); diff --git a/iguana/iguana777.h b/iguana/iguana777.h index 0b03a189b..b83ed6895 100755 --- a/iguana/iguana777.h +++ b/iguana/iguana777.h @@ -450,7 +450,7 @@ struct iguana_peer char ipaddr[64],lastcommand[16],coinstr[16],symbol[16]; uint64_t pingnonce,totalsent,totalrecv,ipbits; double pingtime,sendmillis,pingsum,getdatamillis; uint32_t lastcontact,sendtime,ready,startsend,startrecv,pending,lastgotaddr,lastblockrecv,pendtime,lastflush,lastpoll,myipbits,persistent_peer,protover; - int32_t supernet,dead,addrind,usock,lastheight,relayflag,numpackets,numpings,ipv6,height,rank,pendhdrs,pendblocks,recvhdrs,lastlefti,validpub,othervalid,dirty[2],laggard,headerserror; + int32_t supernet,basilisk,dead,addrind,usock,lastheight,relayflag,numpackets,numpings,ipv6,height,rank,pendhdrs,pendblocks,recvhdrs,lastlefti,validpub,othervalid,dirty[2],laggard,headerserror; double recvblocks,recvtotal; int64_t allocated,freed; bits256 RThashes[IGUANA_MAXBUNDLESIZE]; int32_t numRThashes; diff --git a/iguana/iguana_accept.c b/iguana/iguana_accept.c index 5b0aedf71..c46b711e6 100755 --- a/iguana/iguana_accept.c +++ b/iguana/iguana_accept.c @@ -370,7 +370,7 @@ int32_t iguana_peeraddrrequest(struct iguana_info *coin,struct iguana_peer *addr ((uint8_t *)&tmp.A.port)[0] = ((uint8_t *)&coin->chain->portp2p)[1]; ((uint8_t *)&tmp.A.port)[1] = ((uint8_t *)&coin->chain->portp2p)[0]; } - printf("(%s:%02x%02x).%04x ",ipaddr,((uint8_t *)&tmp.A.port)[0],((uint8_t *)&tmp.A.port)[1],(int32_t)tmp.protover); + //printf("(%s:%02x%02x).%04x ",ipaddr,((uint8_t *)&tmp.A.port)[0],((uint8_t *)&tmp.A.port)[1],(int32_t)tmp.protover); sendlen += iguana_rwaddr(1,&space[sendlen],&tmp.A,CADDR_TIME_VERSION); x++; if ( x == 0xf8 ) @@ -381,7 +381,7 @@ int32_t iguana_peeraddrrequest(struct iguana_info *coin,struct iguana_peer *addr iguana_rwvarint(1,space,&x); //for (i=0; iramchainport = chain->portp2p - 1; if ( (chain->rpcport= juint(argjson,"rpc")) == 0 ) chain->rpcport = chain->portp2p + 1; - if ( jobj(argjson,"txhastimestamp") != 0 ) - chain->hastimestamp = juint(argjson,"txhastimestamp"); + if ( jobj(argjson,"isPoS") != 0 ) + chain->hastimestamp = juint(argjson,"isPoS"); else if ( jobj(argjson,"oldtx_format") != 0 ) chain->hastimestamp = !juint(argjson,"oldtx_format"); + else if ( jobj(argjson,"txhastimestamp") != 0 ) + chain->hastimestamp = !juint(argjson,"txhastimestamp"); if ( jstr(argjson,"userhome") != 0 ) strcpy(chain->userhome,jstr(argjson,"userhome")); else strcpy(chain->userhome,Userhome); diff --git a/iguana/iguana_msg.c b/iguana/iguana_msg.c index 3f5a888b6..c48101b09 100755 --- a/iguana/iguana_msg.c +++ b/iguana/iguana_msg.c @@ -248,7 +248,11 @@ void iguana_gotversion(struct iguana_info *coin,struct iguana_peer *addr,struct { uint8_t serialized[sizeof(struct iguana_msghdr)]; //printf("gotversion from %s: starting height.%d services.%llx proto.%d\n",addr->ipaddr,vers->nStartingHeight,(long long)vers->nServices,vers->nVersion); - if ( (vers->nServices & NODE_NETWORK) != 0 )//&& vers->nonce != coin->instance_nonce ) + if ( strncmp(vers->strSubVer,"/iguana",strlen("/iguana")) == 0 ) + addr->supernet = 1, addr->basilisk = 0; + else if ( strncmp(vers->strSubVer,"/basilisk",strlen("/basilisk")) == 0 ) + addr->basilisk = 1, addr->supernet = 0; + if ( (vers->nServices & NODE_NETWORK) != 0 ) { addr->protover = (vers->nVersion < PROTOCOL_VERSION) ? vers->nVersion : PROTOCOL_VERSION; //printf("(%s) proto.%d -> %d\n",addr->ipaddr,vers->nVersion,addr->protover); @@ -259,11 +263,9 @@ void iguana_gotversion(struct iguana_info *coin,struct iguana_peer *addr,struct iguana_queue_send(addr,0,serialized,"verack",0); //iguana_send_ping(coin,addr); } - else if ( (vers->nServices & (1<<7)) == 0 ) + else if ( addr->supernet == 0 || (coin->RELAYNODE == 0 && coin->VALIDATENODE == 0) ) addr->dead = (uint32_t)time(NULL); - if ( (vers->nServices & (1<<7)) == (1<<7) ) - addr->supernet = 1; - if ( addr->supernet != 0 ) + if ( addr->supernet != 0 || addr->basilisk != 0 ) printf("height.%d nServices.%lld nonce.%llu %srelay node.(%s) supernet.%d\n",vers->nStartingHeight,(long long)vers->nServices,(long long)vers->nonce,addr->relayflag==0?"non-":"",addr->ipaddr,addr->supernet); if ( (int32_t)vers->nStartingHeight > coin->longestchain ) { @@ -281,7 +283,7 @@ int32_t iguana_send_version(struct iguana_info *coin,struct iguana_peer *addr,ui int32_t len; struct iguana_msgversion msg; uint8_t serialized[sizeof(struct iguana_msghdr)+sizeof(msg)]; memset(&msg,0,sizeof(msg)); msg.nVersion = PROTOCOL_VERSION; - msg.nServices = myservices; + msg.nServices = (myservices & NODE_NETWORK); msg.nTime = (int64_t)time(NULL); msg.nonce = coin->instance_nonce; if ( coin->RELAYNODE != 0 || coin->VALIDATENODE != 0 ) @@ -299,15 +301,27 @@ int32_t iguana_send_VPNversion(struct iguana_info *coin,struct iguana_peer *addr int32_t len; struct iguana_VPNversion msg; uint8_t serialized[sizeof(struct iguana_msghdr)+sizeof(msg)]; memset(&msg,0,sizeof(msg)); msg.nVersion = PROTOCOL_VERSION; - msg.nServices = myservices; + msg.nServices = (myservices & NODE_NETWORK); msg.nTime = (int64_t)time(NULL); msg.nonce = 0;//coin->instance_nonce; - sprintf(msg.strSubVer,"/Satoshi:0.11.99/"); + if ( coin->RELAYNODE != 0 || coin->VALIDATENODE != 0 ) + sprintf(msg.strSubVer,"/iguana 0.00/"); + else sprintf(msg.strSubVer,"/basilisk 0.00/"); msg.nStartingHeight = coin->blocks.hwmchain.height; len = iguana_rwversion(1,&serialized[sizeof(struct iguana_msghdr)],(void *)&msg,addr->ipaddr,117); return(iguana_queue_send(addr,0,serialized,"version",len)); } +void iguana_supernet_ping(struct iguana_peer *addr) +{ + if ( addr->supernet != 0 || addr->basilisk != 0 ) + { + //printf("send getpeers to %s\n",addr->ipaddr); + printf("maybe send basilisk ping here?\n"); + //iguana_send_supernet(addr,SUPERNET_GETPEERSTR,0); + } +} + void iguana_gotverack(struct iguana_info *coin,struct iguana_peer *addr) { uint8_t serialized[sizeof(struct iguana_msghdr)]; @@ -316,11 +330,7 @@ void iguana_gotverack(struct iguana_info *coin,struct iguana_peer *addr) //printf("gotverack from %s\n",addr->ipaddr); addr->A.nTime = (uint32_t)time(NULL); iguana_queue_send(addr,0,serialized,"getaddr",0); - if ( addr->supernet != 0 ) - { - //printf("send getpeers to %s\n",addr->ipaddr); - iguana_send_supernet(addr,SUPERNET_GETPEERSTR,0); - } + iguana_supernet_ping(addr); } } @@ -351,10 +361,7 @@ void iguana_gotping(struct iguana_info *coin,struct iguana_peer *addr,uint64_t n if ( memcmp(data,&serialized[sizeof(struct iguana_msghdr)],sizeof(nonce)) != 0 ) printf("ping ser error %llx != %llx\n",(long long)nonce,*(long long *)data); iguana_queue_send(addr,0,serialized,"pong",len); - if ( addr->supernet != 0 ) - { - iguana_send_supernet(addr,SUPERNET_GETPEERSTR,0); - } + iguana_supernet_ping(addr); } int32_t iguana_send_ping(struct iguana_info *coin,struct iguana_peer *addr) @@ -369,8 +376,7 @@ int32_t iguana_send_ping(struct iguana_info *coin,struct iguana_peer *addr) //printf("pingnonce.%llx from (%s)\n",(long long)nonce,addr->ipaddr); iguana_queue_send(addr,0,serialized,"getaddr",0); len = iguana_rwnum(1,&serialized[sizeof(struct iguana_msghdr)],sizeof(uint64_t),&nonce); - if ( addr->supernet != 0 ) - iguana_send_supernet(addr,SUPERNET_GETPEERSTR,0); + iguana_supernet_ping(addr); return(iguana_queue_send(addr,0,serialized,"ping",len)); } @@ -673,11 +679,14 @@ int32_t iguana_msgparser(struct iguana_info *coin,struct iguana_peer *addr,struc uint8_t serialized[16384]; char *ipaddr; struct supernet_info *myinfo = SuperNET_MYINFO(0); int32_t i,n,retval=-1,ishost,delay=0,srvmsg,bloom,sendlen=0,intvectors,len= -100; uint64_t nonce,x; bits256 hash2; bloom = intvectors = srvmsg = -1; - if ( strncmp(H->command,"SuperNET",strlen("SuperNET")) == 0 || strncmp(H->command,"SuperNet",strlen("SuperNet")) == 0 ) + if ( strncmp(H->command+1,"uperNET",strlen("uperNET")) == 0 || strncmp(H->command,"uperNet",strlen("uperNet")) == 0 ) { if ( addr != 0 ) { - addr->supernet = 1; + if ( H->command[0] == 'S' ) + addr->supernet = 1, addr->basilisk = 0; + else if ( H->command[0] == 's' ) + addr->basilisk = 1, addr->supernet = 0; ipaddr = addr->ipaddr; } else ipaddr = 0; len = recvlen; diff --git a/iguana/iguana_peers.c b/iguana/iguana_peers.c index 17cc86ce0..9bb0cce41 100755 --- a/iguana/iguana_peers.c +++ b/iguana/iguana_peers.c @@ -20,8 +20,12 @@ struct iguana_iAddr *iguana_iAddrhashfind(struct iguana_info *coin,uint64_t ipbi int32_t iguana_validatehdr(char *symbol,struct iguana_msghdr *H) { - int32_t i = 0,valid=0,len = -1; - if ( strcmp(symbol,"VPN") == 0 || strncmp("SuperNET",H->command,strlen("SuperNET")) == 0 ) + int32_t i = 0,valid=0,len = -1; char cmdstr[16]; + memcpy(cmdstr,H->command,sizeof(H->command)); + cmdstr[0] = toupper(cmdstr[0]); + cmdstr[6] = toupper(cmdstr[6]); + cmdstr[7] = toupper(cmdstr[7]); + if ( strcmp(symbol,"VPN") == 0 || strncmp("SuperNET",cmdstr,strlen("SuperNET")) == 0 ) valid = 1; else { @@ -419,7 +423,7 @@ int32_t iguana_send(struct iguana_info *coin,struct iguana_peer *addr,uint8_t *s return(-1); } remains = len; - if ( strncmp(cmdstr,"SuperNET",strlen("SuperNET")) == 0 || strncmp(cmdstr,"SuperNet",strlen("SuperNet")) == 0 ) + if ( strncmp(cmdstr+1,"uperNET",strlen("uperNET")) == 0 || strncmp(cmdstr+1,"uperNet",strlen("uperNet")) == 0 ) { printf(" >>>>>>> send.(%s) %d bytes to %s:%u supernet.%d\n",cmdstr,len,addr->ipaddr,addr->A.port,addr->supernet); } diff --git a/iguana/main.c b/iguana/main.c index 125bf6e0e..2297e0b09 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -53,7 +53,7 @@ int32_t myfclose(FILE *fp) // ALL globals must be here! char *Iguana_validcommands[] = { - "SuperNET", "inv2", "getdata2", "ConnectTo", + "inv2", "getdata2", "ConnectTo", "version", "verack", "getaddr", "addr", "inv", "getdata", "notfound", "getblocks", "getheaders", "headers", "tx", "block", "mempool", "ping", "pong", "reject", "filterload", "filteradd", "filterclear", "merkleblock", "alert", "" }; @@ -343,32 +343,33 @@ char *SuperNET_processJSON(struct supernet_info *myinfo,cJSON *json,char *remote void iguana_exit() { - int32_t i,j,iter; char *stopstr = SUPERNET_STOPSTR; + int32_t i,j,iter; printf("start EXIT\n"); for (iter=0; iter<3; iter++) { - for (i=0; ipeers.active[j].usock >= 0 && Coins[i]->peers.active[j].supernet != 0 ) - iguana_send_supernet(&Coins[i]->peers.active[j],stopstr,0); - break; - case 1: Coins[i]->peers.active[j].dead = (uint32_t)time(NULL); break; - case 2: - if ( Coins[i]->peers.active[j].usock >= 0 ) - closesocket(Coins[i]->peers.active[j].usock); - break; + switch ( iter ) + { + case 1: Coins[i]->peers.active[j].dead = (uint32_t)time(NULL); break; + case 2: + if ( Coins[i]->peers.active[j].usock >= 0 ) + closesocket(Coins[i]->peers.active[j].usock); + break; + } } } } } - sleep(5); + sleep(3); } printf("sockets closed, now EXIT\n"); exit(0); diff --git a/iguana/pangea_api.c b/iguana/pangea_api.c index 13718ba62..f33203b1a 100755 --- a/iguana/pangea_api.c +++ b/iguana/pangea_api.c @@ -294,8 +294,8 @@ void pangea_sendcmd(struct supernet_info *myinfo,struct table_info *tp,char *cmd } else if ( (p= tp->active[destplayer]) != 0 ) { - if ( (str= SuperNET_DHTsend(myinfo,p->ipbits,tp->G.gamehash,tp->G.tablehash,hexstr,0,0,plaintext)) != 0 ) - free(str); + //if ( (str= SuperNET_DHTsend(myinfo,p->ipbits,tp->G.gamehash,tp->G.tablehash,hexstr,0,0,plaintext)) != 0 ) + // free(str); } if ( loopback != 0 ) { diff --git a/iguana/pangea_summary.c b/iguana/pangea_summary.c index 864ea5676..6bd05741b 100755 --- a/iguana/pangea_summary.c +++ b/iguana/pangea_summary.c @@ -126,10 +126,10 @@ cJSON *pangea_handitem(int32_t *cardip,cJSON **pitemp,uint8_t type,uint64_t valA int32_t pangea_parsesummary(uint8_t *typep,uint64_t *valAp,uint64_t *bits64p,bits256 *cardp,uint8_t *summary,int32_t len) { - int32_t handid; uint16_t cardi_player; uint32_t changes=0; uint8_t player; + //int32_t handid; uint16_t cardi_player; uint32_t changes=0; uint8_t player; *bits64p = 0; memset(cardp,0,sizeof(*cardp)); - len += SuperNET_copybits(1,&summary[len],(void *)typep,sizeof(*typep)); + /*len += SuperNET_copybits(1,&summary[len],(void *)typep,sizeof(*typep)); if ( *typep == 0 ) { printf("len.%d type.%d [%d]\n",len,*typep,summary[len-1]); @@ -152,7 +152,7 @@ int32_t pangea_parsesummary(uint8_t *typep,uint64_t *valAp,uint64_t *bits64p,bit len += SuperNET_copybits(1,&summary[len],(void *)bits64p,sizeof(*bits64p) * CARDS777_MAXPLAYERS); else if ( *typep == CARDS777_CHANGES ) len += SuperNET_copybits(1,&summary[len],(void *)bits64p,sizeof(*bits64p) * (changes & 0xf)); - else len += SuperNET_copybits(1,&summary[len],(void *)bits64p,sizeof(*bits64p)); + else len += SuperNET_copybits(1,&summary[len],(void *)bits64p,sizeof(*bits64p));*/ return(len); } @@ -218,14 +218,14 @@ char *pangea_dispsummary(struct supernet_info *myinfo,struct table_info *tp,int3 void pangea_summaryadd(struct supernet_info *myinfo,struct table_info *tp,uint8_t type,void *arg0,int32_t size0,void *arg1,int32_t size1) { - uint64_t valA,bits64[CARDS777_MAXPLAYERS + (CARDS777_MAXCARDS+1)*4]; - bits256 card; uint8_t checktype; int32_t len,startlen = tp->summarysize; + //uint64_t valA,bits64[CARDS777_MAXPLAYERS + (CARDS777_MAXCARDS+1)*4]; + //bits256 card; uint8_t checktype; int32_t len,startlen = tp->summarysize; if ( type == 0 ) { printf("type.0\n"); getchar(); } //printf("summarysize.%d type.%d [%02x %02x]\n",dp->summarysize,type,*(uint8_t *)arg0,*(uint8_t *)arg1); - tp->summarysize += SuperNET_copybits(0,&tp->summary[tp->summarysize],(void *)&type,sizeof(type)); + /*tp->summarysize += SuperNET_copybits(0,&tp->summary[tp->summarysize],(void *)&type,sizeof(type)); //printf("-> %d\n",tp->summary[tp->summarysize-1]); tp->summarysize += SuperNET_copybits(0,&tp->summary[tp->summarysize],arg0,size0); tp->summarysize += SuperNET_copybits(0,&tp->summary[tp->summarysize],arg1,size1); @@ -236,7 +236,7 @@ void pangea_summaryadd(struct supernet_info *myinfo,struct table_info *tp,uint8_ if ( card.txid != 0 && memcmp(card.bytes,arg1,sizeof(card)) != 0 ) printf("pangea_summary: parse error card mismatch %llx != %llx\n",(long long)card.txid,*(long long *)arg1); else if ( card.txid == 0 && memcmp(arg1,bits64,size1) != 0 ) - printf("pangea_summary: parse error bits64 %llx != %llx\n",(long long)bits64[0],*(long long *)arg0); + printf("pangea_summary: parse error bits64 %llx != %llx\n",(long long)bits64[0],*(long long *)arg0);*/ /*if ( 1 && hn->client->H.slot == pangea_slotA(tp->table) ) { if ( (item= pangea_handitem(&cardi,&pitem,type,valA,bits64,card,tp->G.N)) != 0 ) diff --git a/iguana/tests/get b/iguana/tests/get new file mode 100755 index 000000000..494783708 --- /dev/null +++ b/iguana/tests/get @@ -0,0 +1 @@ +curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"basilisk\",\"method\":\"getfield\"}" diff --git a/iguana/tests/pub b/iguana/tests/pub new file mode 100755 index 000000000..fcea54b8e --- /dev/null +++ b/iguana/tests/pub @@ -0,0 +1 @@ +curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"basilisk\",\"method\":\"publish\",\"vals\":{\"testfield\":\"test\"},\"hexstr\":\"deadbeef\"}" diff --git a/iguana/tests/set b/iguana/tests/set new file mode 100755 index 000000000..be5fe318e --- /dev/null +++ b/iguana/tests/set @@ -0,0 +1 @@ +curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"basilisk\",\"method\":\"setfield\",\"vals\":{\"setfield\":\"setthis\"},\"hexstr\":\"beefdead\"}" diff --git a/includes/iguana_apideclares.h b/includes/iguana_apideclares.h index 6a06fbd1e..870b508bf 100755 --- a/includes/iguana_apideclares.h +++ b/includes/iguana_apideclares.h @@ -19,6 +19,22 @@ INT_ARRAY_STRING(basilisk,rawtx,basilisktag,vals,activecoin); INT_ARRAY_STRING(basilisk,value,basilisktag,vals,activecoin); INT_AND_ARRAY(basilisk,result,basilisktag,vals); +HASH_ARRAY_STRING(basilisk,addrelay,pubkey,vals,hexstr); +HASH_ARRAY_STRING(basilisk,dispatch,pubkey,vals,hexstr); +HASH_ARRAY_STRING(basilisk,publish,pubkey,vals,hexstr); +HASH_ARRAY_STRING(basilisk,subscribe,pubkey,vals,hexstr); +HASH_ARRAY_STRING(basilisk,setfield,pubkey,vals,hexstr); +HASH_ARRAY_STRING(basilisk,getfield,pubkey,vals,hexstr); +HASH_ARRAY_STRING(basilisk,forward,pubkey,vals,hexstr); +HASH_ARRAY_STRING(basilisk,mailbox,pubkey,vals,hexstr); + +HASH_ARRAY_STRING(basilisk,VPNcreate,pubkey,vals,hexstr); +HASH_ARRAY_STRING(basilisk,VPNjoin,pubkey,vals,hexstr); +HASH_ARRAY_STRING(basilisk,VPNmessage,pubkey,vals,hexstr); +HASH_ARRAY_STRING(basilisk,VPNbroadcast,pubkey,vals,hexstr); +HASH_ARRAY_STRING(basilisk,VPNreceive,pubkey,vals,hexstr); +HASH_ARRAY_STRING(basilisk,VPNlogout,pubkey,vals,hexstr); + ZERO_ARGS(bitcoinrpc,getinfo); ZERO_ARGS(bitcoinrpc,getblockcount); ZERO_ARGS(bitcoinrpc,getbestblockhash); @@ -183,7 +199,7 @@ THREE_STRINGS(SuperNET,encryptjson,password,permanentfile,payload); TWO_STRINGS(SuperNET,decryptjson,password,permanentfile); TWO_STRINGS(SuperNET,html,agentform,htmlfile); -TWOSTRINGS_AND_TWOHASHES_AND_TWOINTS(SuperNET,DHT,hexmsg,destip,categoryhash,subhash,maxdelay,broadcast); +//TWOSTRINGS_AND_TWOHASHES_AND_TWOINTS(SuperNET,DHT,hexmsg,destip,categoryhash,subhash,maxdelay,broadcast); THREE_STRINGS(SuperNET,rosetta,passphrase,pin,showprivkey); ZERO_ARGS(SuperNET,keypair);