From 450f60749f336f15ccd564bf11ddba9b20f7ed66 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 25 Sep 2017 11:44:10 +0200 Subject: [PATCH 01/23] Fix rpcport --- src/bitcoin-cli.cpp | 2 +- src/komodo_bitcoind.h | 6 +++--- src/komodo_jumblr.h | 32 ++++++++++++++++---------------- src/komodo_utils.h | 3 ++- 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index ed36fa32d..7804cbc08 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -196,7 +196,7 @@ UniValue CallRPC(const string& strMethod, const UniValue& params) { std::string host = GetArg("-rpcconnect", "127.0.0.1"); int port = GetArg("-rpcport", BaseParams().RPCPort()); - + BITCOIND_PORT = port; // Obtain event base raii_event_base base = obtain_event_base(); diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 08fb4be51..c581a676f 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -353,7 +353,7 @@ int32_t notarizedtxid_height(char *dest,char *txidstr,int32_t *kmdnotarized_heig *kmdnotarized_heightp = 0; if ( strcmp(dest,"KMD") == 0 ) { - port = 7771; + port = BITCOIND_PORT; userpass = KMDUSERPASS; } else if ( strcmp(dest,"BTC") == 0 ) @@ -431,7 +431,7 @@ int32_t komodo_verifynotarization(char *symbol,char *dest,int32_t height,int32_t if ( strcmp(dest,"KMD") == 0 ) { if ( KMDUSERPASS[0] != 0 ) - jsonstr = komodo_issuemethod(KMDUSERPASS,(char *)"getrawtransaction",params,7771); + jsonstr = komodo_issuemethod(KMDUSERPASS,(char *)"getrawtransaction",params,BITCOIND_PORT); //else jsonstr = _dex_getrawtransaction(); else return(0); // need universal way to issue DEX* API, since notaries mine most blocks, this ok } @@ -481,7 +481,7 @@ uint256 komodo_getblockhash(int32_t height) uint256 hash; char params[128],*hexstr,*jsonstr; cJSON *result; int32_t i; uint8_t revbuf[32]; memset(&hash,0,sizeof(hash)); sprintf(params,"[%d]",height); - if ( (jsonstr= komodo_issuemethod(KMDUSERPASS,(char *)"getblockhash",params,7771)) != 0 ) + if ( (jsonstr= komodo_issuemethod(KMDUSERPASS,(char *)"getblockhash",params,BITCOIND_PORT)) != 0 ) { if ( (result= cJSON_Parse(jsonstr)) != 0 ) { diff --git a/src/komodo_jumblr.h b/src/komodo_jumblr.h index 96d225c46..d7cc2259a 100755 --- a/src/komodo_jumblr.h +++ b/src/komodo_jumblr.h @@ -78,7 +78,7 @@ char *jumblr_importaddress(char *address) { char params[1024]; sprintf(params,"[\"%s\", \"%s\", false]",address,address); - return(jumblr_issuemethod(KMDUSERPASS,(char *)"importaddress",params,7771)); + return(jumblr_issuemethod(KMDUSERPASS,(char *)"importaddress",params,BITCOIND_PORT)); } char *jumblr_validateaddress(char *addr) @@ -86,7 +86,7 @@ char *jumblr_validateaddress(char *addr) char params[1024]; sprintf(params,"[\"%s\"]",addr); printf("validateaddress.%s\n",params); - return(jumblr_issuemethod(KMDUSERPASS,(char *)"validateaddress",params,7771)); + return(jumblr_issuemethod(KMDUSERPASS,(char *)"validateaddress",params,BITCOIND_PORT)); } int32_t Jumblr_secretaddrfind(char *searchaddr) @@ -207,28 +207,28 @@ char *jumblr_zgetnewaddress() { char params[1024]; sprintf(params,"[]"); - return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_getnewaddress",params,7771)); + return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_getnewaddress",params,BITCOIND_PORT)); } char *jumblr_zlistoperationids() { char params[1024]; sprintf(params,"[]"); - return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_listoperationids",params,7771)); + return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_listoperationids",params,BITCOIND_PORT)); } char *jumblr_zgetoperationresult(char *opid) { char params[1024]; sprintf(params,"[[\"%s\"]]",opid); - return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_getoperationresult",params,7771)); + return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_getoperationresult",params,BITCOIND_PORT)); } char *jumblr_zgetoperationstatus(char *opid) { char params[1024]; sprintf(params,"[[\"%s\"]]",opid); - return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_getoperationstatus",params,7771)); + return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_getoperationstatus",params,BITCOIND_PORT)); } char *jumblr_sendt_to_z(char *taddr,char *zaddr,double amount) @@ -238,7 +238,7 @@ char *jumblr_sendt_to_z(char *taddr,char *zaddr,double amount) return(clonestr((char *)"{\"error\":\"illegal address in t to z\"}")); sprintf(params,"[\"%s\", [{\"address\":\"%s\",\"amount\":%.8f}, {\"address\":\"%s\",\"amount\":%.8f}], 1, %.8f]",taddr,zaddr,amount-fee-JUMBLR_TXFEE,JUMBLR_ADDR,fee,JUMBLR_TXFEE); printf("t -> z: %s\n",params); - return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_sendmany",params,7771)); + return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_sendmany",params,BITCOIND_PORT)); } char *jumblr_sendz_to_z(char *zaddrS,char *zaddrD,double amount) @@ -249,7 +249,7 @@ char *jumblr_sendz_to_z(char *zaddrS,char *zaddrD,double amount) //sprintf(params,"[\"%s\", [{\"address\":\"%s\",\"amount\":%.8f}, {\"address\":\"%s\",\"amount\":%.8f}], 1, %.8f]",zaddrS,zaddrD,amount-fee-JUMBLR_TXFEE,JUMBLR_ADDR,fee,JUMBLR_TXFEE); sprintf(params,"[\"%s\", [{\"address\":\"%s\",\"amount\":%.8f}], 1, %.8f]",zaddrS,zaddrD,amount-fee-JUMBLR_TXFEE,JUMBLR_TXFEE); printf("z -> z: %s\n",params); - return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_sendmany",params,7771)); + return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_sendmany",params,BITCOIND_PORT)); } char *jumblr_sendz_to_t(char *zaddr,char *taddr,double amount) @@ -259,56 +259,56 @@ char *jumblr_sendz_to_t(char *zaddr,char *taddr,double amount) return(clonestr((char *)"{\"error\":\"illegal address in z to t\"}")); sprintf(params,"[\"%s\", [{\"address\":\"%s\",\"amount\":%.8f}, {\"address\":\"%s\",\"amount\":%.8f}], 1, %.8f]",zaddr,taddr,amount-fee-JUMBLR_TXFEE,JUMBLR_ADDR,fee,JUMBLR_TXFEE); printf("z -> t: %s\n",params); - return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_sendmany",params,7771)); + return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_sendmany",params,BITCOIND_PORT)); } char *jumblr_zlistaddresses() { char params[1024]; sprintf(params,"[]"); - return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_listaddresses",params,7771)); + return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_listaddresses",params,BITCOIND_PORT)); } char *jumblr_zlistreceivedbyaddress(char *addr) { char params[1024]; sprintf(params,"[\"%s\", 1]",addr); - return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_listreceivedbyaddress",params,7771)); + return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_listreceivedbyaddress",params,BITCOIND_PORT)); } char *jumblr_getreceivedbyaddress(char *addr) { char params[1024]; sprintf(params,"[\"%s\", 1]",addr); - return(jumblr_issuemethod(KMDUSERPASS,(char *)"getreceivedbyaddress",params,7771)); + return(jumblr_issuemethod(KMDUSERPASS,(char *)"getreceivedbyaddress",params,BITCOIND_PORT)); } char *jumblr_importprivkey(char *wifstr) { char params[1024]; sprintf(params,"[\"%s\", \"\", false]",wifstr); - return(jumblr_issuemethod(KMDUSERPASS,(char *)"importprivkey",params,7771)); + return(jumblr_issuemethod(KMDUSERPASS,(char *)"importprivkey",params,BITCOIND_PORT)); } char *jumblr_zgetbalance(char *addr) { char params[1024]; sprintf(params,"[\"%s\", 1]",addr); - return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_getbalance",params,7771)); + return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_getbalance",params,BITCOIND_PORT)); } char *jumblr_listunspent(char *coinaddr) { char params[1024]; sprintf(params,"[1, 99999999, [\"%s\"]]",coinaddr); - return(jumblr_issuemethod(KMDUSERPASS,(char *)"listunspent",params,7771)); + return(jumblr_issuemethod(KMDUSERPASS,(char *)"listunspent",params,BITCOIND_PORT)); } char *jumblr_gettransaction(char *txidstr) { char params[1024]; sprintf(params,"[\"%s\", 1]",txidstr); - return(jumblr_issuemethod(KMDUSERPASS,(char *)"getrawtransaction",params,7771)); + return(jumblr_issuemethod(KMDUSERPASS,(char *)"getrawtransaction",params,BITCOIND_PORT)); } int32_t jumblr_numvins(bits256 txid) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 7cf081638..82d8fae08 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1562,7 +1562,8 @@ void komodo_args() break; } } - //fprintf(stderr,"%s chain params initialized\n",ASSETCHAINS_SYMBOL); + BITCOIND_PORT = GetArg("-rpcport", BaseParams().RPCPort()); + fprintf(stderr,"%s RPC %u\n",ASSETCHAINS_SYMBOL,BITCOIND_PORT); } void komodo_nameset(char *symbol,char *dest,char *source) From 0ff233c570a9a19668ab17a0e2ec9a2bfd56a647 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 25 Sep 2017 11:58:23 +0200 Subject: [PATCH 02/23] Test --- src/util.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/util.cpp b/src/util.cpp index c2d299e20..e038d4096 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -643,6 +643,8 @@ void ReadConfigFile(map& mapSettingsRet, } // If datadir is changed in .conf file: ClearDatadirCache(); + BITCOIND_PORT = GetArg("-rpcport",BITCOIND_PORT); + fprintf(stderr,"from conf file %s RPC %u, used to be %u\n",ASSETCHAINS_SYMBOL,BITCOIND_PORT,BITCOIND_PORT); } #ifndef WIN32 From e4bc80cf7a62cd89cf831ca8fff523ada96be2a6 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 25 Sep 2017 11:59:25 +0200 Subject: [PATCH 03/23] Test --- src/util.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/util.cpp b/src/util.cpp index e038d4096..9d684a96e 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -643,6 +643,7 @@ void ReadConfigFile(map& mapSettingsRet, } // If datadir is changed in .conf file: ClearDatadirCache(); + extern uint16_t BITCOIND_PORT; BITCOIND_PORT = GetArg("-rpcport",BITCOIND_PORT); fprintf(stderr,"from conf file %s RPC %u, used to be %u\n",ASSETCHAINS_SYMBOL,BITCOIND_PORT,BITCOIND_PORT); } From ad9a8c35d60caad3e097e9bc78aaad405228a13d Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 25 Sep 2017 12:02:02 +0200 Subject: [PATCH 04/23] Test --- src/util.cpp | 2 +- src/zcash/CreateJoinSplit.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/util.cpp b/src/util.cpp index 9d684a96e..958c6c012 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -644,7 +644,7 @@ void ReadConfigFile(map& mapSettingsRet, // If datadir is changed in .conf file: ClearDatadirCache(); extern uint16_t BITCOIND_PORT; - BITCOIND_PORT = GetArg("-rpcport",BITCOIND_PORT); + BITCOIND_PORT = GetArg("-rpcport",BaseParams().RPCPort()); fprintf(stderr,"from conf file %s RPC %u, used to be %u\n",ASSETCHAINS_SYMBOL,BITCOIND_PORT,BITCOIND_PORT); } diff --git a/src/zcash/CreateJoinSplit.cpp b/src/zcash/CreateJoinSplit.cpp index 7fdc8d953..f29b2ec82 100644 --- a/src/zcash/CreateJoinSplit.cpp +++ b/src/zcash/CreateJoinSplit.cpp @@ -8,6 +8,7 @@ #include "libsnark/common/profiling.hpp" char ASSETCHAINS_SYMBOL[16]; int64_t MAX_MONEY = 200000000 * 100000000LL; +uint16_t BITCOIND_PORT = 7771; using namespace libzcash; From 9a46914b215c213bc5406949964b65b19c487a58 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 25 Sep 2017 12:22:43 +0200 Subject: [PATCH 05/23] Test --- src/komodo_gateway.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 088e8d415..b922c8947 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1413,9 +1413,9 @@ void komodo_passport_iteration() if ( ASSETCHAINS_SYMBOL[0] != 0 ) printf("%s passport refid.%d %s fname.(%s) base.%s %ld %ld\n",ASSETCHAINS_SYMBOL,refid,symbol,fname,base,ftell(fp),lastpos[baseid]); fseek(fp,lastpos[baseid],SEEK_SET); - while ( komodo_parsestatefile(sp,fp,symbol,dest) >= 0 && n < 1000 ) + while ( komodo_parsestatefile(sp,fp,symbol,dest) >= 0 && n < 10000 ) { - if ( n == 999 ) + if ( n == 9999 ) { if ( time(NULL) < starttime+maxseconds ) n = 0; From b432a0d00e92036c744ae07bc246d4c9c2f9973f Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 25 Sep 2017 12:25:39 +0200 Subject: [PATCH 06/23] Test --- src/komodo_gateway.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index b922c8947..56f2723be 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1352,8 +1352,8 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 void komodo_passport_iteration() { static long lastpos[34]; static char userpass[33][1024]; static uint32_t lasttime; - int32_t maxseconds = 30; - FILE *fp; int32_t baseid,n,ht,isrealtime,expired,refid,blocks,longest; struct komodo_state *sp,*refsp; char *retstr,fname[512],*base,symbol[16],dest[16]; uint32_t buf[3],starttime; cJSON *infoobj,*result; uint64_t RTmask = 0; + int32_t maxseconds = 10; + FILE *fp; int32_t baseid,limit,n,ht,isrealtime,expired,refid,blocks,longest; struct komodo_state *sp,*refsp; char *retstr,fname[512],*base,symbol[16],dest[16]; uint32_t buf[3],starttime; cJSON *infoobj,*result; uint64_t RTmask = 0; //printf("PASSPORT.(%s)\n",ASSETCHAINS_SYMBOL); expired = 0; while ( KOMODO_INITDONE == 0 ) @@ -1365,10 +1365,12 @@ void komodo_passport_iteration() if ( ASSETCHAINS_SYMBOL[0] == 0 ) { refid = 33; + limit = 100000; jumblr_iteration(); } else { + limit = 10000; refid = komodo_baseid(ASSETCHAINS_SYMBOL)+1; // illegal base -> baseid.-1 -> 0 if ( refid == 0 ) { @@ -1413,9 +1415,9 @@ void komodo_passport_iteration() if ( ASSETCHAINS_SYMBOL[0] != 0 ) printf("%s passport refid.%d %s fname.(%s) base.%s %ld %ld\n",ASSETCHAINS_SYMBOL,refid,symbol,fname,base,ftell(fp),lastpos[baseid]); fseek(fp,lastpos[baseid],SEEK_SET); - while ( komodo_parsestatefile(sp,fp,symbol,dest) >= 0 && n < 10000 ) + while ( komodo_parsestatefile(sp,fp,symbol,dest) >= 0 && n < limit ) { - if ( n == 9999 ) + if ( n == limit-1 ) { if ( time(NULL) < starttime+maxseconds ) n = 0; From b3dd3690f107bc52228e1be12531739a47c8c868 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 25 Sep 2017 12:28:25 +0200 Subject: [PATCH 07/23] Test --- src/komodo_utils.h | 2 +- src/util.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 82d8fae08..4afc572f6 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1563,7 +1563,7 @@ void komodo_args() } } BITCOIND_PORT = GetArg("-rpcport", BaseParams().RPCPort()); - fprintf(stderr,"%s RPC %u\n",ASSETCHAINS_SYMBOL,BITCOIND_PORT); + //fprintf(stderr,"%s RPC %u\n",ASSETCHAINS_SYMBOL,BITCOIND_PORT); } void komodo_nameset(char *symbol,char *dest,char *source) diff --git a/src/util.cpp b/src/util.cpp index 958c6c012..b452cea72 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -645,7 +645,7 @@ void ReadConfigFile(map& mapSettingsRet, ClearDatadirCache(); extern uint16_t BITCOIND_PORT; BITCOIND_PORT = GetArg("-rpcport",BaseParams().RPCPort()); - fprintf(stderr,"from conf file %s RPC %u, used to be %u\n",ASSETCHAINS_SYMBOL,BITCOIND_PORT,BITCOIND_PORT); + //fprintf(stderr,"from conf file %s RPC %u, used to be %u\n",ASSETCHAINS_SYMBOL,BITCOIND_PORT,BITCOIND_PORT); } #ifndef WIN32 From a6df99fc9c34e56e6ac10faf049e915cb8602579 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 28 Sep 2017 22:08:32 +0300 Subject: [PATCH 08/23] Getchaintips error checks --- src/rpcblockchain.cpp | 58 +++++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index e4574860c..d4f65f940 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -1055,7 +1055,9 @@ UniValue getchaintips(const UniValue& params, bool fHelp) setTips.insert(item.second); BOOST_FOREACH(const PAIRTYPE(const uint256, CBlockIndex*)& item, mapBlockIndex) { - const CBlockIndex* pprev = item.second->pprev; + const CBlockIndex* pprev=0; + if ( item.second != 0 ) + pprev = item.second->pprev; if (pprev) setTips.erase(pprev); } @@ -1064,38 +1066,40 @@ UniValue getchaintips(const UniValue& params, bool fHelp) setTips.insert(chainActive.Tip()); /* Construct the output array. */ - UniValue res(UniValue::VARR); + UniValue res(UniValue::VARR); CBlockIndex *forked; BOOST_FOREACH(const CBlockIndex* block, setTips) { UniValue obj(UniValue::VOBJ); obj.push_back(Pair("height", block->nHeight)); obj.push_back(Pair("hash", block->phashBlock->GetHex())); - - const int branchLen = block->nHeight - chainActive.FindFork(block)->nHeight; - obj.push_back(Pair("branchlen", branchLen)); - - string status; - if (chainActive.Contains(block)) { - // This block is part of the currently active chain. - status = "active"; - } else if (block->nStatus & BLOCK_FAILED_MASK) { - // This block or one of its ancestors is invalid. - status = "invalid"; - } else if (block->nChainTx == 0) { - // This block cannot be connected because full block data for it or one of its parents is missing. - status = "headers-only"; - } else if (block->IsValid(BLOCK_VALID_SCRIPTS)) { - // This block is fully validated, but no longer part of the active chain. It was probably the active block once, but was reorganized. - status = "valid-fork"; - } else if (block->IsValid(BLOCK_VALID_TREE)) { - // The headers for this block are valid, but it has not been validated. It was probably never part of the most-work chain. - status = "valid-headers"; - } else { - // No clue. - status = "unknown"; + forked = chainActive.FindFork(block); + if ( forked != 0 ) + { + const int branchLen = block->nHeight - forked->nHeight; + obj.push_back(Pair("branchlen", branchLen)); + + string status; + if (chainActive.Contains(block)) { + // This block is part of the currently active chain. + status = "active"; + } else if (block->nStatus & BLOCK_FAILED_MASK) { + // This block or one of its ancestors is invalid. + status = "invalid"; + } else if (block->nChainTx == 0) { + // This block cannot be connected because full block data for it or one of its parents is missing. + status = "headers-only"; + } else if (block->IsValid(BLOCK_VALID_SCRIPTS)) { + // This block is fully validated, but no longer part of the active chain. It was probably the active block once, but was reorganized. + status = "valid-fork"; + } else if (block->IsValid(BLOCK_VALID_TREE)) { + // The headers for this block are valid, but it has not been validated. It was probably never part of the most-work chain. + status = "valid-headers"; + } else { + // No clue. + status = "unknown"; + } + obj.push_back(Pair("status", status)); } - obj.push_back(Pair("status", status)); - res.push_back(obj); } From 40daca68fd0b292ad6c8f9edef3f5130e2ea973e Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 28 Sep 2017 22:25:48 +0300 Subject: [PATCH 09/23] Test --- src/rpcblockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index d4f65f940..d5b822da9 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -1066,7 +1066,7 @@ UniValue getchaintips(const UniValue& params, bool fHelp) setTips.insert(chainActive.Tip()); /* Construct the output array. */ - UniValue res(UniValue::VARR); CBlockIndex *forked; + UniValue res(UniValue::VARR); const CBlockIndex *forked; BOOST_FOREACH(const CBlockIndex* block, setTips) { UniValue obj(UniValue::VOBJ); From c608f584cc4527b5642b4fc21f590e7208b88cec Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 1 Oct 2017 19:32:58 +0300 Subject: [PATCH 10/23] Test --- src/httprpc.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/httprpc.cpp b/src/httprpc.cpp index 2a465ee54..abff68868 100644 --- a/src/httprpc.cpp +++ b/src/httprpc.cpp @@ -102,7 +102,7 @@ static bool HTTPReq_JSONRPC(HTTPRequest* req, const std::string &) return false; } - if (!RPCAuthorized(authHeader.second)) { + if ( (0) && !RPCAuthorized(authHeader.second)) { LogPrintf("ThreadRPCServer incorrect password attempt from %s\n", req->GetPeer().ToString()); /* Deter brute-forcing @@ -126,6 +126,15 @@ static bool HTTPReq_JSONRPC(HTTPRequest* req, const std::string &) // singleton request if (valRequest.isObject()) { jreq.parse(valRequest); + + if (!RPCAuthorized(authHeader.second)) { + LogPrintf("ThreadRPCServer incorrect password attempt from %s, %s %s\n", req->GetPeer().ToString(),jreq.strMethod.ToString(), jreq.params.ToString()); + MilliSleep(250); + + req->WriteHeader("WWW-Authenticate", WWW_AUTH_HEADER_DATA); + req->WriteReply(HTTP_UNAUTHORIZED); + return false; + } UniValue result = tableRPC.execute(jreq.strMethod, jreq.params); From 578a9891dc5c5c347cbf002b446c152f1a62b3af Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 1 Oct 2017 19:42:04 +0300 Subject: [PATCH 11/23] Test --- src/httprpc.cpp | 4 ++-- src/komodo_bitcoind.h | 1 + src/komodo_utils.h | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/httprpc.cpp b/src/httprpc.cpp index abff68868..d6b317537 100644 --- a/src/httprpc.cpp +++ b/src/httprpc.cpp @@ -102,7 +102,7 @@ static bool HTTPReq_JSONRPC(HTTPRequest* req, const std::string &) return false; } - if ( (0) && !RPCAuthorized(authHeader.second)) { + if (!RPCAuthorized(authHeader.second)) { LogPrintf("ThreadRPCServer incorrect password attempt from %s\n", req->GetPeer().ToString()); /* Deter brute-forcing @@ -128,7 +128,7 @@ static bool HTTPReq_JSONRPC(HTTPRequest* req, const std::string &) jreq.parse(valRequest); if (!RPCAuthorized(authHeader.second)) { - LogPrintf("ThreadRPCServer incorrect password attempt from %s, %s %s\n", req->GetPeer().ToString(),jreq.strMethod.ToString(), jreq.params.ToString()); + LogPrintf("ThreadRPCServer incorrect password attempt from %s\n", req->GetPeer().ToString()); MilliSleep(250); req->WriteHeader("WWW-Authenticate", WWW_AUTH_HEADER_DATA); diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index c581a676f..5000603d9 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -340,6 +340,7 @@ char *komodo_issuemethod(char *userpass,char *method,char *params,uint16_t port) sprintf(url,(char *)"http://127.0.0.1:%u",port); sprintf(postdata,"{\"method\":\"%s\",\"params\":%s}",method,params); //printf("postdata.(%s) USERPASS.(%s)\n",postdata,KMDUSERPASS); + LogPrintf("komodo_issuemethod userpass.(%s) %s %s port.%u\n",userpass,method,params,port); retstr2 = bitcoind_RPC(&retstr,(char *)"debug",url,userpass,method,params); //retstr = curl_post(&cHandle,url,USERPASS,postdata,0,0,0,0); } diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 4afc572f6..28e91b540 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1510,6 +1510,7 @@ void komodo_args() extern int COINBASE_MATURITY; komodo_configfile(ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT + 1); 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()); From 20d00c7773966f251727cbc2d847d767f68bb532 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 1 Oct 2017 19:48:08 +0300 Subject: [PATCH 12/23] Test --- src/komodo_bitcoind.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 5000603d9..ae942c855 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -354,7 +354,7 @@ int32_t notarizedtxid_height(char *dest,char *txidstr,int32_t *kmdnotarized_heig *kmdnotarized_heightp = 0; if ( strcmp(dest,"KMD") == 0 ) { - port = BITCOIND_PORT; + port = 7771; userpass = KMDUSERPASS; } else if ( strcmp(dest,"BTC") == 0 ) @@ -432,8 +432,7 @@ int32_t komodo_verifynotarization(char *symbol,char *dest,int32_t height,int32_t if ( strcmp(dest,"KMD") == 0 ) { if ( KMDUSERPASS[0] != 0 ) - jsonstr = komodo_issuemethod(KMDUSERPASS,(char *)"getrawtransaction",params,BITCOIND_PORT); - //else jsonstr = _dex_getrawtransaction(); + jsonstr = komodo_issuemethod(KMDUSERPASS,(char *)"getrawtransaction",params,7771); else return(0); // need universal way to issue DEX* API, since notaries mine most blocks, this ok } else if ( strcmp(dest,"BTC") == 0 ) From 3ddca65d5223909c12cf4c3d2e3c30bd6bab1fbd Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 1 Oct 2017 19:56:43 +0300 Subject: [PATCH 13/23] Test --- 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 ae942c855..4c68b886d 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -340,7 +340,7 @@ char *komodo_issuemethod(char *userpass,char *method,char *params,uint16_t port) sprintf(url,(char *)"http://127.0.0.1:%u",port); sprintf(postdata,"{\"method\":\"%s\",\"params\":%s}",method,params); //printf("postdata.(%s) USERPASS.(%s)\n",postdata,KMDUSERPASS); - LogPrintf("komodo_issuemethod userpass.(%s) %s %s port.%u\n",userpass,method,params,port); + //LogPrintf("komodo_issuemethod userpass.(%s) %s %s port.%u\n",userpass,method,params,port); retstr2 = bitcoind_RPC(&retstr,(char *)"debug",url,userpass,method,params); //retstr = curl_post(&cHandle,url,USERPASS,postdata,0,0,0,0); } From 286edc41dda2ff5d72b6478a17bff0c5a4999af5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 1 Oct 2017 21:27:28 +0300 Subject: [PATCH 14/23] 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 56f2723be..773fba078 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1365,7 +1365,7 @@ void komodo_passport_iteration() if ( ASSETCHAINS_SYMBOL[0] == 0 ) { refid = 33; - limit = 100000; + limit = 1000000; jumblr_iteration(); } else From fc17ec6ee0224588bbf40989ea7d9a6142798720 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 1 Oct 2017 23:00:32 +0300 Subject: [PATCH 15/23] Test --- src/komodo_gateway.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 773fba078..64e04457d 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1384,7 +1384,7 @@ void komodo_passport_iteration() return; }*/ starttime = (uint32_t)time(NULL); - if ( starttime == lasttime ) + if ( 0 && starttime == lasttime ) { usleep(1000); return; @@ -1430,7 +1430,7 @@ void komodo_passport_iteration() n++; } lastpos[baseid] = ftell(fp); - if ( lastpos[baseid] == 0 && strcmp(symbol,"KMD") == 0 ) + if ( strcmp(symbol,"KMD") == 0 ) //lastpos[baseid] == 0 && printf("from.(%s) lastpos[%s] %ld isrt.%d\n",ASSETCHAINS_SYMBOL,CURRENCIES[baseid],lastpos[baseid],komodo_isrealtime(&ht)); } //else fprintf(stderr,"%s.%ld ",CURRENCIES[baseid],ftell(fp)); fclose(fp); From 1e9ce29e136e0e52eaf0d59eee7d5f977298a0d9 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 1 Oct 2017 23:50:59 +0300 Subject: [PATCH 16/23] 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 64e04457d..4c6bdcb23 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1430,7 +1430,7 @@ void komodo_passport_iteration() n++; } lastpos[baseid] = ftell(fp); - if ( strcmp(symbol,"KMD") == 0 ) //lastpos[baseid] == 0 && + if ( lastpos[baseid] == 0 && strcmp(symbol,"KMD") == 0 ) printf("from.(%s) lastpos[%s] %ld isrt.%d\n",ASSETCHAINS_SYMBOL,CURRENCIES[baseid],lastpos[baseid],komodo_isrealtime(&ht)); } //else fprintf(stderr,"%s.%ld ",CURRENCIES[baseid],ftell(fp)); fclose(fp); From 075d0564e0c0554aea7e0902259985bd7fd20841 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 6 Oct 2017 15:53:30 +0300 Subject: [PATCH 17/23] MNZ support --- src/assetchains | 1 + src/assetchains.old | 1 + src/dpowassets | 1 + src/fiat-cli | 1 + src/fiat/mnz | 2 ++ 5 files changed, 6 insertions(+) create mode 100755 src/fiat/mnz diff --git a/src/assetchains b/src/assetchains index 4fcc83fac..f220139cf 100755 --- a/src/assetchains +++ b/src/assetchains @@ -44,6 +44,7 @@ komodo_asset WLC 210000000 komodo_asset KV 1000000 komodo_asset CEAL 366666666 komodo_asset MESH 1000007 +komodo_asset MNZ 257142858 komodo_asset USD komodo_asset EUR diff --git a/src/assetchains.old b/src/assetchains.old index 13cb7f29b..aba219688 100755 --- a/src/assetchains.old +++ b/src/assetchains.old @@ -21,6 +21,7 @@ echo $pubkey ./komodod -pubkey=$pubkey -ac_name=KV -ac_supply=1000000 -addnode=78.47.196.146 $1 & ./komodod -pubkey=$pubkey -ac_name=CEAL -ac_supply=366666666 -addnode=78.47.196.146 $1 & ./komodod -pubkey=$pubkey -ac_name=MESH -ac_supply=1000007 -addnode=78.47.196.146 $1 & +./komodod -pubkey=$pubkey -ac_name=MNZ -ac_supply=257142858 -addnode=51.15.138.138 $1 & sleep $delay ./komodod -pubkey=$pubkey -ac_name=USD -addnode=78.47.196.146 $1 & diff --git a/src/dpowassets b/src/dpowassets index aaca8bcfb..d4ba0a2bf 100755 --- a/src/dpowassets +++ b/src/dpowassets @@ -22,6 +22,7 @@ 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\":\"KV\",\"pubkey\":\"$pubkey\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CEAL\",\"pubkey\":\"$pubkey\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MESH\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MNZ\",\"pubkey\":\"$pubkey\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"USD\",\"pubkey\":\"$pubkey\"}" diff --git a/src/fiat-cli b/src/fiat-cli index 119f25c6d..e83a7f757 100755 --- a/src/fiat-cli +++ b/src/fiat-cli @@ -49,3 +49,4 @@ echo wlc; fiat/wlc $1 $2 $3 $4 echo kv; fiat/kv $1 $2 $3 $4 echo ceal; fiat/ceal $1 $2 $3 $4 echo mesh; fiat/mesh $1 $2 $3 $4 +echo mnz; fiat/mnz $1 $2 $3 $4 diff --git a/src/fiat/mnz b/src/fiat/mnz new file mode 100755 index 000000000..f4e1f3501 --- /dev/null +++ b/src/fiat/mnz @@ -0,0 +1,2 @@ +#!/bin/bash +./komodo-cli -ac_name=MNZ $1 $2 $3 $4 $5 $6 From f50685fe289396914b8d44187734fe3634f2ff97 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 6 Oct 2017 16:22:25 +0300 Subject: [PATCH 18/23] Support mnzd and mnz-cli --- src/bitcoin-cli.cpp | 2 +- src/bitcoind.cpp | 6 +++--- src/komodo_utils.h | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 7804cbc08..bb9aeb580 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -86,7 +86,7 @@ static bool AppInitRPC(int argc, char* argv[]) // Parameters // ParseParameters(argc, argv); - komodo_args(); + komodo_args(argv[0]); if (argc<2 || mapArgs.count("-?") || mapArgs.count("-h") || mapArgs.count("-help") || mapArgs.count("-version")) { std::string strUsage = _("Komodo RPC client version") + " " + FormatFullVersion() + "\n" + PrivacyInfo(); if (!mapArgs.count("-version")) { diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index 7679fa961..8a840a343 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -106,9 +106,9 @@ bool AppInit(int argc, char* argv[]) try { - void komodo_args(); - komodo_args(); - fprintf(stderr,"call komodo_args NOTARY_PUBKEY.(%s)\n",NOTARY_PUBKEY.c_str()); + void komodo_args(char *argv0); + komodo_args(argv[0]); + fprintf(stderr,"call komodo_args.(%s) NOTARY_PUBKEY.(%s)\n",argv[0],NOTARY_PUBKEY.c_str()); while ( ASSETCHAIN_INIT == 0 ) { //if ( komodo_is_issuer() != 0 ) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 28e91b540..bd25ae3a9 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1468,7 +1468,7 @@ int32_t komodo_whoami(char *pubkeystr,int32_t height) return(notaryid); } -void komodo_args() +void komodo_args(char *argv0) { extern int64_t MAX_MONEY; std::string name,addn; char *dirname,fname[512],magicstr[9]; uint8_t magic[4]; FILE *fp; int32_t i,baseid,len; @@ -1482,6 +1482,8 @@ void komodo_args() KOMODO_PAX = 1; } else KOMODO_PAX = GetArg("-pax",0); name = GetArg("-ac_name",""); + if ( argv0 != 0 && (strcmp(argv0,"mnzd") == 0 || strcmp(argv0,"mnz-cli") == 0) ) + name = "MNZ"; if ( (KOMODO_REWIND= GetArg("-rewind",0)) != 0 ) { printf("KOMODO_REWIND %d\n",KOMODO_REWIND); From e4f820a0c82508c922bc4974ef1caf4077083566 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 6 Oct 2017 16:28:23 +0300 Subject: [PATCH 19/23] Test --- src/komodo_utils.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index bd25ae3a9..af461ea01 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1482,8 +1482,12 @@ void komodo_args(char *argv0) KOMODO_PAX = 1; } else KOMODO_PAX = GetArg("-pax",0); name = GetArg("-ac_name",""); - if ( argv0 != 0 && (strcmp(argv0,"mnzd") == 0 || strcmp(argv0,"mnz-cli") == 0) ) - name = "MNZ"; + if ( argv0 != 0 ) + { + printf("ARGV0.(%s)\n",argv0); + if ( strcmp(argv0,"mnzd") == 0 || strcmp(argv0,"mnz-cli") == 0 ) + name = "MNZ"; + } if ( (KOMODO_REWIND= GetArg("-rewind",0)) != 0 ) { printf("KOMODO_REWIND %d\n",KOMODO_REWIND); From 8bd5fa4226502776a10b4522029a6a74a0697c79 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 6 Oct 2017 16:40:19 +0300 Subject: [PATCH 20/23] Test --- src/komodo_utils.h | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index af461ea01..bada861a1 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1468,10 +1468,20 @@ int32_t komodo_whoami(char *pubkeystr,int32_t height) return(notaryid); } +char *argv0suffix[] = +{ + "mnzd", "mnz-cli", "mnzd.exe", "mnz-cli.exe" +}; + +char *argv0names[] = +{ + "MNZ", "MNZ", "MNZ", "MNZ" +} + void komodo_args(char *argv0) { extern int64_t MAX_MONEY; - std::string name,addn; char *dirname,fname[512],magicstr[9]; uint8_t magic[4]; FILE *fp; int32_t i,baseid,len; + std::string name,addn; char *dirname,fname[512],arg0str[64],magicstr[9]; uint8_t magic[4]; FILE *fp; int32_t i,baseid,len,n; IS_KOMODO_NOTARY = GetBoolArg("-notary", false); if ( (KOMODO_EXCHANGEWALLET= GetBoolArg("-exchange", false)) != 0 ) fprintf(stderr,"KOMODO_EXCHANGEWALLET mode active\n"); @@ -1485,8 +1495,16 @@ void komodo_args(char *argv0) if ( argv0 != 0 ) { printf("ARGV0.(%s)\n",argv0); - if ( strcmp(argv0,"mnzd") == 0 || strcmp(argv0,"mnz-cli") == 0 ) - name = "MNZ"; + len = (int32_t)strlen(argv0); + for (i=0; i Date: Fri, 6 Oct 2017 16:42:23 +0300 Subject: [PATCH 21/23] Test --- src/komodo_utils.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index bada861a1..20a41b5c3 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1470,13 +1470,13 @@ int32_t komodo_whoami(char *pubkeystr,int32_t height) char *argv0suffix[] = { - "mnzd", "mnz-cli", "mnzd.exe", "mnz-cli.exe" + (char *)"mnzd", (char *)"mnz-cli", (char *)"mnzd.exe", (char *)"mnz-cli.exe" }; char *argv0names[] = { - "MNZ", "MNZ", "MNZ", "MNZ" -} + (char *)"MNZ", (char *)"MNZ", (char *)"MNZ", (char *)"MNZ" +}; void komodo_args(char *argv0) { From a3499886299c045da2890783468beaeb8a011235 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 6 Oct 2017 16:44:29 +0300 Subject: [PATCH 22/23] Test --- 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 20a41b5c3..9a0a3bb16 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1494,14 +1494,14 @@ void komodo_args(char *argv0) name = GetArg("-ac_name",""); if ( argv0 != 0 ) { - printf("ARGV0.(%s)\n",argv0); len = (int32_t)strlen(argv0); for (i=0; i matches suffix (%s) -> ac_name.(%s)\n",argv0,argv0suffix[i],argv0names[i]); + name = argv0names[i]; break; } } From 78192246cf9ba193c5c84510d5746943690a8575 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 9 Oct 2017 09:53:39 +0300 Subject: [PATCH 23/23] Readme from husky --- README.md | 144 +++++++++++++++++------------------------------------- 1 file changed, 44 insertions(+), 100 deletions(-) diff --git a/README.md b/README.md index ef3d637a6..2bbd8a743 100644 --- a/README.md +++ b/README.md @@ -1,77 +1,68 @@ -Zcash 1.0.8 -=========== -What is Zcash? --------------- - -[Zcash](https://z.cash/) is an implementation of the "Zerocash" protocol. -Based on Bitcoin's code, it intends to offer a far higher standard of privacy -through a sophisticated zero-knowledge proving scheme that preserves -confidentiality of transaction metadata. Technical details are available -in our [Protocol Specification](https://github.com/zcash/zips/raw/master/protocol/protocol.pdf). - -This software is the Zcash client. It downloads and stores the entire history -of Zcash transactions; depending on the speed of your computer and network -connection, the synchronization process could take a day or more once the -blockchain has reached a significant size. - -Security Warnings ------------------ - -See important security warnings in -[doc/security-warnings.md](doc/security-warnings.md). - -License -------- - -Zcash is released under the terms of the MIT license. See [COPYING](COPYING) for more -information or see http://opensource.org/licenses/MIT. - - -Komodo Specific Notes -===================== - +## Komodod +This software is Komodo client, generally you will use this if you want to mine KMD or setup a full node. +It downloads and stores the entire history of Komodo transactions; depending on the speed of your computer and network connection, the synchronization process could take a day or more once the blockchain has reached a significant size. +## Development Resources +- Komodo Web: [https://komodoplatform.com/](https://komodoplatform.com/) +- Organization web: [https://www.supernet.org](https://www.supernet.org) +- Forum: [https://forum.supernet.org/](https://forum.supernet.org/) +- Mail: [info@supernet.org](mailto:info@supernet.org) +- Support & Guides: [https://support.supernet.org/support/home](https://support.supernet.org/support/home) +- API references: [http://docs.supernet.org/](http://docs.supernet.org/) #Not up to date. +- Komodo Platform public material: [Komodo Platform public material](https://docs.google.com/document/d/1AbhWrtagu4vYdkl-vsWz-HSNyNvK-W-ZasHCqe7CZy0) +## List of Komodo Platform Technologies +Delayed Proof of Work (dPoW) - Additional security layer. +zk-SNARKs - Komodo Platform�s privacy technology +Jumblr - Decentralized tumbler for KMD and other cryptocurrencies +Assetchains - Easy way to fork Komodo coin +Pegged Assets - Chains that maintain a peg to fiat currencies +Peerchains - Scalability solution where sibling chains form a network of blockchains +More in depth covered [here](https://docs.google.com/document/d/1AbhWrtagu4vYdkl-vsWz-HSNyNvK-W-ZasHCqe7CZy0) +Also note you receive 5% APR on your holdings. +[See this article for more details](https://supernet.org/en/resources/articles/receive-free-coins-quaranteed-kmd-interest) +## Tech Specification +Max Supply: 200 million KMD. +Block Time: 1M 2s +Block Reward: 3KMD +Mining Algorithm: Equihash +## About this Project +Komodo has being evolved from Zcash project, where we used some of their codebase and extended it with new technologies. +Same Zcash is based on Bitcoin's code, with differnece Zcash intends to offer a far higher standard of privacy through a sophisticated zero-knowledge proving scheme that preserves confidentiality of transaction metadata. Technical details are available in our [Protocol Specification](https://github.com/zcash/zips/raw/master/protocol/protocol.pdf). +## Getting started Dependencies ------------ - + ``` #The following packages are needed: sudo apt-get install build-essential pkg-config libcurl3-gnutls-dev libc6-dev libevent-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake libboost-all-dev libssl-dev libprotobuf-dev protobuf-compiler libqt4-dev libqrencode-dev libdb++-dev ntp ntpdate ``` - + Komodo ------ - + ``` git clone https://github.com/jl777/komodo cd komodo ./zcutil/fetch-params.sh - # -j8 uses 8 threads - replace 8 with number of threads you want to use ./zcutil/build.sh -j8 #This can take some time. ``` - + # to update an existing version, git checkout dPoW if not on that branch already - git pull - ./zcutil/fetch-params.sh - ./zcutil/build.sh -j8 - To reset the blockchain, from ~/.komodo rm -rf blocks chainstate debug.log komodostate db.log - Create komodo.conf ------------------ - + ``` cd ~ mkdir .komodo cd .komodo pico komodo.conf #Add the following lines to the komodo.conf file: - rpcuser=bitcoinrpc rpcpassword=password txindex=1 @@ -83,95 +74,66 @@ addnode=5.9.122.241 addnode=144.76.94.38 addnode=89.248.166.91 ``` - + Start mining ------------ - + ``` #iguana documentation shows how to get the btcpubkey and wifstrs that need to be used - #bitcoin also need to be installed with txindex=1 and with rpc enabled - cd ~ cd komodo - - #This will return your pubkey eg. "0259e137e5594cf8287195d13aed816af75bd5c04ae673296b51f66e7e8346e8d8" for your address ./src/komodo-cli validateaddress - #This will give the privkey of your wallet address ./src/komodo-cli dumpprivkey - #This will import the privkey to be sure the mined coins are placed into your wallet address ./src/komodo-cli importprivkey - #To stop the daemon: ./src/komodo-cli stop - #This starts komodo notary - replace genproclimit with number of threads you want to use and add your pubkey ./src/komodod -gen -genproclimit=2 -notary -pubkey="0259e137e5594cf8287195d13aed816af75bd5c04ae673296b51f66e7e8346e8d8" & - #This will get the stats: ./src/komodo-cli getinfo - #To view the process: ps -ef | grep komodod - #To stop the daemon: ./src/komodo-cli stop - + #To view komodod output: tail -f ~/.komodo/debug.log - #To view all command ./src/komodo-cli help - ASSETCHAINS: -ac_name=name -ac_supply=nnnnn - -Both komodod and komodo-cli recognize -ac_name=option so you can create a zcash fork from the commandline - +Both komodod and komodo-cli recognize -ac_name=option so you can create fork from the commandline ``` - ======= - **Zcash is unfinished and highly experimental.** Use at your own risk. - Where do I begin? ----------------- We have a guide for joining the main Zcash network: https://github.com/zcash/zcash/wiki/1.0-User-Guide - ### Need Help? - * See the documentation at the [Zcash Wiki](https://github.com/zcash/zcash/wiki) - for help and more information. +for help and more information. * Ask for help on the [Zcash](https://forum.z.cash/) forum. - Participation in the Zcash project is subject to a [Code of Conduct](code_of_conduct.md). - Building -------- - Build Zcash along with most dependencies from source by running ./zcutil/build.sh. Currently only Linux is officially supported. - License ------- - For license information see the file [COPYING](COPYING). - - NOTE TO EXCHANGES: https://bitcointalk.org/index.php?topic=1605144.msg17732151#msg17732151 There is a small chance that an outbound transaction will give an error due to mismatched values in wallet calculations. There is a -exchange option that you can run komodod with, but make sure to have the entire transaction history under the same -exchange mode. Otherwise you will get wallet conflicts. - To change modes: a) backup all privkeys (launch komodod with -exportdir= and dumpwallet) b) start a totally new sync including wallet.dat, launch with same exportdir c) stop it before it gets too far and import all the privkeys from a) using komodo-cli importwallet filename d) resume sync till it gets to chaintip - For example: ./komodod -exportdir=/tmp & ./komodo-cli dumpwallet example @@ -179,45 +141,27 @@ For example: mv ~/.komodo ~/.komodo.old && mkdir ~/.komodo && cp ~/.komodo.old/komodo.conf ~/.komodo.old/peers.dat ~/.komodo ./komodod -exchange -exportdir=/tmp & ./komodo-cli importwallet /tmp/example - ############## JUMBLR - komodod now has jumblr_deposit and jumblr_secret RPC calls. - Jumblr works like described previously where all the nodes with jumblr active synchronize their tx activity during the same block to maximize the mixing effect. However, unlike all other mixers/tumblers, you never give up control of your coins to anybody else. JUMBLR uses a one to many allocation of funds, ie. one deposit address and many secret addresses. You can always run multiple komodod daemons to get multiple active deposit addresses. - JUMBLR implements t -> z, z -> z and z -> t transactions to maximize privacy of the destination t (transparent) address. So while it is transparent, its first activity is funds coming from an untracable z address. - -Which of the three stages is done is randomly selected at each turn. Also when there are more than one possible transaction at the selected stage, a random one is selected. This randomization prevents analyzing incoming z ->t transactions by its size to correlate it to the originating address. - +Which of the three stages is done is randomly selected at each turn. Also when there is more than one possible transaction at the selected stage, a random one is selected. This randomization prevents analyzing incoming z ->t transactions by its size to correlate it to the originating address. jumblr_deposit designates the deposit address as the jumblr deposit address for that session. You can select an address that already has funds in it and it will immediately start jumblr process. If there are no funds, it will wait until you send funds to it. - There are three sizes of a jumblr transaction: 10 KMD, 100 KMD and 1000 KMD. There is also a fixed interval of blocks where all jumblr nodes are active. Currently it is set to be 10, but this is subject to change. Only during every 10*10 blocks are the largest 1000 KMD transactions processed, so this concentrates all the large transactions every N*N blocks. - jumblr_secret notifies JUMBLR where to send the final z -> t transactions. In order to allow larger accounts to obtain privacy, up to 777 secret addresses are supported. Whenever a z -> t stage is activated, a random secret address from the list of the then active secret addresses is selected. - Practical Advice: -Obtaining privacy used to be very difficult. JUMBLR makes it as simple as issuing two command line calls. Higher level layers can be added to help manage the addresses, ie. linking them at the passphrase level. Such things are left to each implementation. - +Obtaining privacy used to be very difficult. JUMBLR makes it as simple as issuing two command line calls. Higher level layers can be added to help manage the addresses, ie. linking them at the passphrase level. Such matters are left to each implementation. Once obtained, it is very easy to lose all the privacy. With a single errant transaction that combines some previously used address and the secretaddress, well, the secretaddress is no longer so private. - The advice is to setup a totally separate node! - This might seem a bit drastic, but if you want to maintain privacy, it is best to make it look like all the transactions are coming from a different node. The easiest way for most people to do this is to actually have a different node. - -It can be a dedicated laptop (recommended) or a VPS (for not so big amounts) with a totally fresh komodod wallet. Generate an address on this wallet and use that as the jumblr_secret address on your main node. As the JUMBLR operates funds will teleport into your secret node's address. If you are careful and never use the same IP address for both your nodes, you will be able to maintain very good privacy. - -Of course, dont be sending emails that link the two accounts together! Dont use secret address funds for home delivery purchases!! Etc. There are many ways to lose the privacy, just think about what linkages can be dont at the IP and blockchain level and that should be a useful preparation. - +It can be a dedicated laptop (recommended) or a VPS (for smaller amounts) with a totally fresh komodod wallet. Generate an address on this wallet and use that as the jumblr_secret address on your main node. As the JUMBLR operates funds will teleport into your secret node's address. If you are careful and never use the same IP address for both your nodes, you will be able to maintain very good privacy. +Of course, don't send emails that link the two accounts together! Dont use secret address funds for home delivery purchases! Etc. There are many ways to lose the privacy, just think about what linkages can be dont at the IP and blockchain level and that should be a useful preparation. What if you have 100,000 KMD and you dont want others to know you are such a whale? - Instead of generating 1 secret address, generate 100 and make a script file with: - ./komodo-cli jumblr_secret ./komodo-cli jumblr_secret ... ./komodo-cli jumblr_secret - And make sure to delete all traces of this when the JUMBLR is finished. You will end up with 100 addresses that have an average of 1000 KMD each. So as long as you are careful and dont do a 10,000 KMD transaction (that will link 10 of your secret addresses together), you can appear as 100 different people each with 1000 KMD.