virtual void startTX( const uint8_t *p, const uint8_t *hash ) { txStart = p; nbInputs = 0; nbOutputs = 0; dump = (txMap.end()!=txMap.find(hash)); if(dump) { struct tm gmTime; time_t blockTime = bTime; gmtime_r(&blockTime, &gmTime); char timeBuf[256]; asctime_r(&gmTime, timeBuf); size_t sz =strlen(timeBuf); if(0<sz) timeBuf[sz-1] = 0; LOAD(uint32_t, version, p); printf("TX = {\n\n"); printf(" version = %" PRIu32 "\n", version); printf(" minted in block = %" PRIu64 "\n", currBlock-1); printf(" mint time = %" PRIu64 " (%s GMT)\n", bTime, timeBuf); printf(" txHash = "); showHex(hash); printf("\n\n"); } }
virtual void endTX( const uint8_t *p ) { if(dump) { LOAD(uint32_t, lockTime, p); printf(" nbInputs = %" PRIu64 "\n", (uint64_t)nbInputs); printf(" nbOutputs = %" PRIu64 "\n", (uint64_t)nbOutputs); printf(" byteSize = %" PRIu64 "\n", (uint64_t)(p - txStart)); printf(" lockTime = %" PRIu32 "\n", (uint32_t)lockTime); printf(" valueIn = %.2f\n", valueIn*1e-6); printf(" valueOut = %.2f\n", valueOut*1e-6); if(!isGenTX && !isStakeTX) { printf(" fees = %.2f\n", (valueIn-valueOut)*1e-6); } if(isStakeTX) { printf(" stakeEarned = %.2f\n", (valueOut-valueIn)*1e-6); } printf("}\n"); ++nbDumped; } if(nbDumped==txMap.size()) { exit(0); } }
virtual int init( int argc, const char *argv[] ) { nbDumped = 0; isDone = false; optparse::Values &values = parser.parse_args(argc, argv); auto args = parser.args(); for(size_t i=1; i<args.size(); ++i) { loadHash256List(rootHashes, args[i].c_str()); } if(0<rootHashes.size()) { info("dumping %d transactions\n", (int)rootHashes.size()); } else { const char *defaultTX = "a1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d"; // Expensive pizza warning("no TX hashes specified, using the famous 10K pizza TX"); loadHash256List(rootHashes, defaultTX); } static uint8_t empty[kSHA256ByteSize] = { 0x42 }; txMap.setEmptyKey(empty); for(auto const &txHash : rootHashes) { txMap[txHash.v] = 1; } return 0; }
virtual void endTX( const uint8_t *p ) { auto i = srcTxMap.find(txHash); bool isSrcTX = (srcTxMap.end() != i); Number taint = 0; if(unlikely(isSrcTX)) taint = 1; else if(txTotal>0 && 0<txBad) taintMap[txHash] = taint = txBad/txTotal; if(threshold<taint) { printNumber(taint); showHex(txHash); putchar('\n'); } }
virtual void endTX( const uint8_t *p ) { if(dump) { LOAD(uint32_t, lockTime, p); printf(" nbInputs = %" PRIu64 "\n", (uint64_t)nbInputs); printf(" nbOutputs = %" PRIu64 "\n", (uint64_t)nbOutputs); printf(" byteSize = %" PRIu64 "\n", (uint64_t)(p - txStart)); printf(" lockTime = %" PRIu32 "\n", (uint32_t)lockTime); printf(" valueIn = %.2f\n", satoshisToNormaForm(valueIn)); printf(" valueOut = %.2f\n", satoshisToNormaForm(valueOut)); if(!isGenTX) { printf(" fees = %.2f\n", satoshisToNormaForm(valueIn-valueOut)); } printf("}\n"); ++nbDumped; } isDone = (nbDumped==txMap.size()); }
virtual int init( int argc, const char *argv[] ) { nbDumped = 0; optparse::Values &values = parser.parse_args(argc, argv); auto args = parser.args(); for(size_t i=1; i<args.size(); ++i) { loadHash256List(rootHashes, args[i].c_str()); } if(0<rootHashes.size()) { info("dumping %d transactions\n", (int)rootHashes.size()); } else { #if defined(PEERCOIN) const char *defaultTX = "19093c85669bf82c9baa70eb437e2f319409f40b54b2c5ebc4dd334ab610fbe6"; warning("no TX hashes specified, using a random proof of stake peercoin transaction"); #else const char *defaultTX = "a1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d"; // Expensive pizza warning("no TX hashes specified, using the infamous 10K pizza TX"); #endif loadHash256List(rootHashes, defaultTX); } static uint8_t empty[kSHA256ByteSize] = { 0x42 }; txMap.setEmptyKey(empty); for(auto it = rootHashes.begin(); it != rootHashes.end(); it++) { auto const &txHash = *it; txMap[txHash.v] = 1; } //for(auto const &txHash : rootHashes) { // txMap[txHash.v] = 1; //} return 0; }
virtual int init( int argc, const char *argv[] ) { threshold = 1e-20; optparse::Values &values = parser.parse_args(argc, argv); auto args = parser.args(); for(size_t i=1; i<args.size(); ++i) { loadHash256List(rootHashes, args[i].c_str()); } if(0<rootHashes.size()) { info("computing taint from %d source transactions\n", (int)rootHashes.size()); } else { warning("no TX hashes specified, using the infamous 10K pizza TX"); //const char *defaultTX = "34b84108a142ad7b6c36f0f3549a3e83dcdbb60e0ba0df96cd48f852da0b1acb"; // Linode slush hack const char *defaultTX = "a1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d"; // Expensive pizza loadHash256List(rootHashes, defaultTX); } static uint8_t empty[kSHA256ByteSize] = { 0x42 }; static unsigned int sz = 15 * 1000 * 1000; srcTxMap.setEmptyKey(empty); taintMap.setEmptyKey(empty); taintMap.resize(sz); auto i = rootHashes.begin(); auto e = rootHashes.end(); while(e!=i) { const uint256_t &txHash = *(i++); taintMap[txHash.v] = 1.0; srcTxMap[txHash.v] = 1; } return 0; }