changeset 29734:73dbba662001

Clean up old coins
author Troy Benjegerdes <troy@7el.us>
date Sat, 13 Feb 2021 19:32:51 -0600
parents f0e1ee44d172
children 06dee73cf366
files src/bluecoin.h src/catcoin.cpp src/catcoin.h src/cleanwatercoin.cpp src/cleanwatercoin.h src/givecoin.cpp src/givecoin.h src/givestake.cpp src/grantcoin/params.cpp src/grantstake.cpp src/grantstake.h src/hamburger.cpp src/hamburger.h src/kittycoin.cpp src/kittycoin.h src/old-coins/catcoin.cpp src/old-coins/catcoin.h src/old-coins/cleanwatercoin.cpp src/old-coins/cleanwatercoin.h src/old-coins/givecoin.cpp src/old-coins/givecoin.h src/old-coins/grantstake.cpp src/old-coins/grantstake.h src/old-coins/hamburger.cpp src/old-coins/hamburger.h src/old-coins/solarcoin.cpp src/old-coins/solarcoin.h src/old-coins/uro.cpp src/old-coins/uro.h src/solarcoin.cpp src/solarcoin.h src/uro.cpp src/uro.h src/validation.cpp
diffstat 34 files changed, 3718 insertions(+), 10207 deletions(-) [+]
line wrap: on
line diff
--- a/src/bluecoin.h	Sat Feb 13 18:53:44 2021 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-// Copyright (c) 2014 Troy Benjegerdes, under AGPLv3
-// Distributed under the Affero GNU General public license version 3
-// file COPYING or http://www.gnu.org/licenses/agpl-3.0.html
-#ifndef CODECOIN_bluecoin_H
-#define CODECOIN_bluecoin_H
-
-#include "util.h"
-
-static const int RPC_PORT = 27105;
-static const int RPC_PORT_TESTNET = 37105;
-static const int P2P_PORT = 27104;
-static const int P2P_PORT_TESTNET = 37104;
-
-static const int64_t COIN = 100000000;
-static const int64_t CENT = 1000000;
-
-/** Dust Soft Limit, allowed with additional fee per output */
-static const int64_t DUST_SOFT_LIMIT = 100000; // 0.001 BLU
-/** Dust Hard Limit, ignored as wallet inputs (mininput default) */
-static const int64_t DUST_HARD_LIMIT = 1000;   // 0.00001 BLU mininput
-/** No amount larger than this (in catoshi) is valid */
-static const int64_t MAX_MONEY = 500000000 * COIN;
-inline bool MoneyRange(int64_t nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
-/** Coinbase transaction outputs can only be spent after this number of new blocks (network rule) */
-static const int COINBASE_MATURITY = 100;
-
-static const int64 MAX_MONEY2 = 1000000000 * COIN;			// 1 bil
-static const int64 CIRCULATION_MONEY = MAX_MONEY2;
-static const double TAX_PERCENTAGE = 0.03;
-static const int64 MIN_MINT_PROOF_OF_STAKE = 0.01 * COIN;	// 3% annual interest
-//static const int64 MIN_TXOUT_AMOUNT = MIN_TX_FEE; this is replaced with CTransaction::nMinTxFee
-static const int X11_CUTOFF_TIME = 1403395200;
-
-static const int STAKE_TARGET_SPACING = 10 * 60; // 10-minute block spacing 
-static const int STAKE_MIN_AGE = 60 * 60 * 24 * 2; // minimum age for coin age
-static const int STAKE_MAX_AGE = 60 * 60 * 24 * 90; // stake age of full weight
-
-static const uint256 hashGenesisBlockOfficial("0x00000e5fcb52c612b989715cb5e9cad4c071c76e8263980b45d34e17cff6f732");
-static const uint256 hashGenesisBlockTestNet ("0x");
-static const int64 nMaxClockDrift = 2 * 60 * 60;        // two hours
-
-#define BRAND "GiveCoin"
-#define BRAND_upper "GiveCoin"
-#define BRAND_lower "givecoin"
-#define BRAND_SYM "ß"
-#define BRAND_CODE "BLU"
-
-
-#endif
--- a/src/catcoin.cpp	Sat Feb 13 18:53:44 2021 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,523 +0,0 @@
-// Copyright (c) 2009-2010 Satoshi Nakamoto
-// Copyright (c) 2009-2012 The Bitcoin developers
-// Copyright (c) 2013-2014 The Catcoin developers
-// Copyright (c) 2014 Troy Benjegerdes, under AGPLv3
-// Distributed under the Affero GNU General public license version 3
-// file COPYING or http://www.gnu.org/licenses/agpl-3.0.html
-
-#include "catcoin.h"
-#include "alert.h"
-#include "checkpoints.h"
-#include "db.h"
-#include "txdb.h"
-#include "net.h"
-#include "init.h"
-#include "ui_interface.h"
-#include "checkqueue.h"
-#include <boost/algorithm/string/replace.hpp>
-#include <boost/filesystem.hpp>
-#include <boost/filesystem/fstream.hpp>
-
-using namespace std;
-using namespace boost;
-
-uint256 hashGenesisBlock = 0;			// TODO: objectize this for multicoin support
-CBigNum bnProofOfWorkLimit(~uint256(0) >> 12);	// *coin: starting difficulty is 1 / 2^12
-
-const string strMessageMagic = "Catcoin Signed Message:\n";
-/* value, in percent of what difficulty value we'll accept for orphans */
-const int ORPHAN_WORK_THRESHOLD = 1; // FIXME WAY TOO WIDE right now
-
-// DNS seeds
-// Each pair gives a source name and a seed name.
-// The first name is used as information source for addrman.
-// The second name should resolve to a list of seed addresses.
-// FIXME use a single string and/or objectify this
-/*
-  Catcoin policy for getting on this list:
-   1) have a catcoind with port 9933 open
-   2) be avaible for #catcoin-dev people to contact you for debug and testing
-   3) be willing to take a haircut on generates if we determine on irc and on
-	  (a future) mailing list that we need to do it to fix the network
- */
-const char *strMainNetDNSSeed[][2] = {
-	{"thepeeps.net", "p2pool.thepeeps.net"},
-	{"catstat.info", "seed.catstat.info"},
-	{"catcoinwallets.com", "seed.catcoinwallets.com"},
-	{"geekhash.org", "cat.geekhash.org"},
-	{NULL, NULL}
-};
-
-const char *strTestNetDNSSeed[][2] = {
-	{"catstat.info", "testnet-seed.catstat.info"},
-	{"catcoinwallets.com", "seed.catcoinwallets.com"},
-	{NULL, NULL}
-};
-
-int64_t GetBlockValue(CBlockIndex *block, int64_t nFees)
-{
-	int64_t nSubsidy = 50 * COIN;
-
-	// Making some sort of 'promise' of 21 million coins is like Monsanto trying to patent
-	// any roundup-resistant plant, or insisting on only running the 'Genuine IBM PC'
-	// Sure you can try to do that, but weeds evolve resistance, China makes clones,
-	// and copycatcoins print money faster than Zimbabwe after they got rid of the farmers.
-	//
-	// Sound currency will come from a robust community that values something in common.
-	// like Cat pictures.  -- Farmer Troy
-	//
-	// FIXME: add Depurrage based on last year of Cat food prices in the blockchain
-	// FIXME2: come up with a way to GET cat food prices in the blockchain
-	// FIXME3: do this more elegantly while maintaining readability
-	//
-	// further economic analysis supporting this at:
-	// http://cryptonomics.org/2014/01/15/the-marginal-cost-of-cryptocurrency/
-	// http://www.ezonomics.com/videos/can_bitcoin_and_other_virtual_currencies_ever_replace_real_money
-
-	return nSubsidy + nFees;
-}
-
-static const int64_t nTargetTimespan = 6 * 60 * 60; // 6 hours
-static const int64_t nTargetSpacing = 10 * 60;
-static const int64_t nInterval = nTargetTimespan / nTargetSpacing;
-
-static const int64_t nTargetTimespanOld = 14 * 24 * 60 * 60; // two weeks
-static const int64_t nIntervalOld = nTargetTimespanOld / nTargetSpacing;
-
-//
-// minimum amount of work that could possibly be required nTime after
-// minimum work required was nBase
-//
-unsigned int ComputeMinWork(unsigned int nBase, int64_t nTime)
-{
-	// Testnet has min-difficulty blocks
-	// after nTargetSpacing*2 time between blocks:
-	if (fTestNet && nTime > nTargetSpacing*2)
-		return bnProofOfWorkLimit.GetCompact();
-
-	CBigNum bnResult;
-	bnResult.SetCompact(nBase);
-	while (nTime > 0 && bnResult < bnProofOfWorkLimit)
-	{
-	// should technically be 112/100 * 36 .. ~40
-		bnResult *= 40;
-		// and if we have long blocks, max 40 x, as well
-		nTime -= nTargetTimespan*40;
-	}
-	if (bnResult > bnProofOfWorkLimit)
-		bnResult = bnProofOfWorkLimit;
-	return bnResult.GetCompact();
-}
-
-static int fork3Block = 27260; // FIXME move to top...
-static int fork4Block = 27680; // Acceptblock needs this
-// static int fork1min = 31919;
-static int fork1min = 210000;	// kittycoin fork block
-
-//Checks for 'hardcoded' block timestamps
-bool AcceptBlockTimestamp(CValidationState &state, CBlockIndex* pindexPrev, const CBlockHeader *pblock)
-{
-	int64_t time_allow = -30;
-	int64_t time_warn = MINIMUM_BLOCK_SPACING;
-	int64_t delta = pblock->GetBlockTime() - pindexPrev->GetBlockTime();
-	int nHeight = pindexPrev->nHeight + 1;
-
-	if (nHeight > fork4Block){
-		time_allow = 30;
-	}
-	
-	if (delta < time_warn){
-		printf("WARNING blocktime nHeight %d time_allow %" PRId64" time_warn %" PRId64" time delta %" PRId64"\n", nHeight, time_allow, time_warn, delta);
-	}
-
-	if (nHeight >= fork3Block) {
-		if (delta <= time_allow) // see above, from first hard limit
-			return state.Invalid(error("AcceptBlock(height=%d) : block time delta %" PRId64" too short", nHeight, delta));
-	}
-	if (nHeight >= fork1min) { /* don't forward these */
-		if (delta <= MINIMUM_BLOCK_SPACING)
-			return state.DoS(10, (error("AcceptBlock(height=%d) : block time delta %" PRId64" too short", nHeight, delta)));
-	}
-	return true;	
-}
-
-unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
-{
-	int64_t nTargetTimespanLocal = 0;
-	int64_t nIntervalLocal = 0;
-	int forkBlock = 20290 - 1;
-	int fork2Block = 21346;
-
-	 // moved variable inits to the top where they belong
-	 
-	unsigned int nProofOfWorkLimit = bnProofOfWorkLimit.GetCompact();
-	int64_t nActualTimespan;
-	const CBlockIndex* pindexFirst = pindexLast;
-
-	 int64_t error;	 
-	 //int64_t diffcalc;
-	double pGainUp=-0.005125;	// Theses values can be changed to tune the PID formula
-	double iGainUp=-0.0225;	// Theses values can be changed to tune the PID formula
-	double dGainUp=-0.0075;		// Theses values can be changed to tune the PID formula
-
-	double pGainDn=-0.005125;	// Theses values can be changed to tune the PID formula
-	double iGainDn=-0.0525;	// Theses values can be changed to tune the PID formula
-	double dGainDn=-0.0075;		// Theses values can be changed to tune the PID formula
-
-	double pCalc;
-	double iCalc;
-	double dCalc;
-	double dResult;
-	int64_t result;
-	CBigNum bResult;
-	CBigNum bnNew;
-	int i;
-	//CBigNum bLowLimit; // Limit for PID calc to never go below this
-	
-	if(fTestNet){
-		forkBlock = -1;
-		fork2Block = 36;
-	}
-
-	// Genesis block
-	if (pindexLast == NULL)
-		return nProofOfWorkLimit;
-
-	// Starting from block 20,290 the network diff was set to 16
-	// and the retarget interval was changed to 36
-	if(pindexLast->nHeight < forkBlock && !fTestNet) 
-	{
-		nTargetTimespanLocal = nTargetTimespanOld;
-		nIntervalLocal = nIntervalOld;
-	} 
-	else if(pindexLast->nHeight == forkBlock && !fTestNet) 
-	{
-		bnNew.SetCompact(0x1c0ffff0); // Difficulty 16
-		return bnNew.GetCompact();
-	} 
-	else // Keep in for a resync
-	{
-		nTargetTimespanLocal = nTargetTimespan;
-		nIntervalLocal = nInterval;
-	}
-
-	// after fork2Block we retarget every block   
-	if(pindexLast->nHeight < fork2Block && !fTestNet)
-	{
-		// Only change once per interval
-		if ((pindexLast->nHeight+1) % nIntervalLocal != 0 && !fTestNet)
-		{
-			// Special difficulty rule for testnet:
-			if (fTestNet)
-			{
-				// If the new block's timestamp is more than 2* 10 minutes
-				// then allow mining of a min-difficulty block.
-				if (pblock->nTime > pindexLast->nTime + nTargetSpacing*2)
-					return nProofOfWorkLimit;
-				else
-				{
-					// Return the last non-special-min-difficulty-rules-block
-					const CBlockIndex* pindex = pindexLast;
-					while (pindex->pprev && pindex->nHeight % nIntervalLocal != 0 && pindex->nBits == nProofOfWorkLimit)
-						pindex = pindex->pprev;
-					return pindex->nBits;
-				}
-			}
-
-			return pindexLast->nBits;
-		}
-	}
-
-
-	if(pindexLast->nHeight < fork3Block && !fTestNet) // let it walk through 2nd fork stuff if below fork3Block, and ignore if on testnet
-	{
-	// Catcoin: This fixes an issue where a 51% attack can change difficulty at will.
-	// Go back the full period unless it's the first retarget after genesis. Code courtesy of Art Forz
-		int blockstogoback = nIntervalLocal-1;
-		if ((pindexLast->nHeight+1) != nIntervalLocal)
-			blockstogoback = nIntervalLocal;
-
-		// Go back by what we want to be 14 days worth of blocks
-		const CBlockIndex* pindexFirst = pindexLast;
-		for (i = 0; pindexFirst && i < blockstogoback; i++)
-			pindexFirst = pindexFirst->pprev;
-		assert(pindexFirst);
-
-		// Limit adjustment step
-		int numerator = 4;
-		int denominator = 1;
-		if(pindexLast->nHeight >= fork2Block){
-			numerator = 112;
-			denominator = 100;
-		}
-		int64_t nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime();
-		int64_t lowLimit = nTargetTimespanLocal*denominator/numerator;
-		int64_t highLimit = nTargetTimespanLocal*numerator/denominator;
-		printf("  nActualTimespan = %" PRId64"  before bounds\n", nActualTimespan);
-		if (nActualTimespan < lowLimit)
-			nActualTimespan = lowLimit;
-		if (nActualTimespan > highLimit)
-			nActualTimespan = highLimit;
-
-		// Retarget
-		bnNew.SetCompact(pindexLast->nBits);
-		bnNew *= nActualTimespan;
-		bnNew /= nTargetTimespanLocal;
-	
-		if (bnNew > bnProofOfWorkLimit)
-			bnNew = bnProofOfWorkLimit;
-
-		/// debug print
-		if(fTestNet) printf("GetNextWorkRequired RETARGET\n");
-		if(fTestNet) printf("nTargetTimespan = %" PRId64"    nActualTimespan = %" PRId64"\n", nTargetTimespanLocal, nActualTimespan);
-		if(fTestNet) printf("Before: %08x  %s\n", pindexLast->nBits, CBigNum().SetCompact(pindexLast->nBits).getuint256().ToString().c_str());
-		if(fTestNet) printf("After:	%08x  %s\n", bnNew.GetCompact(), bnNew.getuint256().ToString().c_str());
-	}
-/*
-PID formula
-Error = Actual Time - Desired time
-P Calc = pGain * Error
-I Calc = iGain * Error * (Desired Time / Actual Time) 
-D Calc = dGain * (Error / Actual Time) * I Calc
-
-New Diff = (Current Diff + P Calc + I Calc + D Calc)
-
-If New diff < 0, then set static value of 0.0001 or so.
-*/	
-
-	int nMinSpacing = 30;
-	if(pindexLast->nHeight >= fork1min || fTestNet)
-		nMinSpacing = MINIMUM_BLOCK_SPACING;
-	
-	if(pindexLast->nHeight >= fork3Block || fTestNet)
-	// Fork 3 to use a PID routine instead of the other 2 forks 
-	{
-		pindexFirst = pindexLast->pprev;	// Set previous block
-		for(i=0;i<7;i++) pindexFirst = pindexFirst->pprev; // Set 4th previous block for 8 block filtering 
-		nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime();		// Get last X blocks time
-		nActualTimespan = nActualTimespan / 8;	// Calculate average for last 8 blocks
-		if(pindexLast->nHeight > fork4Block || fTestNet){
-			if (nMinSpacing > nActualTimespan){
-				printf("WARNING: SANITY CHECK FAILED: PID nActualTimespan %" PRId64" too small! increased to %d\n",
-					nActualTimespan, nMinSpacing );
-				nActualTimespan = nMinSpacing;
-			}
-		}
-		bnNew.SetCompact(pindexLast->nBits);	// Get current difficulty
-		i=0;					// Zero bit-shift counter
-		while(bnNew>0)				// Loop while bnNew > 0
-		{
-			i++;				// Increment bit-shift counter
-			bnNew = bnNew >> 1;		// shift bnNew lower by 1 bit
-			if(i>256) bnNew = 0;		// overflow test, just to make sure that it never stays in this loop
-		}
-		bnNew.SetCompact(pindexLast->nBits);	// Get current difficulty again
-		
-
-		error = nActualTimespan - nTargetSpacing;	// Calculate the error to be fed into the PID Calculation
-		if(error >= -450 && error <= 450) // Slower gains for when the average time is within 2.5 min and 7.5 min 
-		{
-			// Calculate P ... pGainUp defined at beginning of routine
-			pCalc = pGainUp * (double)error;
-			// Calculate I ... iGainUp defined at beginning of routine
-			iCalc = iGainUp * (double)error * (double)((double)nTargetSpacing / (double)nActualTimespan);
-			// Calculate D ... dGainUp defined at beginning of routine
-			dCalc = dGainUp * ((double)error / (double)nActualTimespan) * iCalc;
-		}
-		else // Faster gains for block averages faster than 2.5 min and greater than 7.5 min 
-		{
-			// Calculate P ... pGainDn defined at beginning of routine
-			pCalc = pGainDn * (double)error;
-			// Calculate I ... iGainDn defined at beginning of routine
-			iCalc = iGainDn * (double)error * (double)((double)nTargetSpacing / (double)nActualTimespan);
-			// Calculate D ... dGainDn defined at beginning of routine
-			dCalc = dGainDn * ((double)error / (double)nActualTimespan) * iCalc;
-		}
-
-		if(error > -10 && error < 10)
-		{
-			if(fTestNet) printf("Within dead zone. No change!  error: %" PRId64"\n", error);
-			return(bnNew.GetCompact());
-		}		
-		
-		dResult = pCalc + iCalc + dCalc;	// Sum the PID calculations
-		
-		result = (int64_t)(dResult * 65536);	// Adjust for scrypt calcuation
-		// Bring the result within max range to avoid overflow condition 
-		while(result >	8388607) result = result / 2; 
-		bResult = result;			// Set the bignum value
-		if(i>24) bResult = bResult << (i - 24);	// bit-shift integer value of result to be subtracted from current diff
-
-		//if(fTestNet)
-		printf("pCalc: %f, iCalc: %f, dCalc: %f, Result: %" PRId64" (%f)\n", pCalc, iCalc, dCalc, result, dResult);
-		//if(fTestNet) // TODO: make this key on a 'debugPID' or something
-		printf("PID Actual Time: %" PRId64", error: %" PRId64"\n", nActualTimespan, error); 
-		if(fTestNet)
-			printf("Result: %08x %s\n",bResult.GetCompact(), bResult.getuint256().ToString().c_str()); 
-		if(fTestNet)
-			printf("Before: %08x %s\n",bnNew.GetCompact(), bnNew.getuint256().ToString().c_str()); 
-		bnNew = bnNew - bResult;	// Subtract the result to set the current diff
-		
-		// Make sure that diff is not set too low, ever
-		if (bnNew.GetCompact() > 0x1e0fffff) bnNew.SetCompact(0x1e0fffff);
-		if(fTestNet) 
-			printf("After:  %08x %s\n",bnNew.GetCompact(), bnNew.getuint256().ToString().c_str()); 
-		
-	} // End Fork 3 to use a PID routine instead of the other 2 forks routine
-
-	return bnNew.GetCompact();
-}
-
-
-const char *pchCatMain	= "\xfc\xc1\xb7\xdc";
-const char *pchCatTest	= "\xfd\xcb\xb8\xdd";
-
-unsigned char pchMessageStart[4];
-
-bool LoadBlockIndex()
-{
-	if (fTestNet)
-	{	/* add 1 to litecoin values (3 to bitcoins) */
-		pchMessageStart[0] = pchCatTest[0];
-		pchMessageStart[1] = pchCatTest[1];
-		pchMessageStart[2] = pchCatTest[2];
-		pchMessageStart[3] = pchCatTest[3];
-		hashGenesisBlock = uint256("0xec7987a2ab5225246c5cf9b8d93b4b75bcef383a4a65d5a265bc09ed54006188");
-	} else {
-		pchMessageStart[0] = pchCatMain[0];
-		pchMessageStart[1] = pchCatMain[1];
-		pchMessageStart[2] = pchCatMain[2];
-		pchMessageStart[3] = pchCatMain[3];
-		hashGenesisBlock = uint256("0xbc3b4ec43c4ebb2fef49e6240812549e61ffa623d9418608aa90eaad26c96296");
-	}
-
-	//
-	// Load block index from databases
-	//
-	if (!fReindex && !LoadBlockIndexDB())
-		return false;
-
-	return true;
-}
-
-
-bool InitBlockIndex() {
-	// Check whether we're already initialized
-	if (pindexGenesisBlock != NULL)
-		return true;
-
-	// Use the provided setting for -txindex in the new database
-	fTxIndex = GetBoolArg("-txindex", false);
-	pblocktree->WriteFlag("txindex", fTxIndex);
-	printf("Initializing databases...\n");
-
-	// Only add the genesis block if not reindexing (in which case we reuse the one already on disk)
-	if (!fReindex) {
-		// Genesis Block:
-		// CBlock(hash=12a765e31ffd4059bada, PoW=0000050c34a64b415b6b, ver=1, hashPrevBlock=00000000000000000000, hashMerkleRoot=97ddfbbae6, nTime=1317972665, nBits=1e0ffff0, nNonce=2084524493, vtx=1)
-		//	 CTransaction(hash=97ddfbbae6, ver=1, vin.size=1, vout.size=1, nLockTime=0)
-		//	   CTxIn(COutPoint(0000000000, -1), coinbase 04ffff001d0104404e592054696d65732030352f4f63742f32303131205374657665204a6f62732c204170706c65e280997320566973696f6e6172792c2044696573206174203536)
-		//	   CTxOut(nValue=50.00000000, scriptPubKey=040184710fa689ad5023690c80f3a4)
-		//	 vMerkleTree: 97ddfbbae6
-
-		// Genesis block
-		const char* pszTimestamp = "NY Times - December 23, 2013 - For Today's Babes, Toyland Is Digital";
-		CTransaction txNew;
-		txNew.vin.resize(1);
-		txNew.vout.resize(1);
-		txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
-		txNew.vout[0].nValue = 50 * COIN;
-		txNew.vout[0].scriptPubKey = CScript() << ParseHex("040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9") << OP_CHECKSIG;
-		CBlock block;
-		block.vtx.push_back(txNew);
-		block.hashPrevBlock = 0;
-		block.hashMerkleRoot = block.BuildMerkleTree();
-		block.nVersion = 1;
-		block.nTime    = 1387838302;
-		block.nBits    = 0x1e0ffff0;
-		block.nNonce   = 588050;
-
-		if (fTestNet)
-		{
-			block.nTime    = 1387838303; //FIXME testnet0.1
-			block.nNonce   = 608937;
-		}
-
-		//// debug print
-		uint256 hash = block.GetHash();
-		printf("%s\n", hash.ToString().c_str());
-		printf("%s\n", hashGenesisBlock.ToString().c_str());
-		printf("%s\n", block.hashMerkleRoot.ToString().c_str());
-		assert(block.hashMerkleRoot == uint256("0x4007a33db5d9cdf2aab117335eb8431c8d13fb86e0214031fdaebe69a0f29cf7"));
-
-
-		block.print();
-		assert(hash == hashGenesisBlock);
-
-		// Start new block file
-		try {
-			unsigned int nBlockSize = ::GetSerializeSize(block, SER_DISK, CLIENT_VERSION);
-			CDiskBlockPos blockPos;
-			CValidationState state;
-			if (!FindBlockPos(state, blockPos, nBlockSize+8, 0, block.nTime))
-				return error("LoadBlockIndex() : FindBlockPos failed");
-			if (!block.WriteToDisk(blockPos))
-				return error("LoadBlockIndex() : writing genesis block to disk failed");
-			if (!block.AddToBlockIndex(state, blockPos))
-				return error("LoadBlockIndex() : genesis block not accepted");
-		} catch(std::runtime_error &e) {
-			return error("LoadBlockIndex() : failed to initialize block database: %s", e.what());
-		}
-	}
-
-	return true;
-}
-
-namespace Checkpoints
-{
-	// What makes a good checkpoint block?
-	// + Is surrounded by blocks with reasonable timestamps
-	//	 (no blocks before with a timestamp after, none after with
-	//	  timestamp before)
-	// + Contains no strange transactions
-	// TODO put this in catcoin.cpp|.h
-	static MapCheckpoints mapCheckpoints =
-		boost::assign::map_list_of
-		(    4, uint256("fe508d41b7dc2c3079e827d4230e6f7ddebca43c9afc721c1e6431f78d6ff1de"))
-		(    5, uint256("7fc79021dbfa30255ade9bb8d898640516d9c771c3342a9b889ce380c52c6c1f"))
-		( 5000, uint256("ec268a9cfe87adb4d10a147a544493406c80e00a3e6868641e520b184e7ddce3"))
-		(10000, uint256("29c63023c3b8a36b59837734a9c16133a4ef08d9a0e95f639a830c56e415070d"))
-		(20000, uint256("3a0c072b76a298dabffc4f825a084c0f86dc55fe58f9bf31cc7e21bbfb2ead52"))
-		(22500, uint256("fd3c87eae2e9be72499978155844598a8675eff7a61c90f9aebcedc94e1b217f"))
-		(22544, uint256("6dd1a90cc56cf4a46c8c47528c4861c255e86d5f97fcee53ce356174e15c3045"))
-		(22554, uint256("b13e8b128989f9a9fc1a4c1e547330d0b34d3f60189c00391a116922fa4fcb8c"))
-		(22600, uint256("9e2d7f2fdab36c3e2b6f0455470cd957c12172ad7877f7c8e414fd736469c8d2"))
-		(22650, uint256("7afbd354496346819b8a214693af70e1431bfadbf68d49a688ae27539fc6b37e"))
-		(22700, uint256("35154b803fa5700b69f8081aa6d7c798c1e7fd027971252598a18549092a1291"))
-		(22750, uint256("67e6eca7d46c1a612b7638e7a503e6dbc7cca4da493f4267833a6f1c9a655a35"))
-		(22800, uint256("49e84c3b5c261966c37c101ac7691886bd641a382f514c2221735088b1b2beea"))
-		(22850, uint256("c44cec57381a97c3983df0ef1fcf150669dd1794943202d89b805f423a65516f"))
-		(22900, uint256("44de4c262de678a23554dd06a6f57270815ea9d145f6c542ab2a8dfbd2ca242c"))
-		(22950, uint256("cecc4ab30b39fc09bf85eb191e64c1660ab2206c5f80953694997ec5c2db5338"))
-		(25890, uint256("4806f91100ae83904aa0113cc3acda8fe6ac422186243719a68b76c98e7487c2"))
-		(29400,	uint256("6740c8907d9a13dfa1019142cc3b1e0abfe2fe8c832c5333df82a404d9a3e40e"))
-		(30000, uint256("ff05303dc58caf2d102c85a0504ed16939c7840c91f5f0b37a5bf128e9afb73f"))
-		(31830, uint256("9275b100cd5e540177c285c8801a63e644e7611a60a49b50831f70df6e5ea825"))
-		(32040, uint256("d5c7bdecfd330721f489ea59930204345d3fc05dd5df0d2f09c6c53c8c0352b6"))
-		(35000, uint256("8c5b56e660e47b398395fd01fd721b115fe523da400d23c82120c6fd37636423"))
-		(40000, uint256("b8a6e8aaf4f92d4b521bd022de3008884eba51ff2a5c79e0269d65a03d109283"))
-		(41000, uint256("88f114a60cb0841735df03cecc3c5662ffbdac184c7344d30cef4f98f5b61ed3"))
-		(42000, uint256("4a538c3557ab865d74327e38837b5aac63aaebdc4718c2ee7b8101bcdd241eb6"))
-		(43000, uint256("d2428f19de225b56853090fd548d1d7dd2d3d180b989c785eddb615e60f94209"))
-		(44000, uint256("587b814e0a113eaf52b94e4920362f4c076d7dc942a4f8c5c4900f2d94adbc26"))
-//		(33000, uint256("0x"))
-
-		;
-	const CCheckpointData data = {
-		&mapCheckpoints,
-		1434870875, 	// * UNIX timestamp of last checkpoint block
-		106400,		// * total number of transactions between genesis and last checkpoint
-					//	 (the tx=... number in the SetBestChain debug.log lines)
-		1000.0		// * estimated number of transactions per day after checkpoint
-	};
-}
--- a/src/catcoin.h	Sat Feb 13 18:53:44 2021 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-// Copyright (c) 2014 Troy Benjegerdes, under AGPLv3
-// Distributed under the Affero GNU General public license version 3
-// file COPYING or http://www.gnu.org/licenses/agpl-3.0.html
-#ifndef CODECOIN_catcoin_H
-#define CODECOIN_catcoin_H
-
-static const int RPC_PORT = 9932;
-static const int RPC_PORT_TESTNET = 19932;
-static const int P2P_PORT = 9933;
-static const int P2P_PORT_TESTNET = 19933;
-
-static const int64_t COIN = 100000000;
-static const int64_t CENT = 1000000;
-
-/** Dust Soft Limit, allowed with additional fee per output */
-static const int64_t DUST_SOFT_LIMIT = 100000; // 0.001 CAT
-/** Dust Hard Limit, ignored as wallet inputs (mininput default) */
-static const int64_t DUST_HARD_LIMIT = 1000;   // 0.00001 CAT mininput
-/** No amount larger than this (in satoshi) is valid */
-static const int64_t MAX_MONEY = 21000000 * COIN;
-inline bool MoneyRange(int64_t nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
-
-/** The interval over which we look to calculate the next difficulty **/
-static const int RETARGET_INTERVAL = 36;
-/** Coinbase transaction outputs can only be spent after this number of new blocks (network rule) */
-static const int COINBASE_MATURITY = 100;
-
-/** Minimum block time spacing (hard limit) **/
-static const int64_t MINIMUM_BLOCK_SPACING = 60;	// Absolute minimum spacing
-
-#define BRAND "CatCoin"
-#define BRAND_upper "CatCoin"
-#define BRAND_lower "catcoin"
-#define LITECOIN_SCRYPT_POWHASH
-
-#endif
--- a/src/cleanwatercoin.cpp	Sat Feb 13 18:53:44 2021 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,461 +0,0 @@
-// Copyright (c) 2009-2010 Satoshi Nakamoto
-// Copyright (c) 2009-2012 The Bitcoin developers
-// Copyright (c) 2013-2014 The Catcoin developers
-// Copyright (c) 2014-2015 Troy Benjegerdes, under AGPLv3
-// Distributed under the Affero GNU General public license version 3
-// file COPYING or http://www.gnu.org/licenses/agpl-3.0.html
-
-#include "codecoin.h"
-#include "codecoinrpc.h"   // GetDifficulty
-#include "cleanwatercoin.h"
-#include "kernel.h"
-#include "checkpoints.h"
-#include "db.h"
-#include "txdb.h"
-#include "net.h"
-#include "init.h"
-#include "ui_interface.h"
-#include "checkqueue.h"
-#include "scrypt.h"
-#include <boost/algorithm/string/replace.hpp>
-#include <boost/filesystem.hpp>
-#include <boost/filesystem/fstream.hpp>
-
-using namespace std;
-using namespace boost;
-
-/* TODO: make this part of a decent C++ object with proper constructors */
-uint256 hashGenesisBlock = 0;		
-const string strMessageMagic = "CleanWaterCoin Signed Message:\n";
-unsigned char pchMessageStart[4];
-
-const CBigNum bnProofOfWorkLimit(~uint256(0) >> 20);
-const CBigNum bnProofOfStakeLimit(~uint256(0) >> 20);
-
-unsigned int nStakeMinAge = 60 * 60 * 24 * 1;	// After height 120,000 minimum age for coin age: 1d
-unsigned int nStakeMinAgeOld = 60 * 60 * 24 * 20;	// Before height 120,000 minimum age for coin age: 20d
-unsigned int nStakeMaxAge = 60 * 60 * 24 * 90;	// stake age of full weight: 90d
-unsigned int nStakeTargetSpacing = 120;			// 120 sec block spacing
-const unsigned int nMaxClockDrift = 90 * 60; 		// 90 minutes
-
-// fixme make unsigned?
-int nCoinbaseMaturity = 30;
-const int nCutoff_Pos_Block = 14628; /* first PoS block */
-
-/** TODO: this goes into src/policy/fees.cpp when latest bitcoin code is merged */
-/** Fees smaller than this (in satoshi) are considered zero fee (for transaction creation) */
-int64_t CTransaction::nMinTxFee = CENT;
-/** Fees smaller than this (in satoshi) are considered zero fee (for relaying) */
-int64_t CTransaction::nMinRelayTxFee = CENT;
-
-// DNS seeds
-// Each pair gives a source name and a seed name.
-// The first name is used as information source for addrman.
-// The second name should resolve to a list of seed addresses.
-// FIXME use a single string and/or objectify this
-/*
-  CleanWaterCoin policy for getting on this list:
-  TODO: come up with a policy
- */
-const char *strMainNetDNSSeed[][2] = 
-{
-   {"intercom", "xtc.inter.com"},
-   {NULL, NULL}
-};
-
-const char *strTestNetDNSSeed[][2] = {
-	//{"CleanWaterCointools.com", "testnet-seed.CleanWaterCointools.com"},
-	{NULL, NULL}
-};
-
-// miner's coin base reward based on nBits
-int64_t CleanWaterCoinWorkReward(int nHeight, int64_t nFees)
-{
-    int64_t nSubsidy = 150 * COIN;
-    double coinDifficulty = (double)GetDifficulty();
-
-    int64_t rewardCalc = 1/(sqrt(coinDifficulty + 500));
-    double buttCalc =  1/(sqrt(coinDifficulty + 500));
-
- if (nHeight == 1)
-    {
-        nSubsidy = 10000000 * COIN;       // first block is premine
-    }
-    else if (nHeight >1 && nHeight <= 55)  // 55 blocks for confirmation of premine
-        {
-            nSubsidy = 1 * COIN;
-        }
-    else if (nHeight >55 && nHeight <= 7000)
-        {
-            nSubsidy = 1000 * COIN;
-        }
-    else if (nHeight >7000 && nHeight < 8000)
-        {
-            nSubsidy = (int64_t)((double)(20000 * sqrt(coinDifficulty + 500)) * COIN);
-        }
-
- // fork here for proper block reward - 8000 per cleanwatercoin guys
-
-    else if (nHeight >= 8000 && nHeight < 8500)
-     {
-             nSubsidy = (int64_t)((double)(20000 * rewardCalc) * COIN);
-     }
-
-    else if (nHeight >= 8500 && nHeight <= 250000)
- {
-         nSubsidy = (int64_t)((double)(20000 * buttCalc) * COIN);
- }
-
-
-    else if (nHeight > 250000 && nHeight <= 500000)
-        {
-            nSubsidy = (int64_t)((double)(15000 * buttCalc) * COIN);
-        }
-    else if (nHeight >500000)
-        {
-            nSubsidy = (int64_t)((double)(10000 * buttCalc) * COIN);
-        }
-//    else if (nHeight > CUTOFF_HEIGHT)
-//        {
-//            nSubsidy = 0;
-//        }
-
-
-    return nSubsidy + nFees;
-}
-
-const int YEARLY_BLOCKCOUNT = 262800;	// 365 * 720
-int64_t CleanWaterCoinStakeReward(int64_t nCoinAge, int nHeight)
-{
-    int64_t nRewardCoinYear;
-
-    nRewardCoinYear = MAX_MINT_PROOF_OF_STAKE;
-
-    if(nHeight >= 7000 && nHeight < 500000)
-        nRewardCoinYear = 0.08 * COIN;
-    else if(nHeight >= 500000 && nHeight < 1000000)
-        nRewardCoinYear = 0.07 * COIN;
-    else if(nHeight >= 1000000 && nHeight < 2000000)
-        nRewardCoinYear = 0.06 * COIN;
-    else if(nHeight >= 2000000)
-        nRewardCoinYear = 0.02 * COIN;
-
-    int64_t nSubsidy = nCoinAge * nRewardCoinYear / 365;
-
-	if (fDebug && GetBoolArg("-printcreation"))
-        printf("GetProofOfStakeReward(): create=%s nCoinAge=%" PRId64 "\n", FormatMoney(nSubsidy).c_str(), nCoinAge);
-    return nSubsidy;
-}
-
-static const int64_t nTargetTimespan = 1 * 24 * 60 * 30;
-static const int64_t nTargetSpacingWorkMax = 3 * nStakeTargetSpacing; 
-
-/*
- * Get the allow Seigniorage (money creation, or reward) of the current
- * block. If CoinAge is > 0, this is a proof of stake block.
- */
-int64_t CBlockIndex::GetSeigniorage(int64_t nFees, int64_t CoinAge) const
-{
-	if(IsProofOfWork()){
-		return CleanWaterCoinWorkReward(nHeight, nFees);
-	} else {
-		return CleanWaterCoinStakeReward(CoinAge, nHeight);
-	}
-}
-
-//
-// maximum nBits value could possible be required nTime after
-// minimum proof-of-work required was nBase
-//
-unsigned int ComputeMaxBits(CBigNum bnTargetLimit, unsigned int nBase, int64_t nTime)
-{
-    CBigNum bnResult;
-    bnResult.SetCompact(nBase);
-    bnResult *= 2;
-    while (nTime > 0 && bnResult < bnTargetLimit)
-    {
-        // Maximum 200% adjustment per day...
-        bnResult *= 2;
-        nTime -= 24 * 60 * 60;
-    }
-    if (bnResult > bnTargetLimit)
-        bnResult = bnTargetLimit;
-    return bnResult.GetCompact();
-}
-
-//
-// minimum amount of work that could possibly be required nTime after
-// minimum proof-of-work required was nBase
-//
-unsigned int ComputeMinWork(unsigned int nBase, int64_t nTime, const CBlockHeader* pblock)
-{
-    return ComputeMaxBits(bnProofOfWorkLimit, nBase, nTime);
-}
-
-//
-// minimum amount of stake that could possibly be required nTime after
-// minimum proof-of-stake required was nBase
-//
-unsigned int ComputeMinStake(unsigned int nBase, int64_t nTime, unsigned int nBlockTime)
-{
-    return ComputeMaxBits(bnProofOfStakeLimit, nBase, nTime);
-}
-
-bool AcceptBlockTimestamp(CValidationState &state, CBlockIndex* pindexPrev, const CBlockHeader *pblock)
-{
-	return true;	
-}
-
-unsigned int GetNextTargetRequired(const CBlockIndex* pindexLast, bool fProofOfStake) 
-{
-    CBigNum bnTargetLimit = bnProofOfWorkLimit;
-
-    if(fProofOfStake)
-    {
-        // Proof-of-Stake blocks has own target limit since nVersion=3 supermajority on mainNet and always on testNet
-        bnTargetLimit = bnProofOfStakeLimit;
-    }
-bnTargetLimit = bnProofOfStakeLimit;
-    if (pindexLast == NULL)
-        return bnTargetLimit.GetCompact(); // genesis block
-
-    const CBlockIndex* pindexPrev = GetLastBlockIndex(pindexLast, fProofOfStake);
-    if (pindexPrev->pprev == NULL)
-        return bnTargetLimit.GetCompact(); // first block
-    const CBlockIndex* pindexPrevPrev = GetLastBlockIndex(pindexPrev->pprev, fProofOfStake);
-    if (pindexPrevPrev->pprev == NULL)
-        return bnTargetLimit.GetCompact(); // second block
-
-    int64_t nActualSpacing = pindexPrev->GetBlockTime() - pindexPrevPrev->GetBlockTime();
-	if(nActualSpacing < 0)
-	{
-		// printf(">> nActualSpacing = %"PRI64d" corrected to 1.\n", nActualSpacing);
-		nActualSpacing = 1;
-	}
-	else if(nActualSpacing > nTargetTimespan)
-	{
-		// printf(">> nActualSpacing = %"PRI64d" corrected to nTargetTimespan (900).\n", nActualSpacing);
-		nActualSpacing = nTargetTimespan;
-	}
-
-    // ppcoin: target change every block
-    // ppcoin: retarget with exponential moving toward target spacing
-    CBigNum bnNew;
-    bnNew.SetCompact(pindexPrev->nBits);
-
-    int64_t nTargetSpacing = fProofOfStake? nStakeTargetSpacing : min(nTargetSpacingWorkMax, (int64_t) nStakeTargetSpacing * (1 + pindexLast->nHeight - pindexPrev->nHeight));
-    int64_t nInterval = nTargetTimespan / nTargetSpacing;
-    bnNew *= ((nInterval - 1) * nTargetSpacing + nActualSpacing + nActualSpacing);
-    bnNew /= ((nInterval + 1) * nTargetSpacing);
-	
-	/*
-	printf(">> Height = %d, fProofOfStake = %d, nInterval = %"PRI64d", nTargetSpacing = %"PRI64d", nActualSpacing = %"PRI64d"\n", 
-		pindexPrev->nHeight, fProofOfStake, nInterval, nTargetSpacing, nActualSpacing);  
-	printf(">> pindexPrev->GetBlockTime() = %"PRI64d", pindexPrev->nHeight = %d, pindexPrevPrev->GetBlockTime() = %"PRI64d", pindexPrevPrev->nHeight = %d\n", 
-		pindexPrev->GetBlockTime(), pindexPrev->nHeight, pindexPrevPrev->GetBlockTime(), pindexPrevPrev->nHeight);  
-	*/
-
-    if (bnNew > bnTargetLimit)
-        bnNew = bnTargetLimit;
-
-    return bnNew.GetCompact();
-}
-
-unsigned int GetNextTrustRequired(const CBlockIndex* pindexLast, const CBlock *pblock)
-{
-	return GetNextTargetRequired(pindexLast, pblock->IsProofOfStake());	
-}
-
-
-bool LoadBlockIndex()
-{
-    if (fTestNet)
-    {
-        pchMessageStart[0] = 0xcd;
-        pchMessageStart[1] = 0xf2;
-        pchMessageStart[2] = 0xc0;
-        pchMessageStart[3] = 0xef;
-
-        nStakeMinAge = 20 * 60; // test net min age is 20 min
-        nStakeMaxAge = 60 * 60; // test net min age is 60 min
-        nModifierInterval = 60; // test modifier interval is 2 minutes
-        nCoinbaseMaturity = 10; // test maturity is 10 blocks
-        nStakeTargetSpacing = 3 * 60; // test block spacing is 3 minutes
-        hashGenesisBlock = uint256("0x0000029c5af0435f4cc6068205cba81e7d6f57722f29e8d49763ee229a702a84");
-    } else {
-        pchMessageStart[0] = 0xce;
-        pchMessageStart[1] = 0xd5;
-        pchMessageStart[2] = 0xdb;
-        pchMessageStart[3] = 0xfa;
-	hashGenesisBlock = uint256("0x0000029c5af0435f4cc6068205cba81e7d6f57722f29e8d49763ee229a702a84");
-    }
-
-
-	//
-	// Load block index from databases
-	//
-	if (!fReindex && !LoadBlockIndexDB())
-		return false;
-
-	return true;
-}
-
-bool InitBlockIndex() {
-	// Check whether we're already initialized
-	if (pindexGenesisBlock != NULL)
-		return true;
-
-	// Use the provided setting for -txindex in the new database
-	fTxIndex = GetBoolArg("-txindex", false);
-	pblocktree->WriteFlag("txindex", fTxIndex);
-	printf("Initializing databases...\n");
-
-	// Only add the genesis block if not reindexing (in which case we reuse the one already on disk)
-	if (!fReindex) {
-
-
-
-		 // Genesis block
-		const char* pszTimestamp = "March 28 2014 Oculus didnt expect such a negative reaction to Facebook deal";
-		CTransaction txNew;
-		txNew.nTime = 1396162732;
-		txNew.vin.resize(1);
-		txNew.vout.resize(1);
-		txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(9999) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
-		txNew.vout[0].SetEmpty();
-
-		CBlock block;
-		block.vtx.push_back(txNew);
-		block.hashPrevBlock = 0;
-		block.hashMerkleRoot = block.BuildMerkleTree();
-		block.nVersion = 1;
-		block.nTime    = 1396162732;
-		block.nBits    = bnProofOfWorkLimit.GetCompact();
-		block.nNonce   = 1566135 ;
-
-		if (fTestNet)
-		{
-			block.nTime    = 1449967517;
-			block.nNonce   = 0; // hack, same
-		}
-
-
-		uint256 hash = block.GetHash();
-		if (hash != hashGenesisBlock)
-		{
-			printf("Searching for genesis block...\n");
-			// This will figure out a valid hash and Nonce if you're
-			// creating a different genesis block:
-			uint256 hashTarget = CBigNum().SetCompact(block.nBits).getuint256();
-            uint256 thash;
-            char scratchpad[SCRYPT_SCRATCHPAD_SIZE];
-
-            while (true)
-            {
-#if defined(USE_SSE2)
-                // Detection would work, but in cases where we KNOW it always has SSE2,
-                // it is faster to use directly than to use a function pointer or conditional.
-#if defined(_M_X64) || defined(__x86_64__) || defined(_M_AMD64) || (defined(MAC_OSX) && defined(__i386__))
-                // Always SSE2: x86_64 or Intel MacOS X
-                scrypt_1024_1_1_256_sp_sse2(BEGIN(block.nVersion), BEGIN(thash), scratchpad);
-#else
-                // Detect SSE2: 32bit x86 Linux or Windows
-                scrypt_1024_1_1_256_sp(BEGIN(block.nVersion), BEGIN(thash), scratchpad);
-#endif
-#else
-                // Generic scrypt
-                scrypt_1024_1_1_256_sp_generic(BEGIN(block.nVersion), BEGIN(thash), scratchpad);
-#endif
-                if (thash <= hashTarget)
-					break;
-				if ((block.nNonce & 0xFFF) == 0)
-				{
-                    printf("nonce %08X: hash = %s (target = %s)\n", block.nNonce, thash.ToString().c_str(), hashTarget.ToString().c_str());
-				}
-				++block.nNonce;
-				if (block.nNonce == 0)
-				{
-					printf("NONCE WRAPPED, incrementing time\n");
-					++block.nTime;
-				}
-			}
-			printf("block.nTime = %u \n", block.nTime);
-			printf("block.nNonce = %u \n", block.nNonce);
-			printf("block.GetHash = %s\n", block.GetHash().ToString().c_str());
-		}
-
-		printf("%s\n", hash.ToString().c_str());
-		printf("%s\n", hashGenesisBlock.ToString().c_str());
-		printf("%s\n", block.hashMerkleRoot.ToString().c_str());
-		block.print();
-		assert(block.hashMerkleRoot == uint256("0x22aa4379d53ac896396484f52a39a9f7a4395dd7f5d2384b7d04e3cb7744698d"));
-		//block.print();
-		assert(block.GetHash() == hashGenesisBlock);
-
-		// Start new block file
-		try {
-			unsigned int nBlockSize = ::GetSerializeSize(block, SER_DISK, CLIENT_VERSION);
-			CDiskBlockPos blockPos;
-			CValidationState state;
-			if (!FindBlockPos(state, blockPos, nBlockSize+8, 0, block.nTime))
-				return error("LoadBlockIndex() : FindBlockPos failed");
-			if (!block.WriteToDisk(blockPos))
-				return error("LoadBlockIndex() : writing genesis block to disk failed");
-			if (!block.AddToBlockIndex(state, blockPos))
-				return error("LoadBlockIndex() : genesis block not accepted");
-		} catch(std::runtime_error &e) {
-			return error("LoadBlockIndex() : failed to initialize block database: %s", e.what());
-		}
-	}
-
-	return true;
-}
-
-namespace Checkpoints
-{
-	// What makes a good checkpoint block?
-	// + Is surrounded by blocks with reasonable timestamps
-	//	 (no blocks before with a timestamp after, none after with
-	//	  timestamp before)
-	// + Contains no strange transactions
-	static MapCheckpoints mapCheckpoints =
-		boost::assign::map_list_of
-		(	0, uint256("00000279dba2a8c40c2cd690f160f127a2a7edb8194f0d4e7605f212adf294bc"))
-		(  100000, uint256("00000000a55f6c849f19f82b9bfd7463e4fb744c1aacfe3d5f498d0894168042"))
-		(  109739, uint256("000000003370cbb513af63612d624e0c655b495d7a64f201d2352f34e0315e51"))
-		(  200000, uint256("13b7a2de7f298b43ff400a7d62134a874e63287f4dc348f6bb39c42798577a2b"))
-		(  300000, uint256("ae66c9d17f3f35a8fd9a1d6efc9af172bdc425f0bc26db0b18797beeeaaa3307"))
-		(  400000, uint256("645818f9f433621b1c3780f4dafd15500679339b121367788a7ff82c68bc99e6"))
-		;
-	const CCheckpointData data = {
-		&mapCheckpoints,
-		1424439826, // * UNIX timestamp of last checkpoint block
-		219689,	// * total number of transactions between genesis and last checkpoint
-					//	 (the tx=... number in the SetBestChain debug.log lines)
-		1000.0	   // * estimated number of transactions per day after checkpoint
-	};
-
-	static MapCheckpoints mapCheckpointsTestnet = 
-		boost::assign::map_list_of
-		(	546, uint256("000000002a936ca763904c3c35fce2f3556c559c0214345d31b1bcebf76acb70"))
-//		( 35000, uint256("2af959ab4f12111ce947479bfcef16702485f04afd95210aa90fde7d1e4a64ad"))
-		;
-	const CCheckpointData dataTestnet = {
-		&mapCheckpointsTestnet,
-		1369685559,
-		37581,
-		300
-	}; /* estimated number of transactions per day after checkpoint */
-
-
-	/* TODO enable this someday */
-
-	// Hard checkpoints of stake modifiers to ensure they are deterministic
-	static std::map<int, unsigned int> mapStakeModifierCheckpoints =
-		boost::assign::map_list_of
-		//( 0, 0x0e00670bu )
-		(5516, 0xdeadbeefu)
-		(16665, 0xdeadbeefu)
-		;
-
-}
--- a/src/cleanwatercoin.h	Sat Feb 13 18:53:44 2021 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-// Copyright (c) 2014 Troy Benjegerdes, under AGPLv3
-// Distributed under the Affero GNU General public license version 3
-// file COPYING or http://www.gnu.org/licenses/agpl-3.0.html
-#ifndef CODECOIN_cleanwatercoin_H
-#define CODECOIN_cleanwatercoin_H
-
-static const int RPC_PORT = 53590;
-static const int RPC_PORT_TESTNET =43590;
-static const int P2P_PORT = 53591;
-static const int P2P_PORT_TESTNET = 43591;
-
-static const int64_t COIN = 1000000;
-static const int64_t CENT = 10000;
-static const int COIN_DECIMALS = 6; /* decimal places for coin */
-#define COIN_DECIMALS_FMT "06"
-
-/** The maximum allowed size for a serialized block, in bytes (network rule) */
-static const unsigned int MAX_BLOCK_SIZE = 1500000;
-static const unsigned int MAX_BLOCK_SIZE_GEN = MAX_BLOCK_SIZE/2;
-
-/** Dust Soft Limit, allowed with additional fee per output */
-static const int64_t DUST_SOFT_LIMIT = 10000; // 0.01 WATER
-/** Dust Hard Limit, ignored as wallet inputs (mininput default) */
-static const int64_t DUST_HARD_LIMIT = 100;   // 0.0001 GIVE mininput
-/** Minimum criteria for AllowFree */
-static const int64_t MIN_FREE_PRIORITY = COIN * 576/250;
-/** No amount larger than this (in catoshi) is valid */
-static const int64_t MAX_MONEY = 1000000000 * COIN;
-inline bool MoneyRange(int64_t nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
-
-/** Minimum block time spacing (AcceptBlockTimestamp determines if this is a hard limit or not **/
-static const int64_t MINIMUM_BLOCK_SPACING = 30;
-
-static const int64_t MAX_MINT_PROOF_OF_STAKE = 0.08 * COIN;	// 8% annual interest  default for testing
-
-#define CHARITY_ADDRESS_TESTNET "nVagPzHPNywPCGCXUmsEnfjnCSSYkCz6eB" // Cleanwatercoin Charity Address in TestNet
-#define CHARITY_ADDRESS "5anJYFYW7npP4MyNaAtzTLb5ek2Lxgyb7d" // Cleanwatercoin Charity Address
-static const int64_t CHARITY_DEFAULT_AMOUNT = 100 * COIN;  // Default amount of Charity sent
-
-/** really only used in rpcmining.cpp **/
-static const int RETARGET_INTERVAL = 15;
-
-#define STAKE_TARGET_SPACING nStakeTargetSpacing
-#define COINBASE_MATURITY nCoinbaseMaturity
-
-// MODIFIER_INTERVAL: time to elapse before new modifier is computed
-static const unsigned int MODIFIER_INTERVAL = 6 * 60 * 60; 
-extern unsigned int nModifierInterval;
-
-// MODIFIER_INTERVAL_RATIO:
-// ratio of group interval length between the last group and the first group
-static const int MODIFIER_INTERVAL_RATIO = 3;
-
-extern unsigned int nStakeMinAge;
-extern unsigned int nStakeMaxAge;
-extern unsigned int nStakeTargetSpacing;
-extern const unsigned int nMaxClockDrift;
-extern int nCoinbaseMaturity; // FIXME make unsigned int
-//extern const unsigned int nMinTxOutAmount; // set to = CTransaction::nMinTxFee;
-
-#define CUTOFF_POS_BLOCK nCutoff_Pos_Block
-extern const int CUTOFF_POS_BLOCK;
-
-#define FEATURE_MONEYSUPPLY
-#define FEATURE_CFG_MAXFUTURE
-
-#define BRAND "cleanwatercoin"
-#define BRAND_upper "CleanWaterCoin"
-#define BRAND_lower "cleanwatercoin"
-#define BRAND_domain "givecoin.org"
-#define BRAND_CODE "WATER"
-
-#define PPCOINSTAKE
-#define PPCOINSTAKE_DEBUG
-
-/* cleanwatercoin uses scrypt directly, not just for the POWhash */
-#define LITECOIN_SCRYPT_POWHASH
-
-#endif
--- a/src/givecoin.cpp	Sat Feb 13 18:53:44 2021 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,506 +0,0 @@
-// Copyright (c) 2009-2010 Satoshi Nakamoto
-// Copyright (c) 2009-2012 The Bitcoin developers
-// Copyright (c) 2013-2014 The Catcoin developers
-// Copyright (c) 2014-2015 Troy Benjegerdes, under AGPLv3
-// Distributed under the Affero GNU General public license version 3
-// file COPYING or http://www.gnu.org/licenses/agpl-3.0.html
-
-#include "codecoin.h"
-#include "givecoin.h"
-#include "checkpoints.h"
-#include "db.h"
-#include "txdb.h"
-#include "net.h"
-#include "init.h"
-#include "ui_interface.h"
-#include "checkqueue.h"
-#include <boost/algorithm/string/replace.hpp>
-#include <boost/filesystem.hpp>
-#include <boost/filesystem/fstream.hpp>
-
-using namespace std;
-using namespace boost;
-
-/* TODO: make this part of a decent C++ object with proper constructors */
-uint256 hashGenesisBlock = 0;		
-const string strMessageMagic = "Givecoin Signed Message:\n";
-unsigned char pchMessageStart[4];
-
-/* stake stuff TODO: */
-const CBigNum bnProofOfWorkLimit(~uint256(0) >> 20);
-const CBigNum bnProofOfStakeLimit(~uint256(0) >> 20);
-
-//CBigNum bnProofOfWorkLimitTestNet(~uint256(0) >> 20);
-//CBigNum bnProofOfStakeLimitTestNet(~uint256(0) >> 20);
-
-/* TODO: move to givecoin.h once finalized */
-const unsigned int nStakeMinAge = 60 * 60 * 24 * 2;	// minimum age for coin age: 2d
-const unsigned int nStakeMaxAge = 60 * 60 * 24 * 30;	// stake age of full weight: -1
-const unsigned int nStakeTargetSpacing = 90;		// 60 sec block spacing
-const unsigned int nStakeTargetSpacing2 = 60;		// 90 sec block spacing
-const unsigned int nMaxClockDrift = 45 * 60; 		// 45 minutes
-#warning for test only
-//const int nCutoff_Pos_Block = 250000;
-const int nCutoff_Pos_Block = 10;
-
-/* end stake stuff */
-int nCoinbaseMaturity = COINBASE_MATURITY;
-
-/** TODO: this goes into src/policy/fees.cpp when latest bitcoin code is merged */
-/** Fees smaller than this (in satoshi) are considered zero fee (for transaction creation) */
-int64_t CTransaction::nMinTxFee = CENT;
-/** Fees smaller than this (in satoshi) are considered zero fee (for relaying) */
-int64_t CTransaction::nMinRelayTxFee = CENT;
-
-// DNS seeds
-// Each pair gives a source name and a seed name.
-// The first name is used as information source for addrman.
-// The second name should resolve to a list of seed addresses.
-// FIXME use a single string and/or objectify this
-/*
-  Givecoin policy for getting on this list:
-  TODO: come up with a policy
- */
-const char *strMainNetDNSSeed[][2] = 
-{
-   {"xtc.inter.com", "xtc.inter.com"},
-   {NULL, NULL}
-};
-
-const char *strTestNetDNSSeed[][2] = {
-	//{"Givecointools.com", "testnet-seed.Givecointools.com"},
-	//{"weminemnc.com", "testnet-seed.weminemnc.com"},
-	{NULL, NULL}
-};
-
-// ppcoin: miner's coin stake is rewarded based on coin age spent (coin-days)
-int64_t static PPcoinStakeReward(int64_t nCoinAge)
-{
-    static int64_t nRewardCoinYear = CENT;  // creation amount per coin-year
-    int64_t nSubsidy = nCoinAge * 33 / (365 * 33 + 8) * nRewardCoinYear;
-    if (fDebug && GetBoolArg("-printcreation"))
-        printf("GetProofOfStakeReward(): create=%s nCoinAge=%" PRId64"\n", FormatMoney(nSubsidy).c_str(), nCoinAge);
-    return nSubsidy;
-}
-
-// Givecoin original block reward
-int64_t static GivecoinBlockValue_v1(int nHeight, int64_t nFees)
-{
-    int64_t nSubsidy = 0;
-    if (nHeight <= 5) {    // For Each 5 blocks will have 0.5M coins
-       nSubsidy = 5000000 * COIN;
-    }
-    else {
-       nSubsidy = 1000 * COIN;
-    }
-    // Subsidy is cut in half every 250,000 blocks, which will occur approximately every .5 year
-    nSubsidy >>= (nHeight / 250000); // Givecoin: 250k blocks in ~.5 years
-    //
-    if (nSubsidy < COIN) nSubsidy = COIN;  // Minimum Number of Coin = 1
-    return nSubsidy + nFees;
-}
-
-/*
- * Get the allow Seigniorage (money creation, or reward) of the current
- * block. If CoinAge is > 0, this is a proof of stake block.
- */
-int64_t CBlockIndex::GetSeigniorage(int64_t nFees, int64_t CoinAge) const
-{
-	if(IsProofOfWork()){
-		return GivecoinBlockValue_v1(nHeight, nFees);
-	} else {
-		return PPcoinStakeReward(CoinAge);
-	}
-}
-
-static const int64_t nTargetTimespan = 10 * 60;		// Givecoin: Difficulty adjusted every 10 mintues
-static const int64_t nTargetSpacing =	1 * 60;		// Givecoin: Every Minute
-static const int64_t nInterval = nTargetTimespan / nTargetSpacing;	// 10 block readjustment
-
-//
-// minimum amount of work that could possibly be required nTime after
-// minimum work required was nBase
-//
-unsigned int ComputeMinWork(unsigned int nBase, int64_t nTime, const CBlockHeader* pblock)
-{
-	// Testnet has min-difficulty blocks
-	// after nTargetSpacing*2 time between blocks:
-	if (fTestNet && nTime > nTargetSpacing*2)
-		return bnProofOfWorkLimit.GetCompact();
-
-	CBigNum bnResult;
-	bnResult.SetCompact(nBase);
-	while (nTime > 0 && bnResult < bnProofOfWorkLimit)
-	{
-		// Maximum 400% adjustment...
-		bnResult *= 4;
-		// ... in best-case exactly 4-times-normal target time
-		nTime -= nTargetTimespan*4;
-	}
-	if (bnResult > bnProofOfWorkLimit)
-		bnResult = bnProofOfWorkLimit;
-	return bnResult.GetCompact();
-}
-
-static int minimum_time_fork = 225225;  	// minimum time fork
-static int minimum_time_fork_2 = 250000;        // minimum time fork to drop peers immediately
-
-//Checks for 'hardcoded' block timestamps
-bool AcceptBlockTimestamp(CValidationState &state, CBlockIndex* pindexPrev, const CBlockHeader *pblock)
-{
-	int64_t time_allow = -30;
-	int64_t time_warn = MINIMUM_BLOCK_SPACING;
-	int64_t delta = pblock->GetBlockTime() - pindexPrev->GetBlockTime();
-	int nHeight = pindexPrev->nHeight + 1;
-
-	if (nHeight > minimum_time_fork_2){
-		time_allow = 30;
-	}
-	
-	if (delta < time_warn){
-		printf("WARNING blocktime nHeight %d time_allow %" PRId64" time_warn %" PRId64" time delta %" PRId64"\n", nHeight, time_allow, time_warn, delta);
-	}
-
-	if (nHeight >= minimum_time_fork_2) {
-		if (delta <= time_allow) // see above, from first hard limit
-			return state.Invalid(error("AcceptBlock(height=%d) : block time delta %" PRId64" too short", nHeight, delta));
-	}
-	if (nHeight >= minimum_time_fork) { /* don't forward these */
-		if (delta <= MINIMUM_BLOCK_SPACING)
-			return state.DoS(10, (error("AcceptBlock(height=%d) : block time delta %" PRId64" too short", nHeight, delta)));
-	}
-	return true;	
-}
-
-unsigned int static GetNextWorkRequired_V1(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
-{
-   unsigned int nProofOfWorkLimit = bnProofOfWorkLimit.GetCompact();
-
-	// Genesis block
-	if (pindexLast == NULL)
-		return nProofOfWorkLimit;
-
-	// Only change once per interval
-	if ((pindexLast->nHeight+1) % nInterval != 0)
-	{
-		// Special difficulty rule for testnet:
-		if (fTestNet)
-		{
-			// If the new block's timestamp is more than 2* 10 minutes
-			// then allow mining of a min-difficulty block.
-			if (pblock->nTime > pindexLast->nTime + nTargetSpacing*2)
-				return nProofOfWorkLimit;
-			else
-			{
-				// Return the last non-special-min-difficulty-rules-block
-				const CBlockIndex* pindex = pindexLast;
-				while (pindex->pprev && pindex->nHeight % nInterval != 0 && pindex->nBits == nProofOfWorkLimit)
-					pindex = pindex->pprev;
-				return pindex->nBits;
-			}
-		}
-
-		return pindexLast->nBits;
-	}
-
-	// DarkCoin: This fixes an issue where a 51% attack can change difficulty at will.
-	// Go back the full period unless it's the first retarget after genesis. Code courtesy of Art Forz
-	int blockstogoback = nInterval-1;
-	if ((pindexLast->nHeight+1) != nInterval)
-		blockstogoback = nInterval;
-
-	// Go back by what we want to be 14 days worth of blocks
-	const CBlockIndex* pindexFirst = pindexLast;
-	for (int i = 0; pindexFirst && i < blockstogoback; i++)
-		pindexFirst = pindexFirst->pprev;
-	assert(pindexFirst);
-
-	// Limit adjustment step
-	int64_t nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime();
-	printf("  nActualTimespan = %" PRId64"	before bounds\n", nActualTimespan);
-	if (nActualTimespan < nTargetTimespan/4)
-		nActualTimespan = nTargetTimespan/4;
-	if (nActualTimespan > nTargetTimespan*4)
-		nActualTimespan = nTargetTimespan*4;
-
-	// Retarget
-	CBigNum bnNew;
-	bnNew.SetCompact(pindexLast->nBits);
-	bnNew *= nActualTimespan;
-	bnNew /= nTargetTimespan;
-
-	if (bnNew > bnProofOfWorkLimit)
-		bnNew = bnProofOfWorkLimit;
-
-	return bnNew.GetCompact();
-}
-
-
-unsigned int static KimotoGravityWell(const CBlockIndex* pindexLast, const CBlockHeader *pblock, uint64_t TargetBlocksSpacingSeconds, uint64_t PastBlocksMin, uint64_t PastBlocksMax) {
-
-		const CBlockIndex *BlockLastSolved = pindexLast;
-		const CBlockIndex *BlockReading = pindexLast;
-		const CBlockHeader *BlockCreating = pblock;
-		BlockCreating = BlockCreating;
-		uint64_t PastBlocksMass = 0;
-		int64_t PastRateActualSeconds = 0;
-		int64_t PastRateTargetSeconds = 0;
-		double PastRateAdjustmentRatio = double(1);
-		CBigNum PastDifficultyAverage;
-		CBigNum PastDifficultyAveragePrev;
-		double EventHorizonDeviation;
-		double EventHorizonDeviationFast;
-		double EventHorizonDeviationSlow;
-
-		if (BlockLastSolved == NULL || BlockLastSolved->nHeight == 0 || (uint64_t)BlockLastSolved->nHeight < PastBlocksMin) {
-		   return bnProofOfWorkLimit.GetCompact();
-		}
-
-		int64_t LatestBlockTime = BlockLastSolved->GetBlockTime();
-
-		for (unsigned int i = 1; BlockReading && BlockReading->nHeight > 0; i++) {
-
-			if ((PastBlocksMax > 0) && (i > PastBlocksMax)) {
-			   break;
-			}
-			PastBlocksMass++;
-
-			if (i == 1) {
-			   PastDifficultyAverage.SetCompact(BlockReading->nBits);
-			}
-			else {
-			   PastDifficultyAverage = ((CBigNum().SetCompact(BlockReading->nBits) - PastDifficultyAveragePrev) / i) + PastDifficultyAveragePrev;
-			}
-			PastDifficultyAveragePrev = PastDifficultyAverage;
-
-			if (LatestBlockTime < BlockReading->GetBlockTime()) {
-			   LatestBlockTime = BlockReading->GetBlockTime();
-			}
-
-			PastRateActualSeconds = BlockLastSolved->GetBlockTime() - BlockReading->GetBlockTime();
-			PastRateTargetSeconds = TargetBlocksSpacingSeconds * PastBlocksMass;
-			PastRateAdjustmentRatio = double(1);
-
-			if (PastRateActualSeconds < 1) {
-			   PastRateActualSeconds  = 1;
-			}
-			if ((PastRateActualSeconds != 0) && (PastRateTargetSeconds != 0)) {
-			   PastRateAdjustmentRatio = double(PastRateTargetSeconds) / double(PastRateActualSeconds);
-			}
-			EventHorizonDeviation = 1 + (0.7084 * pow((double(PastBlocksMass)/double(28.2)), -1.228));
-			EventHorizonDeviationFast = EventHorizonDeviation;
-			EventHorizonDeviationSlow = 1 / EventHorizonDeviation;
-
-			if (PastBlocksMass >= PastBlocksMin) {
-			   if ((PastRateAdjustmentRatio <= EventHorizonDeviationSlow) || (PastRateAdjustmentRatio >= EventHorizonDeviationFast)) { assert(BlockReading); break; }
-			}
-			if (BlockReading->pprev == NULL) {
-			   assert(BlockReading);
-			   break;
-			}
-			BlockReading = BlockReading->pprev;
-
-		}
-
-		CBigNum bnNew(PastDifficultyAverage);
-		if (PastRateActualSeconds != 0 && PastRateTargetSeconds != 0) {
-		   bnNew *= PastRateActualSeconds;
-		   bnNew /= PastRateTargetSeconds;
-		}
-
-	if (bnNew > bnProofOfWorkLimit) {
-		bnNew = bnProofOfWorkLimit;
-	}
-
-	return bnNew.GetCompact();
-}
-
-unsigned int static GetNextWorkRequired_V2(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
-{
-		static const int64_t BlocksTargetSpacing   = 60;					// 60 seconds
-		static const unsigned int TimeDaySeconds = 60 * 60 * 24;
-
-		int64_t  PastSecondsMin = TimeDaySeconds * 0.02; // 0.01;
-		int64_t  PastSecondsMax = TimeDaySeconds * 0.30; // 0.14;
-		uint64_t PastBlocksMin	= PastSecondsMin / BlocksTargetSpacing;
-		uint64_t PastBlocksMax	= PastSecondsMax / BlocksTargetSpacing;
-
-		return KimotoGravityWell(pindexLast, pblock, BlocksTargetSpacing, PastBlocksMin, PastBlocksMax);
-}
-
-unsigned int GetNextTrustRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
-{
-		int DiffMode = 1;
-		if (fTestNet) {
-			if    (pindexLast->nHeight+1 >=    50) { DiffMode = 2; }
-		}
-		else {
-			if    (pindexLast->nHeight+1 >= 34804) { DiffMode = 1; }
-			else if (pindexLast->nHeight+1 >= 200) { DiffMode = 2; }
-		}
-		if      (DiffMode == 1) { return GetNextWorkRequired_V1(pindexLast, pblock); }
-		else if (DiffMode == 2) { return GetNextWorkRequired_V2(pindexLast, pblock); }
-		return GetNextWorkRequired_V2(pindexLast, pblock);
-}
-
-
-bool LoadBlockIndex()
-{
-	if (fTestNet)
-	{
-		pchMessageStart[0] = 0xfc;
-		pchMessageStart[1] = 0xc1;
-		pchMessageStart[2] = 0xb7;
-		pchMessageStart[3] = 0xdc;
-		hashGenesisBlock = uint256("0x00000279dba2a8c40c2cd690f160f127a2a7edb8194f0d4e7605f212adf294bc");
-	} else {
-		pchMessageStart[0] = 0xd1;
-		pchMessageStart[1] = 0xd2;
-		pchMessageStart[2] = 0xd3;
-		pchMessageStart[3] = 0xdb;
-		hashGenesisBlock = uint256("0x00000279dba2a8c40c2cd690f160f127a2a7edb8194f0d4e7605f212adf294bc");
-	}
-
-	//
-	// Load block index from databases
-	//
-	if (!fReindex && !LoadBlockIndexDB())
-		return false;
-
-	return true;
-}
-
-bool InitBlockIndex() {
-	// Check whether we're already initialized
-	if (pindexGenesisBlock != NULL)
-		return true;
-
-	// Use the provided setting for -txindex in the new database
-	fTxIndex = GetBoolArg("-txindex", false);
-	pblocktree->WriteFlag("txindex", fTxIndex);
-	printf("Initializing databases...\n");
-
-	// Only add the genesis block if not reindexing (in which case we reuse the one already on disk)
-	if (!fReindex) {
-
-
-
-		 // Genesis Block:
-		 // block.nTime = 1393884829
-		 // 2014-03-09 22:00:10 block.nNonce = 2088083604
-		 // 2014-03-09 22:00:10 block.GetHash = f092eda63502ff8b19f584c56fc6ed32a9e265b798831690ea9aaf44cc74f7f0
-		 // Genesis block
-
-		const char* pszTimestamp = "CNN 03/Mar/20a14 Ukraine crisis: UN Security Council meets";
-		CTransaction txNew;
-		txNew.nVersion = 1;
-		printf("txNew version: %d\n", txNew.nVersion);
-		txNew.vin.resize(1);
-		txNew.vout.resize(1);
-		txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
-		txNew.vout[0].nValue = 1000 * COIN;
-		txNew.vout[0].scriptPubKey = CScript() << ParseHex("040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9") << OP_CHECKSIG;
-		CBlock block;
-		block.vtx.push_back(txNew);
-		block.hashPrevBlock = 0;
-		block.hashMerkleRoot = block.BuildMerkleTree();
-		block.nVersion = 1;
-		block.nTime    = 1393884829;
-		block.nBits    = bnProofOfWorkLimit.GetCompact();
-		block.nNonce   = 2090389678;
-
-		if (fTestNet)
-		{
-			block.nTime    = 1393884829;
-			block.nNonce   = 2090389678; // hack, same
-		}
-
-
-		uint256 hash = block.GetHash();
-		if (hash != hashGenesisBlock)
-		{
-			printf("Searching for genesis block...\n");
-			// This will figure out a valid hash and Nonce if you're
-			// creating a different genesis block:
-			uint256 hashTarget = CBigNum().SetCompact(block.nBits).getuint256();
-			// char scratchpad[SCRYPT_SCRATCHPAD_SIZE];
-
-		while(true){
-				hash = block.GetHash();
-				if (hash <= hashTarget)
-					break;
-				if ((block.nNonce & 0xFFF) == 0)
-				{
-					printf("nonce %08X: hash = %s (target = %s)\n", block.nNonce, hash.ToString().c_str(), hashTarget.ToString().c_str());
-				}
-				++block.nNonce;
-				if (block.nNonce == 0)
-				{
-					printf("NONCE WRAPPED, incrementing time\n");
-					++block.nTime;
-				}
-			}
-			printf("block.nTime = %u \n", block.nTime);
-			printf("block.nNonce = %u \n", block.nNonce);
-			printf("block.GetHash = %s\n", block.GetHash().ToString().c_str());
-		}
-
-		printf("%s\n", hash.ToString().c_str());
-		printf("%s\n", hashGenesisBlock.ToString().c_str());
-		printf("%s\n", block.hashMerkleRoot.ToString().c_str());
-		block.print();
-		assert(block.hashMerkleRoot == uint256("0xdc43fdf63088ee667d957a39f87b217822b9e3d31805b008124c4e821079a43c"));
-		//block.print();
-		assert(hash == hashGenesisBlock);
-
-		// Start new block file
-		try {
-			unsigned int nBlockSize = ::GetSerializeSize(block, SER_DISK, CLIENT_VERSION);
-			CDiskBlockPos blockPos;
-			CValidationState state;
-			if (!FindBlockPos(state, blockPos, nBlockSize+8, 0, block.nTime))
-				return error("LoadBlockIndex() : FindBlockPos failed");
-			if (!block.WriteToDisk(blockPos))
-				return error("LoadBlockIndex() : writing genesis block to disk failed");
-			if (!block.AddToBlockIndex(state, blockPos))
-				return error("LoadBlockIndex() : genesis block not accepted");
-		} catch(std::runtime_error &e) {
-			return error("LoadBlockIndex() : failed to initialize block database: %s", e.what());
-		}
-	}
-
-	return true;
-}
-
-namespace Checkpoints
-{
-	// What makes a good checkpoint block?
-	// + Is surrounded by blocks with reasonable timestamps
-	//	 (no blocks before with a timestamp after, none after with
-	//	  timestamp before)
-	// + Contains no strange transactions
-	static MapCheckpoints mapCheckpoints =
-		boost::assign::map_list_of
-		(	0,	uint256("00000279dba2a8c40c2cd690f160f127a2a7edb8194f0d4e7605f212adf294bc"))
-		(	171000,	uint256("000000000084b49eb538d85b00a40438b99f749124b68ed7719ed27d0abb3447"))
-		;
-	const CCheckpointData data = {
-		&mapCheckpoints,
-		1424439826, // * UNIX timestamp of last checkpoint block
-		219689,	// * total number of transactions between genesis and last checkpoint
-					//	 (the tx=... number in the SetBestChain debug.log lines)
-		1000.0	   // * estimated number of transactions per day after checkpoint
-	};
-
-	static MapCheckpoints mapCheckpointsTestnet = 
-		boost::assign::map_list_of
-		(	546, uint256("000000002a936ca763904c3c35fce2f3556c559c0214345d31b1bcebf76acb70"))
-//		( 35000, uint256("2af959ab4f12111ce947479bfcef16702485f04afd95210aa90fde7d1e4a64ad"))
-		;
-	const CCheckpointData dataTestnet = {
-		&mapCheckpointsTestnet,
-		1369685559,
-		37581,
-		300
-	}; /* estimated number of transactions per day after checkpoint */
-}
--- a/src/givecoin.h	Sat Feb 13 18:53:44 2021 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-// Copyright (c) 2014 Troy Benjegerdes, under AGPLv3
-// Distributed under the Affero GNU General public license version 3
-// file COPYING or http://www.gnu.org/licenses/agpl-3.0.html
-#ifndef CODECOIN_givecoin_H
-#define CODECOIN_givecoin_H
-
-static const int RPC_PORT = 31410;
-static const int RPC_PORT_TESTNET =31411;
-static const int P2P_PORT = 31415;
-static const int P2P_PORT_TESTNET = 31416;
-
-static const int64_t COIN = 100000000;
-static const int64_t CENT = 1000000;
-static const int COIN_DECIMALS = 8; /* decimal places for coin */
-#define COIN_DECIMALS_FMT "08"
-
-static const unsigned int MAX_BLOCK_SIZE = 1000000;                      // 1000KB block hard limit
-static const unsigned int MAX_BLOCK_SIZE_GEN = MAX_BLOCK_SIZE/4;         // 250KB  block soft limit
-
-/** Dust Soft Limit, allowed with additional fee per output */
-static const int64_t DUST_SOFT_LIMIT = 100000; // 0.001 GIVE
-/** Dust Hard Limit, ignored as wallet inputs (mininput default) */
-static const int64_t DUST_HARD_LIMIT = 1000;   // 0.00001 GIVE mininput
-/** Minimum criteria for AllowFree */
-static const int64_t MIN_FREE_PRIORITY = COIN * 576/250;
-/** No amount larger than this (in catoshi) is valid */
-static const int64_t MAX_MONEY = 500000000 * COIN;
-inline bool MoneyRange(int64_t nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
-/** Coinbase transaction outputs can only be spent after this number of new blocks (network rule) */
-static const int COINBASE_MATURITY = 100;
-
-/** Minimum block time spacing (hard limit) **/
-static const int64_t MINIMUM_BLOCK_SPACING = 30;	// Absolute minimum spacing
-
-/** really only used in rpcmining.cpp **/
-static const int RETARGET_INTERVAL = 15;
-
-#define STAKE_TARGET_SPACING nStakeTargetSpacing
-
-extern const unsigned int nStakeMinAge;
-extern const unsigned int nStakeMaxAge;
-extern const unsigned int nStakeTargetSpacing;
-extern const unsigned int nMaxClockDrift;
-//extern const unsigned int nMinTxOutAmount; // set to = CTransaction::nMinTxFee;
-
-#define CUTOFF_POS_BLOCK nCutoff_Pos_Block
-extern const int CUTOFF_POS_BLOCK;
-
-#if defined(FEATURE_SOMEDAY_CodecoinAddress)
-class GivecoinAddress : public CodecoinAddress
-{
-public:
-	enum
-	{
-        PUBKEY_ADDRESS = 15, // Givecoin addresses start with L
-        SCRIPT_ADDRESS = 5,
-        PUBKEY_ADDRESS_TEST = 111,
-        SCRIPT_ADDRESS_TEST = 196,
-	}
-};
-
-typedef GivecoinAddressVisitor CBitcoinAddressVisitor;
-typedef GivecoinAddress CBitcoinAddress;
-#endif
-
-#define FEATURE_MONEYSUPPLY
-#define FEATURE_CFG_MAXFUTURE
-
-#define BRAND "Givecoin"
-#define BRAND_upper "GiveCoin"
-#define BRAND_lower "givecoin"
-#define BRAND_domain "givecoin.org"
-#define BRAND_CODE "GIVE"
-
-#if defined(BRAND_givestake)
-#define PPCOINSTAKE
-#endif
-
-#endif
--- a/src/givestake.cpp	Sat Feb 13 18:53:44 2021 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,506 +0,0 @@
-// Copyright (c) 2009-2010 Satoshi Nakamoto
-// Copyright (c) 2009-2012 The Bitcoin developers
-// Copyright (c) 2013-2014 The Catcoin developers
-// Copyright (c) 2014-2015 Troy Benjegerdes, under AGPLv3
-// Distributed under the Affero GNU General public license version 3
-// file COPYING or http://www.gnu.org/licenses/agpl-3.0.html
-
-#include "codecoin.h"
-#include "givecoin.h"
-#include "checkpoints.h"
-#include "db.h"
-#include "txdb.h"
-#include "net.h"
-#include "init.h"
-#include "ui_interface.h"
-#include "checkqueue.h"
-#include <boost/algorithm/string/replace.hpp>
-#include <boost/filesystem.hpp>
-#include <boost/filesystem/fstream.hpp>
-
-using namespace std;
-using namespace boost;
-
-/* TODO: make this part of a decent C++ object with proper constructors */
-uint256 hashGenesisBlock = 0;		
-const string strMessageMagic = "Givecoin Signed Message:\n";
-unsigned char pchMessageStart[4];
-
-/* stake stuff TODO: */
-const CBigNum bnProofOfWorkLimit(~uint256(0) >> 20);
-const CBigNum bnProofOfStakeLimit(~uint256(0) >> 20);
-
-//CBigNum bnProofOfWorkLimitTestNet(~uint256(0) >> 20);
-//CBigNum bnProofOfStakeLimitTestNet(~uint256(0) >> 20);
-
-/* TODO: move to givecoin.h once finalized */
-const unsigned int nStakeMinAge = 60 * 60 * 24 * 2;	// minimum age for coin age: 2d
-const unsigned int nStakeMaxAge = 60 * 60 * 24 * 30;	// stake age of full weight: -1
-const unsigned int nStakeTargetSpacing = 90;		// 60 sec block spacing
-const unsigned int nStakeTargetSpacing2 = 60;		// 90 sec block spacing
-const unsigned int nMaxClockDrift = 45 * 60; 		// 45 minutes
-#warning for test only
-//const int nCutoff_Pos_Block = 250000;
-const int nCutoff_Pos_Block = 10;
-
-/* end stake stuff */
-int nCoinbaseMaturity = COINBASE_MATURITY;
-
-/** TODO: this goes into src/policy/fees.cpp when latest bitcoin code is merged */
-/** Fees smaller than this (in satoshi) are considered zero fee (for transaction creation) */
-int64_t CTransaction::nMinTxFee = CENT;
-/** Fees smaller than this (in satoshi) are considered zero fee (for relaying) */
-int64_t CTransaction::nMinRelayTxFee = CENT;
-
-// DNS seeds
-// Each pair gives a source name and a seed name.
-// The first name is used as information source for addrman.
-// The second name should resolve to a list of seed addresses.
-// FIXME use a single string and/or objectify this
-/*
-  Givecoin policy for getting on this list:
-  TODO: come up with a policy
- */
-const char *strMainNetDNSSeed[][2] = 
-{
-   {"xtc.inter.com", "xtc.inter.com"},
-   {NULL, NULL}
-};
-
-const char *strTestNetDNSSeed[][2] = {
-	//{"Givecointools.com", "testnet-seed.Givecointools.com"},
-	//{"weminemnc.com", "testnet-seed.weminemnc.com"},
-	{NULL, NULL}
-};
-
-// ppcoin: miner's coin stake is rewarded based on coin age spent (coin-days)
-int64_t static PPcoinStakeReward(int64_t nCoinAge)
-{
-    static int64_t nRewardCoinYear = CENT;  // creation amount per coin-year
-    int64_t nSubsidy = nCoinAge * 33 / (365 * 33 + 8) * nRewardCoinYear;
-    if (fDebug && GetBoolArg("-printcreation"))
-        printf("GetProofOfStakeReward(): create=%s nCoinAge=%" PRId64"\n", FormatMoney(nSubsidy).c_str(), nCoinAge);
-    return nSubsidy;
-}
-
-// Givecoin original block reward
-int64_t static GivecoinBlockValue_v1(int nHeight, int64_t nFees)
-{
-    int64_t nSubsidy = 0;
-    if (nHeight <= 5) {    // For Each 5 blocks will have 0.5M coins
-       nSubsidy = 5000000 * COIN;
-    }
-    else {
-       nSubsidy = 1000 * COIN;
-    }
-    // Subsidy is cut in half every 250,000 blocks, which will occur approximately every .5 year
-    nSubsidy >>= (nHeight / 250000); // Givecoin: 250k blocks in ~.5 years
-    //
-    if (nSubsidy < COIN) nSubsidy = COIN;  // Minimum Number of Coin = 1
-    return nSubsidy + nFees;
-}
-
-/*
- * Get the allow Seigniorage (money creation, or reward) of the current
- * block. If CoinAge is > 0, this is a proof of stake block.
- */
-int64_t CBlockIndex::GetSeigniorage(int64_t nFees, int64_t CoinAge) const
-{
-	if(IsProofOfWork()){
-		return GivecoinBlockValue_v1(nHeight, nFees);
-	} else {
-		return PPcoinStakeReward(CoinAge);
-	}
-}
-
-static const int64_t nTargetTimespan = 10 * 60;		// Givecoin: Difficulty adjusted every 10 mintues
-static const int64_t nTargetSpacing =	1 * 60;		// Givecoin: Every Minute
-static const int64_t nInterval = nTargetTimespan / nTargetSpacing;	// 10 block readjustment
-
-//
-// minimum amount of work that could possibly be required nTime after
-// minimum work required was nBase
-//
-unsigned int ComputeMinWork(unsigned int nBase, int64_t nTime, const CBlockHeader* pblock)
-{
-	// Testnet has min-difficulty blocks
-	// after nTargetSpacing*2 time between blocks:
-	if (fTestNet && nTime > nTargetSpacing*2)
-		return bnProofOfWorkLimit.GetCompact();
-
-	CBigNum bnResult;
-	bnResult.SetCompact(nBase);
-	while (nTime > 0 && bnResult < bnProofOfWorkLimit)
-	{
-		// Maximum 400% adjustment...
-		bnResult *= 4;
-		// ... in best-case exactly 4-times-normal target time
-		nTime -= nTargetTimespan*4;
-	}
-	if (bnResult > bnProofOfWorkLimit)
-		bnResult = bnProofOfWorkLimit;
-	return bnResult.GetCompact();
-}
-
-static int minimum_time_fork = 225225;  	// minimum time fork
-static int minimum_time_fork_2 = 250000;        // minimum time fork to drop peers immediately
-
-//Checks for 'hardcoded' block timestamps
-bool AcceptBlockTimestamp(CValidationState &state, CBlockIndex* pindexPrev, const CBlockHeader *pblock)
-{
-	int64_t time_allow = -30;
-	int64_t time_warn = MINIMUM_BLOCK_SPACING;
-	int64_t delta = pblock->GetBlockTime() - pindexPrev->GetBlockTime();
-	int nHeight = pindexPrev->nHeight + 1;
-
-	if (nHeight > minimum_time_fork_2){
-		time_allow = 30;
-	}
-	
-	if (delta < time_warn){
-		printf("WARNING blocktime nHeight %d time_allow %" PRId64" time_warn %" PRId64" time delta %" PRId64"\n", nHeight, time_allow, time_warn, delta);
-	}
-
-	if (nHeight >= minimum_time_fork_2) {
-		if (delta <= time_allow) // see above, from first hard limit
-			return state.Invalid(error("AcceptBlock(height=%d) : block time delta %" PRId64" too short", nHeight, delta));
-	}
-	if (nHeight >= minimum_time_fork) { /* don't forward these */
-		if (delta <= MINIMUM_BLOCK_SPACING)
-			return state.DoS(10, (error("AcceptBlock(height=%d) : block time delta %" PRId64" too short", nHeight, delta)));
-	}
-	return true;	
-}
-
-unsigned int static GetNextWorkRequired_V1(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
-{
-   unsigned int nProofOfWorkLimit = bnProofOfWorkLimit.GetCompact();
-
-	// Genesis block
-	if (pindexLast == NULL)
-		return nProofOfWorkLimit;
-
-	// Only change once per interval
-	if ((pindexLast->nHeight+1) % nInterval != 0)
-	{
-		// Special difficulty rule for testnet:
-		if (fTestNet)
-		{
-			// If the new block's timestamp is more than 2* 10 minutes
-			// then allow mining of a min-difficulty block.
-			if (pblock->nTime > pindexLast->nTime + nTargetSpacing*2)
-				return nProofOfWorkLimit;
-			else
-			{
-				// Return the last non-special-min-difficulty-rules-block
-				const CBlockIndex* pindex = pindexLast;
-				while (pindex->pprev && pindex->nHeight % nInterval != 0 && pindex->nBits == nProofOfWorkLimit)
-					pindex = pindex->pprev;
-				return pindex->nBits;
-			}
-		}
-
-		return pindexLast->nBits;
-	}
-
-	// DarkCoin: This fixes an issue where a 51% attack can change difficulty at will.
-	// Go back the full period unless it's the first retarget after genesis. Code courtesy of Art Forz
-	int blockstogoback = nInterval-1;
-	if ((pindexLast->nHeight+1) != nInterval)
-		blockstogoback = nInterval;
-
-	// Go back by what we want to be 14 days worth of blocks
-	const CBlockIndex* pindexFirst = pindexLast;
-	for (int i = 0; pindexFirst && i < blockstogoback; i++)
-		pindexFirst = pindexFirst->pprev;
-	assert(pindexFirst);
-
-	// Limit adjustment step
-	int64_t nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime();
-	printf("  nActualTimespan = %" PRId64"	before bounds\n", nActualTimespan);
-	if (nActualTimespan < nTargetTimespan/4)
-		nActualTimespan = nTargetTimespan/4;
-	if (nActualTimespan > nTargetTimespan*4)
-		nActualTimespan = nTargetTimespan*4;
-
-	// Retarget
-	CBigNum bnNew;
-	bnNew.SetCompact(pindexLast->nBits);
-	bnNew *= nActualTimespan;
-	bnNew /= nTargetTimespan;
-
-	if (bnNew > bnProofOfWorkLimit)
-		bnNew = bnProofOfWorkLimit;
-
-	return bnNew.GetCompact();
-}
-
-
-unsigned int static KimotoGravityWell(const CBlockIndex* pindexLast, const CBlockHeader *pblock, uint64_t TargetBlocksSpacingSeconds, uint64_t PastBlocksMin, uint64_t PastBlocksMax) {
-
-		const CBlockIndex *BlockLastSolved = pindexLast;
-		const CBlockIndex *BlockReading = pindexLast;
-		const CBlockHeader *BlockCreating = pblock;
-		BlockCreating = BlockCreating;
-		uint64_t PastBlocksMass = 0;
-		int64_t PastRateActualSeconds = 0;
-		int64_t PastRateTargetSeconds = 0;
-		double PastRateAdjustmentRatio = double(1);
-		CBigNum PastDifficultyAverage;
-		CBigNum PastDifficultyAveragePrev;
-		double EventHorizonDeviation;
-		double EventHorizonDeviationFast;
-		double EventHorizonDeviationSlow;
-
-		if (BlockLastSolved == NULL || BlockLastSolved->nHeight == 0 || (uint64_t)BlockLastSolved->nHeight < PastBlocksMin) {
-		   return bnProofOfWorkLimit.GetCompact();
-		}
-
-		int64_t LatestBlockTime = BlockLastSolved->GetBlockTime();
-
-		for (unsigned int i = 1; BlockReading && BlockReading->nHeight > 0; i++) {
-
-			if ((PastBlocksMax > 0) && (i > PastBlocksMax)) {
-			   break;
-			}
-			PastBlocksMass++;
-
-			if (i == 1) {
-			   PastDifficultyAverage.SetCompact(BlockReading->nBits);
-			}
-			else {
-			   PastDifficultyAverage = ((CBigNum().SetCompact(BlockReading->nBits) - PastDifficultyAveragePrev) / i) + PastDifficultyAveragePrev;
-			}
-			PastDifficultyAveragePrev = PastDifficultyAverage;
-
-			if (LatestBlockTime < BlockReading->GetBlockTime()) {
-			   LatestBlockTime = BlockReading->GetBlockTime();
-			}
-
-			PastRateActualSeconds = BlockLastSolved->GetBlockTime() - BlockReading->GetBlockTime();
-			PastRateTargetSeconds = TargetBlocksSpacingSeconds * PastBlocksMass;
-			PastRateAdjustmentRatio = double(1);
-
-			if (PastRateActualSeconds < 1) {
-			   PastRateActualSeconds  = 1;
-			}
-			if ((PastRateActualSeconds != 0) && (PastRateTargetSeconds != 0)) {
-			   PastRateAdjustmentRatio = double(PastRateTargetSeconds) / double(PastRateActualSeconds);
-			}
-			EventHorizonDeviation = 1 + (0.7084 * pow((double(PastBlocksMass)/double(28.2)), -1.228));
-			EventHorizonDeviationFast = EventHorizonDeviation;
-			EventHorizonDeviationSlow = 1 / EventHorizonDeviation;
-
-			if (PastBlocksMass >= PastBlocksMin) {
-			   if ((PastRateAdjustmentRatio <= EventHorizonDeviationSlow) || (PastRateAdjustmentRatio >= EventHorizonDeviationFast)) { assert(BlockReading); break; }
-			}
-			if (BlockReading->pprev == NULL) {
-			   assert(BlockReading);
-			   break;
-			}
-			BlockReading = BlockReading->pprev;
-
-		}
-
-		CBigNum bnNew(PastDifficultyAverage);
-		if (PastRateActualSeconds != 0 && PastRateTargetSeconds != 0) {
-		   bnNew *= PastRateActualSeconds;
-		   bnNew /= PastRateTargetSeconds;
-		}
-
-	if (bnNew > bnProofOfWorkLimit) {
-		bnNew = bnProofOfWorkLimit;
-	}
-
-	return bnNew.GetCompact();
-}
-
-unsigned int static GetNextWorkRequired_V2(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
-{
-		static const int64_t BlocksTargetSpacing   = 60;					// 60 seconds
-		static const unsigned int TimeDaySeconds = 60 * 60 * 24;
-
-		int64_t  PastSecondsMin = TimeDaySeconds * 0.02; // 0.01;
-		int64_t  PastSecondsMax = TimeDaySeconds * 0.30; // 0.14;
-		uint64_t PastBlocksMin	= PastSecondsMin / BlocksTargetSpacing;
-		uint64_t PastBlocksMax	= PastSecondsMax / BlocksTargetSpacing;
-
-		return KimotoGravityWell(pindexLast, pblock, BlocksTargetSpacing, PastBlocksMin, PastBlocksMax);
-}
-
-unsigned int GetNextTrustRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
-{
-		int DiffMode = 1;
-		if (fTestNet) {
-			if    (pindexLast->nHeight+1 >=    50) { DiffMode = 2; }
-		}
-		else {
-			if    (pindexLast->nHeight+1 >= 34804) { DiffMode = 1; }
-			else if (pindexLast->nHeight+1 >= 200) { DiffMode = 2; }
-		}
-		if      (DiffMode == 1) { return GetNextWorkRequired_V1(pindexLast, pblock); }
-		else if (DiffMode == 2) { return GetNextWorkRequired_V2(pindexLast, pblock); }
-		return GetNextWorkRequired_V2(pindexLast, pblock);
-}
-
-
-bool LoadBlockIndex()
-{
-	if (fTestNet)
-	{
-		pchMessageStart[0] = 0xfc;
-		pchMessageStart[1] = 0xc1;
-		pchMessageStart[2] = 0xb7;
-		pchMessageStart[3] = 0xdc;
-		hashGenesisBlock = uint256("0x00000279dba2a8c40c2cd690f160f127a2a7edb8194f0d4e7605f212adf294bc");
-	} else {
-		pchMessageStart[0] = 0xd1;
-		pchMessageStart[1] = 0xd2;
-		pchMessageStart[2] = 0xd3;
-		pchMessageStart[3] = 0xdb;
-		hashGenesisBlock = uint256("0x00000279dba2a8c40c2cd690f160f127a2a7edb8194f0d4e7605f212adf294bc");
-	}
-
-	//
-	// Load block index from databases
-	//
-	if (!fReindex && !LoadBlockIndexDB())
-		return false;
-
-	return true;
-}
-
-bool InitBlockIndex() {
-	// Check whether we're already initialized
-	if (pindexGenesisBlock != NULL)
-		return true;
-
-	// Use the provided setting for -txindex in the new database
-	fTxIndex = GetBoolArg("-txindex", false);
-	pblocktree->WriteFlag("txindex", fTxIndex);
-	printf("Initializing databases...\n");
-
-	// Only add the genesis block if not reindexing (in which case we reuse the one already on disk)
-	if (!fReindex) {
-
-
-
-		 // Genesis Block:
-		 // block.nTime = 1393884829
-		 // 2014-03-09 22:00:10 block.nNonce = 2088083604
-		 // 2014-03-09 22:00:10 block.GetHash = f092eda63502ff8b19f584c56fc6ed32a9e265b798831690ea9aaf44cc74f7f0
-		 // Genesis block
-
-		const char* pszTimestamp = "CNN 03/Mar/20a14 Ukraine crisis: UN Security Council meets";
-		CTransaction txNew;
-		txNew.nVersion = 1;
-		printf("txNew version: %d\n", txNew.nVersion);
-		txNew.vin.resize(1);
-		txNew.vout.resize(1);
-		txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
-		txNew.vout[0].nValue = 1000 * COIN;
-		txNew.vout[0].scriptPubKey = CScript() << ParseHex("040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9") << OP_CHECKSIG;
-		CBlock block;
-		block.vtx.push_back(txNew);
-		block.hashPrevBlock = 0;
-		block.hashMerkleRoot = block.BuildMerkleTree();
-		block.nVersion = 1;
-		block.nTime    = 1393884829;
-		block.nBits    = bnProofOfWorkLimit.GetCompact();
-		block.nNonce   = 2090389678;
-
-		if (fTestNet)
-		{
-			block.nTime    = 1393884829;
-			block.nNonce   = 2090389678; // hack, same
-		}
-
-
-		uint256 hash = block.GetHash();
-		if (hash != hashGenesisBlock)
-		{
-			printf("Searching for genesis block...\n");
-			// This will figure out a valid hash and Nonce if you're
-			// creating a different genesis block:
-			uint256 hashTarget = CBigNum().SetCompact(block.nBits).getuint256();
-			// char scratchpad[SCRYPT_SCRATCHPAD_SIZE];
-
-		while(true){
-				hash = block.GetHash();
-				if (hash <= hashTarget)
-					break;
-				if ((block.nNonce & 0xFFF) == 0)
-				{
-					printf("nonce %08X: hash = %s (target = %s)\n", block.nNonce, hash.ToString().c_str(), hashTarget.ToString().c_str());
-				}
-				++block.nNonce;
-				if (block.nNonce == 0)
-				{
-					printf("NONCE WRAPPED, incrementing time\n");
-					++block.nTime;
-				}
-			}
-			printf("block.nTime = %u \n", block.nTime);
-			printf("block.nNonce = %u \n", block.nNonce);
-			printf("block.GetHash = %s\n", block.GetHash().ToString().c_str());
-		}
-
-		printf("%s\n", hash.ToString().c_str());
-		printf("%s\n", hashGenesisBlock.ToString().c_str());
-		printf("%s\n", block.hashMerkleRoot.ToString().c_str());
-		block.print();
-		assert(block.hashMerkleRoot == uint256("0xdc43fdf63088ee667d957a39f87b217822b9e3d31805b008124c4e821079a43c"));
-		//block.print();
-		assert(hash == hashGenesisBlock);
-
-		// Start new block file
-		try {
-			unsigned int nBlockSize = ::GetSerializeSize(block, SER_DISK, CLIENT_VERSION);
-			CDiskBlockPos blockPos;
-			CValidationState state;
-			if (!FindBlockPos(state, blockPos, nBlockSize+8, 0, block.nTime))
-				return error("LoadBlockIndex() : FindBlockPos failed");
-			if (!block.WriteToDisk(blockPos))
-				return error("LoadBlockIndex() : writing genesis block to disk failed");
-			if (!block.AddToBlockIndex(state, blockPos))
-				return error("LoadBlockIndex() : genesis block not accepted");
-		} catch(std::runtime_error &e) {
-			return error("LoadBlockIndex() : failed to initialize block database: %s", e.what());
-		}
-	}
-
-	return true;
-}
-
-namespace Checkpoints
-{
-	// What makes a good checkpoint block?
-	// + Is surrounded by blocks with reasonable timestamps
-	//	 (no blocks before with a timestamp after, none after with
-	//	  timestamp before)
-	// + Contains no strange transactions
-	static MapCheckpoints mapCheckpoints =
-		boost::assign::map_list_of
-		(	0,	uint256("00000279dba2a8c40c2cd690f160f127a2a7edb8194f0d4e7605f212adf294bc"))
-		(	171000,	uint256("000000000084b49eb538d85b00a40438b99f749124b68ed7719ed27d0abb3447"))
-		;
-	const CCheckpointData data = {
-		&mapCheckpoints,
-		1424439826, // * UNIX timestamp of last checkpoint block
-		219689,	// * total number of transactions between genesis and last checkpoint
-					//	 (the tx=... number in the SetBestChain debug.log lines)
-		1000.0	   // * estimated number of transactions per day after checkpoint
-	};
-
-	static MapCheckpoints mapCheckpointsTestnet = 
-		boost::assign::map_list_of
-		(	546, uint256("000000002a936ca763904c3c35fce2f3556c559c0214345d31b1bcebf76acb70"))
-//		( 35000, uint256("2af959ab4f12111ce947479bfcef16702485f04afd95210aa90fde7d1e4a64ad"))
-		;
-	const CCheckpointData dataTestnet = {
-		&mapCheckpointsTestnet,
-		1369685559,
-		37581,
-		300
-	}; /* estimated number of transactions per day after checkpoint */
-}
--- a/src/grantcoin/params.cpp	Sat Feb 13 18:53:44 2021 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,434 +0,0 @@
-// Copyright (c) 2010 Satoshi Nakamoto
-// Copyright (c) 2009-2014 The Bitcoin developers
-// Copyright (c) 2014-2018 Troy Benjegerdes, under AGPLv3
-// Distributed under the Affero GNU General public license version 3
-// file COPYING or http://www.gnu.org/licenses/agpl-3.0.html
-
-/* Grantcoin/Manna Params */
-
-#include <chainparams.h>
-#include <consensus/merkle.h>
-
-#include <tinyformat.h>
-#include <util.h>
-#include <utilstrencodings.h>
-
-#include <cinttypes> /* PRId64 */
-#include <assert.h>
-
-//#include <grantcoin/seeds.h>
-
-/**
- * Main network
- */
-
-void CChainParams::UpdateVersionBitsParameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout)
-{
-    consensus.vDeployments[d].nStartTime = nStartTime;
-    consensus.vDeployments[d].nTimeout = nTimeout;
-}
-
-class CMainParams : public CChainParams {
-public:
-    CMainParams() {
-        strNetworkID = "grantcoin";
-        //consensus.powLimit = ~uint256S(0) >> 28; // Reduced initial difficulty from Peercoin's 32
-        consensus.powLimit = uint256S("0000000fffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
-        //consensus.nMajorityEnforceBlockUpgrade = 750;
-        //consensus.nMajorityRejectBlockOutdated = 950;
-        //consensus.nMajorityWindow = 1000;
-        consensus.nPowTargetTimespan = 24 * 60 * 60; // 3.5 days FIXME not used for GRT?
-        consensus.nPowTargetSpacing = 1.5 * 60; // 1.5 minutes
-        consensus.nMinerConfirmationWindow = 3360;
-        consensus.nRuleChangeActivationThreshold = 3024; /* 90% of miners */
-
-        /** 
-         * The message start string is designed to be unlikely to occur in normal data.
-         * The characters are rarely used upper ASCII, not valid as UTF-8, and produce
-         * a large 4-byte int at any alignment.
-         */
-        pchMessageStart[0] = 0xe2;
-        pchMessageStart[1] = 0xe7;
-        pchMessageStart[2] = 0xe1;
-        pchMessageStart[3] = 0xe4;
-        nDefaultPort = 9982; /* P2P_PORT */
-
-        /**
-         * Build the genesis block. Note that the output of the genesis coinbase cannot
-         * be spent as it did not originally exist in the database.
-         */
-        const char* pszTimestamp = "The Courier-Journal 21-MAR-2015 Prince Charles calls for a revolution";
-        CMutableTransaction txNew;
-        txNew.Time = 1427081625;
-        txNew.vin.resize(1);
-        txNew.vout.resize(1);
-        txNew.vin[0].scriptSig = CScript() << 486604799 << CScriptNum(9999) << std::vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
-        txNew.vout[0].nValue = 0; /* SetEmpty() used to do this */
-        txNew.vout[0].scriptPubKey.clear(); /* maybe put it back?? */
-
-        genesis.nVersion = 1;
-        genesis.nTime    = 1427086539;
-        genesis.nBits    = 0x1d0fffff;
-        genesis.nNonce   = 413974755;
-        genesis.vtx.push_back(MakeTransactionRef(std::move(txNew)));
-        genesis.hashPrevBlock.SetNull();  // = 0;  // old way is simpler to read
-        genesis.hashMerkleRoot = BlockMerkleRoot(genesis); //genesis.BuildMerkleTree();
-        consensus.hashGenesisBlock = genesis.GetHash();
-
-        //std::cout << genesis.ToString();
-        assert(genesis.hashMerkleRoot == uint256S("0xca7e1b14fe8d66d18650db8fa0c1b2787fa48b4a342fff3b00aa1cc9b0ae85f3"));
-        assert(consensus.hashGenesisBlock == uint256S("0000000f0483c7cc4433d89e321373d82d86ef5ba8157d8f7b9ef3449283421a"));
-
-        //vSeeds.emplace_back("grt.7el.us", true);
-        vSeeds.emplace_back("seed1-mannacurrency.net", true);
-        vSeeds.emplace_back("seed2-mannacurrency.net", true);
-        vSeeds.emplace_back("seed3-mannacurrency.net", true);
-
-        base58Prefixes[PUBKEY_ADDRESS] = {  38 }; // grantcoin: addresses begin with 'G'
-        base58Prefixes[SCRIPT_ADDRESS] = {  97 }; // grantcoin: addresses begin with 'g'
-        base58Prefixes[SECRET_KEY] =     { 166 }; // pubkey + 128
-        base58Prefixes[EXT_PUBLIC_KEY] = {0x04,0x88,0xB2,0x1E};
-        base58Prefixes[EXT_SECRET_KEY] = {0x04,0x88,0xAD,0xE4};
-
-        //fMiningRequiresPeers = true;
-        fDefaultConsistencyChecks = false;
-        fRequireStandard = true;
-        fMineBlocksOnDemand = false;
-        //fTestnetToBeDeprecatedFieldRPC = false;
-
-        checkpointData = {
-            {
-		{  11111, uint256S("00000005e6192125f526f1a8f24b47253282259d6c59adf2039157c523f5ef6c")},
-		{ 100000, uint256S("000000000000266c129bdcc8549e1517a2d3ec2a5c8aedad7f77ae12426be4d4")},
-		{ 200000, uint256S("00000000000019f86a0086b0d5acdf95a8c7a6da2e1cf9c052f8ed6a7a01957f")},
-		{ 800000, uint256S("00000000004add0b66dab5d4dadae283211f7de0dbd37d2ba6504b603c9b2599")},
-		{ 900000, uint256S("000000000008bef9e174e237d87c067a7f17b289647011465e1a6430fec7a40b")},
-		{ 994000, uint256S("0000000000003599eee46c88fa2d0a52d8b978dd4642f1787e4c465f43b7b2b2")},	
-	    }
-	};
-    }
-};
-
-
-#if 0
-/**
- * Testnet (Grantcoin v1)
- */
-class CTestNetParams : public CChainParams {
-public:
-    CTestNetParams() {
-        strNetworkID = "test";
-        pchMessageStart[0] = 0xe2;
-        pchMessageStart[1] = 0xe7;
-        pchMessageStart[2] = 0xe1;
-        pchMessageStart[3] = 0xe5;
-        nDefaultPort = 9984; /* P2P_PORT_TESTNET */
-        consensus.nMajorityEnforceBlockUpgrade = 51;
-        consensus.nMajorityRejectBlockOutdated = 75;
-        consensus.nMajorityWindow = 100;
-        consensus.nPowTargetTimespan = 3.5 * 24 * 60 * 60; // 3.5 days
-        consensus.nPowTargetSpacing = 1.5 * 60; // 1.5 minutes
-
-        //! Modify the genesis block for the testnet
-        const char* pszTimestamp = "Reuters 10-OCT-2015 Hundreds of thousands protest in Berlin against EU-US trade deal";
-        CMutableTransaction txNew;
-        txNew.Time = 1444509104;
-        txNew.vin.resize(1);
-        txNew.vout.resize(1);
-        txNew.vin[0].scriptSig = CScript() << 486604799 << CScriptNum(9999) << std::vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
-        txNew.vout[0].nValue = 0; /* SetEmpty() used to do this */
-        txNew.vout[0].scriptPubKey.clear(); /* maybe put it back?? */
-        genesis.vtx.assign(1, txNew); /* clobber the base class TX */
-        genesis.hashPrevBlock.SetNull();
-        genesis.hashMerkleRoot = BlockMerkleRoot(genesis); //genesis.BuildMerkleTree();
-        genesis.nVersion = 1;
-        genesis.nTime    = 1444510495;
-//const CBigNum bnInitialHashTarget(~uint256(0) >> 28);  // Reduced from Peercoin's 40
-        genesis.nBits    = 0x1d0fffff;
-        genesis.nNonce   = 87045764;
-
-	//cout << genesis.ToString();
-        consensus.hashGenesisBlock = genesis.GetHash();
-        assert(genesis.hashMerkleRoot == uint256S("650de4987865a27a1c248908c6a93b9d55931ee3df0e97a845c0915bb53a362f"));
-        assert(consensus.hashGenesisBlock == uint256S("000000075c9bddc6a4638910415b2995febabf9dd8b634f0832da86c5bab2df5"));
-
-        vFixedSeeds.clear();
-        vSeeds.clear();
-        vSeeds.emplace_back("testseed.grt.7el.us", true);
-
-        base58Prefixes[PUBKEY_ADDRESS] = { 65 };  // grantcoin test blockchain: addresses begin with 'T'
-        base58Prefixes[SCRIPT_ADDRESS] = { 127 }; // grantcoin test blockchain: addresses begin with 't'
-        base58Prefixes[SECRET_KEY]     = { 193 }; // pubkey + 128
-        base58Prefixes[EXT_PUBLIC_KEY] = { 0x04,0x35,0x87,0xCF};
-        base58Prefixes[EXT_SECRET_KEY] = { 0x04,0x35,0x83,0x94};
-
-        //fMiningRequiresPeers = true;
-        fDefaultConsistencyChecks = false;
-        fRequireStandard = false;
-        fMineBlocksOnDemand = false;
-
-#if 0
-        checkpointData = {
-            {
-                {546, uint256S("0")},
-            }
-        };
-
-	/* 			   Unix TS, total TX=, estimated transactions/sec */
-        chainTxData = ChainTxData{
-#error
-            1517526271, // Unix 
-            100000,
-            0.01
-        };
-#endif
-    }
-};
-
-/**
- * Regression test
- */
-class CRegTestParams : public CChainParams {
-public:
-    CRegTestParams() {
-        strNetworkID = "regtest";
-        consensus.nSubsidyHalvingInterval = 150;
-        consensus.BIP16Height = 0; // always enforce P2SH BIP16 on regtest
-        consensus.BIP34Height = 100000000; // BIP34 has not activated on regtest (far in the future so block v1 are not rejected in tests)
-        consensus.BIP34Hash = uint256();
-        consensus.BIP65Height = 1351; // BIP65 activated on regtest (Used in rpc activation tests)
-        consensus.BIP66Height = 1251; // BIP66 activated on regtest (Used in rpc activation tests)
-        consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
-        consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
-        consensus.nPowTargetSpacing = 10 * 60;
-        consensus.fPowAllowMinDifficultyBlocks = true;
-        consensus.fPowNoRetargeting = true;
-        consensus.nRuleChangeActivationThreshold = 108; // 75% for testchains
-        consensus.nMinerConfirmationWindow = 144; // Faster than normal for regtest (144 instead of 2016)
-        consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;
-        consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 0;
-        consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
-        consensus.vDeployments[Consensus::DEPLOYMENT_CSV].bit = 0;
-        consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = 0;
-        consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
-        consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].bit = 1;
-        consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nStartTime = Consensus::BIP9Deployment::ALWAYS_ACTIVE;
-        consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
-
-        // The best chain should have at least this much work.
-        consensus.nMinimumChainWork = uint256S("0x00");
-
-        // By default assume that the signatures in ancestors of this block are valid.
-        consensus.defaultAssumeValid = uint256S("0x00");
-
-        pchMessageStart[0] = 0xfa;
-        pchMessageStart[1] = 0xbf;
-        pchMessageStart[2] = 0xb5;
-        pchMessageStart[3] = 0xda;
-        nDefaultPort = 18444;
-        nPruneAfterHeight = 1000;
-
-        genesis = CreateGenesisBlock(1296688602, 2, 0x207fffff, 1, 50 * COIN);
-        consensus.hashGenesisBlock = genesis.GetHash();
-        assert(consensus.hashGenesisBlock == uint256S("0x0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206"));
-        assert(genesis.hashMerkleRoot == uint256S("0x4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"));
-
-        vFixedSeeds.clear(); //!< Regtest mode doesn't have any fixed seeds.
-        vSeeds.clear();      //!< Regtest mode doesn't have any DNS seeds.
-
-        fDefaultConsistencyChecks = true;
-        fRequireStandard = false;
-        fMineBlocksOnDemand = true;
-
-        checkpointData = {
-            {
-                {0, uint256S("0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206")},
-            }
-        };
-
-        chainTxData = ChainTxData{
-            0,
-            0,
-            0
-        };
-
-        base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,111);
-        base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,196);
-        base58Prefixes[SECRET_KEY] =     std::vector<unsigned char>(1,239);
-        base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x35, 0x87, 0xCF};
-        base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x35, 0x83, 0x94};
-
-        bech32_hrp = "bcrt";
-    }
-};
-#endif
-
-static std::unique_ptr<CChainParams> globalChainParams;
-
-const CChainParams &Params() {
-    assert(globalChainParams);
-    return *globalChainParams;
-}
-
-std::unique_ptr<CChainParams> CreateChainParams(const std::string& chain)
-{
-    if (chain == CBaseChainParams::MAIN)
-        return std::unique_ptr<CChainParams>(new CMainParams());
-#if 0
-    else if (chain == CBaseChainParams::TESTNET)
-        return std::unique_ptr<CChainParams>(new CTestNetParams());
-    else if (chain == CBaseChainParams::REGTEST)
-        return std::unique_ptr<CChainParams>(new CRegTestParams());
-#endif
-    throw std::runtime_error(strprintf("%s: Unknown chain %s.", __func__, chain));
-}
-
-void SelectParams(const std::string& network)
-{
-    SelectBaseParams(network);
-    globalChainParams = CreateChainParams(network);
-}
-
-void UpdateVersionBitsParameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout)
-{
-    globalChainParams->UpdateVersionBitsParameters(d, nStartTime, nTimeout);
-}
-
-#include "consensus/validation.h"
-#include "arith_uint256.h"
-#include "chain.h"
-#include "txdb.h"
-#include "utilmoneystr.h"
-
-using namespace std;
-using namespace boost;
-
-// GRT always has FEATURE_MAXFUTURE
-int32_t nMaxFutureTime = 0;
-
-// TODO: separate max clock drift from tx timestamp limits?
-const unsigned int nMaxClockDrift = 2*60*60;   // this is WAY to big..
-
-const std::string strMessageMagic = "Grantcoin Signed Message:\n";
-
-const std::string CURRENCY_UNIT = "GRT";
-
-int64_t GetProofOfWorkRewardTestNet(int nHeight)
-{
-    int64_t nSubsidy = COIN;
-    if (nHeight == 1)
-        nSubsidy = 10000000000 * COIN;  // Grantcoin created for planned distribution
-    else if (nHeight < 500)
-        nSubsidy = CENT;  // De minimus reward pre-launch and up to 2 weeks post-launch
-    else if (nHeight < 510)
-        nSubsidy = 6.25 * COIN;  // Public mining begins
-    else if (nHeight < 520)
-        nSubsidy = 12.5 * COIN;  // Reward gradually increases during first few days
-    else if (nHeight < 530)
-        nSubsidy = 25 * COIN;
-    else if (nHeight < 540)
-        nSubsidy = 50 * COIN;
-    else if (nHeight < 550)
-        nSubsidy = 100 * COIN;
-    else if (nHeight < 560)
-        nSubsidy = 200 * COIN;
-    else if (nHeight < 1000)
-        nSubsidy = 400 * COIN;  // Maximum reward reached
-    else if (nHeight < 1500)
-        nSubsidy = 200 * COIN;  // Reward starts to decline
-    else if (nHeight < 2000)
-        nSubsidy = 100 * COIN;
-    else if (nHeight < 2500)
-        nSubsidy = 50 * COIN;
-    else if (nHeight < 3000)
-        nSubsidy = 25 * COIN;
-    else if (nHeight < 3500)
-        nSubsidy = 12.5 * COIN;
-    else if (nHeight < 4000)
-        nSubsidy = 6.25 * COIN;
-    else if (nHeight < 4500)
-        nSubsidy = 3.13 * COIN;
-    else if (nHeight < 5000)
-        nSubsidy = 1.57 * COIN;
-    else if (nHeight >= 5000)
-        nSubsidy = COIN;  // PoW reward reaches final minimum value
-
-    // if (fDebug && GetBoolArg("-printcreation"))
-    //     printf("GetProofOfWorkReward() : create=%s nBits=0x%08x nSubsidy=%"PRI64d"\n", FormatMoney(nSubsidy).c_str(), nBits, nSubsidy);
-
-    return nSubsidy;
-}
-
-int64_t Grantcoin_PoWReward(int nHeight)
-{
-    int64_t nSubsidy = COIN;
-/* kludge, break this because no one much used old testnet above anyway */
-//    if (fTestNet){
-//	return GetProofOfWorkRewardTestNet(nHeight);
-//    }
-
-    if (nHeight == 1)
-        nSubsidy = 10000000000 * COIN;  // Grantcoin created for planned distribution
-    else if (nHeight < 50000)
-        nSubsidy = CENT;  // De minimus reward pre-launch and up to 2 weeks post-launch
-    else if (nHeight < 51000)
-        nSubsidy = 6.25 * COIN;  // Public mining begins
-    else if (nHeight < 52000)
-        nSubsidy = 12.5 * COIN;  // Reward gradually increases during first few days
-    else if (nHeight < 53000)
-        nSubsidy = 25 * COIN;
-    else if (nHeight < 54000)
-        nSubsidy = 50 * COIN;
-    else if (nHeight < 55000)
-        nSubsidy = 100 * COIN;
-    else if (nHeight < 56000)
-        nSubsidy = 200 * COIN;
-    else if (nHeight < 100000)
-        nSubsidy = 400 * COIN;  // Maximum reward reached
-    else if (nHeight < 150000)
-        nSubsidy = 200 * COIN;  // Reward starts to decline
-    else if (nHeight < 200000)
-        nSubsidy = 100 * COIN;
-    else if (nHeight < 250000)
-        nSubsidy = 50 * COIN;
-    else if (nHeight < 300000)
-        nSubsidy = 25 * COIN;
-    else if (nHeight >= 300000)
-        nSubsidy = 10 * COIN;  // Final minimum reward for PoW phase
-
-    // if (fDebug && GetBoolArg("-printcreation"))
-    //     printf("GetProofOfWorkReward() : create=%s nBits=0x%08x nSubsidy=%"PRI64d"\n", FormatMoney(nSubsidy).c_str(), nBits, nSubsidy);
-
-    return nSubsidy;
-}
-
-// peercoin: miner's coin stake is rewarded based on coin age spent (coin-days)
-int64_t Grantcoin_StakeReward(int64_t nCoinAge)
-{
-    static int64_t nRewardCoinYear = CENT;  // creation amount per coin-year
-    int64_t nSubsidy = nCoinAge * 33 / (365 * 33 + 8) * nRewardCoinYear;
-#if 0
-    if (fDebug && GetBoolArg("-printcreation", false))
-        printf("GetProofOfStakeReward(): create=%s nCoinAge=%" PRId64 "\n", FormatMoney(nSubsidy).c_str(), nCoinAge);
-#else
-#warning "fix -printcreation"
-#endif
-    return nSubsidy;
-}
-
-/*
- * Get the allowed Seigniorage (money creation, or reward) of the current
- * block. If CoinAge is > 0, this is a proof of stake block.
- */
-int64_t CBlockIndex::GetSeigniorage(int64_t nFees, int64_t CoinAge) const
-{
-	if(IsProofOfWork()){
-		return Grantcoin_PoWReward(nHeight);
-	} else {
-		return Grantcoin_StakeReward(CoinAge);
-	}
-}
-
-static const int64_t nTargetTimespan = 24 * 60 * 60;  // 24 hours
-static const int64_t nTargetSpacingWorkMax = 12 * STAKE_TARGET_SPACING; // 18 minutes
-
--- a/src/grantstake.cpp	Sat Feb 13 18:53:44 2021 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,634 +0,0 @@
-// Copyright (c) 2009-2010 Satoshi Nakamoto
-// Copyright (c) 2009-2012 The Bitcoin developers
-// Copyright (c) 2013-2014 The Catcoin developers
-// Copyright (c) 2014 Troy Benjegerdes, under AGPLv3
-// Distributed under the Affero GNU General public license version 3
-// file COPYING or http://www.gnu.org/licenses/agpl-3.0.html
-
-#include "codecoin.h"
-#if defined(BRAND_grantstake)
-#include "grantstake.h"
-#else
-#include "grantcoin.h"
-#endif
-#include "alert.h"
-#include "checkpoints.h"
-#include "db.h"
-#include "txdb.h"
-#include "net.h"
-#include "init.h"
-#include "ui_interface.h"
-#include "checkqueue.h"
-#include <boost/algorithm/string/replace.hpp>
-#include <boost/filesystem.hpp>
-#include <boost/filesystem/fstream.hpp>
-
-using namespace std;
-using namespace boost;
-
-uint256 hashGenesisBlock = 0;			// TODO: objectize this for multicoin support
-
-const string strMessageMagic = "Grantcoin Signed Message:\n";
-
-const CBigNum bnProofOfWorkLimit(~uint256(0) >> 28);  // Reduced initial difficulty from Peercoin's 32
-const CBigNum bnInitialHashTarget(~uint256(0) >> 28);  // Reduced from Peercoin's 40
-
-int nCoinbaseMaturity = COINBASE_MATURITY;
-
-/** TODO: this goes into src/policy/fees.cpp when latest bitcoin code is merged */
-/** Fees smaller than this (in satoshi) are considered zero fee (for transaction creation) */
-int64_t CTransaction::nMinTxFee = CENT;
-/** Fees smaller than this (in satoshi) are considered zero fee (for relaying) */
-int64_t CTransaction::nMinRelayTxFee = CENT;
-
-// TODO: separate max clock drift from tx timestamp limits?
-const unsigned int nMaxClockDrift = 2*60*60;   // this is WAY to big..
-
-
-
-/* value, in percent of what difficulty value we'll accept for orphans */
-const int ORPHAN_WORK_THRESHOLD = 1; // FIXME WAY TOO WIDE right now
-
-// DNS seeds
-// Each pair gives a source name and a seed name.
-// The first name is used as information source for addrman.
-// The second name should resolve to a list of seed addresses.
-// FIXME use a single string and/or objectify this
-const char *strMainNetDNSSeed[][2] = {
-	{"grantcoin.net", "seed1.grantcoin.net"},
-	{"grantcoin.net", "seed2.grantcoin.net"},
-	{NULL, NULL}
-};
-
-const char *strTestNetDNSSeed[][2] = {
-	{"seed", "159.203.84.95"},
-	{NULL, NULL}
-};
-
-int64_t GetProofOfWorkRewardTestNet(int nHeight)
-{
-    int64_t nSubsidy = COIN;
-    if (nHeight == 1)
-        nSubsidy = 10000000000 * COIN;  // Grantcoin created for planned distribution
-    else if (nHeight < 500)
-        nSubsidy = CENT;  // De minimus reward pre-launch and up to 2 weeks post-launch
-    else if (nHeight < 510)
-        nSubsidy = 6.25 * COIN;  // Public mining begins
-    else if (nHeight < 520)
-        nSubsidy = 12.5 * COIN;  // Reward gradually increases during first few days
-    else if (nHeight < 530)
-        nSubsidy = 25 * COIN;
-    else if (nHeight < 540)
-        nSubsidy = 50 * COIN;
-    else if (nHeight < 550)
-        nSubsidy = 100 * COIN;
-    else if (nHeight < 560)
-        nSubsidy = 200 * COIN;
-    else if (nHeight < 1000)
-        nSubsidy = 400 * COIN;  // Maximum reward reached
-    else if (nHeight < 1500)
-        nSubsidy = 200 * COIN;  // Reward starts to decline
-    else if (nHeight < 2000)
-        nSubsidy = 100 * COIN;
-    else if (nHeight < 2500)
-        nSubsidy = 50 * COIN;
-    else if (nHeight < 3000)
-        nSubsidy = 25 * COIN;
-    else if (nHeight < 3500)
-        nSubsidy = 12.5 * COIN;
-    else if (nHeight < 4000)
-        nSubsidy = 6.25 * COIN;
-    else if (nHeight < 4500)
-        nSubsidy = 3.13 * COIN;
-    else if (nHeight < 5000)
-        nSubsidy = 1.57 * COIN;
-    else if (nHeight >= 5000)
-        nSubsidy = COIN;  // PoW reward reaches final minimum value
-
-    // if (fDebug && GetBoolArg("-printcreation"))
-    //     printf("GetProofOfWorkReward() : create=%s nBits=0x%08x nSubsidy=%"PRI64d"\n", FormatMoney(nSubsidy).c_str(), nBits, nSubsidy);
-
-    return nSubsidy;
-}
-
-int64_t Grantcoin_PoWReward(int nHeight)
-{
-    int64_t nSubsidy = COIN;
-/* kludge */
-    if (fTestNet){
-	return GetProofOfWorkRewardTestNet(nHeight);
-    }
-
-    if (nHeight == 1)
-        nSubsidy = 10000000000 * COIN;  // Grantcoin created for planned distribution
-    else if (nHeight < 50000)
-        nSubsidy = CENT;  // De minimus reward pre-launch and up to 2 weeks post-launch
-    else if (nHeight < 51000)
-        nSubsidy = 6.25 * COIN;  // Public mining begins
-    else if (nHeight < 52000)
-        nSubsidy = 12.5 * COIN;  // Reward gradually increases during first few days
-    else if (nHeight < 53000)
-        nSubsidy = 25 * COIN;
-    else if (nHeight < 54000)
-        nSubsidy = 50 * COIN;
-    else if (nHeight < 55000)
-        nSubsidy = 100 * COIN;
-    else if (nHeight < 56000)
-        nSubsidy = 200 * COIN;
-    else if (nHeight < 100000)
-        nSubsidy = 400 * COIN;  // Maximum reward reached
-    else if (nHeight < 150000)
-        nSubsidy = 200 * COIN;  // Reward starts to decline
-    else if (nHeight < 200000)
-        nSubsidy = 100 * COIN;
-    else if (nHeight < 250000)
-        nSubsidy = 50 * COIN;
-    else if (nHeight < 300000)
-        nSubsidy = 25 * COIN;
-    else if (nHeight >= 300000)
-        nSubsidy = 10 * COIN;  // Final minimum reward for PoW phase
-
-    // if (fDebug && GetBoolArg("-printcreation"))
-    //     printf("GetProofOfWorkReward() : create=%s nBits=0x%08x nSubsidy=%"PRI64d"\n", FormatMoney(nSubsidy).c_str(), nBits, nSubsidy);
-
-    return nSubsidy;
-}
-
-// peercoin: miner's coin stake is rewarded based on coin age spent (coin-days)
-int64_t Grantcoin_StakeReward(int64_t nCoinAge)
-{
-    static int64_t nRewardCoinYear = CENT;  // creation amount per coin-year
-    int64_t nSubsidy = nCoinAge * 33 / (365 * 33 + 8) * nRewardCoinYear;
-    if (fDebug && GetBoolArg("-printcreation"))
-        printf("GetProofOfStakeReward(): create=%s nCoinAge=%" PRId64 "\n", FormatMoney(nSubsidy).c_str(), nCoinAge);
-    return nSubsidy;
-}
-
-/*
- * Get the allow Seigniorage (money creation, or reward) of the current
- * block. If CoinAge is > 0, this is a proof of stake block.
- */
-int64_t CBlockIndex::GetSeigniorage(int64_t nFees, int64_t CoinAge) const
-{
-	if(IsProofOfWork()){
-		return Grantcoin_PoWReward(nHeight);
-	} else {
-		return Grantcoin_StakeReward(CoinAge);
-	}
-}
-
-static const int64_t nTargetTimespan = 24 * 60 * 60;  // 24 hours
-static const int64_t nTargetSpacingWorkMax = 12 * STAKE_TARGET_SPACING; // 18 minutes
-
-//
-// minimum amount of work that could possibly be required nTime after
-// minimum work required was nBase
-//
-unsigned int ComputeMinWork(unsigned int nBase, int64_t nTime, const CBlockHeader* pblock)
-{
-    CBigNum bnResult;
-    bnResult.SetCompact(nBase);
-    bnResult *= 2;
-    while (nTime > 0 && bnResult < bnProofOfWorkLimit)
-    {
-        // Maximum 200% adjustment per 3 hours
-        bnResult *= 2;
-        nTime -= 3 * 60 * 60;
-    }
-    if (bnResult > bnProofOfWorkLimit)
-        bnResult = bnProofOfWorkLimit;
-    return bnResult.GetCompact();
-}
-
-unsigned int static GetNextTargetRequired(const CBlockIndex* pindexLast, bool fProofOfStake)
-{
-    if (pindexLast == NULL)
-        return bnProofOfWorkLimit.GetCompact(); // genesis block
-
-    const CBlockIndex* pindexPrev = GetLastBlockIndex(pindexLast, fProofOfStake);
-    if (pindexPrev->pprev == NULL)
-        return bnInitialHashTarget.GetCompact(); // first block
-    const CBlockIndex* pindexPrevPrev = GetLastBlockIndex(pindexPrev->pprev, fProofOfStake);
-    if (pindexPrevPrev->pprev == NULL)
-        return bnInitialHashTarget.GetCompact(); // second block
-
-    int64_t nActualSpacing = pindexPrev->GetBlockTime() - pindexPrevPrev->GetBlockTime();
-
-    // peercoin: target change every block
-    // peercoin: retarget with exponential moving toward target spacing
-    CBigNum bnNew;
-    bnNew.SetCompact(pindexPrev->nBits);
-    int64_t nTargetSpacing = fProofOfStake? STAKE_TARGET_SPACING : min(nTargetSpacingWorkMax, (int64_t) STAKE_TARGET_SPACING * (1 + pindexLast->nHeight - pindexPrev->nHeight));
-    int64_t nInterval = nTargetTimespan / nTargetSpacing;
-    bnNew *= ((nInterval - 1) * nTargetSpacing + nActualSpacing + nActualSpacing);
-    bnNew /= ((nInterval + 1) * nTargetSpacing);
-
-    if (bnNew > bnProofOfWorkLimit)
-        bnNew = bnProofOfWorkLimit;
-
-    return bnNew.GetCompact();
-}
-
-#if defined(PPCOINSTAKE)
-unsigned int GetNextTrustRequired(const CBlockIndex* pindexLast, const CBlock *pblock)
-{
-	return GetNextTargetRequired(pindexLast, pblock->IsProofOfStake());	
-}
-#else
-unsigned int GetNextTrustRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
-{
-	return GetNextTargetRequired(pindexLast, false);	
-}
-#endif
-
-static int minimum_time_fork = 250000;	// minimum time fork
-static int minimum_time_fork_2 = 250000;	// minimum time fork
-
-//Checks for 'hardcoded' block timestamps
-bool AcceptBlockTimestamp(CValidationState &state, CBlockIndex* pindexPrev, const CBlockHeader *pblock)
-{
-	int64_t time_allow = -30;
-	int64_t time_warn = MINIMUM_BLOCK_SPACING;
-	int64_t delta = pblock->GetBlockTime() - pindexPrev->GetBlockTime();
-	int nHeight = pindexPrev->nHeight + 1;
-
-	if (nHeight > minimum_time_fork_2){
-		time_allow = 30;
-	}
-	
-	if (delta < time_warn){
-		printf("WARNING blocktime nHeight %d time_allow %" PRId64" time_warn %" PRId64" time delta %" PRId64"\n", nHeight, time_allow, time_warn, delta);
-	}
-
-	if (nHeight >= minimum_time_fork_2) {
-		if (delta <= time_allow) // see above, from first hard limit
-			return state.Invalid(error("AcceptBlock(height=%d) : block time delta %" PRId64" too short", nHeight, delta));
-	}
-	if (nHeight >= minimum_time_fork) { /* don't forward these */
-		if (delta <= MINIMUM_BLOCK_SPACING)
-			return state.DoS(10, (error("AcceptBlock(height=%d) : block time delta %" PRId64" too short", nHeight, delta)));
-	}
-	return true;	
-}
-
-#ifdef CATBOX
-unsigned int GetNextWorkRequired_Catcoin(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
-{
-	int64_t nTargetTimespanLocal = 0;
-	int64_t nIntervalLocal = 0;
-	int forkBlock = 20290 - 1;
-	int fork2Block = 21346;
-
-	 // moved variable inits to the top where they belong
-	 
-	unsigned int nProofOfWorkLimit = bnProofOfWorkLimit.GetCompact();
-	int64_t nActualTimespan;
-	const CBlockIndex* pindexFirst = pindexLast;
-
-	 int64_t error;	 
-	 //int64_t diffcalc;
-	double pGainUp=-0.005125;	// Theses values can be changed to tune the PID formula
-	double iGainUp=-0.0225;	// Theses values can be changed to tune the PID formula
-	double dGainUp=-0.0075;		// Theses values can be changed to tune the PID formula
-
-	double pGainDn=-0.005125;	// Theses values can be changed to tune the PID formula
-	double iGainDn=-0.0525;	// Theses values can be changed to tune the PID formula
-	double dGainDn=-0.0075;		// Theses values can be changed to tune the PID formula
-
-	double pCalc;
-	double iCalc;
-	double dCalc;
-	double dResult;
-	int64_t result;
-	CBigNum bResult;
-	CBigNum bnNew;
-	int i;
-	//CBigNum bLowLimit; // Limit for PID calc to never go below this
-	
-	if(fTestNet){
-		forkBlock = -1;
-		fork2Block = 36;
-	}
-
-	// Genesis block
-	if (pindexLast == NULL)
-		return nProofOfWorkLimit;
-
-	// Starting from block 20,290 the network diff was set to 16
-	// and the retarget interval was changed to 36
-	if(pindexLast->nHeight < forkBlock && !fTestNet) 
-	{
-		nTargetTimespanLocal = nTargetTimespanOld;
-		nIntervalLocal = nIntervalOld;
-	} 
-	else if(pindexLast->nHeight == forkBlock && !fTestNet) 
-	{
-		bnNew.SetCompact(0x1c0ffff0); // Difficulty 16
-		return bnNew.GetCompact();
-	} 
-	else // Keep in for a resync
-	{
-		nTargetTimespanLocal = nTargetTimespan;
-		nIntervalLocal = nInterval;
-	}
-
-	// after fork2Block we retarget every block   
-	if(pindexLast->nHeight < fork2Block && !fTestNet)
-	{
-		// Only change once per interval
-		if ((pindexLast->nHeight+1) % nIntervalLocal != 0 && !fTestNet)
-		{
-			// Special difficulty rule for testnet:
-			if (fTestNet)
-			{
-				// If the new block's timestamp is more than 2* 10 minutes
-				// then allow mining of a min-difficulty block.
-				if (pblock->nTime > pindexLast->nTime + nTargetSpacing*2)
-					return nProofOfWorkLimit;
-				else
-				{
-					// Return the last non-special-min-difficulty-rules-block
-					const CBlockIndex* pindex = pindexLast;
-					while (pindex->pprev && pindex->nHeight % nIntervalLocal != 0 && pindex->nBits == nProofOfWorkLimit)
-						pindex = pindex->pprev;
-					return pindex->nBits;
-				}
-			}
-
-			return pindexLast->nBits;
-		}
-	}
-
-
-	if(pindexLast->nHeight < fork3Block && !fTestNet) // let it walk through 2nd fork stuff if below fork3Block, and ignore if on testnet
-	{
-	// Catcoin: This fixes an issue where a 51% attack can change difficulty at will.
-	// Go back the full period unless it's the first retarget after genesis. Code courtesy of Art Forz
-		int blockstogoback = nIntervalLocal-1;
-		if ((pindexLast->nHeight+1) != nIntervalLocal)
-			blockstogoback = nIntervalLocal;
-
-		// Go back by what we want to be 14 days worth of blocks
-		const CBlockIndex* pindexFirst = pindexLast;
-		for (i = 0; pindexFirst && i < blockstogoback; i++)
-			pindexFirst = pindexFirst->pprev;
-		assert(pindexFirst);
-
-		// Limit adjustment step
-		int numerator = 4;
-		int denominator = 1;
-		if(pindexLast->nHeight >= fork2Block){
-			numerator = 112;
-			denominator = 100;
-		}
-		int64_t nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime();
-		int64_t lowLimit = nTargetTimespanLocal*denominator/numerator;
-		int64_t highLimit = nTargetTimespanLocal*numerator/denominator;
-		printf("  nActualTimespan = %" PRId64"  before bounds\n", nActualTimespan);
-		if (nActualTimespan < lowLimit)
-			nActualTimespan = lowLimit;
-		if (nActualTimespan > highLimit)
-			nActualTimespan = highLimit;
-
-		// Retarget
-		bnNew.SetCompact(pindexLast->nBits);
-		bnNew *= nActualTimespan;
-		bnNew /= nTargetTimespanLocal;
-	
-		if (bnNew > bnProofOfWorkLimit)
-			bnNew = bnProofOfWorkLimit;
-
-		/// debug print
-		if(fTestNet) printf("GetNextWorkRequired RETARGET\n");
-		if(fTestNet) printf("nTargetTimespan = %" PRId64"    nActualTimespan = %" PRId64"\n", nTargetTimespanLocal, nActualTimespan);
-		if(fTestNet) printf("Before: %08x  %s\n", pindexLast->nBits, CBigNum().SetCompact(pindexLast->nBits).getuint256().ToString().c_str());
-		if(fTestNet) printf("After:	%08x  %s\n", bnNew.GetCompact(), bnNew.getuint256().ToString().c_str());
-	}
-/*
-PID formula
-Error = Actual Time - Desired time
-P Calc = pGain * Error
-I Calc = iGain * Error * (Desired Time / Actual Time) 
-D Calc = dGain * (Error / Actual Time) * I Calc
-
-New Diff = (Current Diff + P Calc + I Calc + D Calc)
-
-If New diff < 0, then set static value of 0.0001 or so.
-*/	
-
-	int nMinSpacing = 30;
-	if(pindexLast->nHeight >= fork1min || fTestNet)
-		nMinSpacing = MINIMUM_BLOCK_SPACING;
-	
-	if(pindexLast->nHeight >= fork3Block || fTestNet)
-	// Fork 3 to use a PID routine instead of the other 2 forks 
-	{
-		pindexFirst = pindexLast->pprev;	// Set previous block
-		for(i=0;i<7;i++) pindexFirst = pindexFirst->pprev; // Set 4th previous block for 8 block filtering 
-		nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime();		// Get last X blocks time
-		nActualTimespan = nActualTimespan / 8;	// Calculate average for last 8 blocks
-		if(pindexLast->nHeight > fork4Block || fTestNet){
-			if (nMinSpacing > nActualTimespan){
-				printf("WARNING: SANITY CHECK FAILED: PID nActualTimespan %" PRId64" too small! increased to %d\n",
-					nActualTimespan, nMinSpacing );
-				nActualTimespan = nMinSpacing;
-			}
-		}
-		bnNew.SetCompact(pindexLast->nBits);	// Get current difficulty
-		i=0;					// Zero bit-shift counter
-		while(bnNew>0)				// Loop while bnNew > 0
-		{
-			i++;				// Increment bit-shift counter
-			bnNew = bnNew >> 1;		// shift bnNew lower by 1 bit
-			if(i>256) bnNew = 0;		// overflow test, just to make sure that it never stays in this loop
-		}
-		bnNew.SetCompact(pindexLast->nBits);	// Get current difficulty again
-		
-
-		error = nActualTimespan - nTargetSpacing;	// Calculate the error to be fed into the PID Calculation
-		if(error >= -450 && error <= 450) // Slower gains for when the average time is within 2.5 min and 7.5 min 
-		{
-			// Calculate P ... pGainUp defined at beginning of routine
-			pCalc = pGainUp * (double)error;
-			// Calculate I ... iGainUp defined at beginning of routine
-			iCalc = iGainUp * (double)error * (double)((double)nTargetSpacing / (double)nActualTimespan);
-			// Calculate D ... dGainUp defined at beginning of routine
-			dCalc = dGainUp * ((double)error / (double)nActualTimespan) * iCalc;
-		}
-		else // Faster gains for block averages faster than 2.5 min and greater than 7.5 min 
-		{
-			// Calculate P ... pGainDn defined at beginning of routine
-			pCalc = pGainDn * (double)error;
-			// Calculate I ... iGainDn defined at beginning of routine
-			iCalc = iGainDn * (double)error * (double)((double)nTargetSpacing / (double)nActualTimespan);
-			// Calculate D ... dGainDn defined at beginning of routine
-			dCalc = dGainDn * ((double)error / (double)nActualTimespan) * iCalc;
-		}
-
-		if(error > -10 && error < 10)
-		{
-			if(fTestNet) printf("Within dead zone. No change!  error: %" PRId64"\n", error);
-			return(bnNew.GetCompact());
-		}		
-		
-		dResult = pCalc + iCalc + dCalc;	// Sum the PID calculations
-		
-		result = (int64_t)(dResult * 65536);	// Adjust for scrypt calcuation
-		// Bring the result within max range to avoid overflow condition 
-		while(result >	8388607) result = result / 2; 
-		bResult = result;			// Set the bignum value
-		if(i>24) bResult = bResult << (i - 24);	// bit-shift integer value of result to be subtracted from current diff
-
-		//if(fTestNet)
-		printf("pCalc: %f, iCalc: %f, dCalc: %f, Result: %" PRId64" (%f)\n", pCalc, iCalc, dCalc, result, dResult);
-		//if(fTestNet) // TODO: make this key on a 'debugPID' or something
-		printf("PID Actual Time: %" PRId64", error: %" PRId64"\n", nActualTimespan, error); 
-		if(fTestNet)
-			printf("Result: %08x %s\n",bResult.GetCompact(), bResult.getuint256().ToString().c_str()); 
-		if(fTestNet)
-			printf("Before: %08x %s\n",bnNew.GetCompact(), bnNew.getuint256().ToString().c_str()); 
-		bnNew = bnNew - bResult;	// Subtract the result to set the current diff
-		
-		// Make sure that diff is not set too low, ever
-		if (bnNew.GetCompact() > 0x1e0fffff) bnNew.SetCompact(0x1e0fffff);
-		if(fTestNet) 
-			printf("After:  %08x %s\n",bnNew.GetCompact(), bnNew.getuint256().ToString().c_str()); 
-		
-	} // End Fork 3 to use a PID routine instead of the other 2 forks routine
-
-	return bnNew.GetCompact();
-}
-#endif
-
-const char *pchGrantMain = "\xe2\xe7\xe1\xe4";
-
-unsigned char pchMessageStart[4];
-
-bool LoadBlockIndex()
-{
-	if (fTestNet)
-	{	/* err, currently use the same one. TODO: change PCH */
-		pchMessageStart[0] = pchGrantMain[0];
-		pchMessageStart[1] = pchGrantMain[1];
-		pchMessageStart[2] = pchGrantMain[2];
-		pchMessageStart[3] = pchGrantMain[3];
-		hashGenesisBlock = uint256 ("0x000000075c9bddc6a4638910415b2995febabf9dd8b634f0832da86c5bab2df5");
-	} else {
-		pchMessageStart[0] = pchGrantMain[0];
-		pchMessageStart[1] = pchGrantMain[1];
-		pchMessageStart[2] = pchGrantMain[2];
-		pchMessageStart[3] = pchGrantMain[3];
-		hashGenesisBlock = uint256("0000000f0483c7cc4433d89e321373d82d86ef5ba8157d8f7b9ef3449283421a");
-	}
-
-	//
-	// Load block index from databases
-	//
-	if (!fReindex && !LoadBlockIndexDB())
-		return false;
-
-	return true;
-}
-
-
-bool InitBlockIndex() {
-	// Check whether we're already initialized
-	if (pindexGenesisBlock != NULL)
-		return true;
-
-	// Use the provided setting for -txindex in the new database
-	fTxIndex = GetBoolArg("-txindex", false);
-	pblocktree->WriteFlag("txindex", fTxIndex);
-	printf("Initializing databases...\n");
-
-	// Only add the genesis block if not reindexing (in which case we reuse the one already on disk)
-	if (!fReindex) {
-		CBlock block;
-        	CTransaction txNew;
-		if(fTestNet){ // GrantTestnet, optimize later.
-        const char* pszTimestamp = "Reuters 10-OCT-2015 Hundreds of thousands protest in Berlin against EU-US trade deal";
-        txNew.nTime = 1444509104;
-        txNew.vin.resize(1);
-        txNew.vout.resize(1);
-        txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(9999) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
-        txNew.vout[0].SetEmpty();
-        block.vtx.push_back(txNew);
-        block.hashPrevBlock = 0;
-        block.hashMerkleRoot = block.BuildMerkleTree();
-        block.nVersion = 1;
-        block.nTime    = 1444510495;
-        block.nBits    = bnProofOfWorkLimit.GetCompact();
-        block.nNonce   = 87045764;
-		} else {        
-		// Genesis block
-		const char* pszTimestamp = "The Courier-Journal 21-MAR-2015 Prince Charles calls for a revolution";
-        txNew.nTime = 1427081625;
-		txNew.vin.resize(1);
-		txNew.vout.resize(1);
-		txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(9999) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
-		txNew.vout[0].SetEmpty();
-		block.vtx.push_back(txNew);
-		block.hashPrevBlock = 0;
-		block.hashMerkleRoot = block.BuildMerkleTree();
-		block.nVersion = 1;
-		block.nTime    = 1427086539;
-		block.nBits    = bnProofOfWorkLimit.GetCompact();
-		block.nNonce   = 413974755;
-		}
-
-		//// debug print
-		uint256 hash = block.GetHash();
-		printf("%s\n", hash.ToString().c_str());
-		printf("%s\n", hashGenesisBlock.ToString().c_str());
-		printf("%s\n", block.hashMerkleRoot.ToString().c_str());
-		block.print();
-		assert(hash == hashGenesisBlock);
-		if (fTestNet)
-			assert(block.hashMerkleRoot == uint256("0x650de4987865a27a1c248908c6a93b9d55931ee3df0e97a845c0915bb53a362f"));
-		else {
-			assert(block.hashMerkleRoot == uint256("0xca7e1b14fe8d66d18650db8fa0c1b2787fa48b4a342fff3b00aa1cc9b0ae85f3"));
-		}
-
-		//assert(block.CheckBlock)
-
-		// Start new block file
-		try {
-			unsigned int nBlockSize = ::GetSerializeSize(block, SER_DISK, CLIENT_VERSION);
-			CDiskBlockPos blockPos;
-			CValidationState state;
-			if (!FindBlockPos(state, blockPos, nBlockSize+8, 0, block.nTime))
-				return error("LoadBlockIndex() : FindBlockPos failed");
-			if (!block.WriteToDisk(blockPos))
-				return error("LoadBlockIndex() : writing genesis block to disk failed");
-			if (!block.AddToBlockIndex(state, blockPos))
-				return error("LoadBlockIndex() : genesis block not accepted");
-		} catch(std::runtime_error &e) {
-			return error("LoadBlockIndex() : failed to initialize block database: %s", e.what());
-		}
-	}
-
-	return true;
-}
-
-namespace Checkpoints
-{
-	// What makes a good checkpoint block?
-	// + Is surrounded by blocks with reasonable timestamps
-	//	 (no blocks before with a timestamp after, none after with
-	//	  timestamp before)
-	// + Contains no strange transactions
-	// TODO put this in grantcoin.cpp|.h
-	static MapCheckpoints mapCheckpoints =
-		boost::assign::map_list_of
-		(     0, uint256("0000000f0483c7cc4433d89e321373d82d86ef5ba8157d8f7b9ef3449283421a"))
-//		(33000, uint256("0x"))
-
-		;
-	const CCheckpointData data = {
-		&mapCheckpoints,
-		1434870875, 	// * UNIX timestamp of last checkpoint block
-		106400,		// * total number of transactions between genesis and last checkpoint
-					//	 (the tx=... number in the SetBestChain debug.log lines)
-		1000.0		// * estimated number of transactions per day after checkpoint
-	};
-}
--- a/src/grantstake.h	Sat Feb 13 18:53:44 2021 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-// Copyright (c) 2014 Troy Benjegerdes, under AGPLv3
-// Distributed under the Affero GNU General public license version 3
-// file COPYING or http://www.gnu.org/licenses/agpl-3.0.html
-#ifndef CODECOIN_grantcoin_H
-#define CODECOIN_grantcoin_H
-
-static const int RPC_PORT = 9983;
-static const int RPC_PORT_TESTNET = 9985;
-static const int P2P_PORT = 9982;
-static const int P2P_PORT_TESTNET = 9984;
-
-static const int64_t COIN = 1000000;
-static const int64_t CENT = 10000;
-static const int COIN_DECIMALS = 6; /* decimal places for coin */
-#define COIN_DECIMALS_FMT "06"
-
-/** The maximum allowed size for a serialized block, in bytes (network rule) */
-static const unsigned int MAX_BLOCK_SIZE = 1000000;
-static const unsigned int MAX_BLOCK_SIZE_GEN = MAX_BLOCK_SIZE/2;
-
-/** No amount larger than this (in satoshi) is valid */
-static const int64_t MAX_MONEY = 50000000000 * COIN;
-inline bool MoneyRange(int64_t nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
-
-/** Coinbase transaction outputs can only be spent after this number of new blocks (network rule) */
-static const int COINBASE_MATURITY = 500;
-
-#warning TODO: sanity check following
-
-static const int STAKE_TARGET_SPACING = 1.5 * 60; // 90-second block spacing 
-static const unsigned int nStakeMinAge = 60 * 60 * 24; // minimum age for coin age (24 hours)
-static const unsigned int nStakeMaxAge = 60 * 60 * 24 * 90; // stake age of full weight
-//static const int64 START_BLOCK_PROOF_OF_STAKE = 250000; // PoS allowed starting at this block
-
-extern const unsigned int nMaxClockDrift;
-
-
-/** Dust Soft Limit, allowed with additional fee per output */
-static const int64_t DUST_SOFT_LIMIT = CENT; // 0.01 GRT
-/** Dust Hard Limit, ignored as wallet inputs (mininput default) */
-static const int64_t DUST_HARD_LIMIT = 100;   // 0.00001 GRT mininput
-
-/** main.h CTransaction:AllowFree **/
-static const int MIN_FREE_PRIORITY = COIN * 960 / 250;
-
-/** The interval over which we look to calculate the next difficulty **/
-// TODO: not needed for GRT???
-static const int RETARGET_INTERVAL = 36;
-
-/** Minimum block time spacing (hard limit) **/
-static const int64_t MINIMUM_BLOCK_SPACING = 60;	// Absolute minimum spacing
-
-// MODIFIER_INTERVAL: time to elapse before new modifier is computed
-static const unsigned int MODIFIER_INTERVAL = 6 * 60 * 60; 
-extern unsigned int nModifierInterval;
-
-// MODIFIER_INTERVAL_RATIO:
-// ratio of group interval length between the last group and the first group
-static const int MODIFIER_INTERVAL_RATIO = 3;
-
-#define BRAND "GrantStake"
-#define BRAND_upper "GrantStake"
-#define BRAND_lower "grantstake"
-#define BRAND_domain "grantcoin.org"
-#define BRAND_CODE "GRT"
-
-//Use ppcoinstake
-#define PPCOINSTAKE
-#define FEATURE_MONEYSUPPLY
-// Faster bootstraps with xz. Probably only works on mac/linux
-#define USE_BOOTSTRAP_XZ
-#define USE_BOOTSTRAP_GZ	// might work on android too
-
-#endif
--- a/src/hamburger.cpp	Sat Feb 13 18:53:44 2021 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,489 +0,0 @@
-// Copyright (c) 2009-2010 Satoshi Nakamoto
-// Copyright (c) 2009-2012 The Bitcoin developers
-// Copyright (c) 2013-2014 The Catcoin developers
-// Copyright (c) 2014-2015 Troy Benjegerdes, under AGPLv3
-// Distributed under the Affero GNU General public license version 3
-// file COPYING or http://www.gnu.org/licenses/agpl-3.0.html
-
-#include "codecoin.h"
-#include "hamburger.h"
-#include "checkpoints.h"
-#include "db.h"
-#include "txdb.h"
-#include "net.h"
-#include "init.h"
-#include "ui_interface.h"
-#include "checkqueue.h"
-#include <boost/algorithm/string/replace.hpp>
-#include <boost/filesystem.hpp>
-#include <boost/filesystem/fstream.hpp>
-
-using namespace std;
-using namespace boost;
-
-/* TODO: make this part of a decent C++ object with proper constructors */
-uint256 hashGenesisBlock = 0;		
-const string strMessageMagic = "Hamburger Signed Message:\n";
-unsigned char pchMessageStart[4];
-
-/* stake stuff TODO: */
-const CBigNum bnProofOfWorkLimit(~uint256(0) >> 16);
-const CBigNum bnProofOfStakeLimit(~uint256(0) >> 16);
-
-//CBigNum bnProofOfWorkLimitTestNet(~uint256(0) >> 20);
-//CBigNum bnProofOfStakeLimitTestNet(~uint256(0) >> 20);
-
-/* TODO: move to hamburger.h once finalized */
-const unsigned int nStakeMinAge = 60 * 60 * 1;		// minimum age for coin age: 1h
-const unsigned int nStakeMaxAge = 60 * 60 * 24 * 7;	// stake age of full weight: 7d
-const unsigned int nStakeTargetSpacing = 20;		// 20 sec block spacing
-const unsigned int nMaxClockDrift = 60 * 60 * 3; 		// 3 hours (way too big)
-#warning for test only
-//const int nCutoff_Pos_Block = 250000;
-const int nCutoff_Pos_Block = 10;
-
-/* end stake stuff */
-int nCoinbaseMaturity = COINBASE_MATURITY;
-
-/** TODO: this goes into src/policy/fees.cpp when latest bitcoin code is merged */
-/** Fees smaller than this (in satoshi) are considered zero fee (for transaction creation) */
-int64_t CTransaction::nMinTxFee = CENT;
-/** Fees smaller than this (in satoshi) are considered zero fee (for relaying) */
-int64_t CTransaction::nMinRelayTxFee = CENT;
-
-// DNS seeds
-// Each pair gives a source name and a seed name.
-// The first name is used as information source for addrman.
-// The second name should resolve to a list of seed addresses.
-// FIXME use a single string and/or objectify this
-/*
-  hamburger policy for getting on this list:
-  TODO: come up with a policy
- */
-const char *strMainNetDNSSeed[][2] = 
-{
-   {"hamburger.7el.us", "hamburger.7el.us"},
-   {NULL, NULL}
-};
-
-const char *strTestNetDNSSeed[][2] = {
-	//{"weminemnc.com", "testnet-seed.weminemnc.com"},
-	{NULL, NULL}
-};
-
-// ppcoin: miner's coin stake is rewarded based on coin age spent (coin-days)
-int64_t static PPcoinStakeReward(int64_t nCoinAge)
-{
-    static int64_t nRewardCoinYear = CENT;  // creation amount per coin-year
-    int64_t nSubsidy = nCoinAge * 33 / (365 * 33 + 8) * nRewardCoinYear;
-    if (fDebug && GetBoolArg("-printcreation"))
-        printf("GetProofOfStakeReward(): create=%s nCoinAge=%" PRId64"\n", FormatMoney(nSubsidy).c_str(), nCoinAge);
-    return nSubsidy;
-}
-
-// Givecoin original block reward
-int64_t static GivecoinBlockValue_v1(int nHeight, int64_t nFees)
-{
-    int64_t nSubsidy = 0;
-    if (nHeight <= 5) {    // For Each 5 blocks will have 0.5M coins
-       nSubsidy = 5000000 * COIN;
-    }
-    else {
-       nSubsidy = 1000 * COIN;
-    }
-    // Subsidy is cut in half every 250,000 blocks, which will occur approximately every .5 year
-    nSubsidy >>= (nHeight / 250000); // Givecoin: 250k blocks in ~.5 years
-    //
-    if (nSubsidy < COIN) nSubsidy = COIN;  // Minimum Number of Coin = 1
-    return nSubsidy + nFees;
-}
-
-/*
- * Get the allow Seigniorage (money creation, or reward) of the current
- * block. If CoinAge is > 0, this is a proof of stake block.
- */
-int64_t CBlockIndex::GetSeigniorage(int64_t nFees, int64_t CoinAge) const
-{
-	if(IsProofOfWork()){
-		return GivecoinBlockValue_v1(nHeight, nFees);
-	} else {
-		return PPcoinStakeReward(CoinAge);
-	}
-}
-
-static const int64_t nTargetTimespan = 10 * 60;	// hamburger: Difficulty adjusted every 10 mintues
-static const int64_t nTargetSpacing =	1 * 60;	// hamburger: Every Minute
-static const int64_t nInterval = nTargetTimespan / nTargetSpacing;	// 10 block readjustment
-
-//
-// minimum amount of work that could possibly be required nTime after
-// minimum work required was nBase
-//
-unsigned int ComputeMinWork(unsigned int nBase, int64_t nTime, const CBlockHeader* pblock)
-{
-	// Testnet has min-difficulty blocks
-	// after nTargetSpacing*2 time between blocks:
-	if (fTestNet && nTime > nTargetSpacing*2)
-		return bnProofOfWorkLimit.GetCompact();
-
-	CBigNum bnResult;
-	bnResult.SetCompact(nBase);
-	while (nTime > 0 && bnResult < bnProofOfWorkLimit)
-	{
-		// Maximum 400% adjustment...
-		bnResult *= 4;
-		// ... in best-case exactly 4-times-normal target time
-		nTime -= nTargetTimespan*4;
-	}
-	if (bnResult > bnProofOfWorkLimit)
-		bnResult = bnProofOfWorkLimit;
-	return bnResult.GetCompact();
-}
-
-bool AcceptBlockTimestamp(CValidationState &state, CBlockIndex* pindexPrev, const CBlockHeader *pblock)
-{
-	return true;	
-}
-
-unsigned int static GetNextWorkRequired_V1(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
-{
-   unsigned int nProofOfWorkLimit = bnProofOfWorkLimit.GetCompact();
-
-	// Genesis block
-	if (pindexLast == NULL)
-		return nProofOfWorkLimit;
-
-	// Only change once per interval
-	if ((pindexLast->nHeight+1) % nInterval != 0)
-	{
-		// Special difficulty rule for testnet:
-		if (fTestNet)
-		{
-			// If the new block's timestamp is more than 2* 10 minutes
-			// then allow mining of a min-difficulty block.
-			if (pblock->nTime > pindexLast->nTime + nTargetSpacing*2)
-				return nProofOfWorkLimit;
-			else
-			{
-				// Return the last non-special-min-difficulty-rules-block
-				const CBlockIndex* pindex = pindexLast;
-				while (pindex->pprev && pindex->nHeight % nInterval != 0 && pindex->nBits == nProofOfWorkLimit)
-					pindex = pindex->pprev;
-				return pindex->nBits;
-			}
-		}
-
-		return pindexLast->nBits;
-	}
-
-	// DarkCoin: This fixes an issue where a 51% attack can change difficulty at will.
-	// Go back the full period unless it's the first retarget after genesis. Code courtesy of Art Forz
-	int blockstogoback = nInterval-1;
-	if ((pindexLast->nHeight+1) != nInterval)
-		blockstogoback = nInterval;
-
-	// Go back by what we want to be 14 days worth of blocks
-	const CBlockIndex* pindexFirst = pindexLast;
-	for (int i = 0; pindexFirst && i < blockstogoback; i++)
-		pindexFirst = pindexFirst->pprev;
-	assert(pindexFirst);
-
-	// Limit adjustment step
-	int64_t nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime();
-	printf("  nActualTimespan = %" PRId64"	before bounds\n", nActualTimespan);
-	if (nActualTimespan < nTargetTimespan/4)
-		nActualTimespan = nTargetTimespan/4;
-	if (nActualTimespan > nTargetTimespan*4)
-		nActualTimespan = nTargetTimespan*4;
-
-	// Retarget
-	CBigNum bnNew;
-	bnNew.SetCompact(pindexLast->nBits);
-	bnNew *= nActualTimespan;
-	bnNew /= nTargetTimespan;
-
-	if (bnNew > bnProofOfWorkLimit)
-		bnNew = bnProofOfWorkLimit;
-
-	return bnNew.GetCompact();
-}
-
-
-unsigned int static KimotoGravityWell(const CBlockIndex* pindexLast, const CBlockHeader *pblock, uint64_t TargetBlocksSpacingSeconds, uint64_t PastBlocksMin, uint64_t PastBlocksMax) {
-
-		const CBlockIndex *BlockLastSolved = pindexLast;
-		const CBlockIndex *BlockReading = pindexLast;
-		const CBlockHeader *BlockCreating = pblock;
-		BlockCreating = BlockCreating;
-		uint64_t PastBlocksMass = 0;
-		int64_t PastRateActualSeconds = 0;
-		int64_t PastRateTargetSeconds = 0;
-		double PastRateAdjustmentRatio = double(1);
-		CBigNum PastDifficultyAverage;
-		CBigNum PastDifficultyAveragePrev;
-		double EventHorizonDeviation;
-		double EventHorizonDeviationFast;
-		double EventHorizonDeviationSlow;
-
-		if (BlockLastSolved == NULL || BlockLastSolved->nHeight == 0 || (uint64_t)BlockLastSolved->nHeight < PastBlocksMin) {
-		   return bnProofOfWorkLimit.GetCompact();
-		}
-
-		int64_t LatestBlockTime = BlockLastSolved->GetBlockTime();
-
-		for (unsigned int i = 1; BlockReading && BlockReading->nHeight > 0; i++) {
-
-			if ((PastBlocksMax > 0) && (i > PastBlocksMax)) {
-			   break;
-			}
-			PastBlocksMass++;
-
-			if (i == 1) {
-			   PastDifficultyAverage.SetCompact(BlockReading->nBits);
-			}
-			else {
-			   PastDifficultyAverage = ((CBigNum().SetCompact(BlockReading->nBits) - PastDifficultyAveragePrev) / i) + PastDifficultyAveragePrev;
-			}
-			PastDifficultyAveragePrev = PastDifficultyAverage;
-
-			if (LatestBlockTime < BlockReading->GetBlockTime()) {
-			   LatestBlockTime = BlockReading->GetBlockTime();
-			}
-
-			PastRateActualSeconds = BlockLastSolved->GetBlockTime() - BlockReading->GetBlockTime();
-			PastRateTargetSeconds = TargetBlocksSpacingSeconds * PastBlocksMass;
-			PastRateAdjustmentRatio = double(1);
-
-			if (PastRateActualSeconds < 1) {
-			   PastRateActualSeconds  = 1;
-			}
-			if ((PastRateActualSeconds != 0) && (PastRateTargetSeconds != 0)) {
-			   PastRateAdjustmentRatio = double(PastRateTargetSeconds) / double(PastRateActualSeconds);
-			}
-			EventHorizonDeviation = 1 + (0.7084 * pow((double(PastBlocksMass)/double(28.2)), -1.228));
-			EventHorizonDeviationFast = EventHorizonDeviation;
-			EventHorizonDeviationSlow = 1 / EventHorizonDeviation;
-
-			if (PastBlocksMass >= PastBlocksMin) {
-			   if ((PastRateAdjustmentRatio <= EventHorizonDeviationSlow) || (PastRateAdjustmentRatio >= EventHorizonDeviationFast)) { assert(BlockReading); break; }
-			}
-			if (BlockReading->pprev == NULL) {
-			   assert(BlockReading);
-			   break;
-			}
-			BlockReading = BlockReading->pprev;
-
-		}
-
-		CBigNum bnNew(PastDifficultyAverage);
-		if (PastRateActualSeconds != 0 && PastRateTargetSeconds != 0) {
-		   bnNew *= PastRateActualSeconds;
-		   bnNew /= PastRateTargetSeconds;
-		}
-
-	if (bnNew > bnProofOfWorkLimit) {
-		bnNew = bnProofOfWorkLimit;
-	}
-
-	return bnNew.GetCompact();
-}
-
-unsigned int static GetNextWorkRequired_V2(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
-{
-		static const int64_t BlocksTargetSpacing   = 60;					// 60 seconds
-		static const unsigned int TimeDaySeconds = 60 * 60 * 24;
-
-		int64_t  PastSecondsMin = TimeDaySeconds * 0.02; // 0.01;
-		int64_t  PastSecondsMax = TimeDaySeconds * 0.30; // 0.14;
-		uint64_t PastBlocksMin	= PastSecondsMin / BlocksTargetSpacing;
-		uint64_t PastBlocksMax	= PastSecondsMax / BlocksTargetSpacing;
-
-		return KimotoGravityWell(pindexLast, pblock, BlocksTargetSpacing, PastBlocksMin, PastBlocksMax);
-}
-
-unsigned int GetNextTrustRequired(const CBlockIndex* pindexLast, const CBlock *pblock)
-{
-		int DiffMode = 1;
-		if (fTestNet) {
-			if    (pindexLast->nHeight+1 >=    50) { DiffMode = 2; }
-		}
-		else {
-			if    (pindexLast->nHeight+1 >= 34804) { DiffMode = 1; }
-			else if (pindexLast->nHeight+1 >= 200) { DiffMode = 2; }
-		}
-		if      (DiffMode == 1) { return GetNextWorkRequired_V1(pindexLast, pblock); }
-		else if (DiffMode == 2) { return GetNextWorkRequired_V2(pindexLast, pblock); }
-		return GetNextWorkRequired_V2(pindexLast, pblock);
-}
-
-
-bool LoadBlockIndex()
-{
-	if (fTestNet)
-	{
-		pchMessageStart[0] = 0xfc;
-		pchMessageStart[1] = 0xc1;
-		pchMessageStart[2] = 0xb7;
-		pchMessageStart[3] = 0xdc;
-		hashGenesisBlock = uint256("0000093faa831b139595fcd1a2d4e9a937d46171d00ecda9c9fb2ec906a552d6");
-	} else {
-		pchMessageStart[0] = 0xd1;
-		pchMessageStart[1] = 0xd2;
-		pchMessageStart[2] = 0xd3;
-		pchMessageStart[3] = 0xdb;
-		//hashGenesisBlock = uint256("00008076809c7be9078977c58db4e849f2252a25d50c59c0c6cdaf59b24485ba");
-		//hashGenesisBlock = uint256("48fbec404c7c044167ae077d319e96b07be7db105585206192c340e107796766");
-		hashGenesisBlock = uint256("00008d7c62b09938fb02932daf4a7d1eaca65a2ceac601150e564ae334259496");
-		
-	}
-
-	//
-	// Load block index from databases
-	//
-	if (!fReindex && !LoadBlockIndexDB())
-		return false;
-
-	return true;
-}
-
-bool InitBlockIndex() {
-	// Check whether we're already initialized
-	if (pindexGenesisBlock != NULL)
-		return true;
-
-	// Use the provided setting for -txindex in the new database
-	fTxIndex = GetBoolArg("-txindex", false);
-	pblocktree->WriteFlag("txindex", fTxIndex);
-	printf("Initializing databases...\n");
-
-	// Only add the genesis block if not reindexing (in which case we reuse the one already on disk)
-	if (!fReindex) {
-
-		const char* pszTimestamp = "NYtimes Feb 25: Germany Sells Five-Year Debt at Negative Yield";
-		CTransaction txNew;
-		txNew.nVersion = 1;
-		printf("txNew version: %d\n", txNew.nVersion);
-		txNew.vin.resize(1);
-		txNew.vout.resize(1);
-		txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
-		txNew.vout[0].nValue = 5000000 * COIN;
-		txNew.vout[0].scriptPubKey = CScript() << ParseHex("03908c4bd37de5f0d99d8402b6ec80c298296f0891bc3e7298b0620f402576adc5") << OP_CHECKSIG;
-		CBlock block;
-		block.vtx.push_back(txNew);
-		block.hashPrevBlock = 0;
-		block.hashMerkleRoot = block.BuildMerkleTree();
-		block.nVersion = 1;
-		block.nTime    = 1426459536;
-		block.nBits    = bnProofOfWorkLimit.GetCompact();
-		block.nNonce   = 2090773291;
-		//block.nNonce   = 2090866385;
-
-		if (fTestNet)
-		{
-			printf("Silly user, there's not testnet here");
-			assert(!fTestNet);
-		}
-
-
-		uint256 hash = block.GetHash();
-		printf("%s\n", hash.ToString().c_str());
-		printf("%s\n", hashGenesisBlock.ToString().c_str());
-		printf("%s\n", block.hashMerkleRoot.ToString().c_str());
-		printf("----\n");
-		if (hash != hashGenesisBlock)
-		{
-			printf("Searching for genesis block...\n");
-			// This will figure out a valid hash and Nonce if you're
-			// creating a different genesis block:
-			uint256 hashTarget = CBigNum().SetCompact(block.nBits).getuint256();
-			// char scratchpad[SCRYPT_SCRATCHPAD_SIZE];
-
-			while(true){
-				hash = block.GetPoWHash();
-				if (hash <= hashTarget)
-					break;
-				if ((block.nNonce & 0xFFF) == 0)
-				{
-					printf("nonce %08X: hash = %s (target = %s)\n", block.nNonce, hash.ToString().c_str(), hashTarget.ToString().c_str());
-				}
-				++block.nNonce;
-				if (block.nNonce == 0)
-				{
-					printf("NONCE WRAPPED, incrementing time\n");
-					++block.nTime;
-				}
-			}
-			printf("block.nTime = %u \n", block.nTime);
-			printf("block.nNonce = %u \n", block.nNonce);
-			printf("block.GetHash = %s\n", block.GetHash().ToString().c_str());
-			printf("block.GetPoWHash = %s\n", block.GetPoWHash().ToString().c_str());
-		}
-
-		printf("%s\n", hash.ToString().c_str());
-		printf("%s\n", hashGenesisBlock.ToString().c_str());
-		printf("%s\n", block.hashMerkleRoot.ToString().c_str());
-		block.print();
-		//assert(block.hashMerkleRoot == uint256("183732b7df12d37a9f227faf4f83f60dc2206e642d48f6d56daee40631326a8d"));
-		//assert(block.hashMerkleRoot == uint256("3b9bbd8816fb38cc334ae2745eb7487596579b979fd1bdbb0c5a574a554d196d"));
-		assert(block.hashMerkleRoot == uint256("07e8717e076506c340350a7d56ee0364023c54ebe07ec5d9d5c8b6bff7454567"));
-		//block.print();
-		assert(hash == hashGenesisBlock);
-
-		// Start new block file
-		try {
-			unsigned int nBlockSize = ::GetSerializeSize(block, SER_DISK, CLIENT_VERSION);
-			CDiskBlockPos blockPos;
-			CValidationState state;
-			if (!FindBlockPos(state, blockPos, nBlockSize+8, 0, block.nTime))
-				return error("LoadBlockIndex() : FindBlockPos failed");
-			if (!block.WriteToDisk(blockPos))
-				return error("LoadBlockIndex() : writing genesis block to disk failed");
-			if (!block.AddToBlockIndex(state, blockPos))
-				return error("LoadBlockIndex() : genesis block not accepted");
-
-        		// connect genesis block so we can spend the foundation grant
-			CCoinsView dummy;
-			CCoinsViewCache view(dummy);
-			if (!block.ConnectBlock(state, pindexGenesisBlock, view))
-				return(error("LoadBlockIndex() : could not connect genesis block"));
-
-		} catch(std::runtime_error &e) {
-			return error("LoadBlockIndex() : failed to initialize block database: %s", e.what());
-		}
-	}
-
-	return true;
-}
-
-namespace Checkpoints
-{
-	// What makes a good checkpoint block?
-	// + Is surrounded by blocks with reasonable timestamps
-	//	 (no blocks before with a timestamp after, none after with
-	//	  timestamp before)
-	// + Contains no strange transactions
-	static MapCheckpoints mapCheckpoints =
-		boost::assign::map_list_of
-		(	0,	uint256("48fbec404c7c044167ae077d319e96b07be7db105585206192c340e107796766"))
-	//	(	2,	uint256("6475f5fde71158860fa84f4f549744b662507aa07120f5f283946f1ac91e2fa7"))
-		;
-	const CCheckpointData data = {
-		&mapCheckpoints,
-		1426479192, // * UNIX timestamp of last checkpoint block
-		3,	// * total number of transactions between genesis and last checkpoint
-					//	 (the tx=... number in the SetBestChain debug.log lines)
-		960.0	   // * estimated number of transactions per day after checkpoint
-	};
-
-	static MapCheckpoints mapCheckpointsTestnet = 
-		boost::assign::map_list_of
-		(	546, uint256("000000002a936ca763904c3c35fce2f3556c559c0214345d31b1bcebf76acb70"))
-//		( 35000, uint256("2af959ab4f12111ce947479bfcef16702485f04afd95210aa90fde7d1e4a64ad"))
-		;
-	const CCheckpointData dataTestnet = {
-		&mapCheckpointsTestnet,
-		1369685559,
-		37581,
-		300
-	}; /* estimated number of transactions per day after checkpoint */
-}
--- a/src/hamburger.h	Sat Feb 13 18:53:44 2021 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-// Copyright (c) 2014 Troy Benjegerdes, under AGPLv3
-// Distributed under the Affero GNU General public license version 3
-// file COPYING or http://www.gnu.org/licenses/agpl-3.0.html
-#ifndef CODECOIN_hamburger_H
-#define CODECOIN_hamburger_H
-
-static const int RPC_PORT = 3123;
-static const int P2P_PORT = 3234;
-static const int RPC_PORT_TESTNET = 4123;
-static const int P2P_PORT_TESTNET = 4234;
-
-static const int64_t COIN = 1000000;
-static const int64_t CENT = 10000;
-static const int COIN_DECIMALS = 6; /* decimal places for coin */
-#define COIN_DECIMALS_FMT "06"
-
-/** The maximum allowed size for a serialized block, in bytes (network rule) */
-static const unsigned int MAX_BLOCK_SIZE = 1000000;
-static const unsigned int MAX_BLOCK_SIZE_GEN = MAX_BLOCK_SIZE/2;
-
-/** Dust Soft Limit, allowed with additional fee per output */
-static const int64_t DUST_SOFT_LIMIT = 10000; // 0.001 HAM
-/** Dust Hard Limit, ignored as wallet inputs (mininput default) */
-static const int64_t DUST_HARD_LIMIT = 100;   // 0.00001 HAM mininput
-
-/** Minimum criteria for CTransaction:AllowFree */
-static const int64_t MIN_FREE_PRIORITY = COIN * 576/250;
-/** No amount larger than this (in catoshi) is valid */
-static const int64_t MAX_MONEY = 500000000 * COIN;
-inline bool MoneyRange(int64_t nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
-/** Coinbase transaction outputs can only be spent after this number of new blocks (network rule) */
-static const int COINBASE_MATURITY = 100;
-
-/** Minimum block time spacing (hard limit) **/
-static const int64_t MINIMUM_BLOCK_SPACING = 15;	// Absolute minimum spacing
-
-/** really only used in rpcmining.cpp **/
-static const int RETARGET_INTERVAL = 15;
-
-#define STAKE_TARGET_SPACING nStakeTargetSpacing
-
-// MODIFIER_INTERVAL: time to elapse before new modifier is computed
-static const unsigned int MODIFIER_INTERVAL = 3 * 60 * 60;  // 3 hours
-extern unsigned int nModifierInterval;
-
-// MODIFIER_INTERVAL_RATIO:
-// ratio of group interval length between the last group and the first group
-static const int MODIFIER_INTERVAL_RATIO = 3;
-
-extern const unsigned int nStakeMinAge;
-extern const unsigned int nStakeMaxAge;
-extern const unsigned int nStakeTargetSpacing;
-extern const unsigned int nMaxClockDrift;
-//extern const unsigned int nMinTxOutAmount; // set to = CTransaction::nMinTxFee;
-
-#define CUTOFF_POS_BLOCK nCutoff_Pos_Block
-extern const int CUTOFF_POS_BLOCK;
-
-#define BRAND "Hamburger"
-#define BRAND_upper "Hamburger"
-#define BRAND_lower "hamburger"
-#define BRAND_domain "hamburger.org"
-#define BRAND_CODE "HAM"
-
-#define PPCOINSTAKE
-#define FEATURE_MONEYSUPPLY
-
-#endif
--- a/src/kittycoin.cpp	Sat Feb 13 18:53:44 2021 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,532 +0,0 @@
-// Copyright (c) 2009-2010 Satoshi Nakamoto
-// Copyright (c) 2009-2012 The Bitcoin developers
-// Copyright (c) 2013-2014 The Catcoin developers
-// Copyright (c) 2014 Troy Benjegerdes, under AGPLv3
-// Distributed under the Affero GNU General public license version 3
-// file COPYING or http://www.gnu.org/licenses/agpl-3.0.html
-
-#include "codecoin.h"
-#include "alert.h"
-#include "checkpoints.h"
-#include "db.h"
-#include "txdb.h"
-#include "net.h"
-#include "init.h"
-#include "ui_interface.h"
-#include "checkqueue.h"
-#include <boost/algorithm/string/replace.hpp>
-#include <boost/filesystem.hpp>
-#include <boost/filesystem/fstream.hpp>
-
-using namespace std;
-using namespace boost;
-
-uint256 hashGenesisBlock = 0;			// TODO: objectize this for multicoin support
-const CBigNum bnProofOfWorkLimit(~uint256(0) >> 12);	// *coin: starting difficulty is 1 / 2^12
-
-/** TODO: this goes into src/policy/fees.cpp when latest bitcoin code is merged */
-/** Fees smaller than this (in satoshi) are considered zero fee (for transaction creation) */
-int64_t CTransaction::nMinTxFee = CENT;
-/** Fees smaller than this (in satoshi) are considered zero fee (for relaying) */
-int64_t CTransaction::nMinRelayTxFee = CENT;
-
-const string strMessageMagic = "Catcoin Signed Message:\n";
-/* value, in percent of what difficulty value we'll accept for orphans */
-const int ORPHAN_WORK_THRESHOLD = 1; // FIXME WAY TOO WIDE right now
-
-// DNS seeds
-// Each pair gives a source name and a seed name.
-// The first name is used as information source for addrman.
-// The second name should resolve to a list of seed addresses.
-// FIXME use a single string and/or objectify this
-/*
-  Catcoin policy for getting on this list:
-   1) have a catcoind with port 9933 open
-   2) be avaible for #catcoin-dev people to contact you for debug and testing
-   3) be willing to take a haircut on generates if we determine on irc and on
-	  (a future) mailing list that we need to do it to fix the network
- */
-const char *strMainNetDNSSeed[][2] = {
-	{"catcoin.org", "seed.catcoin.org"},
-	{"catstat.info", "seed.catstat.info"},
-	{NULL, NULL}
-};
-
-const char *strTestNetDNSSeed[][2] = {
-	{"catstat.info", "testnet-seed.catstat.info"},
-	{NULL, NULL}
-};
-
-inline int64_t KittyCoinBlockValue(int64_t nHeight, int64_t nFees)
-{
-	int64_t nSubsidy = 50 * COIN;
-
-	// Making some sort of 'promise' of 21 million coins is like Monsanto trying to patent
-	// any roundup-resistant plant, or insisting on only running the 'Genuine IBM PC'
-	// Sure you can try to do that, but weeds evolve resistance, China makes clones,
-	// and copycatcoins print money faster than Zimbabwe after they got rid of the farmers.
-	//
-	// Sound currency will come from a robust community that values something in common.
-	// like Cat pictures.  -- Farmer Troy
-	//
-	// FIXME: add Depurrage based on last year of Cat food prices in the blockchain
-	// FIXME2: come up with a way to GET cat food prices in the blockchain
-	// FIXME3: do this more elegantly while maintaining readability
-	//
-	// further economic analysis supporting this at:
-	// http://cryptonomics.org/2014/01/15/the-marginal-cost-of-cryptocurrency/
-	// http://www.ezonomics.com/videos/can_bitcoin_and_other_virtual_currencies_ever_replace_real_money
-
-	return nSubsidy + nFees;
-}
-
-static const int64_t nTargetTimespan = 6 * 60 * 60; // 6 hours
-static const int64_t nTargetSpacing = 10 * 60;
-static const int64_t nInterval = nTargetTimespan / nTargetSpacing;
-
-static const int64_t nTargetTimespanOld = 14 * 24 * 60 * 60; // two weeks
-static const int64_t nIntervalOld = nTargetTimespanOld / nTargetSpacing;
-
-int64_t CBlockIndex::GetSeigniorage(int64_t nFees, int64_t CoinAge) const
-{
-	return KittyCoinBlockValue(nHeight, nFees);
-}
-
-
-//
-// minimum amount of work that could possibly be required nTime after
-// minimum work required was nBase
-//
-unsigned int ComputeMinWork(unsigned int nBase, int64_t nTime, const CBlockHeader* pblock)
-{
-	// Testnet has min-difficulty blocks
-	// after nTargetSpacing*2 time between blocks:
-	if (fTestNet && nTime > nTargetSpacing*2)
-		return bnProofOfWorkLimit.GetCompact();
-
-	CBigNum bnResult;
-	bnResult.SetCompact(nBase);
-	while (nTime > 0 && bnResult < bnProofOfWorkLimit)
-	{
-	// should technically be 112/100 * 36 .. ~40
-		bnResult *= 40;
-		// and if we have long blocks, max 40 x, as well
-		nTime -= nTargetTimespan*40;
-	}
-	if (bnResult > bnProofOfWorkLimit)
-		bnResult = bnProofOfWorkLimit;
-	return bnResult.GetCompact();
-}
-
-static int fork3Block = 27260; // FIXME move to top...
-static int fork4Block = 27680; // Acceptblock needs this
-// static int fork1min = 31919;
-static int fork1min = 210000;	// kittycoin fork block
-
-//Checks for 'hardcoded' block timestamps
-bool AcceptBlockTimestamp(CValidationState &state, CBlockIndex* pindexPrev, const CBlockHeader *pblock)
-{
-	int64_t time_allow = -30;
-	int64_t time_warn = MINIMUM_BLOCK_SPACING;
-	int64_t delta = pblock->GetBlockTime() - pindexPrev->GetBlockTime();
-	int nHeight = pindexPrev->nHeight + 1;
-
-	if (nHeight > fork4Block){
-		time_allow = 30;
-	}
-	
-	if (delta < time_warn){
-		printf("WARNING blocktime nHeight %d time_allow %" PRId64" time_warn %" PRId64" time delta %" PRId64"\n", nHeight, time_allow, time_warn, delta);
-	}
-
-	if (nHeight >= fork3Block) {
-		if (delta <= time_allow) // see above, from first hard limit
-			return state.Invalid(error("AcceptBlock(height=%d) : block time delta %" PRId64" too short", nHeight, delta));
-	}
-	if (nHeight >= fork1min) { /* don't forward these */
-		if (delta <= MINIMUM_BLOCK_SPACING)
-			return state.DoS(10, (error("AcceptBlock(height=%d) : block time delta %" PRId64" too short", nHeight, delta)));
-	}
-	return true;	
-}
-
-unsigned int GetNextTrustRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
-{
-	int64_t nTargetTimespanLocal = 0;
-	int64_t nIntervalLocal = 0;
-	int forkBlock = 20290 - 1;
-	int fork2Block = 21346;
-
-	 // moved variable inits to the top where they belong
-	 
-	unsigned int nProofOfWorkLimit = bnProofOfWorkLimit.GetCompact();
-	int64_t nActualTimespan;
-	const CBlockIndex* pindexFirst = pindexLast;
-
-	 int64_t error;	 
-	 //int64_t diffcalc;
-	double pGainUp=-0.005125;	// Theses values can be changed to tune the PID formula
-	double iGainUp=-0.0225;	// Theses values can be changed to tune the PID formula
-	double dGainUp=-0.0075;		// Theses values can be changed to tune the PID formula
-
-	double pGainDn=-0.005125;	// Theses values can be changed to tune the PID formula
-	double iGainDn=-0.0525;	// Theses values can be changed to tune the PID formula
-	double dGainDn=-0.0075;		// Theses values can be changed to tune the PID formula
-
-	double pCalc;
-	double iCalc;
-	double dCalc;
-	double dResult;
-	int64_t result;
-	CBigNum bResult;
-	CBigNum bnNew;
-	int i;
-	//CBigNum bLowLimit; // Limit for PID calc to never go below this
-	
-	if(fTestNet){
-		forkBlock = -1;
-		fork2Block = 36;
-	}
-
-	// Genesis block
-	if (pindexLast == NULL)
-		return nProofOfWorkLimit;
-
-	// Starting from block 20,290 the network diff was set to 16
-	// and the retarget interval was changed to 36
-	if(pindexLast->nHeight < forkBlock && !fTestNet) 
-	{
-		nTargetTimespanLocal = nTargetTimespanOld;
-		nIntervalLocal = nIntervalOld;
-	} 
-	else if(pindexLast->nHeight == forkBlock && !fTestNet) 
-	{
-		bnNew.SetCompact(0x1c0ffff0); // Difficulty 16
-		return bnNew.GetCompact();
-	} 
-	else // Keep in for a resync
-	{
-		nTargetTimespanLocal = nTargetTimespan;
-		nIntervalLocal = nInterval;
-	}
-
-	// after fork2Block we retarget every block   
-	if(pindexLast->nHeight < fork2Block && !fTestNet)
-	{
-		// Only change once per interval
-		if ((pindexLast->nHeight+1) % nIntervalLocal != 0 && !fTestNet)
-		{
-			// Special difficulty rule for testnet:
-			if (fTestNet)
-			{
-				// If the new block's timestamp is more than 2* 10 minutes
-				// then allow mining of a min-difficulty block.
-				if (pblock->nTime > pindexLast->nTime + nTargetSpacing*2)
-					return nProofOfWorkLimit;
-				else
-				{
-					// Return the last non-special-min-difficulty-rules-block
-					const CBlockIndex* pindex = pindexLast;
-					while (pindex->pprev && pindex->nHeight % nIntervalLocal != 0 && pindex->nBits == nProofOfWorkLimit)
-						pindex = pindex->pprev;
-					return pindex->nBits;
-				}
-			}
-
-			return pindexLast->nBits;
-		}
-	}
-
-
-	if(pindexLast->nHeight < fork3Block && !fTestNet) // let it walk through 2nd fork stuff if below fork3Block, and ignore if on testnet
-	{
-	// Catcoin: This fixes an issue where a 51% attack can change difficulty at will.
-	// Go back the full period unless it's the first retarget after genesis. Code courtesy of Art Forz
-		int blockstogoback = nIntervalLocal-1;
-		if ((pindexLast->nHeight+1) != nIntervalLocal)
-			blockstogoback = nIntervalLocal;
-
-		// Go back by what we want to be 14 days worth of blocks
-		const CBlockIndex* pindexFirst = pindexLast;
-		for (i = 0; pindexFirst && i < blockstogoback; i++)
-			pindexFirst = pindexFirst->pprev;
-		assert(pindexFirst);
-
-		// Limit adjustment step
-		int numerator = 4;
-		int denominator = 1;
-		if(pindexLast->nHeight >= fork2Block){
-			numerator = 112;
-			denominator = 100;
-		}
-		int64_t nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime();
-		int64_t lowLimit = nTargetTimespanLocal*denominator/numerator;
-		int64_t highLimit = nTargetTimespanLocal*numerator/denominator;
-		printf("  nActualTimespan = %" PRId64"  before bounds\n", nActualTimespan);
-		if (nActualTimespan < lowLimit)
-			nActualTimespan = lowLimit;
-		if (nActualTimespan > highLimit)
-			nActualTimespan = highLimit;
-
-		// Retarget
-		bnNew.SetCompact(pindexLast->nBits);
-		bnNew *= nActualTimespan;
-		bnNew /= nTargetTimespanLocal;
-	
-		if (bnNew > bnProofOfWorkLimit)
-			bnNew = bnProofOfWorkLimit;
-
-		/// debug print
-		if(fTestNet) printf("GetNextWorkRequired RETARGET\n");
-		if(fTestNet) printf("nTargetTimespan = %" PRId64"    nActualTimespan = %" PRId64"\n", nTargetTimespanLocal, nActualTimespan);
-		if(fTestNet) printf("Before: %08x  %s\n", pindexLast->nBits, CBigNum().SetCompact(pindexLast->nBits).getuint256().ToString().c_str());
-		if(fTestNet) printf("After:	%08x  %s\n", bnNew.GetCompact(), bnNew.getuint256().ToString().c_str());
-	}
-/*
-PID formula
-Error = Actual Time - Desired time
-P Calc = pGain * Error
-I Calc = iGain * Error * (Desired Time / Actual Time) 
-D Calc = dGain * (Error / Actual Time) * I Calc
-
-New Diff = (Current Diff + P Calc + I Calc + D Calc)
-
-If New diff < 0, then set static value of 0.0001 or so.
-*/	
-
-	int nMinSpacing = 30;
-	if(pindexLast->nHeight >= fork1min || fTestNet)
-		nMinSpacing = MINIMUM_BLOCK_SPACING;
-	
-	if(pindexLast->nHeight >= fork3Block || fTestNet)
-	// Fork 3 to use a PID routine instead of the other 2 forks 
-	{
-		pindexFirst = pindexLast->pprev;	// Set previous block
-		for(i=0;i<7;i++) pindexFirst = pindexFirst->pprev; // Set 4th previous block for 8 block filtering 
-		nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime();		// Get last X blocks time
-		nActualTimespan = nActualTimespan / 8;	// Calculate average for last 8 blocks
-		if(pindexLast->nHeight > fork4Block || fTestNet){
-			if (nMinSpacing > nActualTimespan){
-				printf("WARNING: SANITY CHECK FAILED: PID nActualTimespan %" PRId64" too small! increased to %d\n",
-					nActualTimespan, nMinSpacing );
-				nActualTimespan = nMinSpacing;
-			}
-		}
-		bnNew.SetCompact(pindexLast->nBits);	// Get current difficulty
-		i=0;					// Zero bit-shift counter
-		while(bnNew>0)				// Loop while bnNew > 0
-		{
-			i++;				// Increment bit-shift counter
-			bnNew = bnNew >> 1;		// shift bnNew lower by 1 bit
-			if(i>256) bnNew = 0;		// overflow test, just to make sure that it never stays in this loop
-		}
-		bnNew.SetCompact(pindexLast->nBits);	// Get current difficulty again
-		
-
-		error = nActualTimespan - nTargetSpacing;	// Calculate the error to be fed into the PID Calculation
-		if(error >= -450 && error <= 450) // Slower gains for when the average time is within 2.5 min and 7.5 min 
-		{
-			// Calculate P ... pGainUp defined at beginning of routine
-			pCalc = pGainUp * (double)error;
-			// Calculate I ... iGainUp defined at beginning of routine
-			iCalc = iGainUp * (double)error * (double)((double)nTargetSpacing / (double)nActualTimespan);
-			// Calculate D ... dGainUp defined at beginning of routine
-			dCalc = dGainUp * ((double)error / (double)nActualTimespan) * iCalc;
-		}
-		else // Faster gains for block averages faster than 2.5 min and greater than 7.5 min 
-		{
-			// Calculate P ... pGainDn defined at beginning of routine
-			pCalc = pGainDn * (double)error;
-			// Calculate I ... iGainDn defined at beginning of routine
-			iCalc = iGainDn * (double)error * (double)((double)nTargetSpacing / (double)nActualTimespan);
-			// Calculate D ... dGainDn defined at beginning of routine
-			dCalc = dGainDn * ((double)error / (double)nActualTimespan) * iCalc;
-		}
-
-		if(error > -10 && error < 10)
-		{
-			if(fTestNet) printf("Within dead zone. No change!  error: %" PRId64"\n", error);
-			return(bnNew.GetCompact());
-		}		
-		
-		dResult = pCalc + iCalc + dCalc;	// Sum the PID calculations
-		
-		result = (int64_t)(dResult * 65536);	// Adjust for scrypt calcuation
-		// Bring the result within max range to avoid overflow condition 
-		while(result >	8388607) result = result / 2; 
-		bResult = result;			// Set the bignum value
-		if(i>24) bResult = bResult << (i - 24);	// bit-shift integer value of result to be subtracted from current diff
-
-		//if(fTestNet)
-		printf("pCalc: %f, iCalc: %f, dCalc: %f, Result: %" PRId64" (%f)\n", pCalc, iCalc, dCalc, result, dResult);
-		//if(fTestNet) // TODO: make this key on a 'debugPID' or something
-		printf("PID Actual Time: %" PRId64", error: %" PRId64"\n", nActualTimespan, error); 
-		if(fTestNet)
-			printf("Result: %08x %s\n",bResult.GetCompact(), bResult.getuint256().ToString().c_str()); 
-		if(fTestNet)
-			printf("Before: %08x %s\n",bnNew.GetCompact(), bnNew.getuint256().ToString().c_str()); 
-		bnNew = bnNew - bResult;	// Subtract the result to set the current diff
-		
-		// Make sure that diff is not set too low, ever
-		if (bnNew.GetCompact() > 0x1e0fffff) bnNew.SetCompact(0x1e0fffff);
-		if(fTestNet) 
-			printf("After:  %08x %s\n",bnNew.GetCompact(), bnNew.getuint256().ToString().c_str()); 
-		
-	} // End Fork 3 to use a PID routine instead of the other 2 forks routine
-
-	return bnNew.GetCompact();
-}
-
-
-const char *pchCatMain	= "\xfc\xc1\xb7\xdc";
-const char *pchCatTest	= "\xfd\xcb\xb8\xdd";
-
-unsigned char pchMessageStart[4];
-
-bool LoadBlockIndex()
-{
-	if (fTestNet)
-	{	/* add 1 to litecoin values (3 to bitcoins) */
-		pchMessageStart[0] = pchCatTest[0];
-		pchMessageStart[1] = pchCatTest[1];
-		pchMessageStart[2] = pchCatTest[2];
-		pchMessageStart[3] = pchCatTest[3];
-		hashGenesisBlock = uint256("0xec7987a2ab5225246c5cf9b8d93b4b75bcef383a4a65d5a265bc09ed54006188");
-	} else {
-		pchMessageStart[0] = pchCatMain[0];
-		pchMessageStart[1] = pchCatMain[1];
-		pchMessageStart[2] = pchCatMain[2];
-		pchMessageStart[3] = pchCatMain[3];
-		hashGenesisBlock = uint256("0xbc3b4ec43c4ebb2fef49e6240812549e61ffa623d9418608aa90eaad26c96296");
-	}
-
-	//
-	// Load block index from databases
-	//
-	if (!fReindex && !LoadBlockIndexDB())
-		return false;
-
-	return true;
-}
-
-
-bool InitBlockIndex() {
-	// Check whether we're already initialized
-	if (pindexGenesisBlock != NULL)
-		return true;
-
-	// Use the provided setting for -txindex in the new database
-	fTxIndex = GetBoolArg("-txindex", false);
-	pblocktree->WriteFlag("txindex", fTxIndex);
-	printf("Initializing databases...\n");
-
-	// Only add the genesis block if not reindexing (in which case we reuse the one already on disk)
-	if (!fReindex) {
-		// Genesis Block:
-		// CBlock(hash=12a765e31ffd4059bada, PoW=0000050c34a64b415b6b, ver=1, hashPrevBlock=00000000000000000000, hashMerkleRoot=97ddfbbae6, nTime=1317972665, nBits=1e0ffff0, nNonce=2084524493, vtx=1)
-		//	 CTransaction(hash=97ddfbbae6, ver=1, vin.size=1, vout.size=1, nLockTime=0)
-		//	   CTxIn(COutPoint(0000000000, -1), coinbase 04ffff001d0104404e592054696d65732030352f4f63742f32303131205374657665204a6f62732c204170706c65e280997320566973696f6e6172792c2044696573206174203536)
-		//	   CTxOut(nValue=50.00000000, scriptPubKey=040184710fa689ad5023690c80f3a4)
-		//	 vMerkleTree: 97ddfbbae6
-
-		// Genesis block
-		const char* pszTimestamp = "NY Times - December 23, 2013 - For Today's Babes, Toyland Is Digital";
-		CTransaction txNew;
-		txNew.vin.resize(1);
-		txNew.vout.resize(1);
-		txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
-		txNew.vout[0].nValue = 50 * COIN;
-		txNew.vout[0].scriptPubKey = CScript() << ParseHex("040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9") << OP_CHECKSIG;
-		CBlock block;
-		block.vtx.push_back(txNew);
-		block.hashPrevBlock = 0;
-		block.hashMerkleRoot = block.BuildMerkleTree();
-		block.nVersion = 1;
-		block.nTime    = 1387838302;
-		block.nBits    = 0x1e0ffff0;
-		block.nNonce   = 588050;
-
-		if (fTestNet)
-		{
-			block.nTime    = 1387838303; //FIXME testnet0.1
-			block.nNonce   = 608937;
-		}
-
-		//// debug print
-		uint256 hash = block.GetHash();
-		printf("%s\n", hash.ToString().c_str());
-		printf("%s\n", hashGenesisBlock.ToString().c_str());
-		printf("%s\n", block.hashMerkleRoot.ToString().c_str());
-		assert(block.hashMerkleRoot == uint256("0x4007a33db5d9cdf2aab117335eb8431c8d13fb86e0214031fdaebe69a0f29cf7"));
-
-
-		block.print();
-		assert(hash == hashGenesisBlock);
-
-		// Start new block file
-		try {
-			unsigned int nBlockSize = ::GetSerializeSize(block, SER_DISK, CLIENT_VERSION);
-			CDiskBlockPos blockPos;
-			CValidationState state;
-			if (!FindBlockPos(state, blockPos, nBlockSize+8, 0, block.nTime))
-				return error("LoadBlockIndex() : FindBlockPos failed");
-			if (!block.WriteToDisk(blockPos))
-				return error("LoadBlockIndex() : writing genesis block to disk failed");
-			if (!block.AddToBlockIndex(state, blockPos))
-				return error("LoadBlockIndex() : genesis block not accepted");
-		} catch(std::runtime_error &e) {
-			return error("LoadBlockIndex() : failed to initialize block database: %s", e.what());
-		}
-	}
-
-	return true;
-}
-
-namespace Checkpoints
-{
-	// What makes a good checkpoint block?
-	// + Is surrounded by blocks with reasonable timestamps
-	//	 (no blocks before with a timestamp after, none after with
-	//	  timestamp before)
-	// + Contains no strange transactions
-	// TODO put this in catcoin.cpp|.h
-	static MapCheckpoints mapCheckpoints =
-		boost::assign::map_list_of
-		(    4, uint256("fe508d41b7dc2c3079e827d4230e6f7ddebca43c9afc721c1e6431f78d6ff1de"))
-		(    5, uint256("7fc79021dbfa30255ade9bb8d898640516d9c771c3342a9b889ce380c52c6c1f"))
-		( 5000, uint256("ec268a9cfe87adb4d10a147a544493406c80e00a3e6868641e520b184e7ddce3"))
-		(10000, uint256("29c63023c3b8a36b59837734a9c16133a4ef08d9a0e95f639a830c56e415070d"))
-		(20000, uint256("3a0c072b76a298dabffc4f825a084c0f86dc55fe58f9bf31cc7e21bbfb2ead52"))
-		(22500, uint256("fd3c87eae2e9be72499978155844598a8675eff7a61c90f9aebcedc94e1b217f"))
-		(22544, uint256("6dd1a90cc56cf4a46c8c47528c4861c255e86d5f97fcee53ce356174e15c3045"))
-		(22554, uint256("b13e8b128989f9a9fc1a4c1e547330d0b34d3f60189c00391a116922fa4fcb8c"))
-		(22600, uint256("9e2d7f2fdab36c3e2b6f0455470cd957c12172ad7877f7c8e414fd736469c8d2"))
-		(22650, uint256("7afbd354496346819b8a214693af70e1431bfadbf68d49a688ae27539fc6b37e"))
-		(22700, uint256("35154b803fa5700b69f8081aa6d7c798c1e7fd027971252598a18549092a1291"))
-		(22750, uint256("67e6eca7d46c1a612b7638e7a503e6dbc7cca4da493f4267833a6f1c9a655a35"))
-		(22800, uint256("49e84c3b5c261966c37c101ac7691886bd641a382f514c2221735088b1b2beea"))
-		(22850, uint256("c44cec57381a97c3983df0ef1fcf150669dd1794943202d89b805f423a65516f"))
-		(22900, uint256("44de4c262de678a23554dd06a6f57270815ea9d145f6c542ab2a8dfbd2ca242c"))
-		(22950, uint256("cecc4ab30b39fc09bf85eb191e64c1660ab2206c5f80953694997ec5c2db5338"))
-		(25890, uint256("4806f91100ae83904aa0113cc3acda8fe6ac422186243719a68b76c98e7487c2"))
-		(29400,	uint256("6740c8907d9a13dfa1019142cc3b1e0abfe2fe8c832c5333df82a404d9a3e40e"))
-		(30000, uint256("ff05303dc58caf2d102c85a0504ed16939c7840c91f5f0b37a5bf128e9afb73f"))
-		(31830, uint256("9275b100cd5e540177c285c8801a63e644e7611a60a49b50831f70df6e5ea825"))
-		(32040, uint256("d5c7bdecfd330721f489ea59930204345d3fc05dd5df0d2f09c6c53c8c0352b6"))
-		(35000, uint256("8c5b56e660e47b398395fd01fd721b115fe523da400d23c82120c6fd37636423"))
-		(40000, uint256("b8a6e8aaf4f92d4b521bd022de3008884eba51ff2a5c79e0269d65a03d109283"))
-		(41000, uint256("88f114a60cb0841735df03cecc3c5662ffbdac184c7344d30cef4f98f5b61ed3"))
-		(42000, uint256("4a538c3557ab865d74327e38837b5aac63aaebdc4718c2ee7b8101bcdd241eb6"))
-		(43000, uint256("d2428f19de225b56853090fd548d1d7dd2d3d180b989c785eddb615e60f94209"))
-		(44000, uint256("587b814e0a113eaf52b94e4920362f4c076d7dc942a4f8c5c4900f2d94adbc26"))
-//		(33000, uint256("0x"))
-
-		;
-	const CCheckpointData data = {
-		&mapCheckpoints,
-		1434870875, 	// * UNIX timestamp of last checkpoint block
-		106400,		// * total number of transactions between genesis and last checkpoint
-					//	 (the tx=... number in the SetBestChain debug.log lines)
-		1000.0		// * estimated number of transactions per day after checkpoint
-	};
-}
--- a/src/kittycoin.h	Sat Feb 13 18:53:44 2021 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-// Copyright (c) 2014 Troy Benjegerdes, under AGPLv3
-// Distributed under the Affero GNU General public license version 3
-// file COPYING or http://www.gnu.org/licenses/agpl-3.0.html
-#ifndef CODECOIN_kittycoin_H
-#define CODECOIN_kittycoin_H
-
-static const int RPC_PORT = 9932;
-static const int RPC_PORT_TESTNET = 19932;
-static const int P2P_PORT = 9933;
-static const int P2P_PORT_TESTNET = 19933;
-
-static const int64_t COIN = 100000000;
-static const int64_t CENT = 1000000;
-static const int COIN_DECIMALS = 8; /* decimal places for coin */
-#define COIN_DECIMALS_FMT "08"
-
-static const unsigned int MAX_BLOCK_SIZE = 1000000;                      // 1000KB block hard limit
-static const unsigned int MAX_BLOCK_SIZE_GEN = MAX_BLOCK_SIZE/4;         // 250KB  block soft limit
-
-static const unsigned int nMaxClockDrift = 15*60;
-
-/** Dust Soft Limit, allowed with additional fee per output */
-static const int64_t DUST_SOFT_LIMIT = 100000; // 0.001 CAT
-/** Dust Hard Limit, ignored as wallet inputs (mininput default) */
-static const int64_t DUST_HARD_LIMIT = 1000;   // 0.00001 CAT mininput
-/** No amount larger than this (in satoshi) is valid */
-static const int64_t MAX_MONEY = 21000000 * COIN;
-inline bool MoneyRange(int64_t nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
-
-/** main.h CTransaction:AllowFree **/
-static const int MIN_FREE_PRIORITY = COIN * 576 / 250;
-
-/** The interval over which we look to calculate the next difficulty **/
-static const int RETARGET_INTERVAL = 36;
-/** Coinbase transaction outputs can only be spent after this number of new blocks (network rule) */
-static const int COINBASE_MATURITY = 100;
-
-/** Minimum block time spacing (hard limit) **/
-static const int64_t MINIMUM_BLOCK_SPACING = 60;	// Absolute minimum spacing
-
-#define BRAND "CatCoin"
-#define BRAND_upper "CatCoin"
-#define BRAND_lower "catcoin"
-#define LITECOIN_SCRYPT_POWHASH
-
-#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/old-coins/catcoin.cpp	Sat Feb 13 19:32:51 2021 -0600
@@ -0,0 +1,523 @@
+// Copyright (c) 2009-2010 Satoshi Nakamoto
+// Copyright (c) 2009-2012 The Bitcoin developers
+// Copyright (c) 2013-2014 The Catcoin developers
+// Copyright (c) 2014 Troy Benjegerdes, under AGPLv3
+// Distributed under the Affero GNU General public license version 3
+// file COPYING or http://www.gnu.org/licenses/agpl-3.0.html
+
+#include "catcoin.h"
+#include "alert.h"
+#include "checkpoints.h"
+#include "db.h"
+#include "txdb.h"
+#include "net.h"
+#include "init.h"
+#include "ui_interface.h"
+#include "checkqueue.h"
+#include <boost/algorithm/string/replace.hpp>
+#include <boost/filesystem.hpp>
+#include <boost/filesystem/fstream.hpp>
+
+using namespace std;
+using namespace boost;
+
+uint256 hashGenesisBlock = 0;			// TODO: objectize this for multicoin support
+CBigNum bnProofOfWorkLimit(~uint256(0) >> 12);	// *coin: starting difficulty is 1 / 2^12
+
+const string strMessageMagic = "Catcoin Signed Message:\n";
+/* value, in percent of what difficulty value we'll accept for orphans */
+const int ORPHAN_WORK_THRESHOLD = 1; // FIXME WAY TOO WIDE right now
+
+// DNS seeds
+// Each pair gives a source name and a seed name.
+// The first name is used as information source for addrman.
+// The second name should resolve to a list of seed addresses.
+// FIXME use a single string and/or objectify this
+/*
+  Catcoin policy for getting on this list:
+   1) have a catcoind with port 9933 open
+   2) be avaible for #catcoin-dev people to contact you for debug and testing
+   3) be willing to take a haircut on generates if we determine on irc and on
+	  (a future) mailing list that we need to do it to fix the network
+ */
+const char *strMainNetDNSSeed[][2] = {
+	{"thepeeps.net", "p2pool.thepeeps.net"},
+	{"catstat.info", "seed.catstat.info"},
+	{"catcoinwallets.com", "seed.catcoinwallets.com"},
+	{"geekhash.org", "cat.geekhash.org"},
+	{NULL, NULL}
+};
+
+const char *strTestNetDNSSeed[][2] = {
+	{"catstat.info", "testnet-seed.catstat.info"},
+	{"catcoinwallets.com", "seed.catcoinwallets.com"},
+	{NULL, NULL}
+};
+
+int64_t GetBlockValue(CBlockIndex *block, int64_t nFees)
+{
+	int64_t nSubsidy = 50 * COIN;
+
+	// Making some sort of 'promise' of 21 million coins is like Monsanto trying to patent
+	// any roundup-resistant plant, or insisting on only running the 'Genuine IBM PC'
+	// Sure you can try to do that, but weeds evolve resistance, China makes clones,
+	// and copycatcoins print money faster than Zimbabwe after they got rid of the farmers.
+	//
+	// Sound currency will come from a robust community that values something in common.
+	// like Cat pictures.  -- Farmer Troy
+	//
+	// FIXME: add Depurrage based on last year of Cat food prices in the blockchain
+	// FIXME2: come up with a way to GET cat food prices in the blockchain
+	// FIXME3: do this more elegantly while maintaining readability
+	//
+	// further economic analysis supporting this at:
+	// http://cryptonomics.org/2014/01/15/the-marginal-cost-of-cryptocurrency/
+	// http://www.ezonomics.com/videos/can_bitcoin_and_other_virtual_currencies_ever_replace_real_money
+
+	return nSubsidy + nFees;
+}
+
+static const int64_t nTargetTimespan = 6 * 60 * 60; // 6 hours
+static const int64_t nTargetSpacing = 10 * 60;
+static const int64_t nInterval = nTargetTimespan / nTargetSpacing;
+
+static const int64_t nTargetTimespanOld = 14 * 24 * 60 * 60; // two weeks
+static const int64_t nIntervalOld = nTargetTimespanOld / nTargetSpacing;
+
+//
+// minimum amount of work that could possibly be required nTime after
+// minimum work required was nBase
+//
+unsigned int ComputeMinWork(unsigned int nBase, int64_t nTime)
+{
+	// Testnet has min-difficulty blocks
+	// after nTargetSpacing*2 time between blocks:
+	if (fTestNet && nTime > nTargetSpacing*2)
+		return bnProofOfWorkLimit.GetCompact();
+
+	CBigNum bnResult;
+	bnResult.SetCompact(nBase);
+	while (nTime > 0 && bnResult < bnProofOfWorkLimit)
+	{
+	// should technically be 112/100 * 36 .. ~40
+		bnResult *= 40;
+		// and if we have long blocks, max 40 x, as well
+		nTime -= nTargetTimespan*40;
+	}
+	if (bnResult > bnProofOfWorkLimit)
+		bnResult = bnProofOfWorkLimit;
+	return bnResult.GetCompact();
+}
+
+static int fork3Block = 27260; // FIXME move to top...
+static int fork4Block = 27680; // Acceptblock needs this
+// static int fork1min = 31919;
+static int fork1min = 210000;	// kittycoin fork block
+
+//Checks for 'hardcoded' block timestamps
+bool AcceptBlockTimestamp(CValidationState &state, CBlockIndex* pindexPrev, const CBlockHeader *pblock)
+{
+	int64_t time_allow = -30;
+	int64_t time_warn = MINIMUM_BLOCK_SPACING;
+	int64_t delta = pblock->GetBlockTime() - pindexPrev->GetBlockTime();
+	int nHeight = pindexPrev->nHeight + 1;
+
+	if (nHeight > fork4Block){
+		time_allow = 30;
+	}
+	
+	if (delta < time_warn){
+		printf("WARNING blocktime nHeight %d time_allow %" PRId64" time_warn %" PRId64" time delta %" PRId64"\n", nHeight, time_allow, time_warn, delta);
+	}
+
+	if (nHeight >= fork3Block) {
+		if (delta <= time_allow) // see above, from first hard limit
+			return state.Invalid(error("AcceptBlock(height=%d) : block time delta %" PRId64" too short", nHeight, delta));
+	}
+	if (nHeight >= fork1min) { /* don't forward these */
+		if (delta <= MINIMUM_BLOCK_SPACING)
+			return state.DoS(10, (error("AcceptBlock(height=%d) : block time delta %" PRId64" too short", nHeight, delta)));
+	}
+	return true;	
+}
+
+unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
+{
+	int64_t nTargetTimespanLocal = 0;
+	int64_t nIntervalLocal = 0;
+	int forkBlock = 20290 - 1;
+	int fork2Block = 21346;
+
+	 // moved variable inits to the top where they belong
+	 
+	unsigned int nProofOfWorkLimit = bnProofOfWorkLimit.GetCompact();
+	int64_t nActualTimespan;
+	const CBlockIndex* pindexFirst = pindexLast;
+
+	 int64_t error;	 
+	 //int64_t diffcalc;
+	double pGainUp=-0.005125;	// Theses values can be changed to tune the PID formula
+	double iGainUp=-0.0225;	// Theses values can be changed to tune the PID formula
+	double dGainUp=-0.0075;		// Theses values can be changed to tune the PID formula
+
+	double pGainDn=-0.005125;	// Theses values can be changed to tune the PID formula
+	double iGainDn=-0.0525;	// Theses values can be changed to tune the PID formula
+	double dGainDn=-0.0075;		// Theses values can be changed to tune the PID formula
+
+	double pCalc;
+	double iCalc;
+	double dCalc;
+	double dResult;
+	int64_t result;
+	CBigNum bResult;
+	CBigNum bnNew;
+	int i;
+	//CBigNum bLowLimit; // Limit for PID calc to never go below this
+	
+	if(fTestNet){
+		forkBlock = -1;
+		fork2Block = 36;
+	}
+
+	// Genesis block
+	if (pindexLast == NULL)
+		return nProofOfWorkLimit;
+
+	// Starting from block 20,290 the network diff was set to 16
+	// and the retarget interval was changed to 36
+	if(pindexLast->nHeight < forkBlock && !fTestNet) 
+	{
+		nTargetTimespanLocal = nTargetTimespanOld;
+		nIntervalLocal = nIntervalOld;
+	} 
+	else if(pindexLast->nHeight == forkBlock && !fTestNet) 
+	{
+		bnNew.SetCompact(0x1c0ffff0); // Difficulty 16
+		return bnNew.GetCompact();
+	} 
+	else // Keep in for a resync
+	{
+		nTargetTimespanLocal = nTargetTimespan;
+		nIntervalLocal = nInterval;
+	}
+
+	// after fork2Block we retarget every block   
+	if(pindexLast->nHeight < fork2Block && !fTestNet)
+	{
+		// Only change once per interval
+		if ((pindexLast->nHeight+1) % nIntervalLocal != 0 && !fTestNet)
+		{
+			// Special difficulty rule for testnet:
+			if (fTestNet)
+			{
+				// If the new block's timestamp is more than 2* 10 minutes
+				// then allow mining of a min-difficulty block.
+				if (pblock->nTime > pindexLast->nTime + nTargetSpacing*2)
+					return nProofOfWorkLimit;
+				else
+				{
+					// Return the last non-special-min-difficulty-rules-block
+					const CBlockIndex* pindex = pindexLast;
+					while (pindex->pprev && pindex->nHeight % nIntervalLocal != 0 && pindex->nBits == nProofOfWorkLimit)
+						pindex = pindex->pprev;
+					return pindex->nBits;
+				}
+			}
+
+			return pindexLast->nBits;
+		}
+	}
+
+
+	if(pindexLast->nHeight < fork3Block && !fTestNet) // let it walk through 2nd fork stuff if below fork3Block, and ignore if on testnet
+	{
+	// Catcoin: This fixes an issue where a 51% attack can change difficulty at will.
+	// Go back the full period unless it's the first retarget after genesis. Code courtesy of Art Forz
+		int blockstogoback = nIntervalLocal-1;
+		if ((pindexLast->nHeight+1) != nIntervalLocal)
+			blockstogoback = nIntervalLocal;
+
+		// Go back by what we want to be 14 days worth of blocks
+		const CBlockIndex* pindexFirst = pindexLast;
+		for (i = 0; pindexFirst && i < blockstogoback; i++)
+			pindexFirst = pindexFirst->pprev;
+		assert(pindexFirst);
+
+		// Limit adjustment step
+		int numerator = 4;
+		int denominator = 1;
+		if(pindexLast->nHeight >= fork2Block){
+			numerator = 112;
+			denominator = 100;
+		}
+		int64_t nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime();
+		int64_t lowLimit = nTargetTimespanLocal*denominator/numerator;
+		int64_t highLimit = nTargetTimespanLocal*numerator/denominator;
+		printf("  nActualTimespan = %" PRId64"  before bounds\n", nActualTimespan);
+		if (nActualTimespan < lowLimit)
+			nActualTimespan = lowLimit;
+		if (nActualTimespan > highLimit)
+			nActualTimespan = highLimit;
+
+		// Retarget
+		bnNew.SetCompact(pindexLast->nBits);
+		bnNew *= nActualTimespan;
+		bnNew /= nTargetTimespanLocal;
+	
+		if (bnNew > bnProofOfWorkLimit)
+			bnNew = bnProofOfWorkLimit;
+
+		/// debug print
+		if(fTestNet) printf("GetNextWorkRequired RETARGET\n");
+		if(fTestNet) printf("nTargetTimespan = %" PRId64"    nActualTimespan = %" PRId64"\n", nTargetTimespanLocal, nActualTimespan);
+		if(fTestNet) printf("Before: %08x  %s\n", pindexLast->nBits, CBigNum().SetCompact(pindexLast->nBits).getuint256().ToString().c_str());
+		if(fTestNet) printf("After:	%08x  %s\n", bnNew.GetCompact(), bnNew.getuint256().ToString().c_str());
+	}
+/*
+PID formula
+Error = Actual Time - Desired time
+P Calc = pGain * Error
+I Calc = iGain * Error * (Desired Time / Actual Time) 
+D Calc = dGain * (Error / Actual Time) * I Calc
+
+New Diff = (Current Diff + P Calc + I Calc + D Calc)
+
+If New diff < 0, then set static value of 0.0001 or so.
+*/	
+
+	int nMinSpacing = 30;
+	if(pindexLast->nHeight >= fork1min || fTestNet)
+		nMinSpacing = MINIMUM_BLOCK_SPACING;
+	
+	if(pindexLast->nHeight >= fork3Block || fTestNet)
+	// Fork 3 to use a PID routine instead of the other 2 forks 
+	{
+		pindexFirst = pindexLast->pprev;	// Set previous block
+		for(i=0;i<7;i++) pindexFirst = pindexFirst->pprev; // Set 4th previous block for 8 block filtering 
+		nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime();		// Get last X blocks time
+		nActualTimespan = nActualTimespan / 8;	// Calculate average for last 8 blocks
+		if(pindexLast->nHeight > fork4Block || fTestNet){
+			if (nMinSpacing > nActualTimespan){
+				printf("WARNING: SANITY CHECK FAILED: PID nActualTimespan %" PRId64" too small! increased to %d\n",
+					nActualTimespan, nMinSpacing );
+				nActualTimespan = nMinSpacing;
+			}
+		}
+		bnNew.SetCompact(pindexLast->nBits);	// Get current difficulty
+		i=0;					// Zero bit-shift counter
+		while(bnNew>0)				// Loop while bnNew > 0
+		{
+			i++;				// Increment bit-shift counter
+			bnNew = bnNew >> 1;		// shift bnNew lower by 1 bit
+			if(i>256) bnNew = 0;		// overflow test, just to make sure that it never stays in this loop
+		}
+		bnNew.SetCompact(pindexLast->nBits);	// Get current difficulty again
+		
+
+		error = nActualTimespan - nTargetSpacing;	// Calculate the error to be fed into the PID Calculation
+		if(error >= -450 && error <= 450) // Slower gains for when the average time is within 2.5 min and 7.5 min 
+		{
+			// Calculate P ... pGainUp defined at beginning of routine
+			pCalc = pGainUp * (double)error;
+			// Calculate I ... iGainUp defined at beginning of routine
+			iCalc = iGainUp * (double)error * (double)((double)nTargetSpacing / (double)nActualTimespan);
+			// Calculate D ... dGainUp defined at beginning of routine
+			dCalc = dGainUp * ((double)error / (double)nActualTimespan) * iCalc;
+		}
+		else // Faster gains for block averages faster than 2.5 min and greater than 7.5 min 
+		{
+			// Calculate P ... pGainDn defined at beginning of routine
+			pCalc = pGainDn * (double)error;
+			// Calculate I ... iGainDn defined at beginning of routine
+			iCalc = iGainDn * (double)error * (double)((double)nTargetSpacing / (double)nActualTimespan);
+			// Calculate D ... dGainDn defined at beginning of routine
+			dCalc = dGainDn * ((double)error / (double)nActualTimespan) * iCalc;
+		}
+
+		if(error > -10 && error < 10)
+		{
+			if(fTestNet) printf("Within dead zone. No change!  error: %" PRId64"\n", error);
+			return(bnNew.GetCompact());
+		}		
+		
+		dResult = pCalc + iCalc + dCalc;	// Sum the PID calculations
+		
+		result = (int64_t)(dResult * 65536);	// Adjust for scrypt calcuation
+		// Bring the result within max range to avoid overflow condition 
+		while(result >	8388607) result = result / 2; 
+		bResult = result;			// Set the bignum value
+		if(i>24) bResult = bResult << (i - 24);	// bit-shift integer value of result to be subtracted from current diff
+
+		//if(fTestNet)
+		printf("pCalc: %f, iCalc: %f, dCalc: %f, Result: %" PRId64" (%f)\n", pCalc, iCalc, dCalc, result, dResult);
+		//if(fTestNet) // TODO: make this key on a 'debugPID' or something
+		printf("PID Actual Time: %" PRId64", error: %" PRId64"\n", nActualTimespan, error); 
+		if(fTestNet)
+			printf("Result: %08x %s\n",bResult.GetCompact(), bResult.getuint256().ToString().c_str()); 
+		if(fTestNet)
+			printf("Before: %08x %s\n",bnNew.GetCompact(), bnNew.getuint256().ToString().c_str()); 
+		bnNew = bnNew - bResult;	// Subtract the result to set the current diff
+		
+		// Make sure that diff is not set too low, ever
+		if (bnNew.GetCompact() > 0x1e0fffff) bnNew.SetCompact(0x1e0fffff);
+		if(fTestNet) 
+			printf("After:  %08x %s\n",bnNew.GetCompact(), bnNew.getuint256().ToString().c_str()); 
+		
+	} // End Fork 3 to use a PID routine instead of the other 2 forks routine
+
+	return bnNew.GetCompact();
+}
+
+
+const char *pchCatMain	= "\xfc\xc1\xb7\xdc";
+const char *pchCatTest	= "\xfd\xcb\xb8\xdd";
+
+unsigned char pchMessageStart[4];
+
+bool LoadBlockIndex()
+{
+	if (fTestNet)
+	{	/* add 1 to litecoin values (3 to bitcoins) */
+		pchMessageStart[0] = pchCatTest[0];
+		pchMessageStart[1] = pchCatTest[1];
+		pchMessageStart[2] = pchCatTest[2];
+		pchMessageStart[3] = pchCatTest[3];
+		hashGenesisBlock = uint256("0xec7987a2ab5225246c5cf9b8d93b4b75bcef383a4a65d5a265bc09ed54006188");
+	} else {
+		pchMessageStart[0] = pchCatMain[0];
+		pchMessageStart[1] = pchCatMain[1];
+		pchMessageStart[2] = pchCatMain[2];
+		pchMessageStart[3] = pchCatMain[3];
+		hashGenesisBlock = uint256("0xbc3b4ec43c4ebb2fef49e6240812549e61ffa623d9418608aa90eaad26c96296");
+	}
+
+	//
+	// Load block index from databases
+	//
+	if (!fReindex && !LoadBlockIndexDB())
+		return false;
+
+	return true;
+}
+
+
+bool InitBlockIndex() {
+	// Check whether we're already initialized
+	if (pindexGenesisBlock != NULL)
+		return true;
+
+	// Use the provided setting for -txindex in the new database
+	fTxIndex = GetBoolArg("-txindex", false);
+	pblocktree->WriteFlag("txindex", fTxIndex);
+	printf("Initializing databases...\n");
+
+	// Only add the genesis block if not reindexing (in which case we reuse the one already on disk)
+	if (!fReindex) {
+		// Genesis Block:
+		// CBlock(hash=12a765e31ffd4059bada, PoW=0000050c34a64b415b6b, ver=1, hashPrevBlock=00000000000000000000, hashMerkleRoot=97ddfbbae6, nTime=1317972665, nBits=1e0ffff0, nNonce=2084524493, vtx=1)
+		//	 CTransaction(hash=97ddfbbae6, ver=1, vin.size=1, vout.size=1, nLockTime=0)
+		//	   CTxIn(COutPoint(0000000000, -1), coinbase 04ffff001d0104404e592054696d65732030352f4f63742f32303131205374657665204a6f62732c204170706c65e280997320566973696f6e6172792c2044696573206174203536)
+		//	   CTxOut(nValue=50.00000000, scriptPubKey=040184710fa689ad5023690c80f3a4)
+		//	 vMerkleTree: 97ddfbbae6
+
+		// Genesis block
+		const char* pszTimestamp = "NY Times - December 23, 2013 - For Today's Babes, Toyland Is Digital";
+		CTransaction txNew;
+		txNew.vin.resize(1);
+		txNew.vout.resize(1);
+		txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
+		txNew.vout[0].nValue = 50 * COIN;
+		txNew.vout[0].scriptPubKey = CScript() << ParseHex("040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9") << OP_CHECKSIG;
+		CBlock block;
+		block.vtx.push_back(txNew);
+		block.hashPrevBlock = 0;
+		block.hashMerkleRoot = block.BuildMerkleTree();
+		block.nVersion = 1;
+		block.nTime    = 1387838302;
+		block.nBits    = 0x1e0ffff0;
+		block.nNonce   = 588050;
+
+		if (fTestNet)
+		{
+			block.nTime    = 1387838303; //FIXME testnet0.1
+			block.nNonce   = 608937;
+		}
+
+		//// debug print
+		uint256 hash = block.GetHash();
+		printf("%s\n", hash.ToString().c_str());
+		printf("%s\n", hashGenesisBlock.ToString().c_str());
+		printf("%s\n", block.hashMerkleRoot.ToString().c_str());
+		assert(block.hashMerkleRoot == uint256("0x4007a33db5d9cdf2aab117335eb8431c8d13fb86e0214031fdaebe69a0f29cf7"));
+
+
+		block.print();
+		assert(hash == hashGenesisBlock);
+
+		// Start new block file
+		try {
+			unsigned int nBlockSize = ::GetSerializeSize(block, SER_DISK, CLIENT_VERSION);
+			CDiskBlockPos blockPos;
+			CValidationState state;
+			if (!FindBlockPos(state, blockPos, nBlockSize+8, 0, block.nTime))
+				return error("LoadBlockIndex() : FindBlockPos failed");
+			if (!block.WriteToDisk(blockPos))
+				return error("LoadBlockIndex() : writing genesis block to disk failed");
+			if (!block.AddToBlockIndex(state, blockPos))
+				return error("LoadBlockIndex() : genesis block not accepted");
+		} catch(std::runtime_error &e) {
+			return error("LoadBlockIndex() : failed to initialize block database: %s", e.what());
+		}
+	}
+
+	return true;
+}
+
+namespace Checkpoints
+{
+	// What makes a good checkpoint block?
+	// + Is surrounded by blocks with reasonable timestamps
+	//	 (no blocks before with a timestamp after, none after with
+	//	  timestamp before)
+	// + Contains no strange transactions
+	// TODO put this in catcoin.cpp|.h
+	static MapCheckpoints mapCheckpoints =
+		boost::assign::map_list_of
+		(    4, uint256("fe508d41b7dc2c3079e827d4230e6f7ddebca43c9afc721c1e6431f78d6ff1de"))
+		(    5, uint256("7fc79021dbfa30255ade9bb8d898640516d9c771c3342a9b889ce380c52c6c1f"))
+		( 5000, uint256("ec268a9cfe87adb4d10a147a544493406c80e00a3e6868641e520b184e7ddce3"))
+		(10000, uint256("29c63023c3b8a36b59837734a9c16133a4ef08d9a0e95f639a830c56e415070d"))
+		(20000, uint256("3a0c072b76a298dabffc4f825a084c0f86dc55fe58f9bf31cc7e21bbfb2ead52"))
+		(22500, uint256("fd3c87eae2e9be72499978155844598a8675eff7a61c90f9aebcedc94e1b217f"))
+		(22544, uint256("6dd1a90cc56cf4a46c8c47528c4861c255e86d5f97fcee53ce356174e15c3045"))
+		(22554, uint256("b13e8b128989f9a9fc1a4c1e547330d0b34d3f60189c00391a116922fa4fcb8c"))
+		(22600, uint256("9e2d7f2fdab36c3e2b6f0455470cd957c12172ad7877f7c8e414fd736469c8d2"))
+		(22650, uint256("7afbd354496346819b8a214693af70e1431bfadbf68d49a688ae27539fc6b37e"))
+		(22700, uint256("35154b803fa5700b69f8081aa6d7c798c1e7fd027971252598a18549092a1291"))
+		(22750, uint256("67e6eca7d46c1a612b7638e7a503e6dbc7cca4da493f4267833a6f1c9a655a35"))
+		(22800, uint256("49e84c3b5c261966c37c101ac7691886bd641a382f514c2221735088b1b2beea"))
+		(22850, uint256("c44cec57381a97c3983df0ef1fcf150669dd1794943202d89b805f423a65516f"))
+		(22900, uint256("44de4c262de678a23554dd06a6f57270815ea9d145f6c542ab2a8dfbd2ca242c"))
+		(22950, uint256("cecc4ab30b39fc09bf85eb191e64c1660ab2206c5f80953694997ec5c2db5338"))
+		(25890, uint256("4806f91100ae83904aa0113cc3acda8fe6ac422186243719a68b76c98e7487c2"))
+		(29400,	uint256("6740c8907d9a13dfa1019142cc3b1e0abfe2fe8c832c5333df82a404d9a3e40e"))
+		(30000, uint256("ff05303dc58caf2d102c85a0504ed16939c7840c91f5f0b37a5bf128e9afb73f"))
+		(31830, uint256("9275b100cd5e540177c285c8801a63e644e7611a60a49b50831f70df6e5ea825"))
+		(32040, uint256("d5c7bdecfd330721f489ea59930204345d3fc05dd5df0d2f09c6c53c8c0352b6"))
+		(35000, uint256("8c5b56e660e47b398395fd01fd721b115fe523da400d23c82120c6fd37636423"))
+		(40000, uint256("b8a6e8aaf4f92d4b521bd022de3008884eba51ff2a5c79e0269d65a03d109283"))
+		(41000, uint256("88f114a60cb0841735df03cecc3c5662ffbdac184c7344d30cef4f98f5b61ed3"))
+		(42000, uint256("4a538c3557ab865d74327e38837b5aac63aaebdc4718c2ee7b8101bcdd241eb6"))
+		(43000, uint256("d2428f19de225b56853090fd548d1d7dd2d3d180b989c785eddb615e60f94209"))
+		(44000, uint256("587b814e0a113eaf52b94e4920362f4c076d7dc942a4f8c5c4900f2d94adbc26"))
+//		(33000, uint256("0x"))
+
+		;
+	const CCheckpointData data = {
+		&mapCheckpoints,
+		1434870875, 	// * UNIX timestamp of last checkpoint block
+		106400,		// * total number of transactions between genesis and last checkpoint
+					//	 (the tx=... number in the SetBestChain debug.log lines)
+		1000.0		// * estimated number of transactions per day after checkpoint
+	};
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/old-coins/catcoin.h	Sat Feb 13 19:32:51 2021 -0600
@@ -0,0 +1,36 @@
+// Copyright (c) 2014 Troy Benjegerdes, under AGPLv3
+// Distributed under the Affero GNU General public license version 3
+// file COPYING or http://www.gnu.org/licenses/agpl-3.0.html
+#ifndef CODECOIN_catcoin_H
+#define CODECOIN_catcoin_H
+
+static const int RPC_PORT = 9932;
+static const int RPC_PORT_TESTNET = 19932;
+static const int P2P_PORT = 9933;
+static const int P2P_PORT_TESTNET = 19933;
+
+static const int64_t COIN = 100000000;
+static const int64_t CENT = 1000000;
+
+/** Dust Soft Limit, allowed with additional fee per output */
+static const int64_t DUST_SOFT_LIMIT = 100000; // 0.001 CAT
+/** Dust Hard Limit, ignored as wallet inputs (mininput default) */
+static const int64_t DUST_HARD_LIMIT = 1000;   // 0.00001 CAT mininput
+/** No amount larger than this (in satoshi) is valid */
+static const int64_t MAX_MONEY = 21000000 * COIN;
+inline bool MoneyRange(int64_t nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
+
+/** The interval over which we look to calculate the next difficulty **/
+static const int RETARGET_INTERVAL = 36;
+/** Coinbase transaction outputs can only be spent after this number of new blocks (network rule) */
+static const int COINBASE_MATURITY = 100;
+
+/** Minimum block time spacing (hard limit) **/
+static const int64_t MINIMUM_BLOCK_SPACING = 60;	// Absolute minimum spacing
+
+#define BRAND "CatCoin"
+#define BRAND_upper "CatCoin"
+#define BRAND_lower "catcoin"
+#define LITECOIN_SCRYPT_POWHASH
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/old-coins/cleanwatercoin.cpp	Sat Feb 13 19:32:51 2021 -0600
@@ -0,0 +1,461 @@
+// Copyright (c) 2009-2010 Satoshi Nakamoto
+// Copyright (c) 2009-2012 The Bitcoin developers
+// Copyright (c) 2013-2014 The Catcoin developers
+// Copyright (c) 2014-2015 Troy Benjegerdes, under AGPLv3
+// Distributed under the Affero GNU General public license version 3
+// file COPYING or http://www.gnu.org/licenses/agpl-3.0.html
+
+#include "codecoin.h"
+#include "codecoinrpc.h"   // GetDifficulty
+#include "cleanwatercoin.h"
+#include "kernel.h"
+#include "checkpoints.h"
+#include "db.h"
+#include "txdb.h"
+#include "net.h"
+#include "init.h"
+#include "ui_interface.h"
+#include "checkqueue.h"
+#include "scrypt.h"
+#include <boost/algorithm/string/replace.hpp>
+#include <boost/filesystem.hpp>
+#include <boost/filesystem/fstream.hpp>
+
+using namespace std;
+using namespace boost;
+
+/* TODO: make this part of a decent C++ object with proper constructors */
+uint256 hashGenesisBlock = 0;		
+const string strMessageMagic = "CleanWaterCoin Signed Message:\n";
+unsigned char pchMessageStart[4];
+
+const CBigNum bnProofOfWorkLimit(~uint256(0) >> 20);
+const CBigNum bnProofOfStakeLimit(~uint256(0) >> 20);
+
+unsigned int nStakeMinAge = 60 * 60 * 24 * 1;	// After height 120,000 minimum age for coin age: 1d
+unsigned int nStakeMinAgeOld = 60 * 60 * 24 * 20;	// Before height 120,000 minimum age for coin age: 20d
+unsigned int nStakeMaxAge = 60 * 60 * 24 * 90;	// stake age of full weight: 90d
+unsigned int nStakeTargetSpacing = 120;			// 120 sec block spacing
+const unsigned int nMaxClockDrift = 90 * 60; 		// 90 minutes
+
+// fixme make unsigned?
+int nCoinbaseMaturity = 30;
+const int nCutoff_Pos_Block = 14628; /* first PoS block */
+
+/** TODO: this goes into src/policy/fees.cpp when latest bitcoin code is merged */
+/** Fees smaller than this (in satoshi) are considered zero fee (for transaction creation) */
+int64_t CTransaction::nMinTxFee = CENT;
+/** Fees smaller than this (in satoshi) are considered zero fee (for relaying) */
+int64_t CTransaction::nMinRelayTxFee = CENT;
+
+// DNS seeds
+// Each pair gives a source name and a seed name.
+// The first name is used as information source for addrman.
+// The second name should resolve to a list of seed addresses.
+// FIXME use a single string and/or objectify this
+/*
+  CleanWaterCoin policy for getting on this list:
+  TODO: come up with a policy
+ */
+const char *strMainNetDNSSeed[][2] = 
+{
+   {"intercom", "xtc.inter.com"},
+   {NULL, NULL}
+};
+
+const char *strTestNetDNSSeed[][2] = {
+	//{"CleanWaterCointools.com", "testnet-seed.CleanWaterCointools.com"},
+	{NULL, NULL}
+};
+
+// miner's coin base reward based on nBits
+int64_t CleanWaterCoinWorkReward(int nHeight, int64_t nFees)
+{
+    int64_t nSubsidy = 150 * COIN;
+    double coinDifficulty = (double)GetDifficulty();
+
+    int64_t rewardCalc = 1/(sqrt(coinDifficulty + 500));
+    double buttCalc =  1/(sqrt(coinDifficulty + 500));
+
+ if (nHeight == 1)
+    {
+        nSubsidy = 10000000 * COIN;       // first block is premine
+    }
+    else if (nHeight >1 && nHeight <= 55)  // 55 blocks for confirmation of premine
+        {
+            nSubsidy = 1 * COIN;
+        }
+    else if (nHeight >55 && nHeight <= 7000)
+        {
+            nSubsidy = 1000 * COIN;
+        }
+    else if (nHeight >7000 && nHeight < 8000)
+        {
+            nSubsidy = (int64_t)((double)(20000 * sqrt(coinDifficulty + 500)) * COIN);
+        }
+
+ // fork here for proper block reward - 8000 per cleanwatercoin guys
+
+    else if (nHeight >= 8000 && nHeight < 8500)
+     {
+             nSubsidy = (int64_t)((double)(20000 * rewardCalc) * COIN);
+     }
+
+    else if (nHeight >= 8500 && nHeight <= 250000)
+ {
+         nSubsidy = (int64_t)((double)(20000 * buttCalc) * COIN);
+ }
+
+
+    else if (nHeight > 250000 && nHeight <= 500000)
+        {
+            nSubsidy = (int64_t)((double)(15000 * buttCalc) * COIN);
+        }
+    else if (nHeight >500000)
+        {
+            nSubsidy = (int64_t)((double)(10000 * buttCalc) * COIN);
+        }
+//    else if (nHeight > CUTOFF_HEIGHT)
+//        {
+//            nSubsidy = 0;
+//        }
+
+
+    return nSubsidy + nFees;
+}
+
+const int YEARLY_BLOCKCOUNT = 262800;	// 365 * 720
+int64_t CleanWaterCoinStakeReward(int64_t nCoinAge, int nHeight)
+{
+    int64_t nRewardCoinYear;
+
+    nRewardCoinYear = MAX_MINT_PROOF_OF_STAKE;
+
+    if(nHeight >= 7000 && nHeight < 500000)
+        nRewardCoinYear = 0.08 * COIN;
+    else if(nHeight >= 500000 && nHeight < 1000000)
+        nRewardCoinYear = 0.07 * COIN;
+    else if(nHeight >= 1000000 && nHeight < 2000000)
+        nRewardCoinYear = 0.06 * COIN;
+    else if(nHeight >= 2000000)
+        nRewardCoinYear = 0.02 * COIN;
+
+    int64_t nSubsidy = nCoinAge * nRewardCoinYear / 365;
+
+	if (fDebug && GetBoolArg("-printcreation"))
+        printf("GetProofOfStakeReward(): create=%s nCoinAge=%" PRId64 "\n", FormatMoney(nSubsidy).c_str(), nCoinAge);
+    return nSubsidy;
+}
+
+static const int64_t nTargetTimespan = 1 * 24 * 60 * 30;
+static const int64_t nTargetSpacingWorkMax = 3 * nStakeTargetSpacing; 
+
+/*
+ * Get the allow Seigniorage (money creation, or reward) of the current
+ * block. If CoinAge is > 0, this is a proof of stake block.
+ */
+int64_t CBlockIndex::GetSeigniorage(int64_t nFees, int64_t CoinAge) const
+{
+	if(IsProofOfWork()){
+		return CleanWaterCoinWorkReward(nHeight, nFees);
+	} else {
+		return CleanWaterCoinStakeReward(CoinAge, nHeight);
+	}
+}
+
+//
+// maximum nBits value could possible be required nTime after
+// minimum proof-of-work required was nBase
+//
+unsigned int ComputeMaxBits(CBigNum bnTargetLimit, unsigned int nBase, int64_t nTime)
+{
+    CBigNum bnResult;
+    bnResult.SetCompact(nBase);
+    bnResult *= 2;
+    while (nTime > 0 && bnResult < bnTargetLimit)
+    {
+        // Maximum 200% adjustment per day...
+        bnResult *= 2;
+        nTime -= 24 * 60 * 60;
+    }
+    if (bnResult > bnTargetLimit)
+        bnResult = bnTargetLimit;
+    return bnResult.GetCompact();
+}
+
+//
+// minimum amount of work that could possibly be required nTime after
+// minimum proof-of-work required was nBase
+//
+unsigned int ComputeMinWork(unsigned int nBase, int64_t nTime, const CBlockHeader* pblock)
+{
+    return ComputeMaxBits(bnProofOfWorkLimit, nBase, nTime);
+}
+
+//
+// minimum amount of stake that could possibly be required nTime after
+// minimum proof-of-stake required was nBase
+//
+unsigned int ComputeMinStake(unsigned int nBase, int64_t nTime, unsigned int nBlockTime)
+{
+    return ComputeMaxBits(bnProofOfStakeLimit, nBase, nTime);
+}
+
+bool AcceptBlockTimestamp(CValidationState &state, CBlockIndex* pindexPrev, const CBlockHeader *pblock)
+{
+	return true;	
+}
+
+unsigned int GetNextTargetRequired(const CBlockIndex* pindexLast, bool fProofOfStake) 
+{
+    CBigNum bnTargetLimit = bnProofOfWorkLimit;
+
+    if(fProofOfStake)
+    {
+        // Proof-of-Stake blocks has own target limit since nVersion=3 supermajority on mainNet and always on testNet
+        bnTargetLimit = bnProofOfStakeLimit;
+    }
+bnTargetLimit = bnProofOfStakeLimit;
+    if (pindexLast == NULL)
+        return bnTargetLimit.GetCompact(); // genesis block
+
+    const CBlockIndex* pindexPrev = GetLastBlockIndex(pindexLast, fProofOfStake);
+    if (pindexPrev->pprev == NULL)
+        return bnTargetLimit.GetCompact(); // first block
+    const CBlockIndex* pindexPrevPrev = GetLastBlockIndex(pindexPrev->pprev, fProofOfStake);
+    if (pindexPrevPrev->pprev == NULL)
+        return bnTargetLimit.GetCompact(); // second block
+
+    int64_t nActualSpacing = pindexPrev->GetBlockTime() - pindexPrevPrev->GetBlockTime();
+	if(nActualSpacing < 0)
+	{
+		// printf(">> nActualSpacing = %"PRI64d" corrected to 1.\n", nActualSpacing);
+		nActualSpacing = 1;
+	}
+	else if(nActualSpacing > nTargetTimespan)
+	{
+		// printf(">> nActualSpacing = %"PRI64d" corrected to nTargetTimespan (900).\n", nActualSpacing);
+		nActualSpacing = nTargetTimespan;
+	}
+
+    // ppcoin: target change every block
+    // ppcoin: retarget with exponential moving toward target spacing
+    CBigNum bnNew;
+    bnNew.SetCompact(pindexPrev->nBits);
+
+    int64_t nTargetSpacing = fProofOfStake? nStakeTargetSpacing : min(nTargetSpacingWorkMax, (int64_t) nStakeTargetSpacing * (1 + pindexLast->nHeight - pindexPrev->nHeight));
+    int64_t nInterval = nTargetTimespan / nTargetSpacing;
+    bnNew *= ((nInterval - 1) * nTargetSpacing + nActualSpacing + nActualSpacing);
+    bnNew /= ((nInterval + 1) * nTargetSpacing);
+	
+	/*
+	printf(">> Height = %d, fProofOfStake = %d, nInterval = %"PRI64d", nTargetSpacing = %"PRI64d", nActualSpacing = %"PRI64d"\n", 
+		pindexPrev->nHeight, fProofOfStake, nInterval, nTargetSpacing, nActualSpacing);  
+	printf(">> pindexPrev->GetBlockTime() = %"PRI64d", pindexPrev->nHeight = %d, pindexPrevPrev->GetBlockTime() = %"PRI64d", pindexPrevPrev->nHeight = %d\n", 
+		pindexPrev->GetBlockTime(), pindexPrev->nHeight, pindexPrevPrev->GetBlockTime(), pindexPrevPrev->nHeight);  
+	*/
+
+    if (bnNew > bnTargetLimit)
+        bnNew = bnTargetLimit;
+
+    return bnNew.GetCompact();
+}
+
+unsigned int GetNextTrustRequired(const CBlockIndex* pindexLast, const CBlock *pblock)
+{
+	return GetNextTargetRequired(pindexLast, pblock->IsProofOfStake());	
+}
+
+
+bool LoadBlockIndex()
+{
+    if (fTestNet)
+    {
+        pchMessageStart[0] = 0xcd;
+        pchMessageStart[1] = 0xf2;
+        pchMessageStart[2] = 0xc0;
+        pchMessageStart[3] = 0xef;
+
+        nStakeMinAge = 20 * 60; // test net min age is 20 min
+        nStakeMaxAge = 60 * 60; // test net min age is 60 min
+        nModifierInterval = 60; // test modifier interval is 2 minutes
+        nCoinbaseMaturity = 10; // test maturity is 10 blocks
+        nStakeTargetSpacing = 3 * 60; // test block spacing is 3 minutes
+        hashGenesisBlock = uint256("0x0000029c5af0435f4cc6068205cba81e7d6f57722f29e8d49763ee229a702a84");
+    } else {
+        pchMessageStart[0] = 0xce;
+        pchMessageStart[1] = 0xd5;
+        pchMessageStart[2] = 0xdb;
+        pchMessageStart[3] = 0xfa;
+	hashGenesisBlock = uint256("0x0000029c5af0435f4cc6068205cba81e7d6f57722f29e8d49763ee229a702a84");
+    }
+
+
+	//
+	// Load block index from databases
+	//
+	if (!fReindex && !LoadBlockIndexDB())
+		return false;
+
+	return true;
+}
+
+bool InitBlockIndex() {
+	// Check whether we're already initialized
+	if (pindexGenesisBlock != NULL)
+		return true;
+
+	// Use the provided setting for -txindex in the new database
+	fTxIndex = GetBoolArg("-txindex", false);
+	pblocktree->WriteFlag("txindex", fTxIndex);
+	printf("Initializing databases...\n");
+
+	// Only add the genesis block if not reindexing (in which case we reuse the one already on disk)
+	if (!fReindex) {
+
+
+
+		 // Genesis block
+		const char* pszTimestamp = "March 28 2014 Oculus didnt expect such a negative reaction to Facebook deal";
+		CTransaction txNew;
+		txNew.nTime = 1396162732;
+		txNew.vin.resize(1);
+		txNew.vout.resize(1);
+		txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(9999) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
+		txNew.vout[0].SetEmpty();
+
+		CBlock block;
+		block.vtx.push_back(txNew);
+		block.hashPrevBlock = 0;
+		block.hashMerkleRoot = block.BuildMerkleTree();
+		block.nVersion = 1;
+		block.nTime    = 1396162732;
+		block.nBits    = bnProofOfWorkLimit.GetCompact();
+		block.nNonce   = 1566135 ;
+
+		if (fTestNet)
+		{
+			block.nTime    = 1449967517;
+			block.nNonce   = 0; // hack, same
+		}
+
+
+		uint256 hash = block.GetHash();
+		if (hash != hashGenesisBlock)
+		{
+			printf("Searching for genesis block...\n");
+			// This will figure out a valid hash and Nonce if you're
+			// creating a different genesis block:
+			uint256 hashTarget = CBigNum().SetCompact(block.nBits).getuint256();
+            uint256 thash;
+            char scratchpad[SCRYPT_SCRATCHPAD_SIZE];
+
+            while (true)
+            {
+#if defined(USE_SSE2)
+                // Detection would work, but in cases where we KNOW it always has SSE2,
+                // it is faster to use directly than to use a function pointer or conditional.
+#if defined(_M_X64) || defined(__x86_64__) || defined(_M_AMD64) || (defined(MAC_OSX) && defined(__i386__))
+                // Always SSE2: x86_64 or Intel MacOS X
+                scrypt_1024_1_1_256_sp_sse2(BEGIN(block.nVersion), BEGIN(thash), scratchpad);
+#else
+                // Detect SSE2: 32bit x86 Linux or Windows
+                scrypt_1024_1_1_256_sp(BEGIN(block.nVersion), BEGIN(thash), scratchpad);
+#endif
+#else
+                // Generic scrypt
+                scrypt_1024_1_1_256_sp_generic(BEGIN(block.nVersion), BEGIN(thash), scratchpad);
+#endif
+                if (thash <= hashTarget)
+					break;
+				if ((block.nNonce & 0xFFF) == 0)
+				{
+                    printf("nonce %08X: hash = %s (target = %s)\n", block.nNonce, thash.ToString().c_str(), hashTarget.ToString().c_str());
+				}
+				++block.nNonce;
+				if (block.nNonce == 0)
+				{
+					printf("NONCE WRAPPED, incrementing time\n");
+					++block.nTime;
+				}
+			}
+			printf("block.nTime = %u \n", block.nTime);
+			printf("block.nNonce = %u \n", block.nNonce);
+			printf("block.GetHash = %s\n", block.GetHash().ToString().c_str());
+		}
+
+		printf("%s\n", hash.ToString().c_str());
+		printf("%s\n", hashGenesisBlock.ToString().c_str());
+		printf("%s\n", block.hashMerkleRoot.ToString().c_str());
+		block.print();
+		assert(block.hashMerkleRoot == uint256("0x22aa4379d53ac896396484f52a39a9f7a4395dd7f5d2384b7d04e3cb7744698d"));
+		//block.print();
+		assert(block.GetHash() == hashGenesisBlock);
+
+		// Start new block file
+		try {
+			unsigned int nBlockSize = ::GetSerializeSize(block, SER_DISK, CLIENT_VERSION);
+			CDiskBlockPos blockPos;
+			CValidationState state;
+			if (!FindBlockPos(state, blockPos, nBlockSize+8, 0, block.nTime))
+				return error("LoadBlockIndex() : FindBlockPos failed");
+			if (!block.WriteToDisk(blockPos))
+				return error("LoadBlockIndex() : writing genesis block to disk failed");
+			if (!block.AddToBlockIndex(state, blockPos))
+				return error("LoadBlockIndex() : genesis block not accepted");
+		} catch(std::runtime_error &e) {
+			return error("LoadBlockIndex() : failed to initialize block database: %s", e.what());
+		}
+	}
+
+	return true;
+}
+
+namespace Checkpoints
+{
+	// What makes a good checkpoint block?
+	// + Is surrounded by blocks with reasonable timestamps
+	//	 (no blocks before with a timestamp after, none after with
+	//	  timestamp before)
+	// + Contains no strange transactions
+	static MapCheckpoints mapCheckpoints =
+		boost::assign::map_list_of
+		(	0, uint256("00000279dba2a8c40c2cd690f160f127a2a7edb8194f0d4e7605f212adf294bc"))
+		(  100000, uint256("00000000a55f6c849f19f82b9bfd7463e4fb744c1aacfe3d5f498d0894168042"))
+		(  109739, uint256("000000003370cbb513af63612d624e0c655b495d7a64f201d2352f34e0315e51"))
+		(  200000, uint256("13b7a2de7f298b43ff400a7d62134a874e63287f4dc348f6bb39c42798577a2b"))
+		(  300000, uint256("ae66c9d17f3f35a8fd9a1d6efc9af172bdc425f0bc26db0b18797beeeaaa3307"))
+		(  400000, uint256("645818f9f433621b1c3780f4dafd15500679339b121367788a7ff82c68bc99e6"))
+		;
+	const CCheckpointData data = {
+		&mapCheckpoints,
+		1424439826, // * UNIX timestamp of last checkpoint block
+		219689,	// * total number of transactions between genesis and last checkpoint
+					//	 (the tx=... number in the SetBestChain debug.log lines)
+		1000.0	   // * estimated number of transactions per day after checkpoint
+	};
+
+	static MapCheckpoints mapCheckpointsTestnet = 
+		boost::assign::map_list_of
+		(	546, uint256("000000002a936ca763904c3c35fce2f3556c559c0214345d31b1bcebf76acb70"))
+//		( 35000, uint256("2af959ab4f12111ce947479bfcef16702485f04afd95210aa90fde7d1e4a64ad"))
+		;
+	const CCheckpointData dataTestnet = {
+		&mapCheckpointsTestnet,
+		1369685559,
+		37581,
+		300
+	}; /* estimated number of transactions per day after checkpoint */
+
+
+	/* TODO enable this someday */
+
+	// Hard checkpoints of stake modifiers to ensure they are deterministic
+	static std::map<int, unsigned int> mapStakeModifierCheckpoints =
+		boost::assign::map_list_of
+		//( 0, 0x0e00670bu )
+		(5516, 0xdeadbeefu)
+		(16665, 0xdeadbeefu)
+		;
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/old-coins/cleanwatercoin.h	Sat Feb 13 19:32:51 2021 -0600
@@ -0,0 +1,79 @@
+// Copyright (c) 2014 Troy Benjegerdes, under AGPLv3
+// Distributed under the Affero GNU General public license version 3
+// file COPYING or http://www.gnu.org/licenses/agpl-3.0.html
+#ifndef CODECOIN_cleanwatercoin_H
+#define CODECOIN_cleanwatercoin_H
+
+static const int RPC_PORT = 53590;
+static const int RPC_PORT_TESTNET =43590;
+static const int P2P_PORT = 53591;
+static const int P2P_PORT_TESTNET = 43591;
+
+static const int64_t COIN = 1000000;
+static const int64_t CENT = 10000;
+static const int COIN_DECIMALS = 6; /* decimal places for coin */
+#define COIN_DECIMALS_FMT "06"
+
+/** The maximum allowed size for a serialized block, in bytes (network rule) */
+static const unsigned int MAX_BLOCK_SIZE = 1500000;
+static const unsigned int MAX_BLOCK_SIZE_GEN = MAX_BLOCK_SIZE/2;
+
+/** Dust Soft Limit, allowed with additional fee per output */
+static const int64_t DUST_SOFT_LIMIT = 10000; // 0.01 WATER
+/** Dust Hard Limit, ignored as wallet inputs (mininput default) */
+static const int64_t DUST_HARD_LIMIT = 100;   // 0.0001 GIVE mininput
+/** Minimum criteria for AllowFree */
+static const int64_t MIN_FREE_PRIORITY = COIN * 576/250;
+/** No amount larger than this (in catoshi) is valid */
+static const int64_t MAX_MONEY = 1000000000 * COIN;
+inline bool MoneyRange(int64_t nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
+
+/** Minimum block time spacing (AcceptBlockTimestamp determines if this is a hard limit or not **/
+static const int64_t MINIMUM_BLOCK_SPACING = 30;
+
+static const int64_t MAX_MINT_PROOF_OF_STAKE = 0.08 * COIN;	// 8% annual interest  default for testing
+
+#define CHARITY_ADDRESS_TESTNET "nVagPzHPNywPCGCXUmsEnfjnCSSYkCz6eB" // Cleanwatercoin Charity Address in TestNet
+#define CHARITY_ADDRESS "5anJYFYW7npP4MyNaAtzTLb5ek2Lxgyb7d" // Cleanwatercoin Charity Address
+static const int64_t CHARITY_DEFAULT_AMOUNT = 100 * COIN;  // Default amount of Charity sent
+
+/** really only used in rpcmining.cpp **/
+static const int RETARGET_INTERVAL = 15;
+
+#define STAKE_TARGET_SPACING nStakeTargetSpacing
+#define COINBASE_MATURITY nCoinbaseMaturity
+
+// MODIFIER_INTERVAL: time to elapse before new modifier is computed
+static const unsigned int MODIFIER_INTERVAL = 6 * 60 * 60; 
+extern unsigned int nModifierInterval;
+
+// MODIFIER_INTERVAL_RATIO:
+// ratio of group interval length between the last group and the first group
+static const int MODIFIER_INTERVAL_RATIO = 3;
+
+extern unsigned int nStakeMinAge;
+extern unsigned int nStakeMaxAge;
+extern unsigned int nStakeTargetSpacing;
+extern const unsigned int nMaxClockDrift;
+extern int nCoinbaseMaturity; // FIXME make unsigned int
+//extern const unsigned int nMinTxOutAmount; // set to = CTransaction::nMinTxFee;
+
+#define CUTOFF_POS_BLOCK nCutoff_Pos_Block
+extern const int CUTOFF_POS_BLOCK;
+
+#define FEATURE_MONEYSUPPLY
+#define FEATURE_CFG_MAXFUTURE
+
+#define BRAND "cleanwatercoin"
+#define BRAND_upper "CleanWaterCoin"
+#define BRAND_lower "cleanwatercoin"
+#define BRAND_domain "givecoin.org"
+#define BRAND_CODE "WATER"
+
+#define PPCOINSTAKE
+#define PPCOINSTAKE_DEBUG
+
+/* cleanwatercoin uses scrypt directly, not just for the POWhash */
+#define LITECOIN_SCRYPT_POWHASH
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/old-coins/givecoin.cpp	Sat Feb 13 19:32:51 2021 -0600
@@ -0,0 +1,506 @@
+// Copyright (c) 2009-2010 Satoshi Nakamoto
+// Copyright (c) 2009-2012 The Bitcoin developers
+// Copyright (c) 2013-2014 The Catcoin developers
+// Copyright (c) 2014-2015 Troy Benjegerdes, under AGPLv3
+// Distributed under the Affero GNU General public license version 3
+// file COPYING or http://www.gnu.org/licenses/agpl-3.0.html
+
+#include "codecoin.h"
+#include "givecoin.h"
+#include "checkpoints.h"
+#include "db.h"
+#include "txdb.h"
+#include "net.h"
+#include "init.h"
+#include "ui_interface.h"
+#include "checkqueue.h"
+#include <boost/algorithm/string/replace.hpp>
+#include <boost/filesystem.hpp>
+#include <boost/filesystem/fstream.hpp>
+
+using namespace std;
+using namespace boost;
+
+/* TODO: make this part of a decent C++ object with proper constructors */
+uint256 hashGenesisBlock = 0;		
+const string strMessageMagic = "Givecoin Signed Message:\n";
+unsigned char pchMessageStart[4];
+
+/* stake stuff TODO: */
+const CBigNum bnProofOfWorkLimit(~uint256(0) >> 20);
+const CBigNum bnProofOfStakeLimit(~uint256(0) >> 20);
+
+//CBigNum bnProofOfWorkLimitTestNet(~uint256(0) >> 20);
+//CBigNum bnProofOfStakeLimitTestNet(~uint256(0) >> 20);
+
+/* TODO: move to givecoin.h once finalized */
+const unsigned int nStakeMinAge = 60 * 60 * 24 * 2;	// minimum age for coin age: 2d
+const unsigned int nStakeMaxAge = 60 * 60 * 24 * 30;	// stake age of full weight: -1
+const unsigned int nStakeTargetSpacing = 90;		// 60 sec block spacing
+const unsigned int nStakeTargetSpacing2 = 60;		// 90 sec block spacing
+const unsigned int nMaxClockDrift = 45 * 60; 		// 45 minutes
+#warning for test only
+//const int nCutoff_Pos_Block = 250000;
+const int nCutoff_Pos_Block = 10;
+
+/* end stake stuff */
+int nCoinbaseMaturity = COINBASE_MATURITY;
+
+/** TODO: this goes into src/policy/fees.cpp when latest bitcoin code is merged */
+/** Fees smaller than this (in satoshi) are considered zero fee (for transaction creation) */
+int64_t CTransaction::nMinTxFee = CENT;
+/** Fees smaller than this (in satoshi) are considered zero fee (for relaying) */
+int64_t CTransaction::nMinRelayTxFee = CENT;
+
+// DNS seeds
+// Each pair gives a source name and a seed name.
+// The first name is used as information source for addrman.
+// The second name should resolve to a list of seed addresses.
+// FIXME use a single string and/or objectify this
+/*
+  Givecoin policy for getting on this list:
+  TODO: come up with a policy
+ */
+const char *strMainNetDNSSeed[][2] = 
+{
+   {"xtc.inter.com", "xtc.inter.com"},
+   {NULL, NULL}
+};
+
+const char *strTestNetDNSSeed[][2] = {
+	//{"Givecointools.com", "testnet-seed.Givecointools.com"},
+	//{"weminemnc.com", "testnet-seed.weminemnc.com"},
+	{NULL, NULL}
+};
+
+// ppcoin: miner's coin stake is rewarded based on coin age spent (coin-days)
+int64_t static PPcoinStakeReward(int64_t nCoinAge)
+{
+    static int64_t nRewardCoinYear = CENT;  // creation amount per coin-year
+    int64_t nSubsidy = nCoinAge * 33 / (365 * 33 + 8) * nRewardCoinYear;
+    if (fDebug && GetBoolArg("-printcreation"))
+        printf("GetProofOfStakeReward(): create=%s nCoinAge=%" PRId64"\n", FormatMoney(nSubsidy).c_str(), nCoinAge);
+    return nSubsidy;
+}
+
+// Givecoin original block reward
+int64_t static GivecoinBlockValue_v1(int nHeight, int64_t nFees)
+{
+    int64_t nSubsidy = 0;
+    if (nHeight <= 5) {    // For Each 5 blocks will have 0.5M coins
+       nSubsidy = 5000000 * COIN;
+    }
+    else {
+       nSubsidy = 1000 * COIN;
+    }
+    // Subsidy is cut in half every 250,000 blocks, which will occur approximately every .5 year
+    nSubsidy >>= (nHeight / 250000); // Givecoin: 250k blocks in ~.5 years
+    //
+    if (nSubsidy < COIN) nSubsidy = COIN;  // Minimum Number of Coin = 1
+    return nSubsidy + nFees;
+}
+
+/*
+ * Get the allow Seigniorage (money creation, or reward) of the current
+ * block. If CoinAge is > 0, this is a proof of stake block.
+ */
+int64_t CBlockIndex::GetSeigniorage(int64_t nFees, int64_t CoinAge) const
+{
+	if(IsProofOfWork()){
+		return GivecoinBlockValue_v1(nHeight, nFees);
+	} else {
+		return PPcoinStakeReward(CoinAge);
+	}
+}
+
+static const int64_t nTargetTimespan = 10 * 60;		// Givecoin: Difficulty adjusted every 10 mintues
+static const int64_t nTargetSpacing =	1 * 60;		// Givecoin: Every Minute
+static const int64_t nInterval = nTargetTimespan / nTargetSpacing;	// 10 block readjustment
+
+//
+// minimum amount of work that could possibly be required nTime after
+// minimum work required was nBase
+//
+unsigned int ComputeMinWork(unsigned int nBase, int64_t nTime, const CBlockHeader* pblock)
+{
+	// Testnet has min-difficulty blocks
+	// after nTargetSpacing*2 time between blocks:
+	if (fTestNet && nTime > nTargetSpacing*2)
+		return bnProofOfWorkLimit.GetCompact();
+
+	CBigNum bnResult;
+	bnResult.SetCompact(nBase);
+	while (nTime > 0 && bnResult < bnProofOfWorkLimit)
+	{
+		// Maximum 400% adjustment...
+		bnResult *= 4;
+		// ... in best-case exactly 4-times-normal target time
+		nTime -= nTargetTimespan*4;
+	}
+	if (bnResult > bnProofOfWorkLimit)
+		bnResult = bnProofOfWorkLimit;
+	return bnResult.GetCompact();
+}
+
+static int minimum_time_fork = 225225;  	// minimum time fork
+static int minimum_time_fork_2 = 250000;        // minimum time fork to drop peers immediately
+
+//Checks for 'hardcoded' block timestamps
+bool AcceptBlockTimestamp(CValidationState &state, CBlockIndex* pindexPrev, const CBlockHeader *pblock)
+{
+	int64_t time_allow = -30;
+	int64_t time_warn = MINIMUM_BLOCK_SPACING;
+	int64_t delta = pblock->GetBlockTime() - pindexPrev->GetBlockTime();
+	int nHeight = pindexPrev->nHeight + 1;
+
+	if (nHeight > minimum_time_fork_2){
+		time_allow = 30;
+	}
+	
+	if (delta < time_warn){
+		printf("WARNING blocktime nHeight %d time_allow %" PRId64" time_warn %" PRId64" time delta %" PRId64"\n", nHeight, time_allow, time_warn, delta);
+	}
+
+	if (nHeight >= minimum_time_fork_2) {
+		if (delta <= time_allow) // see above, from first hard limit
+			return state.Invalid(error("AcceptBlock(height=%d) : block time delta %" PRId64" too short", nHeight, delta));
+	}
+	if (nHeight >= minimum_time_fork) { /* don't forward these */
+		if (delta <= MINIMUM_BLOCK_SPACING)
+			return state.DoS(10, (error("AcceptBlock(height=%d) : block time delta %" PRId64" too short", nHeight, delta)));
+	}
+	return true;	
+}
+
+unsigned int static GetNextWorkRequired_V1(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
+{
+   unsigned int nProofOfWorkLimit = bnProofOfWorkLimit.GetCompact();
+
+	// Genesis block
+	if (pindexLast == NULL)
+		return nProofOfWorkLimit;
+
+	// Only change once per interval
+	if ((pindexLast->nHeight+1) % nInterval != 0)
+	{
+		// Special difficulty rule for testnet:
+		if (fTestNet)
+		{
+			// If the new block's timestamp is more than 2* 10 minutes
+			// then allow mining of a min-difficulty block.
+			if (pblock->nTime > pindexLast->nTime + nTargetSpacing*2)
+				return nProofOfWorkLimit;
+			else
+			{
+				// Return the last non-special-min-difficulty-rules-block
+				const CBlockIndex* pindex = pindexLast;
+				while (pindex->pprev && pindex->nHeight % nInterval != 0 && pindex->nBits == nProofOfWorkLimit)
+					pindex = pindex->pprev;
+				return pindex->nBits;
+			}
+		}
+
+		return pindexLast->nBits;
+	}
+
+	// DarkCoin: This fixes an issue where a 51% attack can change difficulty at will.
+	// Go back the full period unless it's the first retarget after genesis. Code courtesy of Art Forz
+	int blockstogoback = nInterval-1;
+	if ((pindexLast->nHeight+1) != nInterval)
+		blockstogoback = nInterval;
+
+	// Go back by what we want to be 14 days worth of blocks
+	const CBlockIndex* pindexFirst = pindexLast;
+	for (int i = 0; pindexFirst && i < blockstogoback; i++)
+		pindexFirst = pindexFirst->pprev;
+	assert(pindexFirst);
+
+	// Limit adjustment step
+	int64_t nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime();
+	printf("  nActualTimespan = %" PRId64"	before bounds\n", nActualTimespan);
+	if (nActualTimespan < nTargetTimespan/4)
+		nActualTimespan = nTargetTimespan/4;
+	if (nActualTimespan > nTargetTimespan*4)
+		nActualTimespan = nTargetTimespan*4;
+
+	// Retarget
+	CBigNum bnNew;
+	bnNew.SetCompact(pindexLast->nBits);
+	bnNew *= nActualTimespan;
+	bnNew /= nTargetTimespan;
+
+	if (bnNew > bnProofOfWorkLimit)
+		bnNew = bnProofOfWorkLimit;
+
+	return bnNew.GetCompact();
+}
+
+
+unsigned int static KimotoGravityWell(const CBlockIndex* pindexLast, const CBlockHeader *pblock, uint64_t TargetBlocksSpacingSeconds, uint64_t PastBlocksMin, uint64_t PastBlocksMax) {
+
+		const CBlockIndex *BlockLastSolved = pindexLast;
+		const CBlockIndex *BlockReading = pindexLast;
+		const CBlockHeader *BlockCreating = pblock;
+		BlockCreating = BlockCreating;
+		uint64_t PastBlocksMass = 0;
+		int64_t PastRateActualSeconds = 0;
+		int64_t PastRateTargetSeconds = 0;
+		double PastRateAdjustmentRatio = double(1);
+		CBigNum PastDifficultyAverage;
+		CBigNum PastDifficultyAveragePrev;
+		double EventHorizonDeviation;
+		double EventHorizonDeviationFast;
+		double EventHorizonDeviationSlow;
+
+		if (BlockLastSolved == NULL || BlockLastSolved->nHeight == 0 || (uint64_t)BlockLastSolved->nHeight < PastBlocksMin) {
+		   return bnProofOfWorkLimit.GetCompact();
+		}
+
+		int64_t LatestBlockTime = BlockLastSolved->GetBlockTime();
+
+		for (unsigned int i = 1; BlockReading && BlockReading->nHeight > 0; i++) {
+
+			if ((PastBlocksMax > 0) && (i > PastBlocksMax)) {
+			   break;
+			}
+			PastBlocksMass++;
+
+			if (i == 1) {
+			   PastDifficultyAverage.SetCompact(BlockReading->nBits);
+			}
+			else {
+			   PastDifficultyAverage = ((CBigNum().SetCompact(BlockReading->nBits) - PastDifficultyAveragePrev) / i) + PastDifficultyAveragePrev;
+			}
+			PastDifficultyAveragePrev = PastDifficultyAverage;
+
+			if (LatestBlockTime < BlockReading->GetBlockTime()) {
+			   LatestBlockTime = BlockReading->GetBlockTime();
+			}
+
+			PastRateActualSeconds = BlockLastSolved->GetBlockTime() - BlockReading->GetBlockTime();
+			PastRateTargetSeconds = TargetBlocksSpacingSeconds * PastBlocksMass;
+			PastRateAdjustmentRatio = double(1);
+
+			if (PastRateActualSeconds < 1) {
+			   PastRateActualSeconds  = 1;
+			}
+			if ((PastRateActualSeconds != 0) && (PastRateTargetSeconds != 0)) {
+			   PastRateAdjustmentRatio = double(PastRateTargetSeconds) / double(PastRateActualSeconds);
+			}
+			EventHorizonDeviation = 1 + (0.7084 * pow((double(PastBlocksMass)/double(28.2)), -1.228));
+			EventHorizonDeviationFast = EventHorizonDeviation;
+			EventHorizonDeviationSlow = 1 / EventHorizonDeviation;
+
+			if (PastBlocksMass >= PastBlocksMin) {
+			   if ((PastRateAdjustmentRatio <= EventHorizonDeviationSlow) || (PastRateAdjustmentRatio >= EventHorizonDeviationFast)) { assert(BlockReading); break; }
+			}
+			if (BlockReading->pprev == NULL) {
+			   assert(BlockReading);
+			   break;
+			}
+			BlockReading = BlockReading->pprev;
+
+		}
+
+		CBigNum bnNew(PastDifficultyAverage);
+		if (PastRateActualSeconds != 0 && PastRateTargetSeconds != 0) {
+		   bnNew *= PastRateActualSeconds;
+		   bnNew /= PastRateTargetSeconds;
+		}
+
+	if (bnNew > bnProofOfWorkLimit) {
+		bnNew = bnProofOfWorkLimit;
+	}
+
+	return bnNew.GetCompact();
+}
+
+unsigned int static GetNextWorkRequired_V2(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
+{
+		static const int64_t BlocksTargetSpacing   = 60;					// 60 seconds
+		static const unsigned int TimeDaySeconds = 60 * 60 * 24;
+
+		int64_t  PastSecondsMin = TimeDaySeconds * 0.02; // 0.01;
+		int64_t  PastSecondsMax = TimeDaySeconds * 0.30; // 0.14;
+		uint64_t PastBlocksMin	= PastSecondsMin / BlocksTargetSpacing;
+		uint64_t PastBlocksMax	= PastSecondsMax / BlocksTargetSpacing;
+
+		return KimotoGravityWell(pindexLast, pblock, BlocksTargetSpacing, PastBlocksMin, PastBlocksMax);
+}
+
+unsigned int GetNextTrustRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
+{
+		int DiffMode = 1;
+		if (fTestNet) {
+			if    (pindexLast->nHeight+1 >=    50) { DiffMode = 2; }
+		}
+		else {
+			if    (pindexLast->nHeight+1 >= 34804) { DiffMode = 1; }
+			else if (pindexLast->nHeight+1 >= 200) { DiffMode = 2; }
+		}
+		if      (DiffMode == 1) { return GetNextWorkRequired_V1(pindexLast, pblock); }
+		else if (DiffMode == 2) { return GetNextWorkRequired_V2(pindexLast, pblock); }
+		return GetNextWorkRequired_V2(pindexLast, pblock);
+}
+
+
+bool LoadBlockIndex()
+{
+	if (fTestNet)
+	{
+		pchMessageStart[0] = 0xfc;
+		pchMessageStart[1] = 0xc1;
+		pchMessageStart[2] = 0xb7;
+		pchMessageStart[3] = 0xdc;
+		hashGenesisBlock = uint256("0x00000279dba2a8c40c2cd690f160f127a2a7edb8194f0d4e7605f212adf294bc");
+	} else {
+		pchMessageStart[0] = 0xd1;
+		pchMessageStart[1] = 0xd2;
+		pchMessageStart[2] = 0xd3;
+		pchMessageStart[3] = 0xdb;
+		hashGenesisBlock = uint256("0x00000279dba2a8c40c2cd690f160f127a2a7edb8194f0d4e7605f212adf294bc");
+	}
+
+	//
+	// Load block index from databases
+	//
+	if (!fReindex && !LoadBlockIndexDB())
+		return false;
+
+	return true;
+}
+
+bool InitBlockIndex() {
+	// Check whether we're already initialized
+	if (pindexGenesisBlock != NULL)
+		return true;
+
+	// Use the provided setting for -txindex in the new database
+	fTxIndex = GetBoolArg("-txindex", false);
+	pblocktree->WriteFlag("txindex", fTxIndex);
+	printf("Initializing databases...\n");
+
+	// Only add the genesis block if not reindexing (in which case we reuse the one already on disk)
+	if (!fReindex) {
+
+
+
+		 // Genesis Block:
+		 // block.nTime = 1393884829
+		 // 2014-03-09 22:00:10 block.nNonce = 2088083604
+		 // 2014-03-09 22:00:10 block.GetHash = f092eda63502ff8b19f584c56fc6ed32a9e265b798831690ea9aaf44cc74f7f0
+		 // Genesis block
+
+		const char* pszTimestamp = "CNN 03/Mar/20a14 Ukraine crisis: UN Security Council meets";
+		CTransaction txNew;
+		txNew.nVersion = 1;
+		printf("txNew version: %d\n", txNew.nVersion);
+		txNew.vin.resize(1);
+		txNew.vout.resize(1);
+		txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
+		txNew.vout[0].nValue = 1000 * COIN;
+		txNew.vout[0].scriptPubKey = CScript() << ParseHex("040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9") << OP_CHECKSIG;
+		CBlock block;
+		block.vtx.push_back(txNew);
+		block.hashPrevBlock = 0;
+		block.hashMerkleRoot = block.BuildMerkleTree();
+		block.nVersion = 1;
+		block.nTime    = 1393884829;
+		block.nBits    = bnProofOfWorkLimit.GetCompact();
+		block.nNonce   = 2090389678;
+
+		if (fTestNet)
+		{
+			block.nTime    = 1393884829;
+			block.nNonce   = 2090389678; // hack, same
+		}
+
+
+		uint256 hash = block.GetHash();
+		if (hash != hashGenesisBlock)
+		{
+			printf("Searching for genesis block...\n");
+			// This will figure out a valid hash and Nonce if you're
+			// creating a different genesis block:
+			uint256 hashTarget = CBigNum().SetCompact(block.nBits).getuint256();
+			// char scratchpad[SCRYPT_SCRATCHPAD_SIZE];
+
+		while(true){
+				hash = block.GetHash();
+				if (hash <= hashTarget)
+					break;
+				if ((block.nNonce & 0xFFF) == 0)
+				{
+					printf("nonce %08X: hash = %s (target = %s)\n", block.nNonce, hash.ToString().c_str(), hashTarget.ToString().c_str());
+				}
+				++block.nNonce;
+				if (block.nNonce == 0)
+				{
+					printf("NONCE WRAPPED, incrementing time\n");
+					++block.nTime;
+				}
+			}
+			printf("block.nTime = %u \n", block.nTime);
+			printf("block.nNonce = %u \n", block.nNonce);
+			printf("block.GetHash = %s\n", block.GetHash().ToString().c_str());
+		}
+
+		printf("%s\n", hash.ToString().c_str());
+		printf("%s\n", hashGenesisBlock.ToString().c_str());
+		printf("%s\n", block.hashMerkleRoot.ToString().c_str());
+		block.print();
+		assert(block.hashMerkleRoot == uint256("0xdc43fdf63088ee667d957a39f87b217822b9e3d31805b008124c4e821079a43c"));
+		//block.print();
+		assert(hash == hashGenesisBlock);
+
+		// Start new block file
+		try {
+			unsigned int nBlockSize = ::GetSerializeSize(block, SER_DISK, CLIENT_VERSION);
+			CDiskBlockPos blockPos;
+			CValidationState state;
+			if (!FindBlockPos(state, blockPos, nBlockSize+8, 0, block.nTime))
+				return error("LoadBlockIndex() : FindBlockPos failed");
+			if (!block.WriteToDisk(blockPos))
+				return error("LoadBlockIndex() : writing genesis block to disk failed");
+			if (!block.AddToBlockIndex(state, blockPos))
+				return error("LoadBlockIndex() : genesis block not accepted");
+		} catch(std::runtime_error &e) {
+			return error("LoadBlockIndex() : failed to initialize block database: %s", e.what());
+		}
+	}
+
+	return true;
+}
+
+namespace Checkpoints
+{
+	// What makes a good checkpoint block?
+	// + Is surrounded by blocks with reasonable timestamps
+	//	 (no blocks before with a timestamp after, none after with
+	//	  timestamp before)
+	// + Contains no strange transactions
+	static MapCheckpoints mapCheckpoints =
+		boost::assign::map_list_of
+		(	0,	uint256("00000279dba2a8c40c2cd690f160f127a2a7edb8194f0d4e7605f212adf294bc"))
+		(	171000,	uint256("000000000084b49eb538d85b00a40438b99f749124b68ed7719ed27d0abb3447"))
+		;
+	const CCheckpointData data = {
+		&mapCheckpoints,
+		1424439826, // * UNIX timestamp of last checkpoint block
+		219689,	// * total number of transactions between genesis and last checkpoint
+					//	 (the tx=... number in the SetBestChain debug.log lines)
+		1000.0	   // * estimated number of transactions per day after checkpoint
+	};
+
+	static MapCheckpoints mapCheckpointsTestnet = 
+		boost::assign::map_list_of
+		(	546, uint256("000000002a936ca763904c3c35fce2f3556c559c0214345d31b1bcebf76acb70"))
+//		( 35000, uint256("2af959ab4f12111ce947479bfcef16702485f04afd95210aa90fde7d1e4a64ad"))
+		;
+	const CCheckpointData dataTestnet = {
+		&mapCheckpointsTestnet,
+		1369685559,
+		37581,
+		300
+	}; /* estimated number of transactions per day after checkpoint */
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/old-coins/givecoin.h	Sat Feb 13 19:32:51 2021 -0600
@@ -0,0 +1,79 @@
+// Copyright (c) 2014 Troy Benjegerdes, under AGPLv3
+// Distributed under the Affero GNU General public license version 3
+// file COPYING or http://www.gnu.org/licenses/agpl-3.0.html
+#ifndef CODECOIN_givecoin_H
+#define CODECOIN_givecoin_H
+
+static const int RPC_PORT = 31410;
+static const int RPC_PORT_TESTNET =31411;
+static const int P2P_PORT = 31415;
+static const int P2P_PORT_TESTNET = 31416;
+
+static const int64_t COIN = 100000000;
+static const int64_t CENT = 1000000;
+static const int COIN_DECIMALS = 8; /* decimal places for coin */
+#define COIN_DECIMALS_FMT "08"
+
+static const unsigned int MAX_BLOCK_SIZE = 1000000;                      // 1000KB block hard limit
+static const unsigned int MAX_BLOCK_SIZE_GEN = MAX_BLOCK_SIZE/4;         // 250KB  block soft limit
+
+/** Dust Soft Limit, allowed with additional fee per output */
+static const int64_t DUST_SOFT_LIMIT = 100000; // 0.001 GIVE
+/** Dust Hard Limit, ignored as wallet inputs (mininput default) */
+static const int64_t DUST_HARD_LIMIT = 1000;   // 0.00001 GIVE mininput
+/** Minimum criteria for AllowFree */
+static const int64_t MIN_FREE_PRIORITY = COIN * 576/250;
+/** No amount larger than this (in catoshi) is valid */
+static const int64_t MAX_MONEY = 500000000 * COIN;
+inline bool MoneyRange(int64_t nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
+/** Coinbase transaction outputs can only be spent after this number of new blocks (network rule) */
+static const int COINBASE_MATURITY = 100;
+
+/** Minimum block time spacing (hard limit) **/
+static const int64_t MINIMUM_BLOCK_SPACING = 30;	// Absolute minimum spacing
+
+/** really only used in rpcmining.cpp **/
+static const int RETARGET_INTERVAL = 15;
+
+#define STAKE_TARGET_SPACING nStakeTargetSpacing
+
+extern const unsigned int nStakeMinAge;
+extern const unsigned int nStakeMaxAge;
+extern const unsigned int nStakeTargetSpacing;
+extern const unsigned int nMaxClockDrift;
+//extern const unsigned int nMinTxOutAmount; // set to = CTransaction::nMinTxFee;
+
+#define CUTOFF_POS_BLOCK nCutoff_Pos_Block
+extern const int CUTOFF_POS_BLOCK;
+
+#if defined(FEATURE_SOMEDAY_CodecoinAddress)
+class GivecoinAddress : public CodecoinAddress
+{
+public:
+	enum
+	{
+        PUBKEY_ADDRESS = 15, // Givecoin addresses start with L
+        SCRIPT_ADDRESS = 5,
+        PUBKEY_ADDRESS_TEST = 111,
+        SCRIPT_ADDRESS_TEST = 196,
+	}
+};
+
+typedef GivecoinAddressVisitor CBitcoinAddressVisitor;
+typedef GivecoinAddress CBitcoinAddress;
+#endif
+
+#define FEATURE_MONEYSUPPLY
+#define FEATURE_CFG_MAXFUTURE
+
+#define BRAND "Givecoin"
+#define BRAND_upper "GiveCoin"
+#define BRAND_lower "givecoin"
+#define BRAND_domain "givecoin.org"
+#define BRAND_CODE "GIVE"
+
+#if defined(BRAND_givestake)
+#define PPCOINSTAKE
+#endif
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/old-coins/grantstake.cpp	Sat Feb 13 19:32:51 2021 -0600
@@ -0,0 +1,634 @@
+// Copyright (c) 2009-2010 Satoshi Nakamoto
+// Copyright (c) 2009-2012 The Bitcoin developers
+// Copyright (c) 2013-2014 The Catcoin developers
+// Copyright (c) 2014 Troy Benjegerdes, under AGPLv3
+// Distributed under the Affero GNU General public license version 3
+// file COPYING or http://www.gnu.org/licenses/agpl-3.0.html
+
+#include "codecoin.h"
+#if defined(BRAND_grantstake)
+#include "grantstake.h"
+#else
+#include "grantcoin.h"
+#endif
+#include "alert.h"
+#include "checkpoints.h"
+#include "db.h"
+#include "txdb.h"
+#include "net.h"
+#include "init.h"
+#include "ui_interface.h"
+#include "checkqueue.h"
+#include <boost/algorithm/string/replace.hpp>
+#include <boost/filesystem.hpp>
+#include <boost/filesystem/fstream.hpp>
+
+using namespace std;
+using namespace boost;
+
+uint256 hashGenesisBlock = 0;			// TODO: objectize this for multicoin support
+
+const string strMessageMagic = "Grantcoin Signed Message:\n";
+
+const CBigNum bnProofOfWorkLimit(~uint256(0) >> 28);  // Reduced initial difficulty from Peercoin's 32
+const CBigNum bnInitialHashTarget(~uint256(0) >> 28);  // Reduced from Peercoin's 40
+
+int nCoinbaseMaturity = COINBASE_MATURITY;
+
+/** TODO: this goes into src/policy/fees.cpp when latest bitcoin code is merged */
+/** Fees smaller than this (in satoshi) are considered zero fee (for transaction creation) */
+int64_t CTransaction::nMinTxFee = CENT;
+/** Fees smaller than this (in satoshi) are considered zero fee (for relaying) */
+int64_t CTransaction::nMinRelayTxFee = CENT;
+
+// TODO: separate max clock drift from tx timestamp limits?
+const unsigned int nMaxClockDrift = 2*60*60;   // this is WAY to big..
+
+
+
+/* value, in percent of what difficulty value we'll accept for orphans */
+const int ORPHAN_WORK_THRESHOLD = 1; // FIXME WAY TOO WIDE right now
+
+// DNS seeds
+// Each pair gives a source name and a seed name.
+// The first name is used as information source for addrman.
+// The second name should resolve to a list of seed addresses.
+// FIXME use a single string and/or objectify this
+const char *strMainNetDNSSeed[][2] = {
+	{"grantcoin.net", "seed1.grantcoin.net"},
+	{"grantcoin.net", "seed2.grantcoin.net"},
+	{NULL, NULL}
+};
+
+const char *strTestNetDNSSeed[][2] = {
+	{"seed", "159.203.84.95"},
+	{NULL, NULL}
+};
+
+int64_t GetProofOfWorkRewardTestNet(int nHeight)
+{
+    int64_t nSubsidy = COIN;
+    if (nHeight == 1)
+        nSubsidy = 10000000000 * COIN;  // Grantcoin created for planned distribution
+    else if (nHeight < 500)
+        nSubsidy = CENT;  // De minimus reward pre-launch and up to 2 weeks post-launch
+    else if (nHeight < 510)
+        nSubsidy = 6.25 * COIN;  // Public mining begins
+    else if (nHeight < 520)
+        nSubsidy = 12.5 * COIN;  // Reward gradually increases during first few days
+    else if (nHeight < 530)
+        nSubsidy = 25 * COIN;
+    else if (nHeight < 540)
+        nSubsidy = 50 * COIN;
+    else if (nHeight < 550)
+        nSubsidy = 100 * COIN;
+    else if (nHeight < 560)
+        nSubsidy = 200 * COIN;
+    else if (nHeight < 1000)
+        nSubsidy = 400 * COIN;  // Maximum reward reached
+    else if (nHeight < 1500)
+        nSubsidy = 200 * COIN;  // Reward starts to decline
+    else if (nHeight < 2000)
+        nSubsidy = 100 * COIN;
+    else if (nHeight < 2500)
+        nSubsidy = 50 * COIN;
+    else if (nHeight < 3000)
+        nSubsidy = 25 * COIN;
+    else if (nHeight < 3500)
+        nSubsidy = 12.5 * COIN;
+    else if (nHeight < 4000)
+        nSubsidy = 6.25 * COIN;
+    else if (nHeight < 4500)
+        nSubsidy = 3.13 * COIN;
+    else if (nHeight < 5000)
+        nSubsidy = 1.57 * COIN;
+    else if (nHeight >= 5000)
+        nSubsidy = COIN;  // PoW reward reaches final minimum value
+
+    // if (fDebug && GetBoolArg("-printcreation"))
+    //     printf("GetProofOfWorkReward() : create=%s nBits=0x%08x nSubsidy=%"PRI64d"\n", FormatMoney(nSubsidy).c_str(), nBits, nSubsidy);
+
+    return nSubsidy;
+}
+
+int64_t Grantcoin_PoWReward(int nHeight)
+{
+    int64_t nSubsidy = COIN;
+/* kludge */
+    if (fTestNet){
+	return GetProofOfWorkRewardTestNet(nHeight);
+    }
+
+    if (nHeight == 1)
+        nSubsidy = 10000000000 * COIN;  // Grantcoin created for planned distribution
+    else if (nHeight < 50000)
+        nSubsidy = CENT;  // De minimus reward pre-launch and up to 2 weeks post-launch
+    else if (nHeight < 51000)
+        nSubsidy = 6.25 * COIN;  // Public mining begins
+    else if (nHeight < 52000)
+        nSubsidy = 12.5 * COIN;  // Reward gradually increases during first few days
+    else if (nHeight < 53000)
+        nSubsidy = 25 * COIN;
+    else if (nHeight < 54000)
+        nSubsidy = 50 * COIN;
+    else if (nHeight < 55000)
+        nSubsidy = 100 * COIN;
+    else if (nHeight < 56000)
+        nSubsidy = 200 * COIN;
+    else if (nHeight < 100000)
+        nSubsidy = 400 * COIN;  // Maximum reward reached
+    else if (nHeight < 150000)
+        nSubsidy = 200 * COIN;  // Reward starts to decline
+    else if (nHeight < 200000)
+        nSubsidy = 100 * COIN;
+    else if (nHeight < 250000)
+        nSubsidy = 50 * COIN;
+    else if (nHeight < 300000)
+        nSubsidy = 25 * COIN;
+    else if (nHeight >= 300000)
+        nSubsidy = 10 * COIN;  // Final minimum reward for PoW phase
+
+    // if (fDebug && GetBoolArg("-printcreation"))
+    //     printf("GetProofOfWorkReward() : create=%s nBits=0x%08x nSubsidy=%"PRI64d"\n", FormatMoney(nSubsidy).c_str(), nBits, nSubsidy);
+
+    return nSubsidy;
+}
+
+// peercoin: miner's coin stake is rewarded based on coin age spent (coin-days)
+int64_t Grantcoin_StakeReward(int64_t nCoinAge)
+{
+    static int64_t nRewardCoinYear = CENT;  // creation amount per coin-year
+    int64_t nSubsidy = nCoinAge * 33 / (365 * 33 + 8) * nRewardCoinYear;
+    if (fDebug && GetBoolArg("-printcreation"))
+        printf("GetProofOfStakeReward(): create=%s nCoinAge=%" PRId64 "\n", FormatMoney(nSubsidy).c_str(), nCoinAge);
+    return nSubsidy;
+}
+
+/*
+ * Get the allow Seigniorage (money creation, or reward) of the current
+ * block. If CoinAge is > 0, this is a proof of stake block.
+ */
+int64_t CBlockIndex::GetSeigniorage(int64_t nFees, int64_t CoinAge) const
+{
+	if(IsProofOfWork()){
+		return Grantcoin_PoWReward(nHeight);
+	} else {
+		return Grantcoin_StakeReward(CoinAge);
+	}
+}
+
+static const int64_t nTargetTimespan = 24 * 60 * 60;  // 24 hours
+static const int64_t nTargetSpacingWorkMax = 12 * STAKE_TARGET_SPACING; // 18 minutes
+
+//
+// minimum amount of work that could possibly be required nTime after
+// minimum work required was nBase
+//
+unsigned int ComputeMinWork(unsigned int nBase, int64_t nTime, const CBlockHeader* pblock)
+{
+    CBigNum bnResult;
+    bnResult.SetCompact(nBase);
+    bnResult *= 2;
+    while (nTime > 0 && bnResult < bnProofOfWorkLimit)
+    {
+        // Maximum 200% adjustment per 3 hours
+        bnResult *= 2;
+        nTime -= 3 * 60 * 60;
+    }
+    if (bnResult > bnProofOfWorkLimit)
+        bnResult = bnProofOfWorkLimit;
+    return bnResult.GetCompact();
+}
+
+unsigned int static GetNextTargetRequired(const CBlockIndex* pindexLast, bool fProofOfStake)
+{
+    if (pindexLast == NULL)
+        return bnProofOfWorkLimit.GetCompact(); // genesis block
+
+    const CBlockIndex* pindexPrev = GetLastBlockIndex(pindexLast, fProofOfStake);
+    if (pindexPrev->pprev == NULL)
+        return bnInitialHashTarget.GetCompact(); // first block
+    const CBlockIndex* pindexPrevPrev = GetLastBlockIndex(pindexPrev->pprev, fProofOfStake);
+    if (pindexPrevPrev->pprev == NULL)
+        return bnInitialHashTarget.GetCompact(); // second block
+
+    int64_t nActualSpacing = pindexPrev->GetBlockTime() - pindexPrevPrev->GetBlockTime();
+
+    // peercoin: target change every block
+    // peercoin: retarget with exponential moving toward target spacing
+    CBigNum bnNew;
+    bnNew.SetCompact(pindexPrev->nBits);
+    int64_t nTargetSpacing = fProofOfStake? STAKE_TARGET_SPACING : min(nTargetSpacingWorkMax, (int64_t) STAKE_TARGET_SPACING * (1 + pindexLast->nHeight - pindexPrev->nHeight));
+    int64_t nInterval = nTargetTimespan / nTargetSpacing;
+    bnNew *= ((nInterval - 1) * nTargetSpacing + nActualSpacing + nActualSpacing);
+    bnNew /= ((nInterval + 1) * nTargetSpacing);
+
+    if (bnNew > bnProofOfWorkLimit)
+        bnNew = bnProofOfWorkLimit;
+
+    return bnNew.GetCompact();
+}
+
+#if defined(PPCOINSTAKE)
+unsigned int GetNextTrustRequired(const CBlockIndex* pindexLast, const CBlock *pblock)
+{
+	return GetNextTargetRequired(pindexLast, pblock->IsProofOfStake());	
+}
+#else
+unsigned int GetNextTrustRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
+{
+	return GetNextTargetRequired(pindexLast, false);	
+}
+#endif
+
+static int minimum_time_fork = 250000;	// minimum time fork
+static int minimum_time_fork_2 = 250000;	// minimum time fork
+
+//Checks for 'hardcoded' block timestamps
+bool AcceptBlockTimestamp(CValidationState &state, CBlockIndex* pindexPrev, const CBlockHeader *pblock)
+{
+	int64_t time_allow = -30;
+	int64_t time_warn = MINIMUM_BLOCK_SPACING;
+	int64_t delta = pblock->GetBlockTime() - pindexPrev->GetBlockTime();
+	int nHeight = pindexPrev->nHeight + 1;
+
+	if (nHeight > minimum_time_fork_2){
+		time_allow = 30;
+	}
+	
+	if (delta < time_warn){
+		printf("WARNING blocktime nHeight %d time_allow %" PRId64" time_warn %" PRId64" time delta %" PRId64"\n", nHeight, time_allow, time_warn, delta);
+	}
+
+	if (nHeight >= minimum_time_fork_2) {
+		if (delta <= time_allow) // see above, from first hard limit
+			return state.Invalid(error("AcceptBlock(height=%d) : block time delta %" PRId64" too short", nHeight, delta));
+	}
+	if (nHeight >= minimum_time_fork) { /* don't forward these */
+		if (delta <= MINIMUM_BLOCK_SPACING)
+			return state.DoS(10, (error("AcceptBlock(height=%d) : block time delta %" PRId64" too short", nHeight, delta)));
+	}
+	return true;	
+}
+
+#ifdef CATBOX
+unsigned int GetNextWorkRequired_Catcoin(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
+{
+	int64_t nTargetTimespanLocal = 0;
+	int64_t nIntervalLocal = 0;
+	int forkBlock = 20290 - 1;
+	int fork2Block = 21346;
+
+	 // moved variable inits to the top where they belong
+	 
+	unsigned int nProofOfWorkLimit = bnProofOfWorkLimit.GetCompact();
+	int64_t nActualTimespan;
+	const CBlockIndex* pindexFirst = pindexLast;
+
+	 int64_t error;	 
+	 //int64_t diffcalc;
+	double pGainUp=-0.005125;	// Theses values can be changed to tune the PID formula
+	double iGainUp=-0.0225;	// Theses values can be changed to tune the PID formula
+	double dGainUp=-0.0075;		// Theses values can be changed to tune the PID formula
+
+	double pGainDn=-0.005125;	// Theses values can be changed to tune the PID formula
+	double iGainDn=-0.0525;	// Theses values can be changed to tune the PID formula
+	double dGainDn=-0.0075;		// Theses values can be changed to tune the PID formula
+
+	double pCalc;
+	double iCalc;
+	double dCalc;
+	double dResult;
+	int64_t result;
+	CBigNum bResult;
+	CBigNum bnNew;
+	int i;
+	//CBigNum bLowLimit; // Limit for PID calc to never go below this
+	
+	if(fTestNet){
+		forkBlock = -1;
+		fork2Block = 36;
+	}
+
+	// Genesis block
+	if (pindexLast == NULL)
+		return nProofOfWorkLimit;
+
+	// Starting from block 20,290 the network diff was set to 16
+	// and the retarget interval was changed to 36
+	if(pindexLast->nHeight < forkBlock && !fTestNet) 
+	{
+		nTargetTimespanLocal = nTargetTimespanOld;
+		nIntervalLocal = nIntervalOld;
+	} 
+	else if(pindexLast->nHeight == forkBlock && !fTestNet) 
+	{
+		bnNew.SetCompact(0x1c0ffff0); // Difficulty 16
+		return bnNew.GetCompact();
+	} 
+	else // Keep in for a resync
+	{
+		nTargetTimespanLocal = nTargetTimespan;
+		nIntervalLocal = nInterval;
+	}
+
+	// after fork2Block we retarget every block   
+	if(pindexLast->nHeight < fork2Block && !fTestNet)
+	{
+		// Only change once per interval
+		if ((pindexLast->nHeight+1) % nIntervalLocal != 0 && !fTestNet)
+		{
+			// Special difficulty rule for testnet:
+			if (fTestNet)
+			{
+				// If the new block's timestamp is more than 2* 10 minutes
+				// then allow mining of a min-difficulty block.
+				if (pblock->nTime > pindexLast->nTime + nTargetSpacing*2)
+					return nProofOfWorkLimit;
+				else
+				{
+					// Return the last non-special-min-difficulty-rules-block
+					const CBlockIndex* pindex = pindexLast;
+					while (pindex->pprev && pindex->nHeight % nIntervalLocal != 0 && pindex->nBits == nProofOfWorkLimit)
+						pindex = pindex->pprev;
+					return pindex->nBits;
+				}
+			}
+
+			return pindexLast->nBits;
+		}
+	}
+
+
+	if(pindexLast->nHeight < fork3Block && !fTestNet) // let it walk through 2nd fork stuff if below fork3Block, and ignore if on testnet
+	{
+	// Catcoin: This fixes an issue where a 51% attack can change difficulty at will.
+	// Go back the full period unless it's the first retarget after genesis. Code courtesy of Art Forz
+		int blockstogoback = nIntervalLocal-1;
+		if ((pindexLast->nHeight+1) != nIntervalLocal)
+			blockstogoback = nIntervalLocal;
+
+		// Go back by what we want to be 14 days worth of blocks
+		const CBlockIndex* pindexFirst = pindexLast;
+		for (i = 0; pindexFirst && i < blockstogoback; i++)
+			pindexFirst = pindexFirst->pprev;
+		assert(pindexFirst);
+
+		// Limit adjustment step
+		int numerator = 4;
+		int denominator = 1;
+		if(pindexLast->nHeight >= fork2Block){
+			numerator = 112;
+			denominator = 100;
+		}
+		int64_t nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime();
+		int64_t lowLimit = nTargetTimespanLocal*denominator/numerator;
+		int64_t highLimit = nTargetTimespanLocal*numerator/denominator;
+		printf("  nActualTimespan = %" PRId64"  before bounds\n", nActualTimespan);
+		if (nActualTimespan < lowLimit)
+			nActualTimespan = lowLimit;
+		if (nActualTimespan > highLimit)
+			nActualTimespan = highLimit;
+
+		// Retarget
+		bnNew.SetCompact(pindexLast->nBits);
+		bnNew *= nActualTimespan;
+		bnNew /= nTargetTimespanLocal;
+	
+		if (bnNew > bnProofOfWorkLimit)
+			bnNew = bnProofOfWorkLimit;
+
+		/// debug print
+		if(fTestNet) printf("GetNextWorkRequired RETARGET\n");
+		if(fTestNet) printf("nTargetTimespan = %" PRId64"    nActualTimespan = %" PRId64"\n", nTargetTimespanLocal, nActualTimespan);
+		if(fTestNet) printf("Before: %08x  %s\n", pindexLast->nBits, CBigNum().SetCompact(pindexLast->nBits).getuint256().ToString().c_str());
+		if(fTestNet) printf("After:	%08x  %s\n", bnNew.GetCompact(), bnNew.getuint256().ToString().c_str());
+	}
+/*
+PID formula
+Error = Actual Time - Desired time
+P Calc = pGain * Error
+I Calc = iGain * Error * (Desired Time / Actual Time) 
+D Calc = dGain * (Error / Actual Time) * I Calc
+
+New Diff = (Current Diff + P Calc + I Calc + D Calc)
+
+If New diff < 0, then set static value of 0.0001 or so.
+*/	
+
+	int nMinSpacing = 30;
+	if(pindexLast->nHeight >= fork1min || fTestNet)
+		nMinSpacing = MINIMUM_BLOCK_SPACING;
+	
+	if(pindexLast->nHeight >= fork3Block || fTestNet)
+	// Fork 3 to use a PID routine instead of the other 2 forks 
+	{
+		pindexFirst = pindexLast->pprev;	// Set previous block
+		for(i=0;i<7;i++) pindexFirst = pindexFirst->pprev; // Set 4th previous block for 8 block filtering 
+		nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime();		// Get last X blocks time
+		nActualTimespan = nActualTimespan / 8;	// Calculate average for last 8 blocks
+		if(pindexLast->nHeight > fork4Block || fTestNet){
+			if (nMinSpacing > nActualTimespan){
+				printf("WARNING: SANITY CHECK FAILED: PID nActualTimespan %" PRId64" too small! increased to %d\n",
+					nActualTimespan, nMinSpacing );
+				nActualTimespan = nMinSpacing;
+			}
+		}
+		bnNew.SetCompact(pindexLast->nBits);	// Get current difficulty
+		i=0;					// Zero bit-shift counter
+		while(bnNew>0)				// Loop while bnNew > 0
+		{
+			i++;				// Increment bit-shift counter
+			bnNew = bnNew >> 1;		// shift bnNew lower by 1 bit
+			if(i>256) bnNew = 0;		// overflow test, just to make sure that it never stays in this loop
+		}
+		bnNew.SetCompact(pindexLast->nBits);	// Get current difficulty again
+		
+
+		error = nActualTimespan - nTargetSpacing;	// Calculate the error to be fed into the PID Calculation
+		if(error >= -450 && error <= 450) // Slower gains for when the average time is within 2.5 min and 7.5 min 
+		{
+			// Calculate P ... pGainUp defined at beginning of routine
+			pCalc = pGainUp * (double)error;
+			// Calculate I ... iGainUp defined at beginning of routine
+			iCalc = iGainUp * (double)error * (double)((double)nTargetSpacing / (double)nActualTimespan);
+			// Calculate D ... dGainUp defined at beginning of routine
+			dCalc = dGainUp * ((double)error / (double)nActualTimespan) * iCalc;
+		}
+		else // Faster gains for block averages faster than 2.5 min and greater than 7.5 min 
+		{
+			// Calculate P ... pGainDn defined at beginning of routine
+			pCalc = pGainDn * (double)error;
+			// Calculate I ... iGainDn defined at beginning of routine
+			iCalc = iGainDn * (double)error * (double)((double)nTargetSpacing / (double)nActualTimespan);
+			// Calculate D ... dGainDn defined at beginning of routine
+			dCalc = dGainDn * ((double)error / (double)nActualTimespan) * iCalc;
+		}
+
+		if(error > -10 && error < 10)
+		{
+			if(fTestNet) printf("Within dead zone. No change!  error: %" PRId64"\n", error);
+			return(bnNew.GetCompact());
+		}		
+		
+		dResult = pCalc + iCalc + dCalc;	// Sum the PID calculations
+		
+		result = (int64_t)(dResult * 65536);	// Adjust for scrypt calcuation
+		// Bring the result within max range to avoid overflow condition 
+		while(result >	8388607) result = result / 2; 
+		bResult = result;			// Set the bignum value
+		if(i>24) bResult = bResult << (i - 24);	// bit-shift integer value of result to be subtracted from current diff
+
+		//if(fTestNet)
+		printf("pCalc: %f, iCalc: %f, dCalc: %f, Result: %" PRId64" (%f)\n", pCalc, iCalc, dCalc, result, dResult);
+		//if(fTestNet) // TODO: make this key on a 'debugPID' or something
+		printf("PID Actual Time: %" PRId64", error: %" PRId64"\n", nActualTimespan, error); 
+		if(fTestNet)
+			printf("Result: %08x %s\n",bResult.GetCompact(), bResult.getuint256().ToString().c_str()); 
+		if(fTestNet)
+			printf("Before: %08x %s\n",bnNew.GetCompact(), bnNew.getuint256().ToString().c_str()); 
+		bnNew = bnNew - bResult;	// Subtract the result to set the current diff
+		
+		// Make sure that diff is not set too low, ever
+		if (bnNew.GetCompact() > 0x1e0fffff) bnNew.SetCompact(0x1e0fffff);
+		if(fTestNet) 
+			printf("After:  %08x %s\n",bnNew.GetCompact(), bnNew.getuint256().ToString().c_str()); 
+		
+	} // End Fork 3 to use a PID routine instead of the other 2 forks routine
+
+	return bnNew.GetCompact();
+}
+#endif
+
+const char *pchGrantMain = "\xe2\xe7\xe1\xe4";
+
+unsigned char pchMessageStart[4];
+
+bool LoadBlockIndex()
+{
+	if (fTestNet)
+	{	/* err, currently use the same one. TODO: change PCH */
+		pchMessageStart[0] = pchGrantMain[0];
+		pchMessageStart[1] = pchGrantMain[1];
+		pchMessageStart[2] = pchGrantMain[2];
+		pchMessageStart[3] = pchGrantMain[3];
+		hashGenesisBlock = uint256 ("0x000000075c9bddc6a4638910415b2995febabf9dd8b634f0832da86c5bab2df5");
+	} else {
+		pchMessageStart[0] = pchGrantMain[0];
+		pchMessageStart[1] = pchGrantMain[1];
+		pchMessageStart[2] = pchGrantMain[2];
+		pchMessageStart[3] = pchGrantMain[3];
+		hashGenesisBlock = uint256("0000000f0483c7cc4433d89e321373d82d86ef5ba8157d8f7b9ef3449283421a");
+	}
+
+	//
+	// Load block index from databases
+	//
+	if (!fReindex && !LoadBlockIndexDB())
+		return false;
+
+	return true;
+}
+
+
+bool InitBlockIndex() {
+	// Check whether we're already initialized
+	if (pindexGenesisBlock != NULL)
+		return true;
+
+	// Use the provided setting for -txindex in the new database
+	fTxIndex = GetBoolArg("-txindex", false);
+	pblocktree->WriteFlag("txindex", fTxIndex);
+	printf("Initializing databases...\n");
+
+	// Only add the genesis block if not reindexing (in which case we reuse the one already on disk)
+	if (!fReindex) {
+		CBlock block;
+        	CTransaction txNew;
+		if(fTestNet){ // GrantTestnet, optimize later.
+        const char* pszTimestamp = "Reuters 10-OCT-2015 Hundreds of thousands protest in Berlin against EU-US trade deal";
+        txNew.nTime = 1444509104;
+        txNew.vin.resize(1);
+        txNew.vout.resize(1);
+        txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(9999) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
+        txNew.vout[0].SetEmpty();
+        block.vtx.push_back(txNew);
+        block.hashPrevBlock = 0;
+        block.hashMerkleRoot = block.BuildMerkleTree();
+        block.nVersion = 1;
+        block.nTime    = 1444510495;
+        block.nBits    = bnProofOfWorkLimit.GetCompact();
+        block.nNonce   = 87045764;
+		} else {        
+		// Genesis block
+		const char* pszTimestamp = "The Courier-Journal 21-MAR-2015 Prince Charles calls for a revolution";
+        txNew.nTime = 1427081625;
+		txNew.vin.resize(1);
+		txNew.vout.resize(1);
+		txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(9999) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
+		txNew.vout[0].SetEmpty();
+		block.vtx.push_back(txNew);
+		block.hashPrevBlock = 0;
+		block.hashMerkleRoot = block.BuildMerkleTree();
+		block.nVersion = 1;
+		block.nTime    = 1427086539;
+		block.nBits    = bnProofOfWorkLimit.GetCompact();
+		block.nNonce   = 413974755;
+		}
+
+		//// debug print
+		uint256 hash = block.GetHash();
+		printf("%s\n", hash.ToString().c_str());
+		printf("%s\n", hashGenesisBlock.ToString().c_str());
+		printf("%s\n", block.hashMerkleRoot.ToString().c_str());
+		block.print();
+		assert(hash == hashGenesisBlock);
+		if (fTestNet)
+			assert(block.hashMerkleRoot == uint256("0x650de4987865a27a1c248908c6a93b9d55931ee3df0e97a845c0915bb53a362f"));
+		else {
+			assert(block.hashMerkleRoot == uint256("0xca7e1b14fe8d66d18650db8fa0c1b2787fa48b4a342fff3b00aa1cc9b0ae85f3"));
+		}
+
+		//assert(block.CheckBlock)
+
+		// Start new block file
+		try {
+			unsigned int nBlockSize = ::GetSerializeSize(block, SER_DISK, CLIENT_VERSION);
+			CDiskBlockPos blockPos;
+			CValidationState state;
+			if (!FindBlockPos(state, blockPos, nBlockSize+8, 0, block.nTime))
+				return error("LoadBlockIndex() : FindBlockPos failed");
+			if (!block.WriteToDisk(blockPos))
+				return error("LoadBlockIndex() : writing genesis block to disk failed");
+			if (!block.AddToBlockIndex(state, blockPos))
+				return error("LoadBlockIndex() : genesis block not accepted");
+		} catch(std::runtime_error &e) {
+			return error("LoadBlockIndex() : failed to initialize block database: %s", e.what());
+		}
+	}
+
+	return true;
+}
+
+namespace Checkpoints
+{
+	// What makes a good checkpoint block?
+	// + Is surrounded by blocks with reasonable timestamps
+	//	 (no blocks before with a timestamp after, none after with
+	//	  timestamp before)
+	// + Contains no strange transactions
+	// TODO put this in grantcoin.cpp|.h
+	static MapCheckpoints mapCheckpoints =
+		boost::assign::map_list_of
+		(     0, uint256("0000000f0483c7cc4433d89e321373d82d86ef5ba8157d8f7b9ef3449283421a"))
+//		(33000, uint256("0x"))
+
+		;
+	const CCheckpointData data = {
+		&mapCheckpoints,
+		1434870875, 	// * UNIX timestamp of last checkpoint block
+		106400,		// * total number of transactions between genesis and last checkpoint
+					//	 (the tx=... number in the SetBestChain debug.log lines)
+		1000.0		// * estimated number of transactions per day after checkpoint
+	};
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/old-coins/grantstake.h	Sat Feb 13 19:32:51 2021 -0600
@@ -0,0 +1,74 @@
+// Copyright (c) 2014 Troy Benjegerdes, under AGPLv3
+// Distributed under the Affero GNU General public license version 3
+// file COPYING or http://www.gnu.org/licenses/agpl-3.0.html
+#ifndef CODECOIN_grantcoin_H
+#define CODECOIN_grantcoin_H
+
+static const int RPC_PORT = 9983;
+static const int RPC_PORT_TESTNET = 9985;
+static const int P2P_PORT = 9982;
+static const int P2P_PORT_TESTNET = 9984;
+
+static const int64_t COIN = 1000000;
+static const int64_t CENT = 10000;
+static const int COIN_DECIMALS = 6; /* decimal places for coin */
+#define COIN_DECIMALS_FMT "06"
+
+/** The maximum allowed size for a serialized block, in bytes (network rule) */
+static const unsigned int MAX_BLOCK_SIZE = 1000000;
+static const unsigned int MAX_BLOCK_SIZE_GEN = MAX_BLOCK_SIZE/2;
+
+/** No amount larger than this (in satoshi) is valid */
+static const int64_t MAX_MONEY = 50000000000 * COIN;
+inline bool MoneyRange(int64_t nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
+
+/** Coinbase transaction outputs can only be spent after this number of new blocks (network rule) */
+static const int COINBASE_MATURITY = 500;
+
+#warning TODO: sanity check following
+
+static const int STAKE_TARGET_SPACING = 1.5 * 60; // 90-second block spacing 
+static const unsigned int nStakeMinAge = 60 * 60 * 24; // minimum age for coin age (24 hours)
+static const unsigned int nStakeMaxAge = 60 * 60 * 24 * 90; // stake age of full weight
+//static const int64 START_BLOCK_PROOF_OF_STAKE = 250000; // PoS allowed starting at this block
+
+extern const unsigned int nMaxClockDrift;
+
+
+/** Dust Soft Limit, allowed with additional fee per output */
+static const int64_t DUST_SOFT_LIMIT = CENT; // 0.01 GRT
+/** Dust Hard Limit, ignored as wallet inputs (mininput default) */
+static const int64_t DUST_HARD_LIMIT = 100;   // 0.00001 GRT mininput
+
+/** main.h CTransaction:AllowFree **/
+static const int MIN_FREE_PRIORITY = COIN * 960 / 250;
+
+/** The interval over which we look to calculate the next difficulty **/
+// TODO: not needed for GRT???
+static const int RETARGET_INTERVAL = 36;
+
+/** Minimum block time spacing (hard limit) **/
+static const int64_t MINIMUM_BLOCK_SPACING = 60;	// Absolute minimum spacing
+
+// MODIFIER_INTERVAL: time to elapse before new modifier is computed
+static const unsigned int MODIFIER_INTERVAL = 6 * 60 * 60; 
+extern unsigned int nModifierInterval;
+
+// MODIFIER_INTERVAL_RATIO:
+// ratio of group interval length between the last group and the first group
+static const int MODIFIER_INTERVAL_RATIO = 3;
+
+#define BRAND "GrantStake"
+#define BRAND_upper "GrantStake"
+#define BRAND_lower "grantstake"
+#define BRAND_domain "grantcoin.org"
+#define BRAND_CODE "GRT"
+
+//Use ppcoinstake
+#define PPCOINSTAKE
+#define FEATURE_MONEYSUPPLY
+// Faster bootstraps with xz. Probably only works on mac/linux
+#define USE_BOOTSTRAP_XZ
+#define USE_BOOTSTRAP_GZ	// might work on android too
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/old-coins/hamburger.cpp	Sat Feb 13 19:32:51 2021 -0600
@@ -0,0 +1,489 @@
+// Copyright (c) 2009-2010 Satoshi Nakamoto
+// Copyright (c) 2009-2012 The Bitcoin developers
+// Copyright (c) 2013-2014 The Catcoin developers
+// Copyright (c) 2014-2015 Troy Benjegerdes, under AGPLv3
+// Distributed under the Affero GNU General public license version 3
+// file COPYING or http://www.gnu.org/licenses/agpl-3.0.html
+
+#include "codecoin.h"
+#include "hamburger.h"
+#include "checkpoints.h"
+#include "db.h"
+#include "txdb.h"
+#include "net.h"
+#include "init.h"
+#include "ui_interface.h"
+#include "checkqueue.h"
+#include <boost/algorithm/string/replace.hpp>
+#include <boost/filesystem.hpp>
+#include <boost/filesystem/fstream.hpp>
+
+using namespace std;
+using namespace boost;
+
+/* TODO: make this part of a decent C++ object with proper constructors */
+uint256 hashGenesisBlock = 0;		
+const string strMessageMagic = "Hamburger Signed Message:\n";
+unsigned char pchMessageStart[4];
+
+/* stake stuff TODO: */
+const CBigNum bnProofOfWorkLimit(~uint256(0) >> 16);
+const CBigNum bnProofOfStakeLimit(~uint256(0) >> 16);
+
+//CBigNum bnProofOfWorkLimitTestNet(~uint256(0) >> 20);
+//CBigNum bnProofOfStakeLimitTestNet(~uint256(0) >> 20);
+
+/* TODO: move to hamburger.h once finalized */
+const unsigned int nStakeMinAge = 60 * 60 * 1;		// minimum age for coin age: 1h
+const unsigned int nStakeMaxAge = 60 * 60 * 24 * 7;	// stake age of full weight: 7d
+const unsigned int nStakeTargetSpacing = 20;		// 20 sec block spacing
+const unsigned int nMaxClockDrift = 60 * 60 * 3; 		// 3 hours (way too big)
+#warning for test only
+//const int nCutoff_Pos_Block = 250000;
+const int nCutoff_Pos_Block = 10;
+
+/* end stake stuff */
+int nCoinbaseMaturity = COINBASE_MATURITY;
+
+/** TODO: this goes into src/policy/fees.cpp when latest bitcoin code is merged */
+/** Fees smaller than this (in satoshi) are considered zero fee (for transaction creation) */
+int64_t CTransaction::nMinTxFee = CENT;
+/** Fees smaller than this (in satoshi) are considered zero fee (for relaying) */
+int64_t CTransaction::nMinRelayTxFee = CENT;
+
+// DNS seeds
+// Each pair gives a source name and a seed name.
+// The first name is used as information source for addrman.
+// The second name should resolve to a list of seed addresses.
+// FIXME use a single string and/or objectify this
+/*
+  hamburger policy for getting on this list:
+  TODO: come up with a policy
+ */
+const char *strMainNetDNSSeed[][2] = 
+{
+   {"hamburger.7el.us", "hamburger.7el.us"},
+   {NULL, NULL}
+};
+
+const char *strTestNetDNSSeed[][2] = {
+	//{"weminemnc.com", "testnet-seed.weminemnc.com"},
+	{NULL, NULL}
+};
+
+// ppcoin: miner's coin stake is rewarded based on coin age spent (coin-days)
+int64_t static PPcoinStakeReward(int64_t nCoinAge)
+{
+    static int64_t nRewardCoinYear = CENT;  // creation amount per coin-year
+    int64_t nSubsidy = nCoinAge * 33 / (365 * 33 + 8) * nRewardCoinYear;
+    if (fDebug && GetBoolArg("-printcreation"))
+        printf("GetProofOfStakeReward(): create=%s nCoinAge=%" PRId64"\n", FormatMoney(nSubsidy).c_str(), nCoinAge);
+    return nSubsidy;
+}
+
+// Givecoin original block reward
+int64_t static GivecoinBlockValue_v1(int nHeight, int64_t nFees)
+{
+    int64_t nSubsidy = 0;
+    if (nHeight <= 5) {    // For Each 5 blocks will have 0.5M coins
+       nSubsidy = 5000000 * COIN;
+    }
+    else {
+       nSubsidy = 1000 * COIN;
+    }
+    // Subsidy is cut in half every 250,000 blocks, which will occur approximately every .5 year
+    nSubsidy >>= (nHeight / 250000); // Givecoin: 250k blocks in ~.5 years
+    //
+    if (nSubsidy < COIN) nSubsidy = COIN;  // Minimum Number of Coin = 1
+    return nSubsidy + nFees;
+}
+
+/*
+ * Get the allow Seigniorage (money creation, or reward) of the current
+ * block. If CoinAge is > 0, this is a proof of stake block.
+ */
+int64_t CBlockIndex::GetSeigniorage(int64_t nFees, int64_t CoinAge) const
+{
+	if(IsProofOfWork()){
+		return GivecoinBlockValue_v1(nHeight, nFees);
+	} else {
+		return PPcoinStakeReward(CoinAge);
+	}
+}
+
+static const int64_t nTargetTimespan = 10 * 60;	// hamburger: Difficulty adjusted every 10 mintues
+static const int64_t nTargetSpacing =	1 * 60;	// hamburger: Every Minute
+static const int64_t nInterval = nTargetTimespan / nTargetSpacing;	// 10 block readjustment
+
+//
+// minimum amount of work that could possibly be required nTime after
+// minimum work required was nBase
+//
+unsigned int ComputeMinWork(unsigned int nBase, int64_t nTime, const CBlockHeader* pblock)
+{
+	// Testnet has min-difficulty blocks
+	// after nTargetSpacing*2 time between blocks:
+	if (fTestNet && nTime > nTargetSpacing*2)
+		return bnProofOfWorkLimit.GetCompact();
+
+	CBigNum bnResult;
+	bnResult.SetCompact(nBase);
+	while (nTime > 0 && bnResult < bnProofOfWorkLimit)
+	{
+		// Maximum 400% adjustment...
+		bnResult *= 4;
+		// ... in best-case exactly 4-times-normal target time
+		nTime -= nTargetTimespan*4;
+	}
+	if (bnResult > bnProofOfWorkLimit)
+		bnResult = bnProofOfWorkLimit;
+	return bnResult.GetCompact();
+}
+
+bool AcceptBlockTimestamp(CValidationState &state, CBlockIndex* pindexPrev, const CBlockHeader *pblock)
+{
+	return true;	
+}
+
+unsigned int static GetNextWorkRequired_V1(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
+{
+   unsigned int nProofOfWorkLimit = bnProofOfWorkLimit.GetCompact();
+
+	// Genesis block
+	if (pindexLast == NULL)
+		return nProofOfWorkLimit;
+
+	// Only change once per interval
+	if ((pindexLast->nHeight+1) % nInterval != 0)
+	{
+		// Special difficulty rule for testnet:
+		if (fTestNet)
+		{
+			// If the new block's timestamp is more than 2* 10 minutes
+			// then allow mining of a min-difficulty block.
+			if (pblock->nTime > pindexLast->nTime + nTargetSpacing*2)
+				return nProofOfWorkLimit;
+			else
+			{
+				// Return the last non-special-min-difficulty-rules-block
+				const CBlockIndex* pindex = pindexLast;
+				while (pindex->pprev && pindex->nHeight % nInterval != 0 && pindex->nBits == nProofOfWorkLimit)
+					pindex = pindex->pprev;
+				return pindex->nBits;
+			}
+		}
+
+		return pindexLast->nBits;
+	}
+
+	// DarkCoin: This fixes an issue where a 51% attack can change difficulty at will.
+	// Go back the full period unless it's the first retarget after genesis. Code courtesy of Art Forz
+	int blockstogoback = nInterval-1;
+	if ((pindexLast->nHeight+1) != nInterval)
+		blockstogoback = nInterval;
+
+	// Go back by what we want to be 14 days worth of blocks
+	const CBlockIndex* pindexFirst = pindexLast;
+	for (int i = 0; pindexFirst && i < blockstogoback; i++)
+		pindexFirst = pindexFirst->pprev;
+	assert(pindexFirst);
+
+	// Limit adjustment step
+	int64_t nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime();
+	printf("  nActualTimespan = %" PRId64"	before bounds\n", nActualTimespan);
+	if (nActualTimespan < nTargetTimespan/4)
+		nActualTimespan = nTargetTimespan/4;
+	if (nActualTimespan > nTargetTimespan*4)
+		nActualTimespan = nTargetTimespan*4;
+
+	// Retarget
+	CBigNum bnNew;
+	bnNew.SetCompact(pindexLast->nBits);
+	bnNew *= nActualTimespan;
+	bnNew /= nTargetTimespan;
+
+	if (bnNew > bnProofOfWorkLimit)
+		bnNew = bnProofOfWorkLimit;
+
+	return bnNew.GetCompact();
+}
+
+
+unsigned int static KimotoGravityWell(const CBlockIndex* pindexLast, const CBlockHeader *pblock, uint64_t TargetBlocksSpacingSeconds, uint64_t PastBlocksMin, uint64_t PastBlocksMax) {
+
+		const CBlockIndex *BlockLastSolved = pindexLast;
+		const CBlockIndex *BlockReading = pindexLast;
+		const CBlockHeader *BlockCreating = pblock;
+		BlockCreating = BlockCreating;
+		uint64_t PastBlocksMass = 0;
+		int64_t PastRateActualSeconds = 0;
+		int64_t PastRateTargetSeconds = 0;
+		double PastRateAdjustmentRatio = double(1);
+		CBigNum PastDifficultyAverage;
+		CBigNum PastDifficultyAveragePrev;
+		double EventHorizonDeviation;
+		double EventHorizonDeviationFast;
+		double EventHorizonDeviationSlow;
+
+		if (BlockLastSolved == NULL || BlockLastSolved->nHeight == 0 || (uint64_t)BlockLastSolved->nHeight < PastBlocksMin) {
+		   return bnProofOfWorkLimit.GetCompact();
+		}
+
+		int64_t LatestBlockTime = BlockLastSolved->GetBlockTime();
+
+		for (unsigned int i = 1; BlockReading && BlockReading->nHeight > 0; i++) {
+
+			if ((PastBlocksMax > 0) && (i > PastBlocksMax)) {
+			   break;
+			}
+			PastBlocksMass++;
+
+			if (i == 1) {
+			   PastDifficultyAverage.SetCompact(BlockReading->nBits);
+			}
+			else {
+			   PastDifficultyAverage = ((CBigNum().SetCompact(BlockReading->nBits) - PastDifficultyAveragePrev) / i) + PastDifficultyAveragePrev;
+			}
+			PastDifficultyAveragePrev = PastDifficultyAverage;
+
+			if (LatestBlockTime < BlockReading->GetBlockTime()) {
+			   LatestBlockTime = BlockReading->GetBlockTime();
+			}
+
+			PastRateActualSeconds = BlockLastSolved->GetBlockTime() - BlockReading->GetBlockTime();
+			PastRateTargetSeconds = TargetBlocksSpacingSeconds * PastBlocksMass;
+			PastRateAdjustmentRatio = double(1);
+
+			if (PastRateActualSeconds < 1) {
+			   PastRateActualSeconds  = 1;
+			}
+			if ((PastRateActualSeconds != 0) && (PastRateTargetSeconds != 0)) {
+			   PastRateAdjustmentRatio = double(PastRateTargetSeconds) / double(PastRateActualSeconds);
+			}
+			EventHorizonDeviation = 1 + (0.7084 * pow((double(PastBlocksMass)/double(28.2)), -1.228));
+			EventHorizonDeviationFast = EventHorizonDeviation;
+			EventHorizonDeviationSlow = 1 / EventHorizonDeviation;
+
+			if (PastBlocksMass >= PastBlocksMin) {
+			   if ((PastRateAdjustmentRatio <= EventHorizonDeviationSlow) || (PastRateAdjustmentRatio >= EventHorizonDeviationFast)) { assert(BlockReading); break; }
+			}
+			if (BlockReading->pprev == NULL) {
+			   assert(BlockReading);
+			   break;
+			}
+			BlockReading = BlockReading->pprev;
+
+		}
+
+		CBigNum bnNew(PastDifficultyAverage);
+		if (PastRateActualSeconds != 0 && PastRateTargetSeconds != 0) {
+		   bnNew *= PastRateActualSeconds;
+		   bnNew /= PastRateTargetSeconds;
+		}
+
+	if (bnNew > bnProofOfWorkLimit) {
+		bnNew = bnProofOfWorkLimit;
+	}
+
+	return bnNew.GetCompact();
+}
+
+unsigned int static GetNextWorkRequired_V2(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
+{
+		static const int64_t BlocksTargetSpacing   = 60;					// 60 seconds
+		static const unsigned int TimeDaySeconds = 60 * 60 * 24;
+
+		int64_t  PastSecondsMin = TimeDaySeconds * 0.02; // 0.01;
+		int64_t  PastSecondsMax = TimeDaySeconds * 0.30; // 0.14;
+		uint64_t PastBlocksMin	= PastSecondsMin / BlocksTargetSpacing;
+		uint64_t PastBlocksMax	= PastSecondsMax / BlocksTargetSpacing;
+
+		return KimotoGravityWell(pindexLast, pblock, BlocksTargetSpacing, PastBlocksMin, PastBlocksMax);
+}
+
+unsigned int GetNextTrustRequired(const CBlockIndex* pindexLast, const CBlock *pblock)
+{
+		int DiffMode = 1;
+		if (fTestNet) {
+			if    (pindexLast->nHeight+1 >=    50) { DiffMode = 2; }
+		}
+		else {
+			if    (pindexLast->nHeight+1 >= 34804) { DiffMode = 1; }
+			else if (pindexLast->nHeight+1 >= 200) { DiffMode = 2; }
+		}
+		if      (DiffMode == 1) { return GetNextWorkRequired_V1(pindexLast, pblock); }
+		else if (DiffMode == 2) { return GetNextWorkRequired_V2(pindexLast, pblock); }
+		return GetNextWorkRequired_V2(pindexLast, pblock);
+}
+
+
+bool LoadBlockIndex()
+{
+	if (fTestNet)
+	{
+		pchMessageStart[0] = 0xfc;
+		pchMessageStart[1] = 0xc1;
+		pchMessageStart[2] = 0xb7;
+		pchMessageStart[3] = 0xdc;
+		hashGenesisBlock = uint256("0000093faa831b139595fcd1a2d4e9a937d46171d00ecda9c9fb2ec906a552d6");
+	} else {
+		pchMessageStart[0] = 0xd1;
+		pchMessageStart[1] = 0xd2;
+		pchMessageStart[2] = 0xd3;
+		pchMessageStart[3] = 0xdb;
+		//hashGenesisBlock = uint256("00008076809c7be9078977c58db4e849f2252a25d50c59c0c6cdaf59b24485ba");
+		//hashGenesisBlock = uint256("48fbec404c7c044167ae077d319e96b07be7db105585206192c340e107796766");
+		hashGenesisBlock = uint256("00008d7c62b09938fb02932daf4a7d1eaca65a2ceac601150e564ae334259496");
+		
+	}
+
+	//
+	// Load block index from databases
+	//
+	if (!fReindex && !LoadBlockIndexDB())
+		return false;
+
+	return true;
+}
+
+bool InitBlockIndex() {
+	// Check whether we're already initialized
+	if (pindexGenesisBlock != NULL)
+		return true;
+
+	// Use the provided setting for -txindex in the new database
+	fTxIndex = GetBoolArg("-txindex", false);
+	pblocktree->WriteFlag("txindex", fTxIndex);
+	printf("Initializing databases...\n");
+
+	// Only add the genesis block if not reindexing (in which case we reuse the one already on disk)
+	if (!fReindex) {
+
+		const char* pszTimestamp = "NYtimes Feb 25: Germany Sells Five-Year Debt at Negative Yield";
+		CTransaction txNew;
+		txNew.nVersion = 1;
+		printf("txNew version: %d\n", txNew.nVersion);
+		txNew.vin.resize(1);
+		txNew.vout.resize(1);
+		txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
+		txNew.vout[0].nValue = 5000000 * COIN;
+		txNew.vout[0].scriptPubKey = CScript() << ParseHex("03908c4bd37de5f0d99d8402b6ec80c298296f0891bc3e7298b0620f402576adc5") << OP_CHECKSIG;
+		CBlock block;
+		block.vtx.push_back(txNew);
+		block.hashPrevBlock = 0;
+		block.hashMerkleRoot = block.BuildMerkleTree();
+		block.nVersion = 1;
+		block.nTime    = 1426459536;
+		block.nBits    = bnProofOfWorkLimit.GetCompact();
+		block.nNonce   = 2090773291;
+		//block.nNonce   = 2090866385;
+
+		if (fTestNet)
+		{
+			printf("Silly user, there's not testnet here");
+			assert(!fTestNet);
+		}
+
+
+		uint256 hash = block.GetHash();
+		printf("%s\n", hash.ToString().c_str());
+		printf("%s\n", hashGenesisBlock.ToString().c_str());
+		printf("%s\n", block.hashMerkleRoot.ToString().c_str());
+		printf("----\n");
+		if (hash != hashGenesisBlock)
+		{
+			printf("Searching for genesis block...\n");
+			// This will figure out a valid hash and Nonce if you're
+			// creating a different genesis block:
+			uint256 hashTarget = CBigNum().SetCompact(block.nBits).getuint256();
+			// char scratchpad[SCRYPT_SCRATCHPAD_SIZE];
+
+			while(true){
+				hash = block.GetPoWHash();
+				if (hash <= hashTarget)
+					break;
+				if ((block.nNonce & 0xFFF) == 0)
+				{
+					printf("nonce %08X: hash = %s (target = %s)\n", block.nNonce, hash.ToString().c_str(), hashTarget.ToString().c_str());
+				}
+				++block.nNonce;
+				if (block.nNonce == 0)
+				{
+					printf("NONCE WRAPPED, incrementing time\n");
+					++block.nTime;
+				}
+			}
+			printf("block.nTime = %u \n", block.nTime);
+			printf("block.nNonce = %u \n", block.nNonce);
+			printf("block.GetHash = %s\n", block.GetHash().ToString().c_str());
+			printf("block.GetPoWHash = %s\n", block.GetPoWHash().ToString().c_str());
+		}
+
+		printf("%s\n", hash.ToString().c_str());
+		printf("%s\n", hashGenesisBlock.ToString().c_str());
+		printf("%s\n", block.hashMerkleRoot.ToString().c_str());
+		block.print();
+		//assert(block.hashMerkleRoot == uint256("183732b7df12d37a9f227faf4f83f60dc2206e642d48f6d56daee40631326a8d"));
+		//assert(block.hashMerkleRoot == uint256("3b9bbd8816fb38cc334ae2745eb7487596579b979fd1bdbb0c5a574a554d196d"));
+		assert(block.hashMerkleRoot == uint256("07e8717e076506c340350a7d56ee0364023c54ebe07ec5d9d5c8b6bff7454567"));
+		//block.print();
+		assert(hash == hashGenesisBlock);
+
+		// Start new block file
+		try {
+			unsigned int nBlockSize = ::GetSerializeSize(block, SER_DISK, CLIENT_VERSION);
+			CDiskBlockPos blockPos;
+			CValidationState state;
+			if (!FindBlockPos(state, blockPos, nBlockSize+8, 0, block.nTime))
+				return error("LoadBlockIndex() : FindBlockPos failed");
+			if (!block.WriteToDisk(blockPos))
+				return error("LoadBlockIndex() : writing genesis block to disk failed");
+			if (!block.AddToBlockIndex(state, blockPos))
+				return error("LoadBlockIndex() : genesis block not accepted");
+
+        		// connect genesis block so we can spend the foundation grant
+			CCoinsView dummy;
+			CCoinsViewCache view(dummy);
+			if (!block.ConnectBlock(state, pindexGenesisBlock, view))
+				return(error("LoadBlockIndex() : could not connect genesis block"));
+
+		} catch(std::runtime_error &e) {
+			return error("LoadBlockIndex() : failed to initialize block database: %s", e.what());
+		}
+	}
+
+	return true;
+}
+
+namespace Checkpoints
+{
+	// What makes a good checkpoint block?
+	// + Is surrounded by blocks with reasonable timestamps
+	//	 (no blocks before with a timestamp after, none after with
+	//	  timestamp before)
+	// + Contains no strange transactions
+	static MapCheckpoints mapCheckpoints =
+		boost::assign::map_list_of
+		(	0,	uint256("48fbec404c7c044167ae077d319e96b07be7db105585206192c340e107796766"))
+	//	(	2,	uint256("6475f5fde71158860fa84f4f549744b662507aa07120f5f283946f1ac91e2fa7"))
+		;
+	const CCheckpointData data = {
+		&mapCheckpoints,
+		1426479192, // * UNIX timestamp of last checkpoint block
+		3,	// * total number of transactions between genesis and last checkpoint
+					//	 (the tx=... number in the SetBestChain debug.log lines)
+		960.0	   // * estimated number of transactions per day after checkpoint
+	};
+
+	static MapCheckpoints mapCheckpointsTestnet = 
+		boost::assign::map_list_of
+		(	546, uint256("000000002a936ca763904c3c35fce2f3556c559c0214345d31b1bcebf76acb70"))
+//		( 35000, uint256("2af959ab4f12111ce947479bfcef16702485f04afd95210aa90fde7d1e4a64ad"))
+		;
+	const CCheckpointData dataTestnet = {
+		&mapCheckpointsTestnet,
+		1369685559,
+		37581,
+		300
+	}; /* estimated number of transactions per day after checkpoint */
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/old-coins/hamburger.h	Sat Feb 13 19:32:51 2021 -0600
@@ -0,0 +1,68 @@
+// Copyright (c) 2014 Troy Benjegerdes, under AGPLv3
+// Distributed under the Affero GNU General public license version 3
+// file COPYING or http://www.gnu.org/licenses/agpl-3.0.html
+#ifndef CODECOIN_hamburger_H
+#define CODECOIN_hamburger_H
+
+static const int RPC_PORT = 3123;
+static const int P2P_PORT = 3234;
+static const int RPC_PORT_TESTNET = 4123;
+static const int P2P_PORT_TESTNET = 4234;
+
+static const int64_t COIN = 1000000;
+static const int64_t CENT = 10000;
+static const int COIN_DECIMALS = 6; /* decimal places for coin */
+#define COIN_DECIMALS_FMT "06"
+
+/** The maximum allowed size for a serialized block, in bytes (network rule) */
+static const unsigned int MAX_BLOCK_SIZE = 1000000;
+static const unsigned int MAX_BLOCK_SIZE_GEN = MAX_BLOCK_SIZE/2;
+
+/** Dust Soft Limit, allowed with additional fee per output */
+static const int64_t DUST_SOFT_LIMIT = 10000; // 0.001 HAM
+/** Dust Hard Limit, ignored as wallet inputs (mininput default) */
+static const int64_t DUST_HARD_LIMIT = 100;   // 0.00001 HAM mininput
+
+/** Minimum criteria for CTransaction:AllowFree */
+static const int64_t MIN_FREE_PRIORITY = COIN * 576/250;
+/** No amount larger than this (in catoshi) is valid */
+static const int64_t MAX_MONEY = 500000000 * COIN;
+inline bool MoneyRange(int64_t nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
+/** Coinbase transaction outputs can only be spent after this number of new blocks (network rule) */
+static const int COINBASE_MATURITY = 100;
+
+/** Minimum block time spacing (hard limit) **/
+static const int64_t MINIMUM_BLOCK_SPACING = 15;	// Absolute minimum spacing
+
+/** really only used in rpcmining.cpp **/
+static const int RETARGET_INTERVAL = 15;
+
+#define STAKE_TARGET_SPACING nStakeTargetSpacing
+
+// MODIFIER_INTERVAL: time to elapse before new modifier is computed
+static const unsigned int MODIFIER_INTERVAL = 3 * 60 * 60;  // 3 hours
+extern unsigned int nModifierInterval;
+
+// MODIFIER_INTERVAL_RATIO:
+// ratio of group interval length between the last group and the first group
+static const int MODIFIER_INTERVAL_RATIO = 3;
+
+extern const unsigned int nStakeMinAge;
+extern const unsigned int nStakeMaxAge;
+extern const unsigned int nStakeTargetSpacing;
+extern const unsigned int nMaxClockDrift;
+//extern const unsigned int nMinTxOutAmount; // set to = CTransaction::nMinTxFee;
+
+#define CUTOFF_POS_BLOCK nCutoff_Pos_Block
+extern const int CUTOFF_POS_BLOCK;
+
+#define BRAND "Hamburger"
+#define BRAND_upper "Hamburger"
+#define BRAND_lower "hamburger"
+#define BRAND_domain "hamburger.org"
+#define BRAND_CODE "HAM"
+
+#define PPCOINSTAKE
+#define FEATURE_MONEYSUPPLY
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/old-coins/solarcoin.cpp	Sat Feb 13 19:32:51 2021 -0600
@@ -0,0 +1,307 @@
+// Copyright (c) 2009-2010 Satoshi Nakamoto
+// Copyright (c) 2009-2012 The Bitcoin developers
+// Copyright (c) 2013 SolarCoin developers
+// Copyright (c) 2014 Troy Benjegerdes, under AGPLv3
+// Distributed under the Affero GNU General public license version 3
+// file COPYING or http://www.gnu.org/licenses/agpl-3.0.html
+
+#include "solarcoin.h"
+#include "alert.h"
+#include "checkpoints.h"
+#include "db.h"
+#include "txdb.h"
+#include "net.h"
+#include "init.h"
+#include "ui_interface.h"
+#include "checkqueue.h"
+#include <boost/algorithm/string/replace.hpp>
+#include <boost/filesystem.hpp>
+#include <boost/filesystem/fstream.hpp>
+
+using namespace std;
+using namespace boost;
+
+uint256 hashGenesisBlock = 0;			// TODO: objectize this for multicoin support
+CBigNum bnProofOfWorkLimit(~uint256(0) >> 20);	// *coin: starting difficulty is 1 / 2^20
+
+const string strMessageMagic = "SolarCoin Signed Message:\n";
+
+// DNS seeds
+// Each pair gives a source name and a seed name.
+// The first name is used as information source for addrman.
+// The second name should resolve to a list of seed addresses.
+// FIXME use a single string and/or objectify this
+const char *strMainNetDNSSeed[][2] = {
+	{"catstat.info", "seed.catstat.info"},
+	{"solarcoin.org", "seed.solarcoin.org"},
+	{NULL, NULL}
+};
+
+const char *strTestNetDNSSeed[][2] = {
+	{"catstat.info", "testnet-seed.catstat.info"},
+	{"solarcoin.org", "seed.solarcoin.org"},
+	{NULL, NULL}
+};
+
+int64_t GetBlockValue(CBlockIndex *block, int64_t nFees)
+{
+    int64_t nSubsidy = 100 * COIN; 
+	if(block->nHeight < 99) {nSubsidy = 1000000000 * COIN;}
+	nSubsidy >>= (block->nHeight / 525600);
+    return nSubsidy + nFees;
+}
+
+static const int64_t nTargetTimespan_Version1 = 24 * 60 * 60; // SolarCoin: 24 Hours
+static const int64_t nTargetSpacing = 60 ; // SolarCoin: 1 Minute Blocks
+static const int64_t nInterval_Version1 = nTargetTimespan_Version1 / nTargetSpacing; // SolarCoin: 1440 blocks
+
+//this is used in computeminwork but no longer in getnextwork
+static const int64_t nHeight_Version2 = 208440;
+static const int64_t nInterval_Version2 = 15;
+static const int64_t nTargetTimespan_Version2 = nInterval_Version2 * nTargetSpacing; // 15 minutes
+
+//block to apply patch
+static const int64_t DiffChangeBlock = 200000;
+
+//
+// minimum amount of work that could possibly be required nTime after
+// minimum work required was nBase
+//
+unsigned int ComputeMinWork(unsigned int nBase, int64_t nTime)
+{
+	// Testnet has min-difficulty blocks
+	// after nTargetSpacing*2 time between blocks:
+	if (fTestNet && nTime > nTargetSpacing*2)
+		return bnProofOfWorkLimit.GetCompact();
+
+    CBigNum bnResult;
+    bnResult.SetCompact(nBase);
+    while (nTime > 0 && bnResult < bnProofOfWorkLimit)
+    {
+        // Maximum 400% adjustment...
+        bnResult *= 4;
+        // ... in best-case exactly 4-times-normal target time
+        nTime -= nTargetTimespan_Version2*4;
+    }
+    if (bnResult > bnProofOfWorkLimit)
+        bnResult = bnProofOfWorkLimit;
+    return bnResult.GetCompact();
+}
+
+unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
+{
+    unsigned int nProofOfWorkLimit = bnProofOfWorkLimit.GetCompact();
+    int nHeight = pindexLast->nHeight + 1;
+
+    // Genesis block
+    if (pindexLast == NULL)
+        return nProofOfWorkLimit;
+        
+    int64_t nInterval;
+    int64_t nTargetTimespan;
+    
+    nInterval = nInterval_Version1;
+    nTargetTimespan = nTargetTimespan_Version1;
+    
+    
+    if (nHeight >= DiffChangeBlock) {
+        nTargetTimespan = 60; //1 min
+        nInterval = nTargetTimespan / nTargetSpacing; //60/60 = 1 block
+        //target timespan remains the same, 1 min
+    }
+        
+    // Only change once per interval
+    if ((pindexLast->nHeight+1) % nInterval != 0)
+    {
+        // Special difficulty rule for testnet:
+        if (fTestNet)
+        {
+            // If the new block's timestamp is more than 2* 10 minutes
+            // then allow mining of a min-difficulty block.
+            if (pblock->nTime > pindexLast->nTime + nTargetSpacing*2)
+                return nProofOfWorkLimit;
+            
+            /* 5/30 - temporarily removing to test difficulty retargeting
+            else
+            {
+                // Return the last non-special-min-difficulty-rules-block
+                const CBlockIndex* pindex = pindexLast;
+                while (pindex->pprev && pindex->nHeight % nInterval != 0 && pindex->nBits == nProofOfWorkLimit)
+                    pindex = pindex->pprev;
+                return pindex->nBits;
+            } */
+        }
+
+        return pindexLast->nBits;
+    }
+
+    // Litecoin: This fixes an issue where a 51% attack can change difficulty at will.
+    // Go back the full period unless it's the first retarget after genesis. Code courtesy of Art Forz
+    int blockstogoback = nInterval-1;
+    if ((pindexLast->nHeight+1) != nInterval)
+        blockstogoback = nInterval;
+
+    // Go back by what we want to be 14 days worth of blocks
+    const CBlockIndex* pindexFirst = pindexLast;
+    for (int i = 0; pindexFirst && i < blockstogoback; i++)
+        pindexFirst = pindexFirst->pprev;
+    assert(pindexFirst);
+
+    // Limit adjustment step
+    int64_t nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime();
+    printf("  nActualTimespan = %" PRId64"  before bounds\n", nActualTimespan);
+    if (nActualTimespan < nTargetTimespan/4)
+        nActualTimespan = nTargetTimespan/4;
+    if (nActualTimespan > nTargetTimespan*4)
+        nActualTimespan = nTargetTimespan*4;
+    
+    if (nHeight >= DiffChangeBlock) //courtesy RealSolid and WDC
+    {
+        // amplitude filter - thanks to daft27 for this code
+        nActualTimespan = nTargetTimespan + (nActualTimespan - nTargetTimespan)/8;
+        if (nActualTimespan < (nTargetTimespan - (nTargetTimespan/4)) ) nActualTimespan = (nTargetTimespan - (nTargetTimespan/4));
+        if (nActualTimespan > (nTargetTimespan + (nTargetTimespan/2)) ) nActualTimespan = (nTargetTimespan + (nTargetTimespan/2));
+    }
+
+    // Retarget
+    CBigNum bnNew;
+    bnNew.SetCompact(pindexLast->nBits);
+    bnNew *= nActualTimespan;
+    bnNew /= nTargetTimespan;
+
+    if (bnNew > bnProofOfWorkLimit)
+        bnNew = bnProofOfWorkLimit;
+
+    /// debug print
+    printf("GetNextWorkRequired RETARGET\n");
+    printf("nTargetTimespan = %" PRId64"    nActualTimespan = %" PRId64"\n", nTargetTimespan, nActualTimespan);
+    printf("Before: %08x  %s\n", pindexLast->nBits, CBigNum().SetCompact(pindexLast->nBits).getuint256().ToString().c_str());
+    printf("After:  %08x  %s\n", bnNew.GetCompact(), bnNew.getuint256().ToString().c_str());
+
+    return bnNew.GetCompact();
+}
+
+const char *pchSLRMain	= "\x04\xf1\x04\xfd";
+const char *pchSLRTest	= "\xfd\xc0\x5a\xf2";
+
+unsigned char pchMessageStart[4];
+
+bool LoadBlockIndex()
+{
+	if (fTestNet)
+	{	/* yes this could be more elegant */
+		pchMessageStart[0] = pchSLRTest[0];
+		pchMessageStart[1] = pchSLRTest[1];
+		pchMessageStart[2] = pchSLRTest[2];
+		pchMessageStart[3] = pchSLRTest[3];
+		hashGenesisBlock = uint256("0x");
+	} else {
+		pchMessageStart[0] = pchSLRMain[0];
+		pchMessageStart[1] = pchSLRMain[1];
+		pchMessageStart[2] = pchSLRMain[2];
+		pchMessageStart[3] = pchSLRMain[3];
+		hashGenesisBlock = uint256("0xedcf32dbfd327fe7f546d3a175d91b05e955ec1224e087961acc9a2aa8f592ee");
+	}
+
+	//
+	// Load block index from databases
+	//
+	if (!fReindex && !LoadBlockIndexDB())
+		return false;
+
+	return true;
+}
+
+
+bool InitBlockIndex() {
+	// Check whether we're already initialized
+	if (pindexGenesisBlock != NULL)
+		return true;
+
+	// Use the provided setting for -txindex in the new database
+	fTxIndex = GetBoolArg("-txindex", false);
+	pblocktree->WriteFlag("txindex", fTxIndex);
+	printf("Initializing databases...\n");
+
+	// Only add the genesis block if not reindexing (in which case we reuse the one already on disk)
+	if (!fReindex) {
+		// Genesis block
+		const char* pszTimestamp = "One Megawatt Hour";
+		CTransaction txNew;
+		txNew.vin.resize(1);
+		txNew.vout.resize(1);
+		txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
+		txNew.vout[0].nValue = 100 * COIN;
+		txNew.vout[0].scriptPubKey = CScript() << ParseHex("040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9") << OP_CHECKSIG;
+		txNew.strTxComment = "text:SolarCoin genesis block";
+		CBlock block;
+		block.vtx.push_back(txNew);
+		block.hashPrevBlock = 0;
+		block.hashMerkleRoot = block.BuildMerkleTree();
+		block.nVersion = 1;
+		block.nTime    = 1384473600;
+		block.nBits    = 0x1e0ffff0;
+		block.nNonce   = 1397766;
+
+		//// debug print
+		uint256 hash = block.GetHash();
+		printf("%s\n", hash.ToString().c_str());
+		printf("%s\n", hashGenesisBlock.ToString().c_str());
+		printf("%s\n", block.hashMerkleRoot.ToString().c_str());
+		assert(block.hashMerkleRoot == uint256("0x33ecdb1985425f576c65e2c85d7983edc6207038a2910fefaf86cfb4e53185a3"));
+
+		block.print();
+		assert(hash == hashGenesisBlock);
+
+		// Start new block file
+		try {
+			unsigned int nBlockSize = ::GetSerializeSize(block, SER_DISK, CLIENT_VERSION);
+			CDiskBlockPos blockPos;
+			CValidationState state;
+			if (!FindBlockPos(state, blockPos, nBlockSize+8, 0, block.nTime))
+				return error("LoadBlockIndex() : FindBlockPos failed");
+			if (!block.WriteToDisk(blockPos))
+				return error("LoadBlockIndex() : writing genesis block to disk failed");
+			if (!block.AddToBlockIndex(state, blockPos))
+				return error("LoadBlockIndex() : genesis block not accepted");
+		} catch(std::runtime_error &e) {
+			return error("LoadBlockIndex() : failed to initialize block database: %s", e.what());
+		}
+	}
+
+	return true;
+}
+
+namespace Checkpoints
+{
+		// What makes a good checkpoint block?
+	// + Is surrounded by blocks with reasonable timestamps
+	//	 (no blocks before with a timestamp after, none after with
+	//	  timestamp before)
+	// + Contains no strange transactions
+	// TODO put this in catcoin.cpp|.h
+	static MapCheckpoints mapCheckpoints =
+		boost::assign::map_list_of
+	(	0, hashGenesisBlock)
+	(	1, uint256("0xe8666c8715fafbfb095132deb1dd2af63fe14d3d7163715341d48feffab458cc"))
+	(	25, uint256("0xe49cfc3e60515965380cbc3a1add5ab007e5bd2f226624cad9ff0f79eef680cc"))
+	(	50, uint256("0x0b082428186ab2dc55403b2b3c9bd14f087590b204e05c09a656914285520b4d"))
+	(	98, uint256("0xd27e483ae4d334cc65575bcc66d65f7a97913f31188662e2d3fe329675714128"))
+	(	128, uint256("0xbce9c463a9e8b0d7b1c6df522fc80468fb47873c00b7b650f6b8046546c95dd0"))
+	(	50000, uint256("0xf4fd47272011481dda8bc2a7b1305e39ff3429ecf3bcb9bd5af32fdef3945860"))
+	(	100000, uint256("68d5027a570c605f6a0d24f8bad5c454769438eb4a237e93b4ee7a638eaa01b0"))
+	(	150000, uint256("a9d3915cc6c9a18a6fe72429d496c985308c5335e60afe616fe6c8123c6e624f"))
+//	(	200000, uint256("5f295d3a00a74641d9fda7bf538585456b30261d20bf559c4f4ca30a949062fe"))
+//	(	230000, uint256("6ef474fb57b765ced46e28878be7e49648046438894288e983f1d58c8450dfdd"))
+//	(	238000, uint256("c87ccce7cd13651126be87c4eff3d1429bc6e89b0cea417a807487f7cc81d768"))
+	;
+
+	const CCheckpointData data = {
+		&mapCheckpoints,
+		1398103556,     // * UNIX timestamp of last checkpoint block
+		274778,		// * total number of transactions between genesis and last checkpoint
+					//	 (the tx=... number in the SetBestChain debug.log lines)
+		1000.0		// * estimated number of transactions per day after checkpoint
+	};
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/old-coins/solarcoin.h	Sat Feb 13 19:32:51 2021 -0600
@@ -0,0 +1,38 @@
+// Copyright (c) 2014 Troy Benjegerdes, under AGPLv3
+// Distributed under the Affero GNU General public license version 3
+// file COPYING or http://www.gnu.org/licenses/agpl-3.0.html
+#ifndef CODECOIN_solarcoin_H
+#define CODECOIN_solarcoin_H
+
+#include "util.h"
+
+static const int RPC_PORT = 18181;
+static const int RPC_PORT_TESTNET = 28181;
+static const int P2P_PORT = 18188;
+static const int P2P_PORT_TESTNET = 28188;
+
+static const unsigned int TX_COMMENT_LEN = 528;
+
+static const uint64_t COIN = 100000000;
+static const int64_t CENT = 1000000;
+
+static const int RETARGET_INTERVAL = 15;
+
+/** Dust Soft Limit, allowed with additional fee per output */
+static const int64_t DUST_SOFT_LIMIT = 100000; // 0.001 CAT
+/** Dust Hard Limit, ignored as wallet inputs (mininput default) */
+static const int64_t DUST_HARD_LIMIT = 1000;   // 0.00001 CAT mininput
+/** No amount larger than this (in satoshi) is valid */
+static const uint64_t MAX_MONEY = 100000000000 * COIN;
+//inline bool MoneyRange(int64_t nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
+inline bool MoneyRange(uint64_t nValue) { return (nValue <= MAX_MONEY); }
+
+/** Coinbase transaction outputs can only be spent after this number of new blocks (network rule) */
+#warning "this is way too small for long-term stable operation"
+static const int COINBASE_MATURITY = 10; /* solarcoin original, but waaay to small */
+
+#define BRAND "SolarCoin"
+#define BRAND_upper "SolarCoin"
+#define BRAND_lower "solarcoin"
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/old-coins/uro.cpp	Sat Feb 13 19:32:51 2021 -0600
@@ -0,0 +1,387 @@
+// Copyright (c) 2009-2010 Satoshi Nakamoto
+// Copyright (c) 2009-2012 The Bitcoin developers
+// Copyright (c) 2014 Uro Foundation
+// Copyright (c) 2014 Troy Benjegerdes, under AGPLv3
+// Distributed under the Affero GNU General public license version 3
+// file COPYING or http://www.gnu.org/licenses/agpl-3.0.html
+
+#include "uro.h"
+#include "alert.h"
+#include "checkpoints.h"
+#include "db.h"
+#include "txdb.h"
+#include "net.h"
+#include "init.h"
+#include "ui_interface.h"
+#include "checkqueue.h"
+#include <boost/algorithm/string/replace.hpp>
+#include <boost/filesystem.hpp>
+#include <boost/filesystem/fstream.hpp>
+
+using namespace std;
+using namespace boost;
+
+uint256 hashGenesisBlock = 0;			// TODO: objectize this for multicoin support
+CBigNum bnProofOfWorkLimit(~uint256(0) >> 20);	// *coin: starting difficulty is 1 / 2^20
+
+const string strMessageMagic = "Uro Signed Message:\n";
+
+// DNS seeds
+// Each pair gives a source name and a seed name.
+// The first name is used as information source for addrman.
+// The second name should resolve to a list of seed addresses.
+// FIXME use a single string and/or objectify this
+const char *strMainNetDNSSeed[][2] = {
+	{"catstat.info", "seed.catstat.info"},
+	{"uro.io", "uro.io"},
+	{NULL, NULL}
+};
+
+const char *strTestNetDNSSeed[][2] = {
+	{"catstat.info", "testnet-seed.catstat.info"},
+	{"uro.io", "seed.uro.io"},
+	{NULL, NULL}
+};
+
+int64_t GetBlockValue(CBlockIndex *block, int64_t nFees)
+{
+	int64_t nSubsidy = 12 * COIN;
+
+	if (block->nHeight > 83334)
+	{
+		nSubsidy = 0.6 * COIN;
+		return nSubsidy + nFees;
+	}
+
+	return nSubsidy + nFees;
+}
+
+static const int64_t nTargetTimespan = 24 * 60 * 60; // Uro: 24 hours
+static const int64_t nTargetSpacing = 3 * 60; // Uro: 3 minutes
+static const int64_t nInterval = nTargetTimespan / nTargetSpacing;
+
+//
+// minimum amount of work that could possibly be required nTime after
+// minimum work required was nBase
+//
+unsigned int ComputeMinWork(unsigned int nBase, int64_t nTime)
+{
+	// Testnet has min-difficulty blocks
+	// after nTargetSpacing*2 time between blocks:
+	if (fTestNet && nTime > nTargetSpacing*2)
+		return bnProofOfWorkLimit.GetCompact();
+
+	CBigNum bnResult;
+	bnResult.SetCompact(nBase);
+	while (nTime > 0 && bnResult < bnProofOfWorkLimit)
+	{
+		// Maximum 400% adjustment...
+		bnResult *= 4;
+		// ... in best-case exactly 4-times-normal target time
+		nTime -= nTargetTimespan*4;
+	}
+	if (bnResult > bnProofOfWorkLimit)
+		bnResult = bnProofOfWorkLimit;
+	return bnResult.GetCompact();
+}
+
+bool AcceptBlockTimestamp(CValidationState &state, CBlockIndex* pindexPrev, const CBlockHeader *pblock)
+{
+	return true;	
+}
+
+unsigned int static GetNextWorkRequired_V1(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
+{
+	unsigned int nProofOfWorkLimit = bnProofOfWorkLimit.GetCompact();
+
+	// Genesis block
+	if (pindexLast == NULL)
+		return nProofOfWorkLimit;
+
+	// Only change once per interval
+	if ((pindexLast->nHeight+1) % nInterval != 0)
+	{
+		// Special difficulty rule for testnet:
+		if (fTestNet)
+		{
+			// If the new block's timestamp is more than 2* 2.5 minutes
+			// then allow mining of a min-difficulty block.
+			if (pblock->nTime > pindexLast->nTime + nTargetSpacing*2)
+				return nProofOfWorkLimit;
+			else
+			{
+				// Return the last non-special-min-difficulty-rules-block
+				const CBlockIndex* pindex = pindexLast;
+				while (pindex->pprev && pindex->nHeight % nInterval != 0 && pindex->nBits == nProofOfWorkLimit)
+					pindex = pindex->pprev;
+				return pindex->nBits;
+			}
+		}
+
+		return pindexLast->nBits;
+	}
+
+	// Uro: This fixes an issue where a 51% attack can change difficulty at will.
+	// Go back the full period unless it's the first retarget after genesis. Code courtesy of Art Forz
+	int blockstogoback = nInterval-1;
+	if ((pindexLast->nHeight+1) != nInterval)
+		blockstogoback = nInterval;
+
+	// Go back by what we want to be 14 days worth of blocks
+	const CBlockIndex* pindexFirst = pindexLast;
+	for (int i = 0; pindexFirst && i < blockstogoback; i++)
+		pindexFirst = pindexFirst->pprev;
+	assert(pindexFirst);
+
+	// Limit adjustment step
+	int64_t nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime();
+	printf("  nActualTimespan = %" PRId64"  before bounds\n", nActualTimespan);
+	if (nActualTimespan < nTargetTimespan/4)
+		nActualTimespan = nTargetTimespan/4;
+	if (nActualTimespan > nTargetTimespan*4)
+		nActualTimespan = nTargetTimespan*4;
+
+	// Retarget
+	CBigNum bnNew;
+	bnNew.SetCompact(pindexLast->nBits);
+	bnNew *= nActualTimespan;
+	bnNew /= nTargetTimespan;
+
+	if (bnNew > bnProofOfWorkLimit)
+		bnNew = bnProofOfWorkLimit;
+
+#if 0
+	/// debug print
+	printf("GetNextWorkRequired RETARGET\n");
+	printf("nTargetTimespan = %" PRId64"    nActualTimespan = %" PRId64"\n", nTargetTimespan, nActualTimespan);
+	printf("Before: %08x  %s\n", pindexLast->nBits, CBigNum().SetCompact(pindexLast->nBits).getuint256().ToString().c_str());
+	printf("After:	%08x  %s\n", bnNew.GetCompact(), bnNew.getuint256().ToString().c_str());
+#endif
+
+	return bnNew.GetCompact();
+}
+
+
+unsigned int static KimotoGravityWell(const CBlockIndex* pindexLast, const CBlockHeader *pblock, uint64_t TargetBlocksSpacingSeconds, uint64_t PastBlocksMin, uint64_t PastBlocksMax) {
+	/* current difficulty formula, megacoin - kimoto gravity well */
+	const CBlockIndex *BlockLastSolved = pindexLast;
+	const CBlockIndex *BlockReading = pindexLast;
+	const CBlockHeader *BlockCreating = pblock;
+	BlockCreating = BlockCreating;
+	uint64_t PastBlocksMass = 0;
+	int64_t PastRateActualSeconds = 0;
+	int64_t PastRateTargetSeconds = 0;
+	double PastRateAdjustmentRatio = double(1);
+	CBigNum PastDifficultyAverage;
+	CBigNum PastDifficultyAveragePrev;
+	double EventHorizonDeviation;
+	double EventHorizonDeviationFast;
+	double EventHorizonDeviationSlow;
+	
+	if (BlockLastSolved == NULL || BlockLastSolved->nHeight == 0 || (uint64_t)BlockLastSolved->nHeight < PastBlocksMin) { return bnProofOfWorkLimit.GetCompact(); }
+	int64_t LatestBlockTime = BlockLastSolved->GetBlockTime();
+	for (unsigned int i = 1; BlockReading && BlockReading->nHeight > 0; i++) {
+		if (PastBlocksMax > 0 && i > PastBlocksMax) { break; }
+		PastBlocksMass++;
+		
+		if (i == 1) { PastDifficultyAverage.SetCompact(BlockReading->nBits); }
+		else { PastDifficultyAverage = ((CBigNum().SetCompact(BlockReading->nBits) - PastDifficultyAveragePrev) / i) + PastDifficultyAveragePrev; }
+		PastDifficultyAveragePrev = PastDifficultyAverage;
+		
+		if (LatestBlockTime < BlockReading->GetBlockTime()) {
+		       if ((BlockReading->nHeight > 1) || (fTestNet && (BlockReading->nHeight >= 10)))
+			       LatestBlockTime = BlockReading->GetBlockTime();
+	       }
+	       PastRateActualSeconds		       = LatestBlockTime - BlockReading->GetBlockTime();
+		PastRateTargetSeconds = TargetBlocksSpacingSeconds * PastBlocksMass;
+		PastRateAdjustmentRatio = double(1);
+		if ((BlockReading->nHeight > 1) || (fTestNet && (BlockReading->nHeight >= 10))) {
+		       if (PastRateActualSeconds < 1) { PastRateActualSeconds = 1; }
+	       } else {
+		       if (PastRateActualSeconds < 0) { PastRateActualSeconds = 0; }
+	       }
+		if (PastRateActualSeconds != 0 && PastRateTargetSeconds != 0) {
+		PastRateAdjustmentRatio = double(PastRateTargetSeconds) / double(PastRateActualSeconds);
+		}
+		EventHorizonDeviation = 1 + (0.7084 * pow((double(PastBlocksMass)/double(28.2)), -1.228));
+		EventHorizonDeviationFast = EventHorizonDeviation;
+		EventHorizonDeviationSlow = 1 / EventHorizonDeviation;
+		
+		if (PastBlocksMass >= PastBlocksMin) {
+			if ((PastRateAdjustmentRatio <= EventHorizonDeviationSlow) || (PastRateAdjustmentRatio >= EventHorizonDeviationFast)) { assert(BlockReading); break; }
+		}
+		if (BlockReading->pprev == NULL) { assert(BlockReading); break; }
+		BlockReading = BlockReading->pprev;
+	}
+	
+	CBigNum bnNew(PastDifficultyAverage);
+	if (PastRateActualSeconds != 0 && PastRateTargetSeconds != 0) {
+		bnNew *= PastRateActualSeconds;
+		bnNew /= PastRateTargetSeconds;
+	}
+	if (bnNew > bnProofOfWorkLimit) { bnNew = bnProofOfWorkLimit; }
+	printf("GetNextWorkRequired KGW RETARGET\n");
+	printf("PastRateTargetSeconds = %" PRId64" PastRateActualSeconds = %" PRId64"\n", PastRateTargetSeconds, PastRateActualSeconds);
+	printf("Before: %08x  %s\n", pindexLast->nBits, CBigNum().SetCompact(pindexLast->nBits).getuint256().ToString().c_str());
+	printf("After:  %08x  %s\n", bnNew.GetCompact(), bnNew.getuint256().ToString().c_str());
+	
+	return bnNew.GetCompact();
+}
+
+
+unsigned int static GetNextWorkRequired_V2(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
+{
+	static const int64_t BlocksTargetSpacing = 3 * 60; // Uro: 3 minutes
+	static const unsigned int TimeDaySeconds = 24 * 60 * 60; // Uro: 1 day
+	int64_t PastSecondsMin = TimeDaySeconds * 0.025;
+	int64_t PastSecondsMax = TimeDaySeconds * 7;
+	if (pindexLast->nHeight + 1 >= 12760) {
+		PastSecondsMin *= 2;
+	}
+	uint64_t PastBlocksMin = PastSecondsMin / BlocksTargetSpacing;
+	uint64_t PastBlocksMax = PastSecondsMax / BlocksTargetSpacing;
+	
+	return KimotoGravityWell(pindexLast, pblock, BlocksTargetSpacing, PastBlocksMin, PastBlocksMax);
+}
+
+
+unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
+{
+        int DiffMode = 1;
+        if (fTestNet) {
+		DiffMode = 1;
+        } else {
+		if (pindexLast->nHeight + 1 >= 12760) {
+			DiffMode = 2;
+		}
+        }
+      
+        if (DiffMode == 1) { 
+		return GetNextWorkRequired_V1(pindexLast, pblock); 
+	}
+
+        else if (DiffMode == 2) { 
+		return GetNextWorkRequired_V2(pindexLast, pblock); 
+	}
+
+}
+
+const char *pchUROMain	= "\xfe\xc3\xb9\xde";
+const char *pchUROTest	= "\xfe\xc4\xba\xde";
+
+unsigned char pchMessageStart[4];
+
+bool LoadBlockIndex()
+{
+	if (fTestNet)
+	{	/* yes this could be more elegant */
+		pchMessageStart[0] = pchUROTest[0];
+		pchMessageStart[1] = pchUROTest[1];
+		pchMessageStart[2] = pchUROTest[2];
+		pchMessageStart[3] = pchUROTest[3];
+		hashGenesisBlock = uint256("0x");
+	} else {
+		pchMessageStart[0] = pchUROMain[0];
+		pchMessageStart[1] = pchUROMain[1];
+		pchMessageStart[2] = pchUROMain[2];
+		pchMessageStart[3] = pchUROMain[3];
+		hashGenesisBlock = uint256("0x000001196bbe430b7e0cdce3504f5ddfda0d0313ea479526d79afbf4d090a880");
+	}
+
+	//
+	// Load block index from databases
+	//
+	if (!fReindex && !LoadBlockIndexDB())
+		return false;
+
+	return true;
+}
+
+
+bool InitBlockIndex() {
+	// Check whether we're already initialized
+	if (pindexGenesisBlock != NULL)
+		return true;
+
+	// Use the provided setting for -txindex in the new database
+	fTxIndex = GetBoolArg("-txindex", false);
+	pblocktree->WriteFlag("txindex", fTxIndex);
+	printf("Initializing databases...\n");
+
+	// Only add the genesis block if not reindexing (in which case we reuse the one already on disk)
+	if (!fReindex) {
+		// Genesis block
+		const char* pszTimestamp = "URO";
+		CTransaction txNew;
+		txNew.vin.resize(1);
+		txNew.vout.resize(1);
+		txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
+		txNew.vout[0].nValue = 40 * COIN;
+		txNew.vout[0].scriptPubKey = CScript() << ParseHex("040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9") << OP_CHECKSIG;
+		CBlock block;
+		block.vtx.push_back(txNew);
+		block.hashPrevBlock = 0;
+		block.hashMerkleRoot = block.BuildMerkleTree();
+		block.nVersion = 1;
+		block.nTime    = 1398093006;
+		block.nBits    = 0x1e0ffff0;
+		block.nNonce   = 307242;
+
+		if (fTestNet)
+		{
+			block.nTime    = 1398093006;
+			block.nNonce   = 307242;
+		}
+
+		//// debug print
+		uint256 hash = block.GetHash();
+		printf("%s\n", hash.ToString().c_str());
+		printf("%s\n", hashGenesisBlock.ToString().c_str());
+		printf("%s\n", block.hashMerkleRoot.ToString().c_str());
+		assert(block.hashMerkleRoot == uint256("0xcf112b0792eaf749de18d633d3545aecd7b1343d78e14a830a242a03a6c31339"));
+
+		block.print();
+		assert(hash == hashGenesisBlock);
+
+		// Start new block file
+		try {
+			unsigned int nBlockSize = ::GetSerializeSize(block, SER_DISK, CLIENT_VERSION);
+			CDiskBlockPos blockPos;
+			CValidationState state;
+			if (!FindBlockPos(state, blockPos, nBlockSize+8, 0, block.nTime))
+				return error("LoadBlockIndex() : FindBlockPos failed");
+			if (!block.WriteToDisk(blockPos))
+				return error("LoadBlockIndex() : writing genesis block to disk failed");
+			if (!block.AddToBlockIndex(state, blockPos))
+				return error("LoadBlockIndex() : genesis block not accepted");
+			// TODO: add sync checkpoint
+		} catch(std::runtime_error &e) {
+			return error("LoadBlockIndex() : failed to initialize block database: %s", e.what());
+		}
+	}
+
+	return true;
+}
+
+namespace Checkpoints
+{
+		// What makes a good checkpoint block?
+	// + Is surrounded by blocks with reasonable timestamps
+	//	 (no blocks before with a timestamp after, none after with
+	//	  timestamp before)
+	// + Contains no strange transactions
+	// TODO put this in catcoin.cpp|.h
+	static MapCheckpoints mapCheckpoints =
+		boost::assign::map_list_of
+	(	0, hashGenesisBlock)
+	;
+
+	const CCheckpointData data = {
+		&mapCheckpoints,
+		1398103556,     // * UNIX timestamp of last checkpoint block
+		274778,		// * total number of transactions between genesis and last checkpoint
+					//	 (the tx=... number in the SetBestChain debug.log lines)
+		1000.0		// * estimated number of transactions per day after checkpoint
+	};
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/old-coins/uro.h	Sat Feb 13 19:32:51 2021 -0600
@@ -0,0 +1,37 @@
+// Copyright (c) 2014 Troy Benjegerdes, under AGPLv3
+// Distributed under the Affero GNU General public license version 3
+// file COPYING or http://www.gnu.org/licenses/agpl-3.0.html
+#ifndef CODECOIN_solarcoin_H
+#define CODECOIN_solarcoin_H
+
+#include "util.h"
+
+static const int RPC_PORT = 36347;
+static const int RPC_PORT_TESTNET = 26347;
+static const int P2P_PORT = 36348;
+static const int P2P_PORT_TESTNET = 26348;
+
+static const uint64_t COIN = 100000000;
+static const int64_t CENT = 1000000;
+
+static const int RETARGET_INTERVAL = 480; /* 24 hours */
+
+/** Dust Soft Limit, allowed with additional fee per output */
+static const int64_t DUST_SOFT_LIMIT = 100000; // 0.001 CAT
+/** Dust Hard Limit, ignored as wallet inputs (mininput default) */
+static const int64_t DUST_HARD_LIMIT = 1000;   // 0.00001 CAT mininput
+/** No amount larger than this (in satoshi) is valid */
+static const int64_t MAX_MONEY = 10000000 * COIN;
+inline bool MoneyRange(int64_t nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
+
+/** Coinbase transaction outputs can only be spent after this number of new blocks (network rule) */
+static const int COINBASE_MATURITY = 20; /* probably to small */
+
+/** Minimum block time spacing (see also: AcceptBlockTimestamp) **/
+static const int64_t MINIMUM_BLOCK_SPACING = 1;	// Absolute minimum spacing:
+
+#define BRAND "Uro"
+#define BRAND_upper "Uro"
+#define BRAND_lower "uro"
+
+#endif
--- a/src/solarcoin.cpp	Sat Feb 13 18:53:44 2021 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,307 +0,0 @@
-// Copyright (c) 2009-2010 Satoshi Nakamoto
-// Copyright (c) 2009-2012 The Bitcoin developers
-// Copyright (c) 2013 SolarCoin developers
-// Copyright (c) 2014 Troy Benjegerdes, under AGPLv3
-// Distributed under the Affero GNU General public license version 3
-// file COPYING or http://www.gnu.org/licenses/agpl-3.0.html
-
-#include "solarcoin.h"
-#include "alert.h"
-#include "checkpoints.h"
-#include "db.h"
-#include "txdb.h"
-#include "net.h"
-#include "init.h"
-#include "ui_interface.h"
-#include "checkqueue.h"
-#include <boost/algorithm/string/replace.hpp>
-#include <boost/filesystem.hpp>
-#include <boost/filesystem/fstream.hpp>
-
-using namespace std;
-using namespace boost;
-
-uint256 hashGenesisBlock = 0;			// TODO: objectize this for multicoin support
-CBigNum bnProofOfWorkLimit(~uint256(0) >> 20);	// *coin: starting difficulty is 1 / 2^20
-
-const string strMessageMagic = "SolarCoin Signed Message:\n";
-
-// DNS seeds
-// Each pair gives a source name and a seed name.
-// The first name is used as information source for addrman.
-// The second name should resolve to a list of seed addresses.
-// FIXME use a single string and/or objectify this
-const char *strMainNetDNSSeed[][2] = {
-	{"catstat.info", "seed.catstat.info"},
-	{"solarcoin.org", "seed.solarcoin.org"},
-	{NULL, NULL}
-};
-
-const char *strTestNetDNSSeed[][2] = {
-	{"catstat.info", "testnet-seed.catstat.info"},
-	{"solarcoin.org", "seed.solarcoin.org"},
-	{NULL, NULL}
-};
-
-int64_t GetBlockValue(CBlockIndex *block, int64_t nFees)
-{
-    int64_t nSubsidy = 100 * COIN; 
-	if(block->nHeight < 99) {nSubsidy = 1000000000 * COIN;}
-	nSubsidy >>= (block->nHeight / 525600);
-    return nSubsidy + nFees;
-}
-
-static const int64_t nTargetTimespan_Version1 = 24 * 60 * 60; // SolarCoin: 24 Hours
-static const int64_t nTargetSpacing = 60 ; // SolarCoin: 1 Minute Blocks
-static const int64_t nInterval_Version1 = nTargetTimespan_Version1 / nTargetSpacing; // SolarCoin: 1440 blocks
-
-//this is used in computeminwork but no longer in getnextwork
-static const int64_t nHeight_Version2 = 208440;
-static const int64_t nInterval_Version2 = 15;
-static const int64_t nTargetTimespan_Version2 = nInterval_Version2 * nTargetSpacing; // 15 minutes
-
-//block to apply patch
-static const int64_t DiffChangeBlock = 200000;
-
-//
-// minimum amount of work that could possibly be required nTime after
-// minimum work required was nBase
-//
-unsigned int ComputeMinWork(unsigned int nBase, int64_t nTime)
-{
-	// Testnet has min-difficulty blocks
-	// after nTargetSpacing*2 time between blocks:
-	if (fTestNet && nTime > nTargetSpacing*2)
-		return bnProofOfWorkLimit.GetCompact();
-
-    CBigNum bnResult;
-    bnResult.SetCompact(nBase);
-    while (nTime > 0 && bnResult < bnProofOfWorkLimit)
-    {
-        // Maximum 400% adjustment...
-        bnResult *= 4;
-        // ... in best-case exactly 4-times-normal target time
-        nTime -= nTargetTimespan_Version2*4;
-    }
-    if (bnResult > bnProofOfWorkLimit)
-        bnResult = bnProofOfWorkLimit;
-    return bnResult.GetCompact();
-}
-
-unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
-{
-    unsigned int nProofOfWorkLimit = bnProofOfWorkLimit.GetCompact();
-    int nHeight = pindexLast->nHeight + 1;
-
-    // Genesis block
-    if (pindexLast == NULL)
-        return nProofOfWorkLimit;
-        
-    int64_t nInterval;
-    int64_t nTargetTimespan;
-    
-    nInterval = nInterval_Version1;
-    nTargetTimespan = nTargetTimespan_Version1;
-    
-    
-    if (nHeight >= DiffChangeBlock) {
-        nTargetTimespan = 60; //1 min
-        nInterval = nTargetTimespan / nTargetSpacing; //60/60 = 1 block
-        //target timespan remains the same, 1 min
-    }
-        
-    // Only change once per interval
-    if ((pindexLast->nHeight+1) % nInterval != 0)
-    {
-        // Special difficulty rule for testnet:
-        if (fTestNet)
-        {
-            // If the new block's timestamp is more than 2* 10 minutes
-            // then allow mining of a min-difficulty block.
-            if (pblock->nTime > pindexLast->nTime + nTargetSpacing*2)
-                return nProofOfWorkLimit;
-            
-            /* 5/30 - temporarily removing to test difficulty retargeting
-            else
-            {
-                // Return the last non-special-min-difficulty-rules-block
-                const CBlockIndex* pindex = pindexLast;
-                while (pindex->pprev && pindex->nHeight % nInterval != 0 && pindex->nBits == nProofOfWorkLimit)
-                    pindex = pindex->pprev;
-                return pindex->nBits;
-            } */
-        }
-
-        return pindexLast->nBits;
-    }
-
-    // Litecoin: This fixes an issue where a 51% attack can change difficulty at will.
-    // Go back the full period unless it's the first retarget after genesis. Code courtesy of Art Forz
-    int blockstogoback = nInterval-1;
-    if ((pindexLast->nHeight+1) != nInterval)
-        blockstogoback = nInterval;
-
-    // Go back by what we want to be 14 days worth of blocks
-    const CBlockIndex* pindexFirst = pindexLast;
-    for (int i = 0; pindexFirst && i < blockstogoback; i++)
-        pindexFirst = pindexFirst->pprev;
-    assert(pindexFirst);
-
-    // Limit adjustment step
-    int64_t nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime();
-    printf("  nActualTimespan = %" PRId64"  before bounds\n", nActualTimespan);
-    if (nActualTimespan < nTargetTimespan/4)
-        nActualTimespan = nTargetTimespan/4;
-    if (nActualTimespan > nTargetTimespan*4)
-        nActualTimespan = nTargetTimespan*4;
-    
-    if (nHeight >= DiffChangeBlock) //courtesy RealSolid and WDC
-    {
-        // amplitude filter - thanks to daft27 for this code
-        nActualTimespan = nTargetTimespan + (nActualTimespan - nTargetTimespan)/8;
-        if (nActualTimespan < (nTargetTimespan - (nTargetTimespan/4)) ) nActualTimespan = (nTargetTimespan - (nTargetTimespan/4));
-        if (nActualTimespan > (nTargetTimespan + (nTargetTimespan/2)) ) nActualTimespan = (nTargetTimespan + (nTargetTimespan/2));
-    }
-
-    // Retarget
-    CBigNum bnNew;
-    bnNew.SetCompact(pindexLast->nBits);
-    bnNew *= nActualTimespan;
-    bnNew /= nTargetTimespan;
-
-    if (bnNew > bnProofOfWorkLimit)
-        bnNew = bnProofOfWorkLimit;
-
-    /// debug print
-    printf("GetNextWorkRequired RETARGET\n");
-    printf("nTargetTimespan = %" PRId64"    nActualTimespan = %" PRId64"\n", nTargetTimespan, nActualTimespan);
-    printf("Before: %08x  %s\n", pindexLast->nBits, CBigNum().SetCompact(pindexLast->nBits).getuint256().ToString().c_str());
-    printf("After:  %08x  %s\n", bnNew.GetCompact(), bnNew.getuint256().ToString().c_str());
-
-    return bnNew.GetCompact();
-}
-
-const char *pchSLRMain	= "\x04\xf1\x04\xfd";
-const char *pchSLRTest	= "\xfd\xc0\x5a\xf2";
-
-unsigned char pchMessageStart[4];
-
-bool LoadBlockIndex()
-{
-	if (fTestNet)
-	{	/* yes this could be more elegant */
-		pchMessageStart[0] = pchSLRTest[0];
-		pchMessageStart[1] = pchSLRTest[1];
-		pchMessageStart[2] = pchSLRTest[2];
-		pchMessageStart[3] = pchSLRTest[3];
-		hashGenesisBlock = uint256("0x");
-	} else {
-		pchMessageStart[0] = pchSLRMain[0];
-		pchMessageStart[1] = pchSLRMain[1];
-		pchMessageStart[2] = pchSLRMain[2];
-		pchMessageStart[3] = pchSLRMain[3];
-		hashGenesisBlock = uint256("0xedcf32dbfd327fe7f546d3a175d91b05e955ec1224e087961acc9a2aa8f592ee");
-	}
-
-	//
-	// Load block index from databases
-	//
-	if (!fReindex && !LoadBlockIndexDB())
-		return false;
-
-	return true;
-}
-
-
-bool InitBlockIndex() {
-	// Check whether we're already initialized
-	if (pindexGenesisBlock != NULL)
-		return true;
-
-	// Use the provided setting for -txindex in the new database
-	fTxIndex = GetBoolArg("-txindex", false);
-	pblocktree->WriteFlag("txindex", fTxIndex);
-	printf("Initializing databases...\n");
-
-	// Only add the genesis block if not reindexing (in which case we reuse the one already on disk)
-	if (!fReindex) {
-		// Genesis block
-		const char* pszTimestamp = "One Megawatt Hour";
-		CTransaction txNew;
-		txNew.vin.resize(1);
-		txNew.vout.resize(1);
-		txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
-		txNew.vout[0].nValue = 100 * COIN;
-		txNew.vout[0].scriptPubKey = CScript() << ParseHex("040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9") << OP_CHECKSIG;
-		txNew.strTxComment = "text:SolarCoin genesis block";
-		CBlock block;
-		block.vtx.push_back(txNew);
-		block.hashPrevBlock = 0;
-		block.hashMerkleRoot = block.BuildMerkleTree();
-		block.nVersion = 1;
-		block.nTime    = 1384473600;
-		block.nBits    = 0x1e0ffff0;
-		block.nNonce   = 1397766;
-
-		//// debug print
-		uint256 hash = block.GetHash();
-		printf("%s\n", hash.ToString().c_str());
-		printf("%s\n", hashGenesisBlock.ToString().c_str());
-		printf("%s\n", block.hashMerkleRoot.ToString().c_str());
-		assert(block.hashMerkleRoot == uint256("0x33ecdb1985425f576c65e2c85d7983edc6207038a2910fefaf86cfb4e53185a3"));
-
-		block.print();
-		assert(hash == hashGenesisBlock);
-
-		// Start new block file
-		try {
-			unsigned int nBlockSize = ::GetSerializeSize(block, SER_DISK, CLIENT_VERSION);
-			CDiskBlockPos blockPos;
-			CValidationState state;
-			if (!FindBlockPos(state, blockPos, nBlockSize+8, 0, block.nTime))
-				return error("LoadBlockIndex() : FindBlockPos failed");
-			if (!block.WriteToDisk(blockPos))
-				return error("LoadBlockIndex() : writing genesis block to disk failed");
-			if (!block.AddToBlockIndex(state, blockPos))
-				return error("LoadBlockIndex() : genesis block not accepted");
-		} catch(std::runtime_error &e) {
-			return error("LoadBlockIndex() : failed to initialize block database: %s", e.what());
-		}
-	}
-
-	return true;
-}
-
-namespace Checkpoints
-{
-		// What makes a good checkpoint block?
-	// + Is surrounded by blocks with reasonable timestamps
-	//	 (no blocks before with a timestamp after, none after with
-	//	  timestamp before)
-	// + Contains no strange transactions
-	// TODO put this in catcoin.cpp|.h
-	static MapCheckpoints mapCheckpoints =
-		boost::assign::map_list_of
-	(	0, hashGenesisBlock)
-	(	1, uint256("0xe8666c8715fafbfb095132deb1dd2af63fe14d3d7163715341d48feffab458cc"))
-	(	25, uint256("0xe49cfc3e60515965380cbc3a1add5ab007e5bd2f226624cad9ff0f79eef680cc"))
-	(	50, uint256("0x0b082428186ab2dc55403b2b3c9bd14f087590b204e05c09a656914285520b4d"))
-	(	98, uint256("0xd27e483ae4d334cc65575bcc66d65f7a97913f31188662e2d3fe329675714128"))
-	(	128, uint256("0xbce9c463a9e8b0d7b1c6df522fc80468fb47873c00b7b650f6b8046546c95dd0"))
-	(	50000, uint256("0xf4fd47272011481dda8bc2a7b1305e39ff3429ecf3bcb9bd5af32fdef3945860"))
-	(	100000, uint256("68d5027a570c605f6a0d24f8bad5c454769438eb4a237e93b4ee7a638eaa01b0"))
-	(	150000, uint256("a9d3915cc6c9a18a6fe72429d496c985308c5335e60afe616fe6c8123c6e624f"))
-//	(	200000, uint256("5f295d3a00a74641d9fda7bf538585456b30261d20bf559c4f4ca30a949062fe"))
-//	(	230000, uint256("6ef474fb57b765ced46e28878be7e49648046438894288e983f1d58c8450dfdd"))
-//	(	238000, uint256("c87ccce7cd13651126be87c4eff3d1429bc6e89b0cea417a807487f7cc81d768"))
-	;
-
-	const CCheckpointData data = {
-		&mapCheckpoints,
-		1398103556,     // * UNIX timestamp of last checkpoint block
-		274778,		// * total number of transactions between genesis and last checkpoint
-					//	 (the tx=... number in the SetBestChain debug.log lines)
-		1000.0		// * estimated number of transactions per day after checkpoint
-	};
-
-}
--- a/src/solarcoin.h	Sat Feb 13 18:53:44 2021 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-// Copyright (c) 2014 Troy Benjegerdes, under AGPLv3
-// Distributed under the Affero GNU General public license version 3
-// file COPYING or http://www.gnu.org/licenses/agpl-3.0.html
-#ifndef CODECOIN_solarcoin_H
-#define CODECOIN_solarcoin_H
-
-#include "util.h"
-
-static const int RPC_PORT = 18181;
-static const int RPC_PORT_TESTNET = 28181;
-static const int P2P_PORT = 18188;
-static const int P2P_PORT_TESTNET = 28188;
-
-static const unsigned int TX_COMMENT_LEN = 528;
-
-static const uint64_t COIN = 100000000;
-static const int64_t CENT = 1000000;
-
-static const int RETARGET_INTERVAL = 15;
-
-/** Dust Soft Limit, allowed with additional fee per output */
-static const int64_t DUST_SOFT_LIMIT = 100000; // 0.001 CAT
-/** Dust Hard Limit, ignored as wallet inputs (mininput default) */
-static const int64_t DUST_HARD_LIMIT = 1000;   // 0.00001 CAT mininput
-/** No amount larger than this (in satoshi) is valid */
-static const uint64_t MAX_MONEY = 100000000000 * COIN;
-//inline bool MoneyRange(int64_t nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
-inline bool MoneyRange(uint64_t nValue) { return (nValue <= MAX_MONEY); }
-
-/** Coinbase transaction outputs can only be spent after this number of new blocks (network rule) */
-#warning "this is way too small for long-term stable operation"
-static const int COINBASE_MATURITY = 10; /* solarcoin original, but waaay to small */
-
-#define BRAND "SolarCoin"
-#define BRAND_upper "SolarCoin"
-#define BRAND_lower "solarcoin"
-
-#endif
--- a/src/uro.cpp	Sat Feb 13 18:53:44 2021 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,387 +0,0 @@
-// Copyright (c) 2009-2010 Satoshi Nakamoto
-// Copyright (c) 2009-2012 The Bitcoin developers
-// Copyright (c) 2014 Uro Foundation
-// Copyright (c) 2014 Troy Benjegerdes, under AGPLv3
-// Distributed under the Affero GNU General public license version 3
-// file COPYING or http://www.gnu.org/licenses/agpl-3.0.html
-
-#include "uro.h"
-#include "alert.h"
-#include "checkpoints.h"
-#include "db.h"
-#include "txdb.h"
-#include "net.h"
-#include "init.h"
-#include "ui_interface.h"
-#include "checkqueue.h"
-#include <boost/algorithm/string/replace.hpp>
-#include <boost/filesystem.hpp>
-#include <boost/filesystem/fstream.hpp>
-
-using namespace std;
-using namespace boost;
-
-uint256 hashGenesisBlock = 0;			// TODO: objectize this for multicoin support
-CBigNum bnProofOfWorkLimit(~uint256(0) >> 20);	// *coin: starting difficulty is 1 / 2^20
-
-const string strMessageMagic = "Uro Signed Message:\n";
-
-// DNS seeds
-// Each pair gives a source name and a seed name.
-// The first name is used as information source for addrman.
-// The second name should resolve to a list of seed addresses.
-// FIXME use a single string and/or objectify this
-const char *strMainNetDNSSeed[][2] = {
-	{"catstat.info", "seed.catstat.info"},
-	{"uro.io", "uro.io"},
-	{NULL, NULL}
-};
-
-const char *strTestNetDNSSeed[][2] = {
-	{"catstat.info", "testnet-seed.catstat.info"},
-	{"uro.io", "seed.uro.io"},
-	{NULL, NULL}
-};
-
-int64_t GetBlockValue(CBlockIndex *block, int64_t nFees)
-{
-	int64_t nSubsidy = 12 * COIN;
-
-	if (block->nHeight > 83334)
-	{
-		nSubsidy = 0.6 * COIN;
-		return nSubsidy + nFees;
-	}
-
-	return nSubsidy + nFees;
-}
-
-static const int64_t nTargetTimespan = 24 * 60 * 60; // Uro: 24 hours
-static const int64_t nTargetSpacing = 3 * 60; // Uro: 3 minutes
-static const int64_t nInterval = nTargetTimespan / nTargetSpacing;
-
-//
-// minimum amount of work that could possibly be required nTime after
-// minimum work required was nBase
-//
-unsigned int ComputeMinWork(unsigned int nBase, int64_t nTime)
-{
-	// Testnet has min-difficulty blocks
-	// after nTargetSpacing*2 time between blocks:
-	if (fTestNet && nTime > nTargetSpacing*2)
-		return bnProofOfWorkLimit.GetCompact();
-
-	CBigNum bnResult;
-	bnResult.SetCompact(nBase);
-	while (nTime > 0 && bnResult < bnProofOfWorkLimit)
-	{
-		// Maximum 400% adjustment...
-		bnResult *= 4;
-		// ... in best-case exactly 4-times-normal target time
-		nTime -= nTargetTimespan*4;
-	}
-	if (bnResult > bnProofOfWorkLimit)
-		bnResult = bnProofOfWorkLimit;
-	return bnResult.GetCompact();
-}
-
-bool AcceptBlockTimestamp(CValidationState &state, CBlockIndex* pindexPrev, const CBlockHeader *pblock)
-{
-	return true;	
-}
-
-unsigned int static GetNextWorkRequired_V1(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
-{
-	unsigned int nProofOfWorkLimit = bnProofOfWorkLimit.GetCompact();
-
-	// Genesis block
-	if (pindexLast == NULL)
-		return nProofOfWorkLimit;
-
-	// Only change once per interval
-	if ((pindexLast->nHeight+1) % nInterval != 0)
-	{
-		// Special difficulty rule for testnet:
-		if (fTestNet)
-		{
-			// If the new block's timestamp is more than 2* 2.5 minutes
-			// then allow mining of a min-difficulty block.
-			if (pblock->nTime > pindexLast->nTime + nTargetSpacing*2)
-				return nProofOfWorkLimit;
-			else
-			{
-				// Return the last non-special-min-difficulty-rules-block
-				const CBlockIndex* pindex = pindexLast;
-				while (pindex->pprev && pindex->nHeight % nInterval != 0 && pindex->nBits == nProofOfWorkLimit)
-					pindex = pindex->pprev;
-				return pindex->nBits;
-			}
-		}
-
-		return pindexLast->nBits;
-	}
-
-	// Uro: This fixes an issue where a 51% attack can change difficulty at will.
-	// Go back the full period unless it's the first retarget after genesis. Code courtesy of Art Forz
-	int blockstogoback = nInterval-1;
-	if ((pindexLast->nHeight+1) != nInterval)
-		blockstogoback = nInterval;
-
-	// Go back by what we want to be 14 days worth of blocks
-	const CBlockIndex* pindexFirst = pindexLast;
-	for (int i = 0; pindexFirst && i < blockstogoback; i++)
-		pindexFirst = pindexFirst->pprev;
-	assert(pindexFirst);
-
-	// Limit adjustment step
-	int64_t nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime();
-	printf("  nActualTimespan = %" PRId64"  before bounds\n", nActualTimespan);
-	if (nActualTimespan < nTargetTimespan/4)
-		nActualTimespan = nTargetTimespan/4;
-	if (nActualTimespan > nTargetTimespan*4)
-		nActualTimespan = nTargetTimespan*4;
-
-	// Retarget
-	CBigNum bnNew;
-	bnNew.SetCompact(pindexLast->nBits);
-	bnNew *= nActualTimespan;
-	bnNew /= nTargetTimespan;
-
-	if (bnNew > bnProofOfWorkLimit)
-		bnNew = bnProofOfWorkLimit;
-
-#if 0
-	/// debug print
-	printf("GetNextWorkRequired RETARGET\n");
-	printf("nTargetTimespan = %" PRId64"    nActualTimespan = %" PRId64"\n", nTargetTimespan, nActualTimespan);
-	printf("Before: %08x  %s\n", pindexLast->nBits, CBigNum().SetCompact(pindexLast->nBits).getuint256().ToString().c_str());
-	printf("After:	%08x  %s\n", bnNew.GetCompact(), bnNew.getuint256().ToString().c_str());
-#endif
-
-	return bnNew.GetCompact();
-}
-
-
-unsigned int static KimotoGravityWell(const CBlockIndex* pindexLast, const CBlockHeader *pblock, uint64_t TargetBlocksSpacingSeconds, uint64_t PastBlocksMin, uint64_t PastBlocksMax) {
-	/* current difficulty formula, megacoin - kimoto gravity well */
-	const CBlockIndex *BlockLastSolved = pindexLast;
-	const CBlockIndex *BlockReading = pindexLast;
-	const CBlockHeader *BlockCreating = pblock;
-	BlockCreating = BlockCreating;
-	uint64_t PastBlocksMass = 0;
-	int64_t PastRateActualSeconds = 0;
-	int64_t PastRateTargetSeconds = 0;
-	double PastRateAdjustmentRatio = double(1);
-	CBigNum PastDifficultyAverage;
-	CBigNum PastDifficultyAveragePrev;
-	double EventHorizonDeviation;
-	double EventHorizonDeviationFast;
-	double EventHorizonDeviationSlow;
-	
-	if (BlockLastSolved == NULL || BlockLastSolved->nHeight == 0 || (uint64_t)BlockLastSolved->nHeight < PastBlocksMin) { return bnProofOfWorkLimit.GetCompact(); }
-	int64_t LatestBlockTime = BlockLastSolved->GetBlockTime();
-	for (unsigned int i = 1; BlockReading && BlockReading->nHeight > 0; i++) {
-		if (PastBlocksMax > 0 && i > PastBlocksMax) { break; }
-		PastBlocksMass++;
-		
-		if (i == 1) { PastDifficultyAverage.SetCompact(BlockReading->nBits); }
-		else { PastDifficultyAverage = ((CBigNum().SetCompact(BlockReading->nBits) - PastDifficultyAveragePrev) / i) + PastDifficultyAveragePrev; }
-		PastDifficultyAveragePrev = PastDifficultyAverage;
-		
-		if (LatestBlockTime < BlockReading->GetBlockTime()) {
-		       if ((BlockReading->nHeight > 1) || (fTestNet && (BlockReading->nHeight >= 10)))
-			       LatestBlockTime = BlockReading->GetBlockTime();
-	       }
-	       PastRateActualSeconds		       = LatestBlockTime - BlockReading->GetBlockTime();
-		PastRateTargetSeconds = TargetBlocksSpacingSeconds * PastBlocksMass;
-		PastRateAdjustmentRatio = double(1);
-		if ((BlockReading->nHeight > 1) || (fTestNet && (BlockReading->nHeight >= 10))) {
-		       if (PastRateActualSeconds < 1) { PastRateActualSeconds = 1; }
-	       } else {
-		       if (PastRateActualSeconds < 0) { PastRateActualSeconds = 0; }
-	       }
-		if (PastRateActualSeconds != 0 && PastRateTargetSeconds != 0) {
-		PastRateAdjustmentRatio = double(PastRateTargetSeconds) / double(PastRateActualSeconds);
-		}
-		EventHorizonDeviation = 1 + (0.7084 * pow((double(PastBlocksMass)/double(28.2)), -1.228));
-		EventHorizonDeviationFast = EventHorizonDeviation;
-		EventHorizonDeviationSlow = 1 / EventHorizonDeviation;
-		
-		if (PastBlocksMass >= PastBlocksMin) {
-			if ((PastRateAdjustmentRatio <= EventHorizonDeviationSlow) || (PastRateAdjustmentRatio >= EventHorizonDeviationFast)) { assert(BlockReading); break; }
-		}
-		if (BlockReading->pprev == NULL) { assert(BlockReading); break; }
-		BlockReading = BlockReading->pprev;
-	}
-	
-	CBigNum bnNew(PastDifficultyAverage);
-	if (PastRateActualSeconds != 0 && PastRateTargetSeconds != 0) {
-		bnNew *= PastRateActualSeconds;
-		bnNew /= PastRateTargetSeconds;
-	}
-	if (bnNew > bnProofOfWorkLimit) { bnNew = bnProofOfWorkLimit; }
-	printf("GetNextWorkRequired KGW RETARGET\n");
-	printf("PastRateTargetSeconds = %" PRId64" PastRateActualSeconds = %" PRId64"\n", PastRateTargetSeconds, PastRateActualSeconds);
-	printf("Before: %08x  %s\n", pindexLast->nBits, CBigNum().SetCompact(pindexLast->nBits).getuint256().ToString().c_str());
-	printf("After:  %08x  %s\n", bnNew.GetCompact(), bnNew.getuint256().ToString().c_str());
-	
-	return bnNew.GetCompact();
-}
-
-
-unsigned int static GetNextWorkRequired_V2(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
-{
-	static const int64_t BlocksTargetSpacing = 3 * 60; // Uro: 3 minutes
-	static const unsigned int TimeDaySeconds = 24 * 60 * 60; // Uro: 1 day
-	int64_t PastSecondsMin = TimeDaySeconds * 0.025;
-	int64_t PastSecondsMax = TimeDaySeconds * 7;
-	if (pindexLast->nHeight + 1 >= 12760) {
-		PastSecondsMin *= 2;
-	}
-	uint64_t PastBlocksMin = PastSecondsMin / BlocksTargetSpacing;
-	uint64_t PastBlocksMax = PastSecondsMax / BlocksTargetSpacing;
-	
-	return KimotoGravityWell(pindexLast, pblock, BlocksTargetSpacing, PastBlocksMin, PastBlocksMax);
-}
-
-
-unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
-{
-        int DiffMode = 1;
-        if (fTestNet) {
-		DiffMode = 1;
-        } else {
-		if (pindexLast->nHeight + 1 >= 12760) {
-			DiffMode = 2;
-		}
-        }
-      
-        if (DiffMode == 1) { 
-		return GetNextWorkRequired_V1(pindexLast, pblock); 
-	}
-
-        else if (DiffMode == 2) { 
-		return GetNextWorkRequired_V2(pindexLast, pblock); 
-	}
-
-}
-
-const char *pchUROMain	= "\xfe\xc3\xb9\xde";
-const char *pchUROTest	= "\xfe\xc4\xba\xde";
-
-unsigned char pchMessageStart[4];
-
-bool LoadBlockIndex()
-{
-	if (fTestNet)
-	{	/* yes this could be more elegant */
-		pchMessageStart[0] = pchUROTest[0];
-		pchMessageStart[1] = pchUROTest[1];
-		pchMessageStart[2] = pchUROTest[2];
-		pchMessageStart[3] = pchUROTest[3];
-		hashGenesisBlock = uint256("0x");
-	} else {
-		pchMessageStart[0] = pchUROMain[0];
-		pchMessageStart[1] = pchUROMain[1];
-		pchMessageStart[2] = pchUROMain[2];
-		pchMessageStart[3] = pchUROMain[3];
-		hashGenesisBlock = uint256("0x000001196bbe430b7e0cdce3504f5ddfda0d0313ea479526d79afbf4d090a880");
-	}
-
-	//
-	// Load block index from databases
-	//
-	if (!fReindex && !LoadBlockIndexDB())
-		return false;
-
-	return true;
-}
-
-
-bool InitBlockIndex() {
-	// Check whether we're already initialized
-	if (pindexGenesisBlock != NULL)
-		return true;
-
-	// Use the provided setting for -txindex in the new database
-	fTxIndex = GetBoolArg("-txindex", false);
-	pblocktree->WriteFlag("txindex", fTxIndex);
-	printf("Initializing databases...\n");
-
-	// Only add the genesis block if not reindexing (in which case we reuse the one already on disk)
-	if (!fReindex) {
-		// Genesis block
-		const char* pszTimestamp = "URO";
-		CTransaction txNew;
-		txNew.vin.resize(1);
-		txNew.vout.resize(1);
-		txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
-		txNew.vout[0].nValue = 40 * COIN;
-		txNew.vout[0].scriptPubKey = CScript() << ParseHex("040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9") << OP_CHECKSIG;
-		CBlock block;
-		block.vtx.push_back(txNew);
-		block.hashPrevBlock = 0;
-		block.hashMerkleRoot = block.BuildMerkleTree();
-		block.nVersion = 1;
-		block.nTime    = 1398093006;
-		block.nBits    = 0x1e0ffff0;
-		block.nNonce   = 307242;
-
-		if (fTestNet)
-		{
-			block.nTime    = 1398093006;
-			block.nNonce   = 307242;
-		}
-
-		//// debug print
-		uint256 hash = block.GetHash();
-		printf("%s\n", hash.ToString().c_str());
-		printf("%s\n", hashGenesisBlock.ToString().c_str());
-		printf("%s\n", block.hashMerkleRoot.ToString().c_str());
-		assert(block.hashMerkleRoot == uint256("0xcf112b0792eaf749de18d633d3545aecd7b1343d78e14a830a242a03a6c31339"));
-
-		block.print();
-		assert(hash == hashGenesisBlock);
-
-		// Start new block file
-		try {
-			unsigned int nBlockSize = ::GetSerializeSize(block, SER_DISK, CLIENT_VERSION);
-			CDiskBlockPos blockPos;
-			CValidationState state;
-			if (!FindBlockPos(state, blockPos, nBlockSize+8, 0, block.nTime))
-				return error("LoadBlockIndex() : FindBlockPos failed");
-			if (!block.WriteToDisk(blockPos))
-				return error("LoadBlockIndex() : writing genesis block to disk failed");
-			if (!block.AddToBlockIndex(state, blockPos))
-				return error("LoadBlockIndex() : genesis block not accepted");
-			// TODO: add sync checkpoint
-		} catch(std::runtime_error &e) {
-			return error("LoadBlockIndex() : failed to initialize block database: %s", e.what());
-		}
-	}
-
-	return true;
-}
-
-namespace Checkpoints
-{
-		// What makes a good checkpoint block?
-	// + Is surrounded by blocks with reasonable timestamps
-	//	 (no blocks before with a timestamp after, none after with
-	//	  timestamp before)
-	// + Contains no strange transactions
-	// TODO put this in catcoin.cpp|.h
-	static MapCheckpoints mapCheckpoints =
-		boost::assign::map_list_of
-	(	0, hashGenesisBlock)
-	;
-
-	const CCheckpointData data = {
-		&mapCheckpoints,
-		1398103556,     // * UNIX timestamp of last checkpoint block
-		274778,		// * total number of transactions between genesis and last checkpoint
-					//	 (the tx=... number in the SetBestChain debug.log lines)
-		1000.0		// * estimated number of transactions per day after checkpoint
-	};
-
-}
--- a/src/uro.h	Sat Feb 13 18:53:44 2021 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-// Copyright (c) 2014 Troy Benjegerdes, under AGPLv3
-// Distributed under the Affero GNU General public license version 3
-// file COPYING or http://www.gnu.org/licenses/agpl-3.0.html
-#ifndef CODECOIN_solarcoin_H
-#define CODECOIN_solarcoin_H
-
-#include "util.h"
-
-static const int RPC_PORT = 36347;
-static const int RPC_PORT_TESTNET = 26347;
-static const int P2P_PORT = 36348;
-static const int P2P_PORT_TESTNET = 26348;
-
-static const uint64_t COIN = 100000000;
-static const int64_t CENT = 1000000;
-
-static const int RETARGET_INTERVAL = 480; /* 24 hours */
-
-/** Dust Soft Limit, allowed with additional fee per output */
-static const int64_t DUST_SOFT_LIMIT = 100000; // 0.001 CAT
-/** Dust Hard Limit, ignored as wallet inputs (mininput default) */
-static const int64_t DUST_HARD_LIMIT = 1000;   // 0.00001 CAT mininput
-/** No amount larger than this (in satoshi) is valid */
-static const int64_t MAX_MONEY = 10000000 * COIN;
-inline bool MoneyRange(int64_t nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
-
-/** Coinbase transaction outputs can only be spent after this number of new blocks (network rule) */
-static const int COINBASE_MATURITY = 20; /* probably to small */
-
-/** Minimum block time spacing (see also: AcceptBlockTimestamp) **/
-static const int64_t MINIMUM_BLOCK_SPACING = 1;	// Absolute minimum spacing:
-
-#define BRAND "Uro"
-#define BRAND_upper "Uro"
-#define BRAND_lower "uro"
-
-#endif
--- a/src/validation.cpp	Sat Feb 13 18:53:44 2021 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4922 +0,0 @@
-
-// Copyright (c) 2009-2016 The Bitcoin developers
-// Copyright (c) 2009-2012 The *coin developers
-// where * = (Bit, Lite, PP, Peerunity, Blu, Cat, Solar, URO, ...)
-// Previously distributed under the MIT/X11 software license, see the
-// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-// Copyright (c) 2014-2017 Troy Benjegerdes, under AGPLv3
-// Distributed under the Affero GNU General public license version 3
-// file COPYING or http://www.gnu.org/licenses/agpl-3.0.html
-
-#include <validation.h>
-
-#include <arith_uint256.h>
-#include <chain.h>
-#include <chainparams.h>
-#include <checkpoints.h>
-#include <checkqueue.h>
-#include <consensus/consensus.h>
-#include <consensus/merkle.h>
-#include <consensus/tx_verify.h>
-#include <consensus/validation.h>
-#include <cuckoocache.h>
-#include <hash.h>
-#include <init.h>
-#if defined(FEATURE_INDEX)
-#include <index.h>
-#endif
-#include <policy/fees.h>
-#include <policy/policy.h>
-#include <policy/rbf.h>
-#include <pow.h>
-#include <primitives/block.h>
-#include <primitives/transaction.h>
-#include <random.h>
-#include <reverse_iterator.h>
-#include <script/script.h>
-#include <script/sigcache.h>
-#include <script/standard.h>
-#include <timedata.h>
-#include <tinyformat.h>
-#include <txdb.h>
-#include <txmempool.h>
-#include <ui_interface.h>
-#include <undo.h>
-#include <util.h>
-#include <utilmoneystr.h>
-#include <utilstrencodings.h>
-#include <validationinterface.h>
-#include <warnings.h>
-
-#include <sstream>
-
-#include <boost/algorithm/string/replace.hpp>
-#include <boost/algorithm/string/join.hpp>
-#include <boost/thread.hpp>
-
-#if defined(USE_SCRYPT)
-#include "crypto/scrypt.h"
-#endif
-
-#if defined(NDEBUG)
-# error "Catoshi cannot be compiled without assertions."
-#endif
-
-#define MICRO 0.000001
-#define MILLI 0.001
-
-/**
- * Global state
- */
-namespace {
-    struct CBlockIndexWorkComparator
-    {
-        bool operator()(const CBlockIndex *pa, const CBlockIndex *pb) const {
-            // First sort by most total work, ...
-            if (pa->nChainWork > pb->nChainWork) return false;
-            if (pa->nChainWork < pb->nChainWork) return true;
-
-            // ... then by earliest time received, ...
-            if (pa->nSequenceId < pb->nSequenceId) return false;
-            if (pa->nSequenceId > pb->nSequenceId) return true;
-
-            // Use pointer address as tie breaker (should only happen with blocks
-            // loaded from disk, as those all have id 0).
-            if (pa < pb) return false;
-            if (pa > pb) return true;
-
-            // Identical blocks.
-            return false;
-        }
-    };
-} // anon namespace
-
-enum DisconnectResult
-{
-    DISCONNECT_OK,      // All good.
-    DISCONNECT_UNCLEAN, // Rolled back, but UTXO set was inconsistent with block.
-    DISCONNECT_FAILED   // Something else went wrong.
-};
-
-class ConnectTrace;
-
-/**
- * CChainState stores and provides an API to update our local knowledge of the
- * current best chain and header tree.
- *
- * It generally provides access to the current block tree, as well as functions
- * to provide new data, which it will appropriately validate and incorporate in
- * its state as necessary.
- *
- * Eventually, the API here is targeted at being exposed externally as a
- * consumable libconsensus library, so any functions added must only call
- * other class member functions, pure functions in other parts of the consensus
- * library, callbacks via the validation interface, or read/write-to-disk
- * functions (eventually this will also be via callbacks).
- */
-class CChainState {
-private:
-    /**
-     * The set of all CBlockIndex entries with BLOCK_VALID_TRANSACTIONS (for itself and all ancestors) and
-     * as good as our current tip or better. Entries may be failed, though, and pruning nodes may be
-     * missing the data for the block.
-     */
-    std::set<CBlockIndex*, CBlockIndexWorkComparator> setBlockIndexCandidates;
-
-    /**
-     * Every received block is assigned a unique and increasing identifier, so we
-     * know which one to give priority in case of a fork.
-     */
-    CCriticalSection cs_nBlockSequenceId;
-    /** Blocks loaded from disk are assigned id 0, so start the counter at 1. */
-    int32_t nBlockSequenceId = 1;
-    /** Decreasing counter (used by subsequent preciousblock calls). */
-    int32_t nBlockReverseSequenceId = -1;
-    /** chainwork for the last block that preciousblock has been applied to. */
-    arith_uint256 nLastPreciousChainwork = 0;
-
-    /** In order to efficiently track invalidity of headers, we keep the set of
-      * blocks which we tried to connect and found to be invalid here (ie which
-      * were set to BLOCK_FAILED_VALID since the last restart). We can then
-      * walk this set and check if a new header is a descendant of something in
-      * this set, preventing us from having to walk mapBlockIndex when we try
-      * to connect a bad block and fail.
-      *
-      * While this is more complicated than marking everything which descends
-      * from an invalid block as invalid at the time we discover it to be
-      * invalid, doing so would require walking all of mapBlockIndex to find all
-      * descendants. Since this case should be very rare, keeping track of all
-      * BLOCK_FAILED_VALID blocks in a set should be just fine and work just as
-      * well.
-      *
-      * Because we already walk mapBlockIndex in height-order at startup, we go
-      * ahead and mark descendants of invalid blocks as FAILED_CHILD at that time,
-      * instead of putting things in this set.
-      */
-    std::set<CBlockIndex*> g_failed_blocks;
-
-public:
-    CChain chainActive;
-    BlockMap mapBlockIndex;
-    std::multimap<CBlockIndex*, CBlockIndex*> mapBlocksUnlinked;
-    CBlockIndex *pindexBestInvalid = nullptr;
-
-    bool LoadBlockIndex(const Consensus::Params& consensus_params, CBlockTreeDB& blocktree);
-
-    bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams, std::shared_ptr<const CBlock> pblock);
-
-    bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, const CChainParams& chainparams, CBlockIndex** ppindex);
-    bool AcceptBlock(const std::shared_ptr<const CBlock>& pblock, CValidationState& state, const CChainParams& chainparams, CBlockIndex** ppindex, bool fRequested, const CDiskBlockPos* dbp, bool* fNewBlock);
-
-    // Block (dis)connection on a given view:
-    DisconnectResult DisconnectBlock(const CBlock& block, const CBlockIndex* pindex, CCoinsViewCache& view);
-    bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pindex,
-                    CCoinsViewCache& view, const CChainParams& chainparams, bool fJustCheck = false);
-
-    // Block disconnection on our pcoinsTip:
-    bool DisconnectTip(CValidationState& state, const CChainParams& chainparams, DisconnectedBlockTransactions *disconnectpool);
-
-    // Manual block validity manipulation:
-    bool PreciousBlock(CValidationState& state, const CChainParams& params, CBlockIndex *pindex);
-    bool InvalidateBlock(CValidationState& state, const CChainParams& chainparams, CBlockIndex *pindex);
-    bool ResetBlockFailureFlags(CBlockIndex *pindex);
-
-    bool ReplayBlocks(const CChainParams& params, CCoinsView* view);
-    bool RewindBlockIndex(const CChainParams& params);
-    bool LoadGenesisBlock(const CChainParams& chainparams);
-
-    void PruneBlockIndexCandidates();
-
-    void UnloadBlockIndex();
-
-private:
-    bool ActivateBestChainStep(CValidationState& state, const CChainParams& chainparams, CBlockIndex* pindexMostWork, const std::shared_ptr<const CBlock>& pblock, bool& fInvalidFound, ConnectTrace& connectTrace);
-    bool ConnectTip(CValidationState& state, const CChainParams& chainparams, CBlockIndex* pindexNew, const std::shared_ptr<const CBlock>& pblock, ConnectTrace& connectTrace, DisconnectedBlockTransactions &disconnectpool);
-
-    CBlockIndex* AddToBlockIndex(const CBlockHeader& block);
-    /** Create a new block index entry for a given block hash */
-    CBlockIndex * InsertBlockIndex(const uint256& hash);
-    void CheckBlockIndex(const Consensus::Params& consensusParams);
-
-    void InvalidBlockFound(CBlockIndex *pindex, const CValidationState &state);
-    CBlockIndex* FindMostWorkChain();
-    bool ReceivedBlockTransactions(const CBlock &block, CValidationState& state, CBlockIndex *pindexNew, const CDiskBlockPos& pos, const Consensus::Params& consensusParams);
-
-
-    bool RollforwardBlock(const CBlockIndex* pindex, CCoinsViewCache& inputs, const CChainParams& params);
-} g_chainstate;
-
-
-
-CCriticalSection cs_main;
-
-BlockMap& mapBlockIndex = g_chainstate.mapBlockIndex;
-CChain& chainActive = g_chainstate.chainActive;
-CBlockIndex *pindexBestHeader = nullptr;
-CWaitableCriticalSection csBestBlock;
-CConditionVariable cvBlockChange;
-int nScriptCheckThreads = 0;
-std::atomic_bool fImporting(false);
-std::atomic_bool fReindex(false);
-bool fTxIndex = false;
-bool fHavePruned = false;
-bool fPruneMode = false;
-bool fIsBareMultisigStd = DEFAULT_PERMIT_BAREMULTISIG;
-bool fRequireStandard = true;
-bool fCheckBlockIndex = false;
-bool fCheckpointsEnabled = DEFAULT_CHECKPOINTS_ENABLED;
-size_t nCoinCacheUsage = 5000 * 300;
-uint64_t nPruneTarget = 0;
-int64_t nMaxTipAge = DEFAULT_MAX_TIP_AGE;
-bool fEnableReplacement = DEFAULT_ENABLE_REPLACEMENT;
-
-uint256 hashAssumeValid;
-arith_uint256 nMinimumChainWork;
-
-CFeeRate minRelayTxFee = CFeeRate(DEFAULT_MIN_RELAY_TX_FEE);
-CAmount maxTxFee = DEFAULT_TRANSACTION_MAXFEE;
-
-CBlockPolicyEstimator feeEstimator;
-CTxMemPool mempool(&feeEstimator);
-
-/** Constant stuff for coinbase transactions we create: */
-CScript COINBASE_FLAGS;
-
-// Internal stuff
-namespace {
-    CBlockIndex *&pindexBestInvalid = g_chainstate.pindexBestInvalid;
-
-    /** All pairs A->B, where A (or one of its ancestors) misses transactions, but B has transactions.
-     * Pruned nodes may have entries where B is missing data.
-     */
-    std::multimap<CBlockIndex*, CBlockIndex*>& mapBlocksUnlinked = g_chainstate.mapBlocksUnlinked;
-
-    CCriticalSection cs_LastBlockFile;
-    std::vector<CBlockFileInfo> vinfoBlockFile;
-    int nLastBlockFile = 0;
-    /** Global flag to indicate we should check to see if there are
-     *  block/undo files that should be deleted.  Set on startup
-     *  or if we allocate more file space when we're in prune mode
-     */
-    bool fCheckForPruning = false;
-
-    /** Dirty block index entries. */
-    std::set<CBlockIndex*> setDirtyBlockIndex;
-
-    /** Dirty block file entries. */
-    std::set<int> setDirtyFileInfo;
-} // anon namespace
-
-CBlockIndex* FindForkInGlobalIndex(const CChain& chain, const CBlockLocator& locator)
-{
-    // Find the first block the caller has in the main chain
-    for (const uint256& hash : locator.vHave) {
-        BlockMap::iterator mi = mapBlockIndex.find(hash);
-        if (mi != mapBlockIndex.end())
-        {
-            CBlockIndex* pindex = (*mi).second;
-            if (chain.Contains(pindex))
-                return pindex;
-            if (pindex->GetAncestor(chain.Height()) == chain.Tip()) {
-                return chain.Tip();
-            }
-        }
-    }
-    return chain.Genesis();
-}
-
-std::unique_ptr<CCoinsViewDB> pcoinsdbview;
-std::unique_ptr<CCoinsViewCache> pcoinsTip;
-std::unique_ptr<CBlockTreeDB> pblocktree;
-
-enum FlushStateMode {
-    FLUSH_STATE_NONE,
-    FLUSH_STATE_IF_NEEDED,
-    FLUSH_STATE_PERIODIC,
-    FLUSH_STATE_ALWAYS
-};
-
-// See definition for documentation
-static bool FlushStateToDisk(const CChainParams& chainParams, CValidationState &state, FlushStateMode mode, int nManualPruneHeight=0);
-static void FindFilesToPruneManual(std::set<int>& setFilesToPrune, int nManualPruneHeight);
-static void FindFilesToPrune(std::set<int>& setFilesToPrune, uint64_t nPruneAfterHeight);
-bool CheckInputs(const CTransaction& tx, CValidationState &state, const CCoinsViewCache &inputs, bool fScriptChecks, unsigned int flags, bool cacheSigStore, bool cacheFullScriptStore, PrecomputedTransactionData& txdata, std::vector<CScriptCheck> *pvChecks = nullptr);
-
-bool CheckFinalTx(const CTransaction &tx, int flags)
-{
-    AssertLockHeld(cs_main);
-
-    // By convention a negative value for flags indicates that the
-    // current network-enforced consensus rules should be used. In
-    // a future soft-fork scenario that would mean checking which
-    // rules would be enforced for the next block and setting the
-    // appropriate flags. At the present time no soft-forks are
-    // scheduled, so no flags are set.
-    flags = std::max(flags, 0);
-
-    // CheckFinalTx() uses chainActive.Height()+1 to evaluate
-    // nLockTime because when IsFinalTx() is called within
-    // CBlock::AcceptBlock(), the height of the block *being*
-    // evaluated is what is used. Thus if we want to know if a
-    // transaction can be part of the *next* block, we need to call
-    // IsFinalTx() with one more than chainActive.Height().
-    const int nBlockHeight = chainActive.Height() + 1;
-
-    // BIP113 requires that time-locked transactions have nLockTime set to
-    // less than the median time of the previous block they're contained in.
-    // When the next block is created its previous block will be the current
-    // chain tip, so we use that to calculate the median time passed to
-    // IsFinalTx() if LOCKTIME_MEDIAN_TIME_PAST is set.
-    const int64_t nBlockTime = (flags & LOCKTIME_MEDIAN_TIME_PAST)
-                             ? chainActive.Tip()->GetMedianTimePast()
-                             : GetAdjustedTime();
-
-    return IsFinalTx(tx, nBlockHeight, nBlockTime);
-}
-
-bool TestLockPointValidity(const LockPoints* lp)
-{
-    AssertLockHeld(cs_main);
-    assert(lp);
-    // If there are relative lock times then the maxInputBlock will be set
-    // If there are no relative lock times, the LockPoints don't depend on the chain
-    if (lp->maxInputBlock) {
-        // Check whether chainActive is an extension of the block at which the LockPoints
-        // calculation was valid.  If not LockPoints are no longer valid
-        if (!chainActive.Contains(lp->maxInputBlock)) {
-            return false;
-        }
-    }
-
-    // LockPoints still valid
-    return true;
-}
-
-bool CheckSequenceLocks(const CTransaction &tx, int flags, LockPoints* lp, bool useExistingLockPoints)
-{
-    AssertLockHeld(cs_main);
-    AssertLockHeld(mempool.cs);
-
-    CBlockIndex* tip = chainActive.Tip();
-    assert(tip != nullptr);
-    
-    CBlockIndex index;
-    index.pprev = tip;
-    // CheckSequenceLocks() uses chainActive.Height()+1 to evaluate
-    // height based locks because when SequenceLocks() is called within
-    // ConnectBlock(), the height of the block *being*
-    // evaluated is what is used.
-    // Thus if we want to know if a transaction can be part of the
-    // *next* block, we need to use one more than chainActive.Height()
-    index.nHeight = tip->nHeight + 1;
-
-    std::pair<int, int64_t> lockPair;
-    if (useExistingLockPoints) {
-        assert(lp);
-        lockPair.first = lp->height;
-        lockPair.second = lp->time;
-    }
-    else {
-        // pcoinsTip contains the UTXO set for chainActive.Tip()
-        CCoinsViewMemPool viewMemPool(pcoinsTip.get(), mempool);
-        std::vector<int> prevheights;
-        prevheights.resize(tx.vin.size());
-        for (size_t txinIndex = 0; txinIndex < tx.vin.size(); txinIndex++) {
-            const CTxIn& txin = tx.vin[txinIndex];
-            Coin coin;
-            if (!viewMemPool.GetCoin(txin.prevout, coin)) {
-                return error("%s: Missing input", __func__);
-            }
-            if (coin.nHeight == MEMPOOL_HEIGHT) {
-                // Assume all mempool transaction confirm in the next block
-                prevheights[txinIndex] = tip->nHeight + 1;
-            } else {
-                prevheights[txinIndex] = coin.nHeight;
-            }
-        }
-        lockPair = CalculateSequenceLocks(tx, flags, &prevheights, index);
-        if (lp) {
-            lp->height = lockPair.first;
-            lp->time = lockPair.second;
-            // Also store the hash of the block with the highest height of
-            // all the blocks which have sequence locked prevouts.
-            // This hash needs to still be on the chain
-            // for these LockPoint calculations to be valid
-            // Note: It is impossible to correctly calculate a maxInputBlock
-            // if any of the sequence locked inputs depend on unconfirmed txs,
-            // except in the special case where the relative lock time/height
-            // is 0, which is equivalent to no sequence lock. Since we assume
-            // input height of tip+1 for mempool txs and test the resulting
-            // lockPair from CalculateSequenceLocks against tip+1.  We know
-            // EvaluateSequenceLocks will fail if there was a non-zero sequence
-            // lock on a mempool input, so we can use the return value of
-            // CheckSequenceLocks to indicate the LockPoints validity
-            int maxInputHeight = 0;
-            for (int height : prevheights) {
-                // Can ignore mempool inputs since we'll fail if they had non-zero locks
-                if (height != tip->nHeight+1) {
-                    maxInputHeight = std::max(maxInputHeight, height);
-                }
-            }
-            lp->maxInputBlock = tip->GetAncestor(maxInputHeight);
-        }
-    }
-    return EvaluateSequenceLocks(index, lockPair);
-}
-
-// Returns the script flags which should be checked for a given block
-static unsigned int GetBlockScriptFlags(const CBlockIndex* pindex, const Consensus::Params& chainparams);
-
-static void LimitMempoolSize(CTxMemPool& pool, size_t limit, unsigned long age) {
-    int expired = pool.Expire(GetTime() - age);
-    if (expired != 0) {
-        LogPrint(BCLog::MEMPOOL, "Expired %i transactions from the memory pool\n", expired);
-    }
-
-    std::vector<COutPoint> vNoSpendsRemaining;
-    pool.TrimToSize(limit, &vNoSpendsRemaining);
-    for (const COutPoint& removed : vNoSpendsRemaining)
-        pcoinsTip->Uncache(removed);
-}
-
-/** Convert CValidationState to a human-readable message for logging */
-std::string FormatStateMessage(const CValidationState &state)
-{
-    return strprintf("%s%s (code %i)",
-        state.GetRejectReason(),
-        state.GetDebugMessage().empty() ? "" : ", "+state.GetDebugMessage(),
-        state.GetRejectCode());
-}
-
-static bool IsCurrentForFeeEstimation()
-{
-    AssertLockHeld(cs_main);
-    if (IsInitialBlockDownload())
-        return false;
-    if (chainActive.Tip()->GetBlockTime() < (GetTime() - MAX_FEE_ESTIMATION_TIP_AGE))
-        return false;
-    if (chainActive.Height() < pindexBestHeader->nHeight - 1)
-        return false;
-    return true;
-}
-
-/* Make mempool consistent after a reorg, by re-adding or recursively erasing
- * disconnected block transactions from the mempool, and also removing any
- * other transactions from the mempool that are no longer valid given the new
- * tip/height.
- *
- * Note: we assume that disconnectpool only contains transactions that are NOT
- * confirmed in the current chain nor already in the mempool (otherwise,
- * in-mempool descendants of such transactions would be removed).
- *
- * Passing fAddToMempool=false will skip trying to add the transactions back,
- * and instead just erase from the mempool as needed.
- */
-
-void UpdateMempoolForReorg(DisconnectedBlockTransactions &disconnectpool, bool fAddToMempool)
-{
-    AssertLockHeld(cs_main);
-    std::vector<uint256> vHashUpdate;
-    // disconnectpool's insertion_order index sorts the entries from
-    // oldest to newest, but the oldest entry will be the last tx from the
-    // latest mined block that was disconnected.
-    // Iterate disconnectpool in reverse, so that we add transactions
-    // back to the mempool starting with the earliest transaction that had
-    // been previously seen in a block.
-    auto it = disconnectpool.queuedTx.get<insertion_order>().rbegin();
-    while (it != disconnectpool.queuedTx.get<insertion_order>().rend()) {
-        // ignore validation errors in resurrected transactions
-        CValidationState stateDummy;
-        if (!fAddToMempool || (*it)->IsCoinBase() ||
-            !AcceptToMemoryPool(mempool, stateDummy, *it, nullptr /* pfMissingInputs */,
-                                nullptr /* plTxnReplaced */, true /* bypass_limits */, 0 /* nAbsurdFee */)) {
-            // If the transaction doesn't make it in to the mempool, remove any
-            // transactions that depend on it (which would now be orphans).
-            mempool.removeRecursive(**it, MemPoolRemovalReason::REORG);
-        } else if (mempool.exists((*it)->GetHash())) {
-            vHashUpdate.push_back((*it)->GetHash());
-        }
-        ++it;
-    }
-    disconnectpool.queuedTx.clear();
-    // AcceptToMemoryPool/addUnchecked all assume that new mempool entries have
-    // no in-mempool children, which is generally not true when adding
-    // previously-confirmed transactions back to the mempool.
-    // UpdateTransactionsFromBlock finds descendants of any transactions in
-    // the disconnectpool that were added back and cleans up the mempool state.
-    mempool.UpdateTransactionsFromBlock(vHashUpdate);
-
-    // We also need to remove any now-immature transactions
-    mempool.removeForReorg(pcoinsTip.get(), chainActive.Tip()->nHeight + 1, STANDARD_LOCKTIME_VERIFY_FLAGS);
-    // Re-limit mempool size, in case we added any transactions
-    LimitMempoolSize(mempool, gArgs.GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000, gArgs.GetArg("-mempoolexpiry", DEFAULT_MEMPOOL_EXPIRY) * 60 * 60);
-}
-
-// Used to avoid mempool polluting consensus critical paths if CCoinsViewMempool
-// were somehow broken and returning the wrong scriptPubKeys
-static bool CheckInputsFromMempoolAndCache(const CTransaction& tx, CValidationState &state, const CCoinsViewCache &view, CTxMemPool& pool,
-                 unsigned int flags, bool cacheSigStore, PrecomputedTransactionData& txdata) {
-    AssertLockHeld(cs_main);
-
-    // pool.cs should be locked already, but go ahead and re-take the lock here
-    // to enforce that mempool doesn't change between when we check the view
-    // and when we actually call through to CheckInputs
-    LOCK(pool.cs);
-
-    assert(!tx.IsCoinBase());
-    for (const CTxIn& txin : tx.vin) {
-        const Coin& coin = view.AccessCoin(txin.prevout);
-
-        // At this point we haven't actually checked if the coins are all
-        // available (or shouldn't assume we have, since CheckInputs does).
-        // So we just return failure if the inputs are not available here,
-        // and then only have to check equivalence for available inputs.
-        if (coin.IsSpent()) return false;
-
-        const CTransactionRef& txFrom = pool.get(txin.prevout.hash);
-        if (txFrom) {
-            assert(txFrom->GetHash() == txin.prevout.hash);
-            assert(txFrom->vout.size() > txin.prevout.n);
-            assert(txFrom->vout[txin.prevout.n] == coin.out);
-        } else {
-            const Coin& coinFromDisk = pcoinsTip->AccessCoin(txin.prevout);
-            assert(!coinFromDisk.IsSpent());
-            assert(coinFromDisk.out == coin.out);
-        }
-    }
-
-    return CheckInputs(tx, state, view, true, flags, cacheSigStore, true, txdata);
-}
-
-static bool AcceptToMemoryPoolWorker(const CChainParams& chainparams, CTxMemPool& pool, CValidationState& state, const CTransactionRef& ptx,
-                              bool* pfMissingInputs, int64_t nAcceptTime, std::list<CTransactionRef>* plTxnReplaced,
-                              bool bypass_limits, const CAmount& nAbsurdFee, std::vector<COutPoint>& coins_to_uncache)
-{
-    const CTransaction& tx = *ptx;
-    const uint256 hash = tx.GetHash();
-    AssertLockHeld(cs_main);
-    if (pfMissingInputs)
-        *pfMissingInputs = false;
-
-    if (!CheckTransaction(tx, state))
-        return false; // state filled in by CheckTransaction
-
-    // Coinbase is only valid in a block, not as a loose transaction
-    if (tx.IsCoinBase())
-        return state.DoS(100, false, REJECT_INVALID, "coinbase");
-
-    // Reject transactions with witness before segregated witness activates (override with -prematurewitness)
-    bool witnessEnabled = IsWitnessEnabled(chainActive.Tip(), chainparams.GetConsensus());
-    if (!gArgs.GetBoolArg("-prematurewitness", false) && tx.HasWitness() && !witnessEnabled) {
-        return state.DoS(0, false, REJECT_NONSTANDARD, "no-witness-yet", true);
-    }
-
-    // Rather not work on nonstandard transactions (unless -testnet/-regtest)
-    std::string reason;
-    if (fRequireStandard && !IsStandardTx(tx, reason, witnessEnabled))
-        return state.DoS(0, false, REJECT_NONSTANDARD, reason);
-
-    // Only accept nLockTime-using transactions that can be mined in the next
-    // block; we don't want our mempool filled up with transactions that can't
-    // be mined yet.
-    if (!CheckFinalTx(tx, STANDARD_LOCKTIME_VERIFY_FLAGS))
-        return state.DoS(0, false, REJECT_NONSTANDARD, "non-final");
-
-    // is it already in the memory pool?
-    if (pool.exists(hash)) {
-        return state.Invalid(false, REJECT_DUPLICATE, "txn-already-in-mempool");
-    }
-
-    // Check for conflicts with in-memory transactions
-    std::set<uint256> setConflicts;
-    {
-    LOCK(pool.cs); // protect pool.mapNextTx
-    for (const CTxIn &txin : tx.vin)
-    {
-        auto itConflicting = pool.mapNextTx.find(txin.prevout);
-        if (itConflicting != pool.mapNextTx.end())
-        {
-            const CTransaction *ptxConflicting = itConflicting->second;
-            if (!setConflicts.count(ptxConflicting->GetHash()))
-            {
-                // Allow opt-out of transaction replacement by setting
-                // nSequence > MAX_BIP125_RBF_SEQUENCE (SEQUENCE_FINAL-2) on all inputs.
-                //
-                // SEQUENCE_FINAL-1 is picked to still allow use of nLockTime by
-                // non-replaceable transactions. All inputs rather than just one
-                // is for the sake of multi-party protocols, where we don't
-                // want a single party to be able to disable replacement.
-                //
-                // The opt-out ignores descendants as anyone relying on
-                // first-seen mempool behavior should be checking all
-                // unconfirmed ancestors anyway; doing otherwise is hopelessly
-                // insecure.
-                bool fReplacementOptOut = true;
-                if (fEnableReplacement)
-                {
-                    for (const CTxIn &_txin : ptxConflicting->vin)
-                    {
-                        if (_txin.nSequence <= MAX_BIP125_RBF_SEQUENCE)
-                        {
-                            fReplacementOptOut = false;
-                            break;
-                        }
-                    }
-                }
-                if (fReplacementOptOut) {
-                    return state.Invalid(false, REJECT_DUPLICATE, "txn-mempool-conflict");
-                }
-
-                setConflicts.insert(ptxConflicting->GetHash());
-            }
-        }
-    }
-    }
-
-    {
-        CCoinsView dummy;
-        CCoinsViewCache view(&dummy);
-
-        LockPoints lp;
-        {
-        LOCK(pool.cs);
-        CCoinsViewMemPool viewMemPool(pcoinsTip.get(), pool);
-        view.SetBackend(viewMemPool);
-
-        // do all inputs exist?
-        for (const CTxIn txin : tx.vin) {
-            if (!pcoinsTip->HaveCoinInCache(txin.prevout)) {
-                coins_to_uncache.push_back(txin.prevout);
-            }
-            if (!view.HaveCoin(txin.prevout)) {
-                // Are inputs missing because we already have the tx?
-                for (size_t out = 0; out < tx.vout.size(); out++) {
-                    // Optimistically just do efficient check of cache for outputs
-                    if (pcoinsTip->HaveCoinInCache(COutPoint(hash, out))) {
-                        return state.Invalid(false, REJECT_DUPLICATE, "txn-already-known");
-                    }
-                }
-                // Otherwise assume this might be an orphan tx for which we just haven't seen parents yet
-                if (pfMissingInputs) {
-                    *pfMissingInputs = true;</