Browse Source

Test

etomic
jl777 8 years ago
parent
commit
a393381bf4
  1. 4
      basilisk/basilisk.c
  2. 10
      basilisk/basilisk_bitcoin.c
  3. 270
      basilisk/jumblr.c
  4. 2
      crypto777/iguana_utils.c
  5. 2
      iguana/coins/genbtc
  6. 6
      iguana/iguana_payments.c
  7. 2
      iguana/tests/dexgetO
  8. 2
      includes/iguana_funcs.h
  9. 2
      includes/iguana_globals.h
  10. 8
      includes/iguana_structs.h

4
basilisk/basilisk.c

@ -1603,7 +1603,7 @@ TWO_STRINGS(basilisk,refresh,symbol,address)
STRING_ARRAY_OBJ_STRING(basilisk,utxorawtx,symbol,utxos,vals,ignore)
{
char *destaddr,*changeaddr; uint64_t satoshis,txfee; int32_t completed,sendflag,timelock;
char *destaddr,*changeaddr; int64_t satoshis,txfee; int32_t completed,sendflag,timelock;
timelock = jint(vals,"timelock");
sendflag = jint(vals,"sendflag");
satoshis = jdouble(vals,"amount") * SATOSHIDEN;
@ -1612,7 +1612,7 @@ STRING_ARRAY_OBJ_STRING(basilisk,utxorawtx,symbol,utxos,vals,ignore)
if ( destaddr != 0 && changeaddr != 0 && symbol != 0 && (coin= iguana_coinfind(symbol)) != 0 )
{
txfee = jdouble(vals,"txfee") * SATOSHIDEN;
return(iguana_utxorawtx(myinfo,coin,timelock,destaddr,changeaddr,satoshis,txfee,&completed,sendflag,utxos));
return(iguana_utxorawtx(myinfo,coin,timelock,destaddr,changeaddr,&satoshis,1,txfee,&completed,sendflag,utxos));
}
return(clonestr("{\"error\":\"invalid coin or address specified\"}"));
}

10
basilisk/basilisk_bitcoin.c

@ -658,9 +658,9 @@ int64_t iguana_verifytimelock(struct supernet_info *myinfo,struct iguana_info *c
} return(-2);
}
char *iguana_utxorawtx(struct supernet_info *myinfo,struct iguana_info *coin,int32_t timelock,char *destaddr,char *changeaddr,uint64_t satoshis,uint64_t txfee,int32_t *completedp,int32_t sendflag,cJSON *utxos)
char *iguana_utxorawtx(struct supernet_info *myinfo,struct iguana_info *coin,int32_t timelock,char *destaddr,char *changeaddr,int64_t *satoshis,int32_t numoutputs,uint64_t txfee,int32_t *completedp,int32_t sendflag,cJSON *utxos)
{
uint8_t script[35],p2shscript[128],rmd160[20],addrtype; bits256 txid; int32_t p2shlen,iter,spendlen; cJSON *retjson,*txcopy,*txobj=0,*vins=0; char *rawtx=0,*signedtx=0; uint32_t timelocked = 0;
uint8_t script[35],p2shscript[128],rmd160[20],addrtype; bits256 txid; int32_t i,p2shlen,iter,spendlen; cJSON *retjson,*txcopy,*txobj=0,*vins=0; char *rawtx=0,*signedtx=0; uint32_t timelocked = 0;
*completedp = 0;
if ( iguana_addressvalidate(coin,&addrtype,destaddr) < 0 || iguana_addressvalidate(coin,&addrtype,changeaddr) < 0 )
return(clonestr("{\"error\":\"invalid coin address\"}"));
@ -687,11 +687,13 @@ char *iguana_utxorawtx(struct supernet_info *myinfo,struct iguana_info *coin,int
spendlen = bitcoin_p2shspend(script,0,rmd160);
printf("timelock.%d spend timelocked %u\n",timelock,timelocked);
}
bitcoin_txoutput(txobj,script,spendlen,satoshis);
for (i=0; i<numoutputs; i++)
if ( satoshis[i] > 0 )
bitcoin_txoutput(txobj,script,spendlen,satoshis[i]);
for (iter=0; iter<2; iter++)
{
txcopy = jduplicate(txobj);
if ( (rawtx= iguana_calcutxorawtx(myinfo,coin,&vins,txobj,satoshis,changeaddr,txfee,utxos,"",0,0)) != 0 )
if ( (rawtx= iguana_calcutxorawtx(myinfo,coin,&vins,txobj,satoshis,numoutputs,changeaddr,txfee,utxos,"",0,0)) != 0 )
{
if ( iter == 1 || txfee != 0 )
jaddstr(retjson,"rawtx",rawtx);

270
basilisk/jumblr.c

@ -375,104 +375,280 @@ bits256 jumblr_privkey(struct supernet_info *myinfo,char *BTCaddr,uint8_t pubtyp
return(privkey);
}
/*struct DEXcoin_info
int64_t jumblr_DEXsplit(struct supernet_info *myinfo,struct iguana_info *coin,bits256 *splittxidp,char *coinaddr,bits256 txid,int32_t vout,int64_t remaining,double bigprice,double middleprice,double smallprice,double fees[4])
{
bits256 deposit_privkey,jumblr_privkey;
struct iguana_info *coin;
cJSON *utxos,*spentutxos,*bigutxos,*normalutxos,*smallutxos,*feeutxos,*otherutxos;
double btcprice,USD_average,DEXpending,maxbid,minask,avail,KMDavail;
uint32_t lasttime;
char CMCname[32],symbol[16],depositaddr[64],KMDdepositaddr[64],KMDjumblraddr[64],jumblraddr[64];
};*/
int64_t values[4],outputs[64],value,total,estfee = 50000; int32_t i,success=0,completed,sendflag,numoutputs = 0; char *retstr; cJSON *retjson,*utxo,*item;
total = 0;
memset(values,0,sizeof(values));
memset(outputs,0,sizeof(outputs));
if ( bigprice > SMALLVAL )
values[0] = SATOSHIDEN * bigprice;
if ( middleprice > SMALLVAL )
values[1] = SATOSHIDEN * middleprice;
if ( smallprice > SMALLVAL )
values[2] = SATOSHIDEN * smallprice;
for (i=0; i<4; i++)
{
if ( fees[i] > SMALLVAL )
values[3+i] = SATOSHIDEN * fees[i];
}
for (i=0; i<7; i++)
{
if ( (value= values[i]) != 0 )
{
while ( remaining > value+estfee && numoutputs < sizeof(outputs)/sizeof(*outputs) )
{
outputs[numoutputs++] = value;
remaining -= value;
total += value;
printf("%.8f ",dstr(value));
}
}
}
char str[65]; printf("numoutputs.%d total %.8f %s/v%d\n",numoutputs,dstr(total),bits256_str(str,txid),vout);
if ( numoutputs > 0 )
{
if ( (retstr= _dex_gettxout(myinfo,coin->symbol,txid,vout)) != 0 )
{
item = cJSON_Parse(retstr);
free(retstr);
if ( item != 0 )
{
utxo = cJSON_CreateArray();
jaddi(utxo,item);
sendflag = 0;
if ( (retstr= iguana_utxorawtx(myinfo,coin,0,coinaddr,coinaddr,outputs,numoutputs,0,&completed,sendflag,utxo)) != 0 )
{
if ( completed != 0 )
{
if ( (retjson= cJSON_Parse(retstr)) != 0 )
{
if ( jobj(retjson,"error") == 0 && jobj(retjson,"sent") != 0 )
{
*splittxidp = jbits256(retjson,"sent");
success = 1;
printf("DEXsplit success %.8f\n",dstr(total));
}
free_json(retjson);
}
}
free(retstr);
}
free_json(utxo);
}
}
}
return(success * total);
}
int32_t jumblr_DEXsplit(struct supernet_info *myinfo,bits256 *splittxidp,bits256 txid,int32_t vout,uint64_t value,double bigprice,double middleprice,double smallprice,double feeprice)
double jumblr_DEXutxosize(double *targetpriceBp,double *targetpriceMp,double *targetpriceSp,int32_t isbob)
{
double fee,depositfactor = (isbob == 0) ? 1. : 1.2;
fee = JUMBLR_INCR * JUMBLR_FEE;
*targetpriceBp = depositfactor * ((JUMBLR_INCR + 3*fee)*100 + 3*JUMBLR_TXFEE);
*targetpriceMp = depositfactor * ((JUMBLR_INCR + 3*fee)*10 + 3*JUMBLR_TXFEE);
*targetpriceSp = depositfactor * ((JUMBLR_INCR + 3*fee) + 3*JUMBLR_TXFEE);
return(depositfactor);
}
int32_t jumblr_DEXutxoupdate(struct supernet_info *myinfo,bits256 *splittxidp,bits256 txid,int32_t vout,uint64_t value,int32_t isbob)
int32_t jumblr_DEXutxoind(int32_t *shouldsplitp,double targetpriceB,double targetpriceM,double targetpriceS,double amount,double margin,double dexfeeratio,double esttxfee)
{
double targetpriceB,targetpriceM,targetpriceS,fee,depositfactor,dexfeeratio,margin = 1.1;
depositfactor = (isbob == 0) ? 1. : 1.2;
dexfeeratio = 500.;
memset(splittxidp,0,sizeof(*splittxidp));
fee = JUMBLR_INCR * JUMBLR_FEE;
targetpriceB = depositfactor * ((JUMBLR_INCR + 3*fee)*100 + 3*JUMBLR_TXFEE);
targetpriceM = depositfactor * ((JUMBLR_INCR + 3*fee)*10 + 3*JUMBLR_TXFEE);
targetpriceS = depositfactor * ((JUMBLR_INCR + 3*fee) + 3*JUMBLR_TXFEE);
if ( value >= targetpriceB )
*shouldsplitp = 0;
if ( amount >= targetpriceB )
{
if ( value > margin * (targetpriceB + targetpriceS) )
jumblr_DEXsplit(myinfo,splittxidp,txid,vout,value,margin * targetpriceB,margin * targetpriceM,margin * targetpriceS,margin * targetpriceB/dexfeeratio);
if ( amount > margin * (targetpriceB + targetpriceS) )
*shouldsplitp = 1;
return(0);
}
else
{
if ( value >= targetpriceM )
if ( amount >= targetpriceM )
{
if ( value > margin * (targetpriceM + targetpriceS) )
return(jumblr_DEXsplit(myinfo,splittxidp,txid,vout,value,0.,margin * targetpriceM,margin * targetpriceS,margin * targetpriceM/dexfeeratio));
else return(0);
if ( amount > margin * (targetpriceM + targetpriceS) )
*shouldsplitp = 1;
return(1);
}
else
{
if ( value >= targetpriceS )
if ( amount >= targetpriceS )
{
if ( amount > margin * targetpriceS )
*shouldsplitp = 1;
return(2);
}
else if ( amount >= targetpriceB/dexfeeratio )
{
if ( amount > margin * targetpriceB/dexfeeratio )
*shouldsplitp = 1;
return(3);
}
else if ( amount >= targetpriceM/dexfeeratio )
{
if ( amount > margin * targetpriceM/dexfeeratio )
*shouldsplitp = 1;
return(4);
}
else if ( amount >= targetpriceS/dexfeeratio )
{
if ( value > margin * targetpriceS )
return(jumblr_DEXsplit(myinfo,splittxidp,txid,vout,value,0.,0.,margin * targetpriceS,margin * targetpriceS/dexfeeratio));
else return(0);
if ( amount > margin * targetpriceS/dexfeeratio )
*shouldsplitp = 1;
return(5);
}
else if ( value > targetpriceS/dexfeeratio )
return(jumblr_DEXsplit(myinfo,splittxidp,txid,vout,value,0.,0.,0.,margin * targetpriceS/dexfeeratio));
else return(0);
else if ( amount >= esttxfee )
{
if ( amount > esttxfee*4 )
*shouldsplitp = 1;
return(6);
}
else return(-1);
}
}
}
void jumblr_DEXupdate(struct supernet_info *myinfo,struct DEXcoin_info *ptr,char *symbol,char *CMCname,double BTC2KMD,double KMDavail)
int64_t jumblr_DEXutxoupdate(struct supernet_info *myinfo,struct iguana_info *coin,bits256 *splittxidp,char *coinaddr,bits256 txid,int32_t vout,uint64_t value,int32_t isbob)
{
double avebid,aveask,highbid,lowask,CMC_average,changes[3]; struct iguana_info *kmdcoin = iguana_coinfind("KMD");
if ( kmdcoin != 0 && time(NULL) > ptr->lasttime+60 )
double fees[4],targetpriceB,amount,targetpriceM,targetpriceS,depositfactor,dexfeeratio,margin; int32_t ind,shouldsplit;
margin = 1.1;
depositfactor = (isbob == 0) ? 1. : 1.2;
dexfeeratio = 500.;
amount = dstr(value);
memset(splittxidp,0,sizeof(*splittxidp));
depositfactor = jumblr_DEXutxosize(&targetpriceB,&targetpriceM,&targetpriceS,isbob);
fees[0] = (margin * targetpriceB) / dexfeeratio;
fees[1] = (margin * targetpriceM) / dexfeeratio;
fees[2] = (margin * targetpriceS) / dexfeeratio;
fees[3] = (strcmp("BTC",coin->symbol) == 0) ? 50000 : 10000;
if ( (ind= jumblr_DEXutxoind(&shouldsplit,targetpriceB,targetpriceM,targetpriceS,amount,margin,dexfeeratio,fees[3])) >= 0 )
{
if ( strcmp(symbol,ptr->symbol) != 0 || ptr->coin == 0 )
if ( shouldsplit != 0 )
return(jumblr_DEXsplit(myinfo,coin,splittxidp,coinaddr,txid,vout,value,margin * targetpriceB,margin * targetpriceM,margin * targetpriceS,fees));
}
return(0);
}
/*struct DEXcoin_info
{
bits256 deposit_privkey,jumblr_privkey;
struct iguana_info *coin;
cJSON *utxos,*spentutxos,*bigutxos,*normalutxos,*smallutxos,*feeutxos,*otherutxos;
double btcprice,USD_average,DEXpending,maxbid,minask,avail,KMDavail;
uint32_t lasttime;
char CMCname[32],symbol[16],depositaddr[64],KMDdepositaddr[64],KMDjumblraddr[64],jumblraddr[64];
};*/
int32_t jumblr_utxotxidpending(struct supernet_info *myinfo,bits256 *splittxidp,struct iguana_info *coin,bits256 txid,int32_t vout)
{
int32_t i;
memset(splittxidp,0,sizeof(*splittxidp));
for (i=0; i<coin->DEXinfo.numpending; i++)
{
if ( coin->DEXinfo.pending[i].vout == vout && bits256_cmp(coin->DEXinfo.pending[i].txid,txid) == 0 )
{
*splittxidp = coin->DEXinfo.pending[i].splittxid;
return(i);
}
}
return(-1);
}
void jumblr_utxotxidpendingadd(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid,int32_t vout,bits256 splittxid)
{
struct jumblr_pending pend;
memset(&pend,0,sizeof(pend));
pend.splittxid = splittxid;
pend.txid = txid;
pend.vout = vout;
coin->DEXinfo.pending = realloc(coin->DEXinfo.pending,sizeof(*coin->DEXinfo.pending) * (1 + coin->DEXinfo.numpending));
coin->DEXinfo.pending[coin->DEXinfo.numpending++] = pend;
}
void jumblr_utxoupdate(struct supernet_info *myinfo,struct iguana_info *coin,double price,char *coinaddr)
{
char *retstr; cJSON *array,*item; int32_t i,n,vout; bits256 txid,splittxid; uint64_t value;
if ( (retstr= _dex_listunspent(myinfo,coin->symbol,coinaddr)) != 0 )
{
if ( (array= cJSON_Parse(retstr)) != 0 )
{
if ( (n= cJSON_GetArraySize(array)) > 0 )
{
for (i=0; i<n; i++)
{
item = jitem(array,i);
txid = jbits256(item,"txid");
vout = jint(item,"vout");
value = SATOSHIDEN * jdouble(item,"amount");
if ( jumblr_utxotxidpending(myinfo,&splittxid,coin,txid,vout) < 0 )
{
jumblr_DEXutxoupdate(myinfo,coin,&splittxid,coinaddr,txid,vout,value,myinfo->IAMLP);
jumblr_utxotxidpendingadd(myinfo,coin,txid,vout,splittxid);
}
}
}
free_json(array);
}
free(retstr);
}
}
void jumblr_DEXupdate(struct supernet_info *myinfo,struct iguana_info *coin,char *symbol,char *CMCname,double BTC2KMD,double KMDavail)
{
double avebid,aveask,highbid,lowask,CMC_average,changes[3]; struct iguana_info *btccoin,*kmdcoin; struct DEXcoin_info *ptr = &coin->DEXinfo;
if ( coin != 0 && (kmdcoin= iguana_coinfind("KMD")) != 0 && time(NULL) > ptr->lasttime+60 )
{
ptr->coin = coin;
if ( strcmp(symbol,ptr->symbol) != 0 )
{
safecopy(ptr->symbol,symbol,sizeof(ptr->symbol));
safecopy(ptr->CMCname,CMCname,sizeof(ptr->CMCname));
if ( ptr->coin == 0 )
ptr->coin = iguana_coinfind(symbol);
}
if ( ptr->coin != 0 )
if ( ptr->depositaddr[0] == 0 )
{
if ( ptr->depositaddr[0] == 0 )
ptr->deposit_privkey = jumblr_privkey(myinfo,ptr->depositaddr,ptr->coin->chain->pubtype,ptr->KMDdepositaddr,JUMBLR_DEPOSITPREFIX);
if ( ptr->jumblraddr[0] == 0 )
ptr->jumblr_privkey = jumblr_privkey(myinfo,ptr->jumblraddr,ptr->coin->chain->pubtype,ptr->KMDjumblraddr,"");
ptr->avail = dstr(jumblr_balance(myinfo,ptr->coin,ptr->depositaddr));
if ( strcmp("KMD",symbol) == 0 )
ptr->deposit_privkey = jumblr_privkey(myinfo,ptr->depositaddr,0,ptr->KMDdepositaddr,JUMBLR_DEPOSITPREFIX);
else ptr->deposit_privkey = jumblr_privkey(myinfo,ptr->depositaddr,ptr->coin->chain->pubtype,ptr->KMDdepositaddr,JUMBLR_DEPOSITPREFIX);
}
if ( ptr->jumblraddr[0] == 0 )
ptr->jumblr_privkey = jumblr_privkey(myinfo,ptr->jumblraddr,ptr->coin->chain->pubtype,ptr->KMDjumblraddr,"");
ptr->avail = dstr(jumblr_balance(myinfo,ptr->coin,ptr->depositaddr));
ptr->btcprice = get_theoretical(&avebid,&aveask,&highbid,&lowask,&CMC_average,changes,CMCname,symbol,"BTC",&ptr->USD_average);
if ( strcmp("KMD",symbol) == 0 )
{
ptr->BTC2KMD = ptr->btcprice;
ptr->kmdprice = 1.;
ptr->KMDavail = ptr->avail;
if ( (btccoin= iguana_coinfind("BTC")) != 0 )
jumblr_utxoupdate(myinfo,btccoin,ptr->btcprice,ptr->depositaddr);
jumblr_utxoupdate(myinfo,kmdcoin,1.,ptr->KMDdepositaddr);
}
else if ( (ptr->BTC2KMD= BTC2KMD) > SMALLVAL )
{
ptr->kmdprice = ptr->btcprice / BTC2KMD;
ptr->KMDavail = KMDavail;
jumblr_utxoupdate(myinfo,ptr->coin,ptr->kmdprice,ptr->depositaddr);
}
ptr->lasttime = (uint32_t)time(NULL);
}
}
void jumblr_CMCname(char *CMCname,char *symbol)
{
if ( strcmp(symbol,"KMD") == 0 )
strcpy(CMCname,"komodo");
}
void jumblr_DEXcheck(struct supernet_info *myinfo,struct iguana_info *coin)
{
struct iguana_info *kmdcoin;
if ( (kmdcoin= iguana_coinfind("KMD")) == 0 )
return;
jumblr_DEXupdate(myinfo,&kmdcoin->DEXinfo,"KMD","komodo",0.,0.);
jumblr_DEXupdate(myinfo,kmdcoin,"KMD","komodo",0.,0.);
if ( strcmp(coin->symbol,"KMD") != 0 && kmdcoin->DEXinfo.btcprice > 0. )
jumblr_DEXupdate(myinfo,&coin->DEXinfo,"KMD","komodo",kmdcoin->DEXinfo.btcprice,kmdcoin->DEXinfo.avail);
{
if ( coin->CMCname[0] == 0 )
jumblr_CMCname(coin->CMCname,coin->symbol);
if ( coin->CMCname[0] != 0 )
jumblr_DEXupdate(myinfo,coin,coin->symbol,coin->CMCname,kmdcoin->DEXinfo.btcprice,kmdcoin->DEXinfo.avail);
}
/*if ( kmdprice > SMALLVAL )
{
minbtc = (kmdprice * 1.2) * (JUMBLR_INCR + 3*(JUMBLR_INCR * JUMBLR_FEE + JUMBLR_TXFEE));

2
crypto777/iguana_utils.c

@ -1279,7 +1279,7 @@ double get_theoretical(double *avebidp,double *aveaskp,double *highbidp,double *
weighted = weighted_orderbook(avebidp,aveaskp,highbidp,lowaskp,bittrex_orderbook(base,rel,25),1./(*CMC_averagep));
if ( *CMC_averagep > SMALLVAL && weighted > SMALLVAL )
theoretical = calc_theoretical(weighted,*CMC_averagep,changes);
if ( counter++ == 0 )
if ( counter++ < 100 )
printf("HBLA.[%.8f %.8f] AVE.[%.8f %.8f] (%s) CMC %f %f %f %f\n",*highbidp,*lowaskp,*avebidp,*aveaskp,jprint(item,0),*CMC_averagep,changes[0],changes[1],changes[2]);
free_json(cmcjson);
}

2
iguana/coins/genbtc

@ -1,2 +1,2 @@
#!/bin/bash
curl --url "http://127.0.0.1:7778" --data "{\"prefetchlag\":-1,\"poll\":1,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"newcoin\":\"BTC\",\"startpend\":64,\"endpend\":64,\"services\":129,\"maxpeers\":512,\"RELAY\":1,\"VALIDATE\":1,\"portp2p\":8333,\"minconfirms\":1}"
curl --url "http://127.0.0.1:7778" --data "{\"prefetchlag\":-1,\"poll\":1,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"newcoin\":\"BTC\",\"startpend\":16,\"endpend\":4,\"services\":129,\"maxpeers\":512,\"RELAY\":1,\"VALIDATE\":1,\"portp2p\":8333,\"minconfirms\":1}"

6
iguana/iguana_payments.c

@ -545,12 +545,14 @@ char *iguana_calcrawtx(struct supernet_info *myinfo,struct iguana_info *coin,cJS
return(rawtx);
}
char *iguana_calcutxorawtx(struct supernet_info *myinfo,struct iguana_info *coin,cJSON **vinsp,cJSON *txobj,int64_t satoshis,char *changeaddr,int64_t txfee,cJSON *utxos,char *remoteaddr,struct vin_info *V,int32_t maxmode)
char *iguana_calcutxorawtx(struct supernet_info *myinfo,struct iguana_info *coin,cJSON **vinsp,cJSON *txobj,int64_t *outputs,int32_t numoutputs,char *changeaddr,int64_t txfee,cJSON *utxos,char *remoteaddr,struct vin_info *V,int32_t maxmode)
{
uint8_t addrtype,rmd160[20],spendscript[IGUANA_MAXSCRIPTSIZE]; int32_t allocflag=0,max,i,n,num,spendlen; char *spendscriptstr,*rawtx=0; bits256 txid; cJSON *sobj,*vins=0,*item; uint64_t value,avail=0,total,change,interests; struct iguana_outpoint *unspents = 0;
uint8_t addrtype,rmd160[20],spendscript[IGUANA_MAXSCRIPTSIZE]; int32_t allocflag=0,max,i,n,num,spendlen; char *spendscriptstr,*rawtx=0; uint64_t satoshis = 0; bits256 txid; cJSON *sobj,*vins=0,*item; uint64_t value,avail=0,total,change,interests; struct iguana_outpoint *unspents = 0;
*vinsp = 0;
max = 0;
interests = 0;
for (i=0; i<numoutputs; i++)
satoshis += outputs[i];
if ( (n= cJSON_GetArraySize(utxos)) == 0 )
return(0);
for (i=0; i<n; i++)

2
iguana/tests/dexgetO

@ -1,2 +1,2 @@
#!/bin/bash
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"gettxout\",\"vout\":1,\"txid\":\"4a1a2026718ac10bd11ccccbdd85f29faa5f0b7c3ab95a57dcf7040c5ca0420c\",\"symbol\":\"KMD\"}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"gettxout\",\"vout\":0,\"txid\":\"3b0f38d8cf4b3a89b6c83003410abdb773422d814ce93d68730c00c91e770995\",\"symbol\":\"KMD\"}"

2
includes/iguana_funcs.h

@ -659,7 +659,7 @@ void iguana_schnorr(struct supernet_info *myinfo);
void iguana_fixsecp(struct supernet_info *myinfo);
int32_t bitcoin_timelockspend(uint8_t *script,int32_t n,uint8_t rmd160[20],uint32_t timestamp);
char *iguana_calcutxorawtx(struct supernet_info *myinfo,struct iguana_info *coin,cJSON **vinsp,cJSON *txobj,int64_t satoshis,char *changeaddr,int64_t txfee,cJSON *utxos,char *remoteaddr,struct vin_info *V,int32_t maxmode);
char *iguana_calcutxorawtx(struct supernet_info *myinfo,struct iguana_info *coin,cJSON **vinsp,cJSON *txobj,int64_t *satoshis,int32_t numoutputs,char *changeaddr,int64_t txfee,cJSON *utxos,char *remoteaddr,struct vin_info *V,int32_t maxmode);
uint64_t _iguana_interest(uint32_t now,int32_t height,uint32_t txlocktime,uint64_t value);
#include "../includes/iguana_api.h"

2
includes/iguana_globals.h

@ -42,7 +42,7 @@ char GLOBAL_GENESISDIR[512] = "genesis";
char GLOBAL_VALIDATEDIR[512] = "DB/purgeable";
char GLOBAL_CONFSDIR[512] = "confs";
#ifdef __linux
int32_t IGUANA_NUMHELPERS = 8;
int32_t IGUANA_NUMHELPERS = 4;
#else
int32_t IGUANA_NUMHELPERS = 1;
#endif

8
includes/iguana_structs.h

@ -466,20 +466,22 @@ struct iguana_RTtxid
struct hashstr_item { UT_hash_handle hh; char address[40]; };
struct jumblr_pending { bits256 splittxid,txid; int32_t vout; };
struct DEXcoin_info
{
bits256 deposit_privkey,jumblr_privkey;
struct iguana_info *coin;
cJSON *utxos,*spentutxos,*bigutxos,*normalutxos,*smallutxos,*feeutxos,*otherutxos;
double btcprice,BTC2KMD,kmdprice,USD_average,DEXpending,maxbid,minask,avail,KMDavail;
uint32_t lasttime;
uint32_t lasttime,numpending;
char CMCname[32],symbol[16],depositaddr[64],KMDdepositaddr[64],KMDjumblraddr[64],jumblraddr[64];
struct jumblr_pending *pending;
};
struct iguana_info
{
UT_hash_handle hh;
char name[64],symbol[64],protocol,statusstr[512],scriptsfname[2][512];
char CMCname[64],name[64],symbol[64],protocol,statusstr[512],scriptsfname[2][512];
struct iguana_peers *peers; struct iguana_peer internaladdr;
//basilisk_func basilisk_rawtx,basilisk_balances,basilisk_value;
//basilisk_metricfunc basilisk_rawtxmetric,basilisk_balancesmetric,basilisk_valuemetric;

Loading…
Cancel
Save