From 8683bd8d11e9af7c7ece45ea8873cd6658c65e9b Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 13 Feb 2018 21:29:42 +0200 Subject: [PATCH 01/32] Debugging --- src/komodo.h | 6 +- src/komodo_bitcoind.h | 6 +- src/komodo_gateway.h | 21 +++++ src/komodo_globals.h | 8 +- src/komodo_interest.h | 13 +-- src/komodo_notary.h | 186 +++++++++++++++++++++++++++++------------- src/komodo_structs.h | 3 +- src/komodo_utils.h | 76 +++++++++++++---- src/main.cpp | 37 ++++++++- src/miner.cpp | 58 +++++++++---- src/pow.cpp | 18 ++-- src/rpcmisc.cpp | 4 +- 12 files changed, 318 insertions(+), 118 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index c6467d957..3b22453a4 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -473,7 +473,7 @@ void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotar } } -int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scriptbuf,int32_t scriptlen,int32_t height,uint256 txhash,int32_t i,int32_t j,uint64_t *voutmaskp,int32_t *specialtxp,int32_t *notarizedheightp,uint64_t value,int32_t notarized,uint64_t signedmask) +int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scriptbuf,int32_t scriptlen,int32_t height,uint256 txhash,int32_t i,int32_t j,uint64_t *voutmaskp,int32_t *specialtxp,int32_t *notarizedheightp,uint64_t value,int32_t notarized,uint64_t signedmask,uint32_t timestamp) { static uint256 zero; static FILE *signedfp; int32_t opretlen,nid,k,len = 0; uint256 kmdtxid,desttxid; uint8_t crypto777[33]; struct komodo_state *sp; char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; @@ -499,7 +499,7 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr *specialtxp = 1; //printf(">>>>>>>> "); } - else if ( komodo_chosennotary(&nid,height,scriptbuf + 1) >= 0 ) + else if ( komodo_chosennotary(&nid,height,scriptbuf + 1,timestamp) >= 0 ) { //printf("found notary.k%d\n",k); if ( notaryid < 64 ) @@ -741,7 +741,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) #else memcpy(scriptbuf,(uint8_t *)&block.vtx[i].vout[j].scriptPubKey[0],len); #endif - notaryid = komodo_voutupdate(&isratification,notaryid,scriptbuf,len,height,txhash,i,j,&voutmask,&specialtx,¬arizedheight,(uint64_t)block.vtx[i].vout[j].nValue,notarized,signedmask); + notaryid = komodo_voutupdate(&isratification,notaryid,scriptbuf,len,height,txhash,i,j,&voutmask,&specialtx,¬arizedheight,(uint64_t)block.vtx[i].vout[j].nValue,notarized,signedmask,(uint32_t)chainActive.Tip()->GetBlockTime()); if ( 0 && i > 0 ) { for (k=0; k= 225000 ) - komodo_chosennotary(¬aryid,height,_pubkey33); + komodo_chosennotary(¬aryid,height,_pubkey33,timestamp); if ( height >= 34000 && notaryid >= 0 ) { if ( height < 79693 ) @@ -777,7 +777,7 @@ int32_t komodo_is_special(int32_t height,uint8_t pubkey33[33]) else limit = 66; for (i=1; i 0 ) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index d655f2aa5..d814bd6bf 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -719,6 +719,27 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above } return(0); } + if ( ASSETCHAINS_SYMBOL[0] != 0 && ASSETCHAINS_COMMISSION != 0 ) + { + total = 0; + for (i=1; i nLockTime && (minutes= (tiptime - nLockTime) / 60) >= 60 ) + if ( nLockTime >= LOCKTIME_THRESHOLD && tiptime > nLockTime && (minutes= (tiptime - nLockTime) / 60) >= 60 ) { if ( minutes > 365 * 24 * 60 ) minutes = 365 * 24 * 60; @@ -152,7 +153,7 @@ uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uin interest = (numerator * minutes) / ((uint64_t)365 * 24 * 60); interestnew = _komodo_interestnew(nValue,nLockTime,tiptime); if ( interest < interestnew ) - printf("path0 current interest %.8f vs new %.8f for ht.%d %.8f locktime.%u tiptime.%u\n",dstr(interest),dstr(interestnew),txheight,dstr(nValue),nLockTime,tiptime); + printf("pathA current interest %.8f vs new %.8f for ht.%d %.8f locktime.%u tiptime.%u\n",dstr(interest),dstr(interestnew),txheight,dstr(nValue),nLockTime,tiptime); } else interest = _komodo_interestnew(nValue,nLockTime,tiptime); } @@ -162,7 +163,7 @@ uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uin interest = (numerator / denominator) / COIN; interestnew = _komodo_interestnew(nValue,nLockTime,tiptime); if ( interest < interestnew ) - printf("path0 current interest %.8f vs new %.8f for ht.%d %.8f locktime.%u tiptime.%u\n",dstr(interest),dstr(interestnew),txheight,dstr(nValue),nLockTime,tiptime); + printf("pathB current interest %.8f vs new %.8f for ht.%d %.8f locktime.%u tiptime.%u\n",dstr(interest),dstr(interestnew),txheight,dstr(nValue),nLockTime,tiptime); } else interest = _komodo_interestnew(nValue,nLockTime,tiptime); } @@ -187,8 +188,8 @@ uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uin interest = ((numerator * minutes) / ((uint64_t)365 * 24 * 60)); //fprintf(stderr,"interest %llu %.8f <- numerator.%llu minutes.%d\n",(long long)interest,(double)interest/COIN,(long long)numerator,(int32_t)minutes); interestnew = _komodo_interestnew(nValue,nLockTime,tiptime); - if ( interest < interestnew )//|| (interestnew < 0.9999*interest && (interest-interestnew) > 50000) ) - printf("path1 current interest %.8f vs new %.8f for ht.%d %.8f locktime.%u tiptime.%u\n",dstr(interest),dstr(interestnew),txheight,dstr(nValue),nLockTime,tiptime); + if ( interest < interestnew ) + fprintf(stderr,"pathC current interest %.8f vs new %.8f for ht.%d %.8f locktime.%u tiptime.%u\n",dstr(interest),dstr(interestnew),txheight,dstr(nValue),nLockTime,tiptime); } else interest = _komodo_interestnew(nValue,nLockTime,tiptime); } diff --git a/src/komodo_notary.h b/src/komodo_notary.h index a306f848f..9da3b6d05 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -58,7 +58,7 @@ const char *Notaries_genesis[][2] = { "titomane_SH", "035f49d7a308dd9a209e894321f010d21b7793461b0c89d6d9231a3fe5f68d9960" }, }; -const char *Notaries_elected[][2] = +const char *Notaries_elected0[][2] = { { "0_jl777_testA", "03b7621b44118017a16043f19b30cc8a4cfe068ac4e42417bae16ba460c80f3828" }, { "0_jl777_testB", "02ebfc784a4ba768aad88d44d1045d240d47b26e248cafaf1c5169a42d7a61d344" }, @@ -126,62 +126,99 @@ const char *Notaries_elected[][2] = { "xxspot2_XX", "03d85b221ea72ebcd25373e7961f4983d12add66a92f899deaf07bab1d8b6f5573" } }; -int32_t komodo_electednotary(uint8_t *pubkey33,int32_t height) -{ - char pubkeystr[67]; int32_t i; uint8_t legacy33[33]; - for (i=0; i<33; i++) - sprintf(&pubkeystr[i*2],"%02x",pubkey33[i]); - pubkeystr[66] = 0; - //printf("%s vs\n",pubkeystr); - for (i=0; i elected %s\n",i,(char *)Notaries_elected[i][1]); - return(i); - } - } - /*if ( height < 300000 ) - { - for (i=0; i elected %s\n",i,(char *)Notaries_elected[i][1]); - return(i+64); - } - } - decode_hex(legacy33,33,(char *)"0252b6185bf8ea7efe8bbc345ddc8da87329149f30233088387abd716d4aa9e974"); - if ( memcmp(pubkey33,legacy33,33) == 0 ) - return(128); - }*/ - return(-1); -} +#define KOMODO_NOTARIES_TIMESTAMP1 1600000000 +#define KOMODO_NOTARIES_HEIGHT1 ((800000 / KOMODO_ELECTION_GAP) * KOMODO_ELECTION_GAP) -int32_t komodo_ratify_threshold(int32_t height,uint64_t signedmask) +const char *Notaries_elected1[][2] = { - int32_t htind,numnotaries,i,wt = 0; - htind = height / KOMODO_ELECTION_GAP; - numnotaries = Pubkeys[htind].numnotaries; - for (i=0; i (numnotaries >> 1) || (wt > 7 && (signedmask & 1) != 0) ) - return(1); - else return(0); -} + { "0_jl777_testA", "03b7621b44118017a16043f19b30cc8a4cfe068ac4e42417bae16ba460c80f3828" }, + { "0_jl777_testB", "02ebfc784a4ba768aad88d44d1045d240d47b26e248cafaf1c5169a42d7a61d344" }, + { "0_kolo_testA", "0287aa4b73988ba26cf6565d815786caf0d2c4af704d7883d163ee89cd9977edec" }, + { "artik_AR", "029acf1dcd9f5ff9c455f8bb717d4ae0c703e089d16cf8424619c491dff5994c90" }, + { "artik_EU", "03f54b2c24f82632e3cdebe4568ba0acf487a80f8a89779173cdb78f74514847ce" }, + { "artik_NA", "0224e31f93eff0cc30eaf0b2389fbc591085c0e122c4d11862c1729d090106c842" }, + { "artik_SH", "02bdd8840a34486f38305f311c0e2ae73e84046f6e9c3dd3571e32e58339d20937" }, + { "badass_EU", "0209d48554768dd8dada988b98aca23405057ac4b5b46838a9378b95c3e79b9b9e" }, + { "badass_NA", "02afa1a9f948e1634a29dc718d218e9d150c531cfa852843a1643a02184a63c1a7" }, + { "badass_SH", "026b49dd3923b78a592c1b475f208e23698d3f085c4c3b4906a59faf659fd9530b" }, + { "crackers_EU", "03bc819982d3c6feb801ec3b720425b017d9b6ee9a40746b84422cbbf929dc73c3" }, // 10 + { "crackers_NA", "03205049103113d48c7c7af811b4c8f194dafc43a50d5313e61a22900fc1805b45" }, + { "crackers_SH", "02be28310e6312d1dd44651fd96f6a44ccc269a321f907502aae81d246fabdb03e" }, + { "durerus_EU", "02bcbd287670bdca2c31e5d50130adb5dea1b53198f18abeec7211825f47485d57" }, + { "etszombi_AR", "031c79168d15edabf17d9ec99531ea9baa20039d0cdc14d9525863b83341b210e9" }, + { "etszombi_EU", "0281b1ad28d238a2b217e0af123ce020b79e91b9b10ad65a7917216eda6fe64bf7" }, // 15 + { "etszombi_SH", "025d7a193c0757f7437fad3431f027e7b5ed6c925b77daba52a8755d24bf682dde" }, + { "farl4web_EU", "0300ecf9121cccf14cf9423e2adb5d98ce0c4e251721fa345dec2e03abeffbab3f" }, + { "farl4web_SH", "0396bb5ed3c57aa1221d7775ae0ff751e4c7dc9be220d0917fa8bbdf670586c030" }, + { "fullmoon_AR", "0254b1d64840ce9ff6bec9dd10e33beb92af5f7cee628f999cb6bc0fea833347cc" }, + { "fullmoon_NA", "031fb362323b06e165231c887836a8faadb96eda88a79ca434e28b3520b47d235b" }, // 20 + { "fullmoon_SH", "030e12b42ec33a80e12e570b6c8274ce664565b5c3da106859e96a7208b93afd0d" }, + { "grewal_NA", "03adc0834c203d172bce814df7c7a5e13dc603105e6b0adabc942d0421aefd2132" }, + { "grewal_SH", "03212a73f5d38a675ee3cdc6e82542a96c38c3d1c79d25a1ed2e42fcf6a8be4e68" }, + { "indenodes_AR", "02ec0fa5a40f47fd4a38ea5c89e375ad0b6ddf4807c99733c9c3dc15fb978ee147" }, + { "indenodes_EU", "0221387ff95c44cb52b86552e3ec118a3c311ca65b75bf807c6c07eaeb1be8303c" }, + { "indenodes_NA", "02698c6f1c9e43b66e82dbb163e8df0e5a2f62f3a7a882ca387d82f86e0b3fa988" }, + { "indenodes_SH", "0334e6e1ec8285c4b85bd6dae67e17d67d1f20e7328efad17ce6fd24ae97cdd65e" }, + { "jeezy_EU", "023cb3e593fb85c5659688528e9a4f1c4c7f19206edc7e517d20f794ba686fd6d6" }, + { "jsgalt_NA", "027b3fb6fede798cd17c30dbfb7baf9332b3f8b1c7c513f443070874c410232446" }, + { "karasugoi_NA", "02a348b03b9c1a8eac1b56f85c402b041c9bce918833f2ea16d13452309052a982" }, // 30 + { "kashifali_EU", "033777c52a0190f261c6f66bd0e2bb299d30f012dcb8bfff384103211edb8bb207" }, + { "kolo_AR", "03016d19344c45341e023b72f9fb6e6152fdcfe105f3b4f50b82a4790ff54e9dc6" }, + { "kolo_SH", "02aa24064500756d9b0959b44d5325f2391d8e95c6127e109184937152c384e185" }, + { "metaphilibert_AR", "02adad675fae12b25fdd0f57250b0caf7f795c43f346153a31fe3e72e7db1d6ac6" }, + { "movecrypto_AR", "022783d94518e4dc77cbdf1a97915b29f427d7bc15ea867900a76665d3112be6f3" }, + { "movecrypto_EU", "021ab53bc6cf2c46b8a5456759f9d608966eff87384c2b52c0ac4cc8dd51e9cc42" }, + { "movecrypto_NA", "02efb12f4d78f44b0542d1c60146738e4d5506d27ec98a469142c5c84b29de0a80" }, + { "movecrypto_SH", "031f9739a3ebd6037a967ce1582cde66e79ea9a0551c54731c59c6b80f635bc859" }, + { "muros_AR", "022d77402fd7179335da39479c829be73428b0ef33fb360a4de6890f37c2aa005e" }, + { "noashh_AR", "029d93ef78197dc93892d2a30e5a54865f41e0ca3ab7eb8e3dcbc59c8756b6e355" }, // 40 + { "noashh_EU", "02061c6278b91fd4ac5cab4401100ffa3b2d5a277e8f71db23401cc071b3665546" }, + { "noashh_NA", "033c073366152b6b01535e15dd966a3a8039169584d06e27d92a69889b720d44e1" }, + { "nxtswe_EU", "032fb104e5eaa704a38a52c126af8f67e870d70f82977e5b2f093d5c1c21ae5899" }, + { "polycryptoblog_NA", "02708dcda7c45fb54b78469673c2587bfdd126e381654819c4c23df0e00b679622" }, + { "pondsea_AR", "032e1c213787312099158f2d74a89e8240a991d162d4ce8017d8504d1d7004f735" }, + { "pondsea_EU", "0225aa6f6f19e543180b31153d9e6d55d41bc7ec2ba191fd29f19a2f973544e29d" }, + { "pondsea_NA", "031bcfdbb62268e2ff8dfffeb9ddff7fe95fca46778c77eebff9c3829dfa1bb411" }, + { "pondsea_SH", "02209073bc0943451498de57f802650311b1f12aa6deffcd893da198a544c04f36" }, + { "popcornbag_AR", "02761f106fb34fbfc5ddcc0c0aa831ed98e462a908550b280a1f7bd32c060c6fa3" }, + { "popcornbag_NA", "03c6085c7fdfff70988fda9b197371f1caf8397f1729a844790e421ee07b3a93e8" }, // 50 + { "ptytrader_NA", "0328c61467148b207400b23875234f8a825cce65b9c4c9b664f47410b8b8e3c222" }, + { "ptytrader_SH", "0250c93c492d8d5a6b565b90c22bee07c2d8701d6118c6267e99a4efd3c7748fa4" }, + { "rnr_AR", "029bdb08f931c0e98c2c4ba4ef45c8e33a34168cb2e6bf953cef335c359d77bfcd" }, + { "rnr_EU", "03f5c08dadffa0ffcafb8dd7ffc38c22887bd02702a6c9ac3440deddcf2837692b" }, + { "rnr_NA", "02e17c5f8c3c80f584ed343b8dcfa6d710dfef0889ec1e7728ce45ce559347c58c" }, + { "rnr_SH", "037536fb9bdfed10251f71543fb42679e7c52308bcd12146b2568b9a818d8b8377" }, + { "titomane_AR", "03cda6ca5c2d02db201488a54a548dbfc10533bdc275d5ea11928e8d6ab33c2185" }, + { "titomane_EU", "02e41feded94f0cc59f55f82f3c2c005d41da024e9a805b41105207ef89aa4bfbd" }, + { "titomane_SH", "035f49d7a308dd9a209e894321f010d21b7793461b0c89d6d9231a3fe5f68d9960" }, + { "vanbreuk_EU", "024f3cad7601d2399c131fd070e797d9cd8533868685ddbe515daa53c2e26004c3" }, // 60 + { "xrobesx_NA", "03f0cc6d142d14a40937f12dbd99dbd9021328f45759e26f1877f2a838876709e1" }, + { "xxspot1_XX", "02ef445a392fcaf3ad4176a5da7f43580e8056594e003eba6559a713711a27f955" }, + { "xxspot2_XX", "03d85b221ea72ebcd25373e7961f4983d12add66a92f899deaf07bab1d8b6f5573" } +}; -int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height) +int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp) { int32_t i,htind,n; uint64_t mask = 0; struct knotary_entry *kp,*tmp; - if ( height >= 180000 || ASSETCHAINS_SYMBOL[0] != 0 ) + if ( height >= KOMODO_NOTARIES_HARDCODED || ASSETCHAINS_SYMBOL[0] != 0 ) { - n = (int32_t)(sizeof(Notaries_elected)/sizeof(*Notaries_elected)); - for (i=0; i= KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP ) + htind = (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1; pthread_mutex_lock(&komodo_mutex); n = Pubkeys[htind].numnotaries; HASH_ITER(hh,Pubkeys[htind].Notaries,kp,tmp) @@ -199,6 +236,38 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height) return(-1); } +int32_t komodo_electednotary(int32_t *numnotariesp,uint8_t *pubkey33,int32_t height,uint32_t timestamp) +{ + char pubkeystr[67]; int32_t i,n; uint8_t pubkeys[64][33]; + for (i=0; i<33; i++) + sprintf(&pubkeystr[i*2],"%02x",pubkey33[i]); + pubkeystr[66] = 0; + //printf("%s vs\n",pubkeystr); + n = komodo_notaries(pubkeys,height,timestamp); + *numnotariesp = n; + for (i=0; i= KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP ) + htind = (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1; + numnotaries = Pubkeys[htind].numnotaries; + for (i=0; i (numnotaries >> 1) || (wt > 7 && (signedmask & 1) != 0) ) + return(1); + else return(0); +} + void komodo_notarysinit(int32_t origheight,uint8_t pubkeys[64][33],int32_t num) { static int32_t hwmheight; @@ -212,6 +281,8 @@ void komodo_notarysinit(int32_t origheight,uint8_t pubkeys[64][33],int32_t num) height /= KOMODO_ELECTION_GAP; height = ((height + 1) * KOMODO_ELECTION_GAP); htind = (height / KOMODO_ELECTION_GAP); + if ( htind >= KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP ) + htind = (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1; //printf("htind.%d activation %d from %d vs %d | hwmheight.%d %s\n",htind,height,origheight,(((origheight+KOMODO_ELECTION_GAP/2)/KOMODO_ELECTION_GAP)+1)*KOMODO_ELECTION_GAP,hwmheight,ASSETCHAINS_SYMBOL); } else htind = 0; pthread_mutex_lock(&komodo_mutex); @@ -244,7 +315,7 @@ void komodo_notarysinit(int32_t origheight,uint8_t pubkeys[64][33],int32_t num) hwmheight = origheight; } -int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33) +int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp) { // -1 if not notary, 0 if notary, 1 if special notary struct knotary_entry *kp; int32_t numnotaries=0,htind,modval = -1; @@ -255,18 +326,19 @@ int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33) printf("komodo_chosennotary ht.%d illegal\n",height); return(-1); } - if ( height >= 180000 ) + if ( height >= KOMODO_NOTARIES_HARDCODED || ASSETCHAINS_SYMBOL[0] != 0 ) { - if ( (*notaryidp= komodo_electednotary(pubkey33,height)) >= 0 ) + if ( (*notaryidp= komodo_electednotary(&numnotaries,pubkey33,height,timestamp)) >= 0 && numnotaries != 0 ) { - numnotaries = (int32_t)(sizeof(Notaries_elected)/sizeof(*Notaries_elected)); modval = ((height % numnotaries) == *notaryidp); return(modval); } } - if ( height >= 250000 )//300000 ) + if ( height >= 250000 ) return(-1); htind = height / KOMODO_ELECTION_GAP; + if ( htind >= KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP ) + htind = (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1; pthread_mutex_lock(&komodo_mutex); HASH_FIND(hh,Pubkeys[htind].Notaries,pubkey33,33,kp); pthread_mutex_unlock(&komodo_mutex); @@ -405,7 +477,7 @@ void komodo_init(int32_t height) // Minerids[i] = -2; didinit = 1; } - else if ( 0 && height == KOMODO_MAINNET_START ) + /*else if ( 0 && height == KOMODO_MAINNET_START ) { n = (int32_t)(sizeof(Notaries_elected)/sizeof(*Notaries_elected)); for (k=0; k 100000000 ) + { + ASSETCHAINS_DECAY = 0; + printf("ASSETCHAINS_DECAY cant be more than 100000000\n"); + } + if ( strlen(ASSETCHAINS_OVERRIDE_PUBKEY.c_str()) == 66 && ASSETCHAINS_COMMISSION > 0 && ASSETCHAINS_COMMISSION <= 1000000 ) + decode_hex(ASSETCHAINS_OVERRIDE_PUBKEY33,33,(char *)ASSETCHAINS_OVERRIDE_PUBKEY.c_str()); + else + { + ASSETCHAINS_COMMISSION = 0; + printf("ASSETCHAINS_COMMISSION needs an ASETCHAINS_OVERRIDE_PUBKEY\n"); + } + if ( ASSETCHAINS_ENDSUBSIDY != 0 || ASSETCHAINS_REWARD != 0 || ASSETCHAINS_HALVING != 0 || ASSETCHAINS_DECAY != 0 || ASSETCHAINS_COMMISSION != 0 ) + { + printf("end.%d reward.%llu halving.%llu decay.%llu perc.%llu\n",ASSETCHAINS_ENDSUBSIDY,(long long)ASSETCHAINS_REWARD,(long long)ASSETCHAINS_HALVING,(long long)ASSETCHAINS_DECAY,(long long)ASSETCHAINS_COMMISSION); + extraptr = extrabuf; + memcpy(extraptr,ASSETCHAINS_OVERRIDE_PUBKEY33,33), extralen = 33; + extralen += iguana_rwnum(1,&extraptr[extralen],sizeof(ASSETCHAINS_ENDSUBSIDY),(void *)&ASSETCHAINS_ENDSUBSIDY); + extralen += iguana_rwnum(1,&extraptr[extralen],sizeof(ASSETCHAINS_REWARD),(void *)&ASSETCHAINS_REWARD); + extralen += iguana_rwnum(1,&extraptr[extralen],sizeof(ASSETCHAINS_HALVING),(void *)&ASSETCHAINS_HALVING); + extralen += iguana_rwnum(1,&extraptr[extralen],sizeof(ASSETCHAINS_DECAY),(void *)&ASSETCHAINS_DECAY); + extralen += iguana_rwnum(1,&extraptr[extralen],sizeof(ASSETCHAINS_COMMISSION),(void *)&ASSETCHAINS_COMMISSION); + } addn = GetArg("-seednode",""); if ( strlen(addn.c_str()) > 0 ) ASSETCHAINS_SEED = 1; @@ -1545,7 +1589,7 @@ void komodo_args(char *argv0) MAX_MONEY = komodo_maxallowed(baseid); else MAX_MONEY = (ASSETCHAINS_SUPPLY+1) * SATOSHIDEN; //printf("baseid.%d MAX_MONEY.%s %.8f\n",baseid,ASSETCHAINS_SYMBOL,(double)MAX_MONEY/SATOSHIDEN); - ASSETCHAINS_PORT = komodo_port(ASSETCHAINS_SYMBOL,ASSETCHAINS_SUPPLY,&ASSETCHAINS_MAGIC); + ASSETCHAINS_PORT = komodo_port(ASSETCHAINS_SYMBOL,ASSETCHAINS_SUPPLY,&ASSETCHAINS_MAGIC,extraptr,extralen); while ( (dirname= (char *)GetDataDir(false).string().c_str()) == 0 || dirname[0] == 0 ) { fprintf(stderr,"waiting for datadir\n"); @@ -1564,8 +1608,8 @@ void komodo_args(char *argv0) COINBASE_MATURITY = 1; LogPrintf("ASSETCHAINS_PORT %s %u\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT); } - ASSETCHAINS_NOTARIES = GetArg("-ac_notaries",""); - komodo_assetchain_pubkeys((char *)ASSETCHAINS_NOTARIES.c_str()); + //ASSETCHAINS_NOTARIES = GetArg("-ac_notaries",""); + //komodo_assetchain_pubkeys((char *)ASSETCHAINS_NOTARIES.c_str()); iguana_rwnum(1,magic,sizeof(ASSETCHAINS_MAGIC),(void *)&ASSETCHAINS_MAGIC); for (i=0; i<4; i++) sprintf(&magicstr[i<<1],"%02x",magic[i]); @@ -1615,7 +1659,7 @@ void komodo_args(char *argv0) break; } } - BITCOIND_PORT = GetArg("-rpcport", BaseParams().RPCPort()); + BITCOIND_PORT = GetArg("-rpcport", BaseParams().RPCPort()); //fprintf(stderr,"%s chain params initialized\n",ASSETCHAINS_SYMBOL); } diff --git a/src/main.cpp b/src/main.cpp index e06749072..0ac888c71 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1493,11 +1493,11 @@ bool ReadBlockFromDisk(CBlock& block, const CBlockIndex* pindex) //uint64_t komodo_moneysupply(int32_t height); extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; extern uint32_t ASSETCHAINS_MAGIC; -extern uint64_t ASSETCHAINS_SUPPLY; +extern uint64_t ASSETCHAINS_ENDSUBSIDY,ASSETCHAINS_REWARD,ASSETCHAINS_HALVING,ASSETCHAINS_LINEAR,ASSETCHAINS_COMMISSION,ASSETCHAINS_SUPPLY = 10; CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams) { - CAmount nSubsidy = 3 * COIN; + int32_t numhalvings; uint64_t numerator; CAmount nSubsidy = 3 * COIN; if ( ASSETCHAINS_SYMBOL[0] == 0 ) { if ( nHeight == 1 ) @@ -1510,7 +1510,38 @@ CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams) { if ( nHeight == 1 ) return(ASSETCHAINS_SUPPLY * COIN + (ASSETCHAINS_MAGIC & 0xffffff)); - else return(10000); + else if ( ASSETCHAINS_ENDSUBSIDY == 0 || nHeight < ASSETCHAINS_ENDSUBSIDY ) + { + if ( ASSETCHAINS_REWARD == 0 ) + return(10000); + else if ( ASSETCHAINS_ENDHEIGHT != 0 && nHeight >= ASSETCHAINS_ENDHEIGHT ) + return(0); + else + { + nSubsidy = ASSETCHAINS_REWARD; + if ( ASSETCHAINS_HALVING != 0 ) + { + if ( (numhalvings= (nHeight / ASSETCHAINS_HALVING)) > 0 ) + { + if ( numhalvings >= 64 && ASSETCHAINS_DECAY == 0 ) + return(0); + if ( ASSETCHAINS_DECAY == 0 ) + nSubsidy >>= numhalvings; + else if ( ASSETCHAINS_DECAY == 100000000 && ASSETCHAINS_ENDHEIGHT != 0 ) + { + numerator = (ASSETCHAINS_ENDHEIGHT - nHeight); + nSubsidy = (nSubidy * numerator) / ASSETCHAINS_ENDHEIGHT; + } + else + { + for (i=0; i 0 ) // have pricefeed @@ -411,14 +411,14 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) txNew.vout[1].nValue = 0; //fprintf(stderr,"opretlen.%d\n",opretlen); } //else printf("null opretlen for prices\n"); - }*/ + } } else if ( komodo_is_issuer() != 0 ) { komodo_gateway_deposits(&txNew,ASSETCHAINS_SYMBOL,0); if ( txNew.vout.size() > 1 ) fprintf(stderr,"%s txNew numvouts.%d\n",ASSETCHAINS_SYMBOL,(int32_t)txNew.vout.size()); - } + }*/ pblock->vtx[0] = txNew; pblocktemplate->vTxFees[0] = -nFees; @@ -640,7 +640,7 @@ void static BitcoinMiner() unsigned int n = chainparams.EquihashN(); unsigned int k = chainparams.EquihashK(); - int32_t notaryid = -1; + uint8_t *script; uint64_t total,checktoshis; int32_t i,j,notaryid = -1; while ( (ASSETCHAIN_INIT == 0 || KOMODO_INITDONE == 0) ) //chainActive.Tip()->nHeight != 235300 && { sleep(1); @@ -648,7 +648,7 @@ void static BitcoinMiner() break; } //sleep(60); - komodo_chosennotary(¬aryid,chainActive.Tip()->nHeight,NOTARY_PUBKEY33); + komodo_chosennotary(¬aryid,chainActive.Tip()->nHeight,NOTARY_PUBKEY33,(uint32_t)chainActive.Tip()->GetBlockTime()); std::string solver; //if ( notaryid >= 0 || ASSETCHAINS_SYMBOL[0] != 0 ) @@ -741,14 +741,42 @@ void static BitcoinMiner() CBlock *pblock = &pblocktemplate->block; if ( ASSETCHAINS_SYMBOL[0] != 0 ) { - if ( pblock->vtx.size() == 1 && pblock->vtx[0].vout.size() == 1 && Mining_height > ASSETCHAINS_MINHEIGHT ) + if ( ASSETCHAINS_REWARD == 0 ) { - static uint32_t counter; - if ( counter++ < 10 ) - fprintf(stderr,"skip generating %s on-demand block, no tx avail\n",ASSETCHAINS_SYMBOL); - sleep(10); - continue; - } else fprintf(stderr,"%s vouts.%d mining.%d vs %d\n",ASSETCHAINS_SYMBOL,(int32_t)pblock->vtx[0].vout.size(),Mining_height,ASSETCHAINS_MINHEIGHT); + if ( pblock->vtx.size() == 1 && pblock->vtx[0].vout.size() == 1 && Mining_height > ASSETCHAINS_MINHEIGHT ) + { + static uint32_t counter; + if ( counter++ < 10 ) + fprintf(stderr,"skip generating %s on-demand block, no tx avail\n",ASSETCHAINS_SYMBOL); + sleep(10); + continue; + } else fprintf(stderr,"%s vouts.%d mining.%d vs %d\n",ASSETCHAINS_SYMBOL,(int32_t)pblock->vtx[0].vout.size(),Mining_height,ASSETCHAINS_MINHEIGHT); + } + else if ( ASSETCHAINS_COMMISSION != 0 ) + { + total = 0; + for (i=1; ivtx.size(); i++) + { + n = pblock->vtx[i].vout.size(); + for (j=0; jvtx[i].vout[j].nValue; + } + if ( (checktoshis = (total * ASSETCHAINS_COMMISSION) / COIN) != 0 ) + { + pblock->vtx[0].vout[1].nValue = checktoshis; + pblock->vtx[0].vout.resize(2); + pblock->vtx[0].vout[1].scriptPubKey.resize(35); + script = (uint8_t *)pblock->vtx[0].vout[1].scriptPubKey.data(); + script[0] = 33; + for (i=0; i<33; i++) + script[i+1] = ASSETCHAINS_OVERRIDE_PUBKEY33[i]; + script[34] = OP_CHECKSIG; + } + } + else + { + pblock->vtx[0].vout.resize(1); + } } IncrementExtraNonce(pblock, pindexPrev, nExtraNonce); LogPrintf("Running KomodoMiner.%s with %u transactions in block (%u bytes)\n",solver.c_str(),pblock->vtx.size(),::GetSerializeSize(*pblock,SER_NETWORK,PROTOCOL_VERSION)); diff --git a/src/pow.cpp b/src/pow.cpp index cbee3f6a6..39d4fbc42 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -115,13 +115,14 @@ bool CheckEquihashSolution(const CBlockHeader *pblock, const CChainParams& param return true; } -int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33); -int32_t komodo_is_special(int32_t height,uint8_t pubkey33[33]); +int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp); +int32_t komodo_is_special(int32_t height,uint8_t pubkey33[33],uint32_t timestamp); int32_t komodo_currentheight(); CBlockIndex *komodo_chainactive(int32_t height); int8_t komodo_minerid(int32_t height,uint8_t *pubkey33); void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height); extern int32_t KOMODO_CHOSEN_ONE; +extern char ASSETCHAINS_SYMBOL[]; #define KOMODO_ELECTION_GAP 2000 int32_t komodo_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,int32_t *nonzpkeysp,int32_t height); @@ -132,15 +133,16 @@ extern std::string NOTARY_PUBKEY; bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned int nBits, const Consensus::Params& params) { extern int32_t KOMODO_REWIND; - bool fNegative,fOverflow; int32_t i,nonzpkeys=0,nonz=0,special=0,special2=0,notaryid=-1,duplicate,flag = 0, mids[66]; + bool fNegative,fOverflow; int32_t i,nonzpkeys=0,nonz=0,special=0,special2=0,notaryid=-1,duplicate,flag = 0, mids[66]; uint32_t timestamp = 0; arith_uint256 bnTarget; CBlockIndex *pindex; uint8_t pubkeys[66][33]; - + if ( (pindex= chainActive.Tip()) != 0 ) + timestamp = (uint32_t)pindex->GetBlockTime(); bnTarget.SetCompact(nBits, &fNegative, &fOverflow); if ( height == 0 ) height = komodo_currentheight() + 1; - special = komodo_chosennotary(¬aryid,height,pubkey33); - flag = komodo_eligiblenotary(pubkeys,mids,&nonzpkeys,height); - if ( height > 34000 ) // 0 -> non-special notary + special = komodo_chosennotary(¬aryid,height,pubkey33,timestamp); + flag = komodo_eligiblenotary(pubkeys,mids,&nonzpkeys,height,timestamp); + if ( height > 34000 && ASSETCHAINS_SYMBOL[0] == 0 ) // 0 -> non-special notary { for (i=0; i<33; i++) { @@ -149,7 +151,7 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in } if ( nonz == 0 ) return(true); // will come back via different path with pubkey set - special2 = komodo_is_special(height,pubkey33); + special2 = komodo_is_special(height,pubkey33,timestamp); if ( notaryid >= 0 ) { if ( height > 10000 && height < 80000 && (special != 0 || special2 > 0) ) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 6008e341d..d34cfde05 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -46,7 +46,7 @@ int32_t Jumblr_secretaddradd(char *secretaddr); uint64_t komodo_interestsum(); int32_t komodo_longestchain(); int32_t komodo_notarized_height(uint256 *hashp,uint256 *txidp); -int32_t komodo_whoami(char *pubkeystr,int32_t height); +int32_t komodo_whoami(char *pubkeystr,int32_t height,uint32_t timestamp); extern int32_t KOMODO_LASTMINED,JUMBLR_PAUSE; extern char ASSETCHAINS_SYMBOL[]; int32_t notarizedtxid_height(char *dest,char *txidstr,int32_t *kmdnotarized_heightp); @@ -139,7 +139,7 @@ UniValue getinfo(const UniValue& params, bool fHelp) obj.push_back(Pair("errors", GetWarnings("statusbar"))); { char pubkeystr[65]; int32_t notaryid; - if ( (notaryid= komodo_whoami(pubkeystr,(int32_t)chainActive.Tip()->nHeight)) >= 0 ) + if ( (notaryid= komodo_whoami(pubkeystr,(int32_t)chainActive.Tip()->nHeight,(int32_t)(uint32_t)(uint32_t)chainActive.Tip()->GetBlocktime())) >= 0 ) { obj.push_back(Pair("notaryid", notaryid)); obj.push_back(Pair("pubkey", pubkeystr)); From 9757c8f97eff7665559fdc352f8e54a15927113d Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 13 Feb 2018 21:33:49 +0200 Subject: [PATCH 02/32] Test --- src/komodo_utils.h | 2 +- src/main.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index d18bfc659..0c9281e58 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1572,7 +1572,7 @@ void komodo_args(char *argv0) } if ( ASSETCHAINS_ENDSUBSIDY != 0 || ASSETCHAINS_REWARD != 0 || ASSETCHAINS_HALVING != 0 || ASSETCHAINS_DECAY != 0 || ASSETCHAINS_COMMISSION != 0 ) { - printf("end.%d reward.%llu halving.%llu decay.%llu perc.%llu\n",ASSETCHAINS_ENDSUBSIDY,(long long)ASSETCHAINS_REWARD,(long long)ASSETCHAINS_HALVING,(long long)ASSETCHAINS_DECAY,(long long)ASSETCHAINS_COMMISSION); + printf("end.%llu reward.%llu halving.%llu decay.%llu perc.%llu\n",(long long)ASSETCHAINS_ENDSUBSIDY,(long long)ASSETCHAINS_REWARD,(long long)ASSETCHAINS_HALVING,(long long)ASSETCHAINS_DECAY,(long long)ASSETCHAINS_COMMISSION); extraptr = extrabuf; memcpy(extraptr,ASSETCHAINS_OVERRIDE_PUBKEY33,33), extralen = 33; extralen += iguana_rwnum(1,&extraptr[extralen],sizeof(ASSETCHAINS_ENDSUBSIDY),(void *)&ASSETCHAINS_ENDSUBSIDY); diff --git a/src/main.cpp b/src/main.cpp index 0ac888c71..9e6674580 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1493,7 +1493,7 @@ bool ReadBlockFromDisk(CBlock& block, const CBlockIndex* pindex) //uint64_t komodo_moneysupply(int32_t height); extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; extern uint32_t ASSETCHAINS_MAGIC; -extern uint64_t ASSETCHAINS_ENDSUBSIDY,ASSETCHAINS_REWARD,ASSETCHAINS_HALVING,ASSETCHAINS_LINEAR,ASSETCHAINS_COMMISSION,ASSETCHAINS_SUPPLY = 10; +extern uint64_t ASSETCHAINS_ENDSUBSIDY,ASSETCHAINS_REWARD,ASSETCHAINS_HALVING,ASSETCHAINS_LINEAR,ASSETCHAINS_COMMISSION,ASSETCHAINS_SUPPLY; CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams) { @@ -1514,7 +1514,7 @@ CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams) { if ( ASSETCHAINS_REWARD == 0 ) return(10000); - else if ( ASSETCHAINS_ENDHEIGHT != 0 && nHeight >= ASSETCHAINS_ENDHEIGHT ) + else if ( ASSETCHAINS_ENDSUBSIDY != 0 && nHeight >= ASSETCHAINS_ENDSUBSIDY ) return(0); else { @@ -1527,10 +1527,10 @@ CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams) return(0); if ( ASSETCHAINS_DECAY == 0 ) nSubsidy >>= numhalvings; - else if ( ASSETCHAINS_DECAY == 100000000 && ASSETCHAINS_ENDHEIGHT != 0 ) + else if ( ASSETCHAINS_DECAY == 100000000 && ASSETCHAINS_ENDSUBSIDY != 0 ) { - numerator = (ASSETCHAINS_ENDHEIGHT - nHeight); - nSubsidy = (nSubidy * numerator) / ASSETCHAINS_ENDHEIGHT; + numerator = (ASSETCHAINS_ENDSUBSIDY - nHeight); + nSubsidy = (nSubidy * numerator) / ASSETCHAINS_ENDSUBSIDY; } else { From 53a94b280dc6785a8f6e34d4f37dcb5ea4e48fac Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 13 Feb 2018 21:34:09 +0200 Subject: [PATCH 03/32] Test --- src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 9e6674580..8d66ebe72 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1497,7 +1497,7 @@ extern uint64_t ASSETCHAINS_ENDSUBSIDY,ASSETCHAINS_REWARD,ASSETCHAINS_HALVING,AS CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams) { - int32_t numhalvings; uint64_t numerator; CAmount nSubsidy = 3 * COIN; + int32_t numhalvings,i; uint64_t numerator; CAmount nSubsidy = 3 * COIN; if ( ASSETCHAINS_SYMBOL[0] == 0 ) { if ( nHeight == 1 ) @@ -1530,7 +1530,7 @@ CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams) else if ( ASSETCHAINS_DECAY == 100000000 && ASSETCHAINS_ENDSUBSIDY != 0 ) { numerator = (ASSETCHAINS_ENDSUBSIDY - nHeight); - nSubsidy = (nSubidy * numerator) / ASSETCHAINS_ENDSUBSIDY; + nSubsidy = (nSubsidy * numerator) / ASSETCHAINS_ENDSUBSIDY; } else { From 6e94384f91302ff758d76ab770033f7e7f76a87b Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 13 Feb 2018 21:37:32 +0200 Subject: [PATCH 04/32] Test --- src/komodo_utils.h | 6 +++--- src/main.cpp | 12 ++++++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 0c9281e58..22cc4fdf2 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1548,10 +1548,10 @@ void komodo_args(char *argv0) ASSETCHAINS_DECAY = GetArg("-ac_decay",0); ASSETCHAINS_COMMISSION = GetArg("-ac_perc",0); ASSETCHAINS_OVERRIDE_PUBKEY = GetArg("-ac_pubkey",""); - if ( ASSETCHAINS_HALVING != 0 && ASSETCHAINS_HALVING < 10000 ) + if ( ASSETCHAINS_HALVING != 0 && ASSETCHAINS_HALVING < 1440 ) { - ASSETCHAINS_HALVING = 10000; - printf("ASSETCHAINS_HALVING must be at least 10000 blocks\n"); + ASSETCHAINS_HALVING = 1440; + printf("ASSETCHAINS_HALVING must be at least 1440 blocks\n"); } if ( ASSETCHAINS_DECAY == 100000000 && ASSETCHAINS_ENDSUBSIDY == 0 ) { diff --git a/src/main.cpp b/src/main.cpp index 8d66ebe72..7f373e03b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1497,6 +1497,7 @@ extern uint64_t ASSETCHAINS_ENDSUBSIDY,ASSETCHAINS_REWARD,ASSETCHAINS_HALVING,AS CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams) { + static uint64_t cached_subsidy; static int32_t cached_numhalvings; int32_t numhalvings,i; uint64_t numerator; CAmount nSubsidy = 3 * COIN; if ( ASSETCHAINS_SYMBOL[0] == 0 ) { @@ -1534,8 +1535,15 @@ CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams) } else { - for (i=0; i 0 && cached_numhalvings == numhalvings ) + nSubsidy = cached_subsidy; + else + { + for (i=0; i Date: Tue, 13 Feb 2018 21:59:39 +0200 Subject: [PATCH 05/32] Test --- src/miner.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index bf6596065..ed2523a5a 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -109,9 +109,10 @@ void UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams, #include "komodo_defs.h" extern int32_t ASSETCHAINS_SEED,IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAIN_INIT,KOMODO_INITDONE,KOMODO_ON_DEMAND,KOMODO_INITDONE,KOMODO_PASSPORT_INITDONE; +extern uint32_t ASSETCHAINS_REWARD,ASSETCHAINS_COMMISSION; extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; extern std::string NOTARY_PUBKEY; -extern uint8_t NOTARY_PUBKEY33[33]; +extern uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33]; uint32_t Mining_start,Mining_height; int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp); int32_t komodo_is_special(int32_t height,uint8_t pubkey33[33],uint32_t timestamp); @@ -763,8 +764,8 @@ void static BitcoinMiner() } if ( (checktoshis = (total * ASSETCHAINS_COMMISSION) / COIN) != 0 ) { - pblock->vtx[0].vout[1].nValue = checktoshis; pblock->vtx[0].vout.resize(2); + pblock->vtx[0].vout[1].nValue = checktoshis; pblock->vtx[0].vout[1].scriptPubKey.resize(35); script = (uint8_t *)pblock->vtx[0].vout[1].scriptPubKey.data(); script[0] = 33; From 3ca78e01424a5f94cc4bbc659b6b664a9ede5d22 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 13 Feb 2018 22:06:20 +0200 Subject: [PATCH 06/32] Test --- src/miner.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index ed2523a5a..d447327a0 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -554,7 +554,7 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey) { for (i=0; i<65; i++) fprintf(stderr,"%d ",komodo_minerid(chainActive.Tip()->nHeight-i,0)); - fprintf(stderr," minerids.special %d from ht.%d\n",komodo_is_special(chainActive.Tip()->nHeight+1,NOTARY_PUBKEY33),chainActive.Tip()->nHeight); + fprintf(stderr," minerids.special %d from ht.%d\n",komodo_is_special(chainActive.Tip()->nHeight+1,NOTARY_PUBKEY33,chainActive.Tip()->nHeight); } return CreateNewBlock(scriptPubKey); } @@ -764,9 +764,9 @@ void static BitcoinMiner() } if ( (checktoshis = (total * ASSETCHAINS_COMMISSION) / COIN) != 0 ) { - pblock->vtx[0].vout.resize(2); + pblock->vtx[0].vout.resize((long)2); pblock->vtx[0].vout[1].nValue = checktoshis; - pblock->vtx[0].vout[1].scriptPubKey.resize(35); + pblock->vtx[0].vout[1].scriptPubKey.resize((long)35); script = (uint8_t *)pblock->vtx[0].vout[1].scriptPubKey.data(); script[0] = 33; for (i=0; i<33; i++) @@ -776,7 +776,7 @@ void static BitcoinMiner() } else { - pblock->vtx[0].vout.resize(1); + pblock->vtx[0].vout.resize((long)1); } } IncrementExtraNonce(pblock, pindexPrev, nExtraNonce); From d209491abf01aa4da4acb540b80d24411525a85a Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 13 Feb 2018 22:25:30 +0200 Subject: [PATCH 07/32] Test --- src/komodo_gateway.h | 13 ++++++------- src/komodo_utils.h | 4 ++-- src/miner.cpp | 27 +-------------------------- 3 files changed, 9 insertions(+), 35 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index d814bd6bf..b5ec33fb5 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -653,7 +653,7 @@ void komodo_passport_iteration(); int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above block is valid pax pricing { static uint256 array[64]; static int32_t numbanned,indallvouts; - int32_t i,j,k,n,ht,baseid,txn_count,activation,num,opretlen,offset=1,errs=0,matched=0,kmdheights[256],otherheights[256]; uint256 hash,txids[256]; char symbol[KOMODO_ASSETCHAIN_MAXLEN],base[KOMODO_ASSETCHAIN_MAXLEN]; uint16_t vouts[256]; int8_t baseids[256]; uint8_t *script,opcode,rmd160s[256*20]; uint64_t total,available,deposited,issued,withdrawn,approved,redeemed,checktoshis,seed; int64_t values[256],srcvalues[256]; struct pax_transaction *pax; struct komodo_state *sp; + int32_t i,j,k,n,ht,baseid,txn_count,activation,num,opretlen,offset=1,errs=0,matched=0,kmdheights[256],otherheights[256]; uint256 hash,txids[256]; char symbol[KOMODO_ASSETCHAIN_MAXLEN],base[KOMODO_ASSETCHAIN_MAXLEN]; uint16_t vouts[256]; int8_t baseids[256]; uint8_t *script,opcode,rmd160s[256*20]; uint64_t total,subsidy,available,deposited,issued,withdrawn,approved,redeemed,checktoshis,seed; int64_t values[256],srcvalues[256]; struct pax_transaction *pax; struct komodo_state *sp; activation = 235300; if ( *(int32_t *)&array[0] == 0 ) numbanned = komodo_bannedset(&indallvouts,array,(int32_t)(sizeof(array)/sizeof(*array))); @@ -721,6 +721,9 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above } if ( ASSETCHAINS_SYMBOL[0] != 0 && ASSETCHAINS_COMMISSION != 0 ) { + script = (uint8_t *)block.vtx[0].vout[0].scriptPubKey.data(); + if ( script[0] != 33 || script[34] != OP_CHECKSIG || memcmp(script+1,ASSETCHAINS_OVERRIDE_PUBKEY33,33) != 0 ) + return(-1); total = 0; for (i=1; i 0 && ASSETCHAINS_COMMISSION <= 1000000 ) + if ( strlen(ASSETCHAINS_OVERRIDE_PUBKEY.c_str()) == 66 && ASSETCHAINS_COMMISSION > 0 && ASSETCHAINS_COMMISSION <= 100000000 ) decode_hex(ASSETCHAINS_OVERRIDE_PUBKEY33,33,(char *)ASSETCHAINS_OVERRIDE_PUBKEY.c_str()); else { ASSETCHAINS_COMMISSION = 0; - printf("ASSETCHAINS_COMMISSION needs an ASETCHAINS_OVERRIDE_PUBKEY\n"); + printf("ASSETCHAINS_COMMISSION needs an ASETCHAINS_OVERRIDE_PUBKEY and cant be more than 100000000 (100%%)\n"); } if ( ASSETCHAINS_ENDSUBSIDY != 0 || ASSETCHAINS_REWARD != 0 || ASSETCHAINS_HALVING != 0 || ASSETCHAINS_DECAY != 0 || ASSETCHAINS_COMMISSION != 0 ) { diff --git a/src/miner.cpp b/src/miner.cpp index d447327a0..ddd484759 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -554,7 +554,7 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey) { for (i=0; i<65; i++) fprintf(stderr,"%d ",komodo_minerid(chainActive.Tip()->nHeight-i,0)); - fprintf(stderr," minerids.special %d from ht.%d\n",komodo_is_special(chainActive.Tip()->nHeight+1,NOTARY_PUBKEY33,chainActive.Tip()->nHeight); + fprintf(stderr," minerids.special %d from ht.%d\n",komodo_is_special(chainActive.Tip()->nHeight+1,NOTARY_PUBKEY33,chainActive.Tip()->nHeight)); } return CreateNewBlock(scriptPubKey); } @@ -753,31 +753,6 @@ void static BitcoinMiner() continue; } else fprintf(stderr,"%s vouts.%d mining.%d vs %d\n",ASSETCHAINS_SYMBOL,(int32_t)pblock->vtx[0].vout.size(),Mining_height,ASSETCHAINS_MINHEIGHT); } - else if ( ASSETCHAINS_COMMISSION != 0 ) - { - total = 0; - for (i=1; ivtx.size(); i++) - { - n = pblock->vtx[i].vout.size(); - for (j=0; jvtx[i].vout[j].nValue; - } - if ( (checktoshis = (total * ASSETCHAINS_COMMISSION) / COIN) != 0 ) - { - pblock->vtx[0].vout.resize((long)2); - pblock->vtx[0].vout[1].nValue = checktoshis; - pblock->vtx[0].vout[1].scriptPubKey.resize((long)35); - script = (uint8_t *)pblock->vtx[0].vout[1].scriptPubKey.data(); - script[0] = 33; - for (i=0; i<33; i++) - script[i+1] = ASSETCHAINS_OVERRIDE_PUBKEY33[i]; - script[34] = OP_CHECKSIG; - } - } - else - { - pblock->vtx[0].vout.resize((long)1); - } } IncrementExtraNonce(pblock, pindexPrev, nExtraNonce); LogPrintf("Running KomodoMiner.%s with %u transactions in block (%u bytes)\n",solver.c_str(),pblock->vtx.size(),::GetSerializeSize(*pblock,SER_NETWORK,PROTOCOL_VERSION)); From 6b1d77f5853d8836776016045666638f031f8622 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 13 Feb 2018 22:27:18 +0200 Subject: [PATCH 08/32] Test --- src/komodo_gateway.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index b5ec33fb5..2b3d382ac 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -733,7 +733,7 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above } if ( (checktoshis = (total * ASSETCHAINS_COMMISSION) / COIN) != 0 ) { - subsidy = GetBlockSubsidy(height,chainparams.GetConsensus()); + subsidy = GetBlockSubsidy(height,Params().GetConsensus()); if ( block.vtx[0].vout.size() != 1 || block.vtx[0].vout[0].nValue != checktoshis+subsidy ) return(-1); } From da7b748e6bd4b051cd1450d8c084e31ccc878531 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 13 Feb 2018 22:30:59 +0200 Subject: [PATCH 09/32] Test --- src/miner.cpp | 2 +- src/pow.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index ddd484759..9abd309f3 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -554,7 +554,7 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey) { for (i=0; i<65; i++) fprintf(stderr,"%d ",komodo_minerid(chainActive.Tip()->nHeight-i,0)); - fprintf(stderr," minerids.special %d from ht.%d\n",komodo_is_special(chainActive.Tip()->nHeight+1,NOTARY_PUBKEY33,chainActive.Tip()->nHeight)); + fprintf(stderr," minerids.special %d from ht.%d\n",komodo_is_special(chainActive.Tip()->nHeight+1,NOTARY_PUBKEY33,chainActive.Tip()->GetBlockTime()),chainActive.Tip()->nHeight)); } return CreateNewBlock(scriptPubKey); } diff --git a/src/pow.cpp b/src/pow.cpp index 39d4fbc42..fde35cb57 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -141,7 +141,7 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in if ( height == 0 ) height = komodo_currentheight() + 1; special = komodo_chosennotary(¬aryid,height,pubkey33,timestamp); - flag = komodo_eligiblenotary(pubkeys,mids,&nonzpkeys,height,timestamp); + flag = komodo_eligiblenotary(pubkeys,mids,&nonzpkeys,height); if ( height > 34000 && ASSETCHAINS_SYMBOL[0] == 0 ) // 0 -> non-special notary { for (i=0; i<33; i++) From ac756fd8bbb7a323f939eae3ec561360fedb2c56 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 13 Feb 2018 22:32:14 +0200 Subject: [PATCH 10/32] Test --- src/miner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/miner.cpp b/src/miner.cpp index 9abd309f3..44acf06c6 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -554,7 +554,7 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey) { for (i=0; i<65; i++) fprintf(stderr,"%d ",komodo_minerid(chainActive.Tip()->nHeight-i,0)); - fprintf(stderr," minerids.special %d from ht.%d\n",komodo_is_special(chainActive.Tip()->nHeight+1,NOTARY_PUBKEY33,chainActive.Tip()->GetBlockTime()),chainActive.Tip()->nHeight)); + fprintf(stderr," minerids.special %d from ht.%d\n",komodo_is_special(chainActive.Tip()->nHeight+1,NOTARY_PUBKEY33,chainActive.Tip()->GetBlockTime()),chainActive.Tip()->nHeight); } return CreateNewBlock(scriptPubKey); } From 698c5e7e94eb39d16d422ec2cab8e162b513ff53 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 13 Feb 2018 22:34:29 +0200 Subject: [PATCH 11/32] Test --- src/pow.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pow.cpp b/src/pow.cpp index fde35cb57..033f8d9e3 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -13,6 +13,7 @@ #include "streams.h" #include "uint256.h" #include "util.h" +#include "consensus/validation.h" #include "sodium.h" From ae0bb3d3c3188ac1f8c55ef281941d78bc34ebb8 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 13 Feb 2018 22:36:44 +0200 Subject: [PATCH 12/32] Test --- src/komodo_bitcoind.h | 7 +++++++ src/pow.cpp | 5 ++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index de77c6fb3..2a226a714 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -658,6 +658,13 @@ int32_t komodo_blockload(CBlock& block,CBlockIndex *pindex) return(0); } +uint32_t komodo_chainactive_timestamp() +{ + if ( chainActive.Tip() != 0 ) + return((uint32_t)chainActive.Tip()->GetBlockTime()); + else return(0); +} + CBlockIndex *komodo_chainactive(int32_t height) { if ( chainActive.Tip() != 0 ) diff --git a/src/pow.cpp b/src/pow.cpp index 033f8d9e3..9621fadad 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -13,13 +13,13 @@ #include "streams.h" #include "uint256.h" #include "util.h" -#include "consensus/validation.h" #include "sodium.h" #ifdef ENABLE_RUST #include "librustzcash.h" #endif // ENABLE_RUST +uint32_t komodo_chainactive_timestamp(); unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params) { @@ -136,8 +136,7 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in extern int32_t KOMODO_REWIND; bool fNegative,fOverflow; int32_t i,nonzpkeys=0,nonz=0,special=0,special2=0,notaryid=-1,duplicate,flag = 0, mids[66]; uint32_t timestamp = 0; arith_uint256 bnTarget; CBlockIndex *pindex; uint8_t pubkeys[66][33]; - if ( (pindex= chainActive.Tip()) != 0 ) - timestamp = (uint32_t)pindex->GetBlockTime(); + timestamp = komodo_chainactive_timestamp(); bnTarget.SetCompact(nBits, &fNegative, &fOverflow); if ( height == 0 ) height = komodo_currentheight() + 1; From e169b65ff0ac7a435952d71552905920fc647667 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 13 Feb 2018 22:37:47 +0200 Subject: [PATCH 13/32] New features in testing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New komodod -ac parameters for assetchains. If -ac_reward= is non-zero, the chain will mine normally and start with -ac_reward for the block reward. if -ac_end= is set, then -ac_reward will be 0 after endheight is reached if -ac_halving= is set, then every blocks the block reward is reduced according to one of three methods. 1440 (approx a day) is the most frequent halving period if -ac_decay is not set, then the normal bitcoin halving is done. if -ac_decay= is set to be exactly 100000000, then the -ac_reward is scaled linearly toward 0, with 0 at endheight. for all other values of numerator (less than 100000000) the reward is iteratively reduced by the number of "halving" periods, ie. numhalvings = (height / -ac_halving); for (i=0; i is nonzero and less than equal 100000000 and -ac_pubkey= is set to a 33byte hexstr (len 66 starting with 02 or 03) then there will be a second vout in the coinbase transaction that is exactly the commission rate indicated by -ac_perc, with 100000000 being the max of 100%. wallets will need to be customized to make sure to pay the -ac_perc of transaction size as txfee. chains with a percentage override can only be mined by the -ac_pubkey address bitcoin behavior would be -ac_reward=5000000000 -ac_halving=210000 KMD behavior would be -ac_reward = 300000000 -ac_end=7777777 a more smoothly reducing reward that halves every 210000 blocks would be:  -ac_reward=5000000000 -ac_halving=10000 -ac_decay=96777000 This release also supports a second slate of hardcoded notaries --- src/komodo_bitcoind.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 2a226a714..e904a5b1b 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -662,7 +662,7 @@ uint32_t komodo_chainactive_timestamp() { if ( chainActive.Tip() != 0 ) return((uint32_t)chainActive.Tip()->GetBlockTime()); - else return(0); + else return(0); } CBlockIndex *komodo_chainactive(int32_t height) From e34a9d43fee54989617040f00e0981ea6f0e910d Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 13 Feb 2018 22:42:34 +0200 Subject: [PATCH 14/32] Fix --- .gitignore | 2 ++ src/komodo_bitcoind.h | 2 +- src/rpcmisc.cpp | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 3e934cb9f..5b8b361e1 100644 --- a/.gitignore +++ b/.gitignore @@ -114,3 +114,5 @@ libzcashconsensus.pc src/fiat/-usd contrib/debian/files contrib/debian/substvars + +src/rpcmisc~.cpp diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index e904a5b1b..2a226a714 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -662,7 +662,7 @@ uint32_t komodo_chainactive_timestamp() { if ( chainActive.Tip() != 0 ) return((uint32_t)chainActive.Tip()->GetBlockTime()); - else return(0); + else return(0); } CBlockIndex *komodo_chainactive(int32_t height) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index d34cfde05..3fdd3bb89 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -46,6 +46,7 @@ int32_t Jumblr_secretaddradd(char *secretaddr); uint64_t komodo_interestsum(); int32_t komodo_longestchain(); int32_t komodo_notarized_height(uint256 *hashp,uint256 *txidp); +uint32_t komodo_chainactive_timestamp(); int32_t komodo_whoami(char *pubkeystr,int32_t height,uint32_t timestamp); extern int32_t KOMODO_LASTMINED,JUMBLR_PAUSE; extern char ASSETCHAINS_SYMBOL[]; @@ -139,7 +140,7 @@ UniValue getinfo(const UniValue& params, bool fHelp) obj.push_back(Pair("errors", GetWarnings("statusbar"))); { char pubkeystr[65]; int32_t notaryid; - if ( (notaryid= komodo_whoami(pubkeystr,(int32_t)chainActive.Tip()->nHeight,(int32_t)(uint32_t)(uint32_t)chainActive.Tip()->GetBlocktime())) >= 0 ) + if ( (notaryid= komodo_whoami(pubkeystr,(int32_t)chainActive.Tip()->nHeight,komodo_chainactive_timestamp())) >= 0 ) { obj.push_back(Pair("notaryid", notaryid)); obj.push_back(Pair("pubkey", pubkeystr)); From 85ef725a7d5700e5b35bf5f46ddf2d8e516c15c4 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 13 Feb 2018 22:52:45 +0200 Subject: [PATCH 15/32] Test --- src/komodo.h | 2 +- src/komodo_bitcoind.h | 11 ++++++----- src/rpcblockchain.cpp | 12 +++++++++--- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index 3b22453a4..129ea3b5f 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -646,7 +646,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) return; } //fprintf(stderr,"%s connect.%d\n",ASSETCHAINS_SYMBOL,pindex->nHeight); - numnotaries = komodo_notaries(pubkeys,pindex->nHeight); + numnotaries = komodo_notaries(pubkeys,pindex->nHeight,pindex->GetBlockTime()); calc_rmd160_sha256(rmd160,pubkeys[0],33); if ( pindex->nHeight > hwmheight ) hwmheight = pindex->nHeight; diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 2a226a714..e73cae4e5 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -710,27 +710,28 @@ void komodo_connectpindex(CBlockIndex *pindex) komodo_connectblock(pindex,block); } -int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height); -int32_t komodo_electednotary(uint8_t *pubkey33,int32_t height); +int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp); +int32_t komodo_electednotary(uint8_t *pubkey33,int32_t height,uint32_t timestamp); int8_t komodo_minerid(int32_t height,uint8_t *pubkey33) { - int32_t num,i; CBlockIndex *pindex; uint8_t _pubkey33[33],pubkeys[64][33]; + int32_t num,i; CBlockIndex *pindex; uint32_t timestamp=0; uint8_t _pubkey33[33],pubkeys[64][33]; if ( pubkey33 == 0 && (pindex= chainActive[height]) != 0 ) { + timestamp = pindex->GetBlockTime(); if ( pubkey33 == 0 ) { pubkey33 = _pubkey33; komodo_index2pubkey33(pubkey33,pindex,height); } - if ( (num= komodo_notaries(pubkeys,height)) > 0 ) + if ( (num= komodo_notaries(pubkeys,height,timestamp)) > 0 ) { for (i=0; inHeight; + else + { + CBlockIndex *pblockindex = chainActive[height]; + if ( pblockindex != 0 ) + timestamp = pblockindex->GetBlockTime(); + } if ( (n= komodo_minerids(minerids,height,(int32_t)(sizeof(minerids)/sizeof(*minerids)))) > 0 ) { memset(tally,0,sizeof(tally)); - numnotaries = komodo_notaries(pubkeys,height); + numnotaries = komodo_notaries(pubkeys,height,timestamp); if ( numnotaries > 0 ) { for (i=0; i Date: Tue, 13 Feb 2018 22:54:45 +0200 Subject: [PATCH 16/32] Test --- src/rpcblockchain.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 5a15fb918..e004252b4 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -638,13 +638,22 @@ UniValue minerids(const UniValue& params, bool fHelp) UniValue notaries(const UniValue& params, bool fHelp) { - UniValue a(UniValue::VARR); UniValue ret(UniValue::VOBJ); int32_t i,j,n,m; char *hexstr; uint8_t pubkeys[64][33]; char btcaddr[64],kmdaddr[64],*ptr; + UniValue a(UniValue::VARR); uint32_t timestamp=0; UniValue ret(UniValue::VOBJ); int32_t i,j,n,m; char *hexstr; uint8_t pubkeys[64][33]; char btcaddr[64],kmdaddr[64],*ptr; if ( fHelp || params.size() != 1 ) throw runtime_error("notaries height\n"); LOCK(cs_main); int32_t height = atoi(params[0].get_str().c_str()); if ( height < 0 ) + { height = chainActive.Tip()->nHeight; + timestamp = chainActive.Tip()->GetBlockTime(); + } + else + { + CBlockIndex *pblockindex = chainActive[height]; + if ( pblockindex != 0 ) + timestamp = pblockindex->GetBlockTime(); + } //fprintf(stderr,"notaries as of height.%d\n",height); //if ( height > chainActive.Height()+20000 ) // throw JSONRPCError(RPC_INVALID_PARAMETER, "Block height out of range"); From 148e99adac7e1ca09b753cd13ef9433eccf40195 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 13 Feb 2018 22:55:14 +0200 Subject: [PATCH 17/32] Test --- src/rpcblockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index e004252b4..91f694abb 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -659,7 +659,7 @@ UniValue notaries(const UniValue& params, bool fHelp) // throw JSONRPCError(RPC_INVALID_PARAMETER, "Block height out of range"); //else { - if ( (n= komodo_notaries(pubkeys,height)) > 0 ) + if ( (n= komodo_notaries(pubkeys,height,timestamp)) > 0 ) { for (i=0; i Date: Tue, 13 Feb 2018 22:57:25 +0200 Subject: [PATCH 18/32] Test --- src/komodo_bitcoind.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index e73cae4e5..d4364a3ea 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -711,11 +711,11 @@ void komodo_connectpindex(CBlockIndex *pindex) } int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp); -int32_t komodo_electednotary(uint8_t *pubkey33,int32_t height,uint32_t timestamp); +int32_t komodo_electednotary(int32_t *numnotariesp,uint8_t *pubkey33,int32_t height,uint32_t timestamp); int8_t komodo_minerid(int32_t height,uint8_t *pubkey33) { - int32_t num,i; CBlockIndex *pindex; uint32_t timestamp=0; uint8_t _pubkey33[33],pubkeys[64][33]; + int32_t num,i,numnotaries; CBlockIndex *pindex; uint32_t timestamp=0; uint8_t _pubkey33[33],pubkeys[64][33]; if ( pubkey33 == 0 && (pindex= chainActive[height]) != 0 ) { timestamp = pindex->GetBlockTime(); @@ -731,7 +731,7 @@ int8_t komodo_minerid(int32_t height,uint8_t *pubkey33) return(i); } } - return(komodo_electednotary(pubkey33,height,timestamp)); + return(komodo_electednotary(&numnotaries,pubkey33,height,timestamp)); } int32_t komodo_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,int32_t *nonzpkeysp,int32_t height) From e8a05f61f00bac808779f535cfb43915c4b7d89d Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 13 Feb 2018 23:00:15 +0200 Subject: [PATCH 19/32] Test --- src/komodo_utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 2d9d31dfb..617e9c423 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1565,7 +1565,7 @@ void komodo_args(char *argv0) } if ( strlen(ASSETCHAINS_OVERRIDE_PUBKEY.c_str()) == 66 && ASSETCHAINS_COMMISSION > 0 && ASSETCHAINS_COMMISSION <= 100000000 ) decode_hex(ASSETCHAINS_OVERRIDE_PUBKEY33,33,(char *)ASSETCHAINS_OVERRIDE_PUBKEY.c_str()); - else + else if ( ASSETCHAINS_COMMISSION != 0 ) { ASSETCHAINS_COMMISSION = 0; printf("ASSETCHAINS_COMMISSION needs an ASETCHAINS_OVERRIDE_PUBKEY and cant be more than 100000000 (100%%)\n"); From 036a250c6e284064345de476a103ad07ad77756c Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 13 Feb 2018 23:04:01 +0200 Subject: [PATCH 20/32] Test --- src/komodo_notary.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 9da3b6d05..438d81809 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -321,7 +321,7 @@ int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33, struct knotary_entry *kp; int32_t numnotaries=0,htind,modval = -1; komodo_init(0); *notaryidp = -1; - if ( height < 0 || height >= KOMODO_MAXBLOCKS ) + if ( height < 0 )//|| height >= KOMODO_MAXBLOCKS ) { printf("komodo_chosennotary ht.%d illegal\n",height); return(-1); From fc5bee9e146dc3127f4f840b190b8f2537742ad5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 14 Feb 2018 00:57:33 +0200 Subject: [PATCH 21/32] -print --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 7f373e03b..72f25f1fc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -737,7 +737,7 @@ bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime) } else if (!txin.IsFinal()) { - printf("non-final txin seq.%x locktime.%u vs nTime.%u\n",txin.nSequence,(uint32_t)tx.nLockTime,(uint32_t)nBlockTime); + //printf("non-final txin seq.%x locktime.%u vs nTime.%u\n",txin.nSequence,(uint32_t)tx.nLockTime,(uint32_t)nBlockTime); return false; } } From c989bc86e3a7d3244de828519128a10dd9453373 Mon Sep 17 00:00:00 2001 From: "Jonathan \"Duke\" Leto" Date: Sat, 17 Feb 2018 20:45:00 -0800 Subject: [PATCH 22/32] Read hashReserved from disk instead of assuming 0 Related to https://github.com/zcash/zcash/pull/2931 --- src/txdb.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/txdb.cpp b/src/txdb.cpp index 868d3d4cd..9a23596d9 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -302,6 +302,7 @@ bool CBlockTreeDB::LoadBlockIndexGuts() pindexNew->nUndoPos = diskindex.nUndoPos; pindexNew->hashAnchor = diskindex.hashAnchor; pindexNew->nVersion = diskindex.nVersion; + pindexNew->hashReserved = diskindex.hashReserved; pindexNew->hashMerkleRoot = diskindex.hashMerkleRoot; pindexNew->nTime = diskindex.nTime; pindexNew->nBits = diskindex.nBits; From 253cd526acb50ce5220582f404d7ab556e4afa84 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 18 Feb 2018 23:59:52 +0200 Subject: [PATCH 23/32] MAX_MONEY to handle mining chains --- src/komodo_utils.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 617e9c423..9f7384883 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1587,7 +1587,9 @@ void komodo_args(char *argv0) strncpy(ASSETCHAINS_SYMBOL,name.c_str(),sizeof(ASSETCHAINS_SYMBOL)-1); if ( (baseid= komodo_baseid(ASSETCHAINS_SYMBOL)) >= 0 && baseid < 32 ) MAX_MONEY = komodo_maxallowed(baseid); - else MAX_MONEY = (ASSETCHAINS_SUPPLY+1) * SATOSHIDEN; + else if ( ASSETCHAINS_REWARD == 0 ) + MAX_MONEY = (ASSETCHAINS_SUPPLY+1) * SATOSHIDEN; + else MAX_MONEY = (ASSETCHAINS_SUPPLY+1) * SATOSHIDEN + ASSETCHAINS_REWARD * (ASSETCHAINS_ENDSUBSIDY==0 ? 10000000 : ASSETCHAINS_ENDSUBSIDY); //printf("baseid.%d MAX_MONEY.%s %.8f\n",baseid,ASSETCHAINS_SYMBOL,(double)MAX_MONEY/SATOSHIDEN); ASSETCHAINS_PORT = komodo_port(ASSETCHAINS_SYMBOL,ASSETCHAINS_SUPPLY,&ASSETCHAINS_MAGIC,extraptr,extralen); while ( (dirname= (char *)GetDataDir(false).string().c_str()) == 0 || dirname[0] == 0 ) From 052f0068008a5f6db587551bfeee1165cbccc222 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 19 Feb 2018 00:08:02 +0200 Subject: [PATCH 24/32] ASSETCHAINS_CC --- src/komodo_globals.h | 2 +- src/komodo_utils.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/komodo_globals.h b/src/komodo_globals.h index f666d9c6f..6c2e56f5b 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -44,7 +44,7 @@ struct komodo_state KOMODO_STATES[34]; int COINBASE_MATURITY = _COINBASE_MATURITY;//100; int32_t IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET,KOMODO_REWIND; -int32_t KOMODO_LASTMINED,prevKOMODO_LASTMINED,JUMBLR_PAUSE; +int32_t KOMODO_LASTMINED,prevKOMODO_LASTMINED,JUMBLR_PAUSE,ASSETCHAINS_CC; std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_OVERRIDE_PUBKEY; uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33]; diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 9f7384883..231d1a3c4 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1535,6 +1535,7 @@ void komodo_args(char *argv0) } } } + ASSETCHAINS_CC = GetArg("-ac_cc",0); if ( (KOMODO_REWIND= GetArg("-rewind",0)) != 0 ) { printf("KOMODO_REWIND %d\n",KOMODO_REWIND); From 5be9870f7755995cdca31d3a78d203559c23dde8 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 19 Feb 2018 00:11:38 +0200 Subject: [PATCH 25/32] A comment --- src/komodo_utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 231d1a3c4..b4b5297e2 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1535,7 +1535,7 @@ void komodo_args(char *argv0) } } } - ASSETCHAINS_CC = GetArg("-ac_cc",0); + ASSETCHAINS_CC = GetArg("-ac_cc",0); // keep it outside the assetchains hashing so KMD can do it and we dont have two identical chains other than -ac_cc if ( (KOMODO_REWIND= GetArg("-rewind",0)) != 0 ) { printf("KOMODO_REWIND %d\n",KOMODO_REWIND); From 6ec3d43c5c199f700980260b239d43668587da59 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 21 Feb 2018 16:15:42 +0200 Subject: [PATCH 26/32] -print --- src/komodo_utils.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index b4b5297e2..8db610e5d 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1399,7 +1399,7 @@ void komodo_configfile(char *symbol,uint16_t port) sprintf(KMDUSERPASS,"%s:%s",username,password); fclose(fp); //printf("KOMODO.(%s) -> userpass.(%s)\n",fname,KMDUSERPASS); - } else printf("couldnt open.(%s)\n",fname); + } //else printf("couldnt open.(%s)\n",fname); } uint16_t komodo_userpass(char *userpass,char *symbol) @@ -1657,7 +1657,7 @@ void komodo_args(char *argv0) sprintf(iter == 0 ? KMDUSERPASS : BTCUSERPASS,"%s:%s",username,password); fclose(fp); //printf("KOMODO.(%s) -> userpass.(%s)\n",fname,KMDUSERPASS); - } else printf("couldnt open.(%s)\n",fname); + } //else printf("couldnt open.(%s)\n",fname); if ( IS_KOMODO_NOTARY == 0 ) break; } From 71b9e59c5af147120ae379df771ee1fb9490f9af Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 22 Feb 2018 12:00:08 +0200 Subject: [PATCH 27/32] Guard against set generate crash in regtest --- src/main.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 72f25f1fc..99d66f4a2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4216,7 +4216,9 @@ void static CheckBlockIndex() // Build forward-pointing map of the entire block tree. std::multimap forward; for (BlockMap::iterator it = mapBlockIndex.begin(); it != mapBlockIndex.end(); it++) { - forward.insert(std::make_pair(it->second->pprev, it->second)); + if ( it != 0 && it->second != 0 ) + forward.insert(std::make_pair(it->second->pprev, it->second)); + else break; } assert(forward.size() == mapBlockIndex.size()); From 58434c5c3431d6a5820d53901c6cca1687a2ef65 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 22 Feb 2018 12:15:36 +0200 Subject: [PATCH 28/32] Revert if --- src/main.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 99d66f4a2..0d9dd52b7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4216,7 +4216,6 @@ void static CheckBlockIndex() // Build forward-pointing map of the entire block tree. std::multimap forward; for (BlockMap::iterator it = mapBlockIndex.begin(); it != mapBlockIndex.end(); it++) { - if ( it != 0 && it->second != 0 ) forward.insert(std::make_pair(it->second->pprev, it->second)); else break; } From bbb8ae00adf30726bcc623612ba886b9277dcde4 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 22 Feb 2018 12:17:39 +0200 Subject: [PATCH 29/32] Fix --- src/main.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 0d9dd52b7..a52fd3f02 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4217,7 +4217,6 @@ void static CheckBlockIndex() std::multimap forward; for (BlockMap::iterator it = mapBlockIndex.begin(); it != mapBlockIndex.end(); it++) { forward.insert(std::make_pair(it->second->pprev, it->second)); - else break; } assert(forward.size() == mapBlockIndex.size()); From 830d5ff54e0f203c1093c687edb4653af1ff3b77 Mon Sep 17 00:00:00 2001 From: Mihail Fedorov Date: Sun, 25 Feb 2018 03:22:03 +0300 Subject: [PATCH 30/32] vote2018 --- src/assetchains | 39 +++------------------------------------ src/assetchains.old | 4 ++-- src/dpowassets | 34 +--------------------------------- 3 files changed, 6 insertions(+), 71 deletions(-) diff --git a/src/assetchains b/src/assetchains index 1ca93b3c2..746f0d542 100755 --- a/src/assetchains +++ b/src/assetchains @@ -35,11 +35,9 @@ komodo_asset JUMBLR 999999 komodo_asset BET 999999 komodo_asset CRYPTO 999999 komodo_asset HODL 9999999 -#komodo_asset SHARK 1401 komodo_asset MSHARK 1400000 komodo_asset BOTS 999999 komodo_asset MGW 999999 -#komodo_asset MVP 1000000 komodo_asset COQUI 72000000 komodo_asset WLC 210000000 komodo_asset KV 1000000 @@ -49,37 +47,6 @@ komodo_asset MNZ 257142858 komodo_asset AXO 200000000 komodo_asset ETOMIC 100000000 komodo_asset BTCH 20998641 -komodo_asset VOTE 49999999999 - -#komodo_asset USD -#komodo_asset EUR -#komodo_asset JPY -#komodo_asset GBP -#komodo_asset AUD -#komodo_asset CAD -#komodo_asset CHF -#komodo_asset NZD -#komodo_asset CNY -#komodo_asset RUB -#komodo_asset MXN -#komodo_asset BRL -#komodo_asset INR -#komodo_asset HKD -#komodo_asset TRY -#komodo_asset ZAR -#komodo_asset PLN -#komodo_asset NOK -#komodo_asset SEK -#komodo_asset DKK -#komodo_asset CZK -#komodo_asset HUF -#komodo_asset ILS -#komodo_asset KRW -#komodo_asset MYR -#komodo_asset PHP -#komodo_asset RON -#komodo_asset SGD -#komodo_asset THB -#komodo_asset BGN -#komodo_asset IDR -#komodo_asset HRK +komodo_asset VOTE2018 600000000 +komodo_asset PIZZA 100000000 +komodo_asset BEER 100000000 diff --git a/src/assetchains.old b/src/assetchains.old index 20f47d006..ab3c152b8 100755 --- a/src/assetchains.old +++ b/src/assetchains.old @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash set -x delay=60 source pubkey.txt @@ -24,7 +24,7 @@ echo $pubkey ./komodod -pubkey=$pubkey -ac_name=AXO -ac_supply=200000000 -addnode=78.47.196.146 & ./komodod -pubkey=$pubkey -ac_name=ETOMIC -ac_supply=100000000 -addnode=78.47.196.146 & ./komodod -pubkey=$pubkey -ac_name=BTCH -ac_supply=20998641 -addnode=78.47.196.146 & -./komodod -pubkey=$pubkey -ac_name=VOTE -ac_supply=49999999999 -addnode=78.47.196.146 & +./komodod -pubkey=$pubkey -ac_name=VOTE2018 -ac_supply=600000000 -addnode=78.47.196.146 & ./komodod -pubkey=$pubkey -ac_name=BEER -ac_supply=100000000 -addnode=24.54.206.138 & ./komodod -pubkey=$pubkey -ac_name=PIZZA -ac_supply=100000000 -addnode=24.54.206.138 & #sleep $delay diff --git a/src/dpowassets b/src/dpowassets index 3fe8aa1b0..81cb5b68e 100755 --- a/src/dpowassets +++ b/src/dpowassets @@ -27,40 +27,8 @@ curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dp curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"ETOMIC\",\"pubkey\":\"$pubkey\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"BTCH\",\"pubkey\":\"$pubkey\"}" #curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CHAIN\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"VOTE\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"VOTE2018\",\"pubkey\":\"$pubkey\"}" #curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"USD\",\"pubkey\":\"$pubkey\"}" #curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"EUR\",\"pubkey\":\"$pubkey\"}" - # -#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"JPY\",\"pubkey\":\"$pubkey\"}" -#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"GBP\",\"pubkey\":\"$pubkey\"}" -#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"AUD\",\"pubkey\":\"$pubkey\"}" -#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CAD\",\"pubkey\":\"$pubkey\"}" -#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CHF\",\"pubkey\":\"$pubkey\"}" -#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"NZD\",\"pubkey\":\"$pubkey\"}" -#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CNY\",\"pubkey\":\"$pubkey\"}" -#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"RUB\",\"pubkey\":\"$pubkey\"}" -#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MXN\",\"pubkey\":\"$pubkey\"}" -#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"BRL\",\"pubkey\":\"$pubkey\"}" -#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"INR\",\"pubkey\":\"$pubkey\"}" -#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"HKD\",\"pubkey\":\"$pubkey\"}" -#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"TRY\",\"pubkey\":\"$pubkey\"}" -#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"ZAR\",\"pubkey\":\"$pubkey\"}" -#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"PLN\",\"pubkey\":\"$pubkey\"}" -#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"NOK\",\"pubkey\":\"$pubkey\"}" -#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"SEK\",\"pubkey\":\"$pubkey\"}" -#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"DKK\",\"pubkey\":\"$pubkey\"}" -#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CZK\",\"pubkey\":\"$pubkey\"}" -#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"HUF\",\"pubkey\":\"$pubkey\"}" -#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"ILS\",\"pubkey\":\"$pubkey\"}" -#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"KRW\",\"pubkey\":\"$pubkey\"}" -#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MYR\",\"pubkey\":\"$pubkey\"}" -#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"PHP\",\"pubkey\":\"$pubkey\"}" -#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"RON\",\"pubkey\":\"$pubkey\"}" -#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"SGD\",\"pubkey\":\"$pubkey\"}" -#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"THB\",\"pubkey\":\"$pubkey\"}" -#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"BGN\",\"pubkey\":\"$pubkey\"}" -#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"IDR\",\"pubkey\":\"$pubkey\"}" -#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"HRK\",\"pubkey\":\"$pubkey\"}" - From ec0b0757b6a3f3fbefd04e07a08206b13f12d821 Mon Sep 17 00:00:00 2001 From: Mihail Fedorov Date: Sun, 25 Feb 2018 03:46:02 +0300 Subject: [PATCH 31/32] fiat scripts --- src/fiat-cli | 36 +----------------------------------- src/fiat/vote | 2 -- 2 files changed, 1 insertion(+), 37 deletions(-) delete mode 100755 src/fiat/vote diff --git a/src/fiat-cli b/src/fiat-cli index 81ed6b56a..d9cc68ff5 100755 --- a/src/fiat-cli +++ b/src/fiat-cli @@ -1,37 +1,5 @@ #!/bin/bash #set -x -#echo aud; fiat/aud $1 $2 $3 $4 -#echo bgn; fiat/bgn $1 $2 $3 $4 -#echo cad; fiat/cad $1 $2 $3 $4 -#echo chf; fiat/chf $1 $2 $3 $4 -#echo cny; fiat/cny $1 $2 $3 $4 -#echo czk; fiat/czk $1 $2 $3 $4 -#echo dkk; fiat/dkk $1 $2 $3 $4 -#echo eur; fiat/eur $1 $2 $3 $4 -#echo gbp; fiat/gbp $1 $2 $3 $4 -#echo hkd; fiat/hkd $1 $2 $3 $4 -#echo hrk; fiat/hrk $1 $2 $3 $4 -#echo huf; fiat/huf $1 $2 $3 $4 -#echo idr; fiat/idr $1 $2 $3 $4 -#echo ils; fiat/ils $1 $2 $3 $4 -#echo inr; fiat/inr $1 $2 $3 $4 -#echo jpy; fiat/jpy $1 $2 $3 $4 -#echo krw; fiat/krw $1 $2 $3 $4 -#echo mxn; fiat/mxn $1 $2 $3 $4 -#echo myr; fiat/myr $1 $2 $3 $4 -#echo nok; fiat/nok $1 $2 $3 $4 -#echo nzd; fiat/nzd $1 $2 $3 $4 -#echo php; fiat/php $1 $2 $3 $4 -#echo pln; fiat/pln $1 $2 $3 $4 -#echo brl; fiat/brl $1 $2 $3 $4 -#echo ron; fiat/ron $1 $2 $3 $4 -#echo rub; fiat/rub $1 $2 $3 $4 -#echo sek; fiat/sek $1 $2 $3 $4 -#echo sgd; fiat/sgd $1 $2 $3 $4 -#echo thb; fiat/thb $1 $2 $3 $4 -#echo try; fiat/try $1 $2 $3 $4 -#echo usd; fiat/usd $1 $2 $3 $4 -#echo zar; fiat/zar $1 $2 $3 $4 echo revs; fiat/revs $1 $2 $3 $4 echo supernet; fiat/supernet $1 $2 $3 $4 echo dex; fiat/dex $1 $2 $3 $4 @@ -40,11 +8,9 @@ echo jumblr; fiat/jumblr $1 $2 $3 $4 echo bet; fiat/bet $1 $2 $3 $4 echo crypto; fiat/crypto $1 $2 $3 $4 echo hodl; fiat/hodl $1 $2 $3 $4 -#echo shark; fiat/shark $1 $2 $3 $4 echo mshark; fiat/mshark $1 $2 $3 $4 echo bots; fiat/bots $1 $2 $3 $4 echo mgw; fiat/mgw $1 $2 $3 $4 -#echo mvp; fiat/mvp $1 $2 $3 $4 echo coqui; fiat/coqui $1 $2 $3 $4 echo wlc; fiat/wlc $1 $2 $3 $4 echo kv; fiat/kv $1 $2 $3 $4 @@ -56,4 +22,4 @@ echo etomic; fiat/etomic $1 $2 $3 $4 echo btch; fiat/btch $1 $2 $3 $4 echo pizza; fiat/pizza $1 $2 $3 $4 echo beer; fiat/beer $1 $2 $3 $4 -echo vote; fiat/vote $1 $2 $3 $4 +echo vote2018; fiat/vote2018 $1 $2 $3 $4 diff --git a/src/fiat/vote b/src/fiat/vote deleted file mode 100755 index 67f47953e..000000000 --- a/src/fiat/vote +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./komodo-cli -ac_name=VOTE $1 $2 $3 $4 $5 $6 From 8bf22c6fd0c9a3ea58c7101540b50d62f9df439d Mon Sep 17 00:00:00 2001 From: Mihail Fedorov Date: Sun, 25 Feb 2018 03:49:58 +0300 Subject: [PATCH 32/32] fiat scripts --- src/fiat/vote2018 | 2 ++ 1 file changed, 2 insertions(+) create mode 100755 src/fiat/vote2018 diff --git a/src/fiat/vote2018 b/src/fiat/vote2018 new file mode 100755 index 000000000..4e385d76f --- /dev/null +++ b/src/fiat/vote2018 @@ -0,0 +1,2 @@ +#!/bin/bash +./komodo-cli -ac_name=VOTE2018 $1 $2 $3 $4 $5 $6