diff --git a/README.md b/README.md index 61a4840..c436249 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,11 @@ Port: 23373 RPC port: 23372 -Coin supply: 500,000,000 +Max Coin supply: 1,500,000,000 Yearly interest: 200% +Yearly interest following Block 1328350: 10% +(until cap reached, enforced in latest release) Proof of Work Reward: Random?! diff --git a/condensation-qt.pro b/condensation-qt.pro index 0b58470..7458026 100644 --- a/condensation-qt.pro +++ b/condensation-qt.pro @@ -28,9 +28,9 @@ MOC_DIR = build UI_DIR = build win32 { - BOOST_LIB_SUFFIX=-mgw49-mt-s-1_57 - BOOST_INCLUDE_PATH=C:/deps/boost_1_57_0 - BOOST_LIB_PATH=C:/deps/boost_1_57_0/stage/lib + BOOST_LIB_SUFFIX=-mt + BOOST_INCLUDE_PATH=$MXE_INCLUDE_PATH/boost + BOOST_LIB_PATH=$MXE_LIB_PATH BDB_INCLUDE_PATH=C:/deps/db-6.1.26.NC/build_unix BDB_LIB_PATH=C:/deps/db-6.1.26.NC/build_unix OPENSSL_INCLUDE_PATH=C:/deps/openssl-1.0.2j/include @@ -95,6 +95,7 @@ contains(USE_QRCODE, 1) { LIBS += -lqrencode } +USE_UPNP=- # use: qmake "USE_UPNP=1" ( enabled by default; default) # or: qmake "USE_UPNP=0" (disabled by default) # or: qmake "USE_UPNP=-" (not supported) @@ -484,7 +485,7 @@ LIBS += $$join(BOOST_LIB_PATH,,-L,) $$join(BDB_LIB_PATH,,-L,) $$join(OPENSSL_LIB LIBS += -lssl -lcrypto -ldb_cxx$$BDB_LIB_SUFFIX # -lgdi32 has to happen after -lcrypto (see #681) windows:LIBS += -lws2_32 -lshlwapi -lmswsock -lole32 -loleaut32 -luuid -lgdi32 -LIBS += -lboost_system$$BOOST_LIB_SUFFIX -lboost_filesystem$$BOOST_LIB_SUFFIX -lboost_program_options$$BOOST_LIB_SUFFIX -lboost_thread$$BOOST_THREAD_LIB_SUFFIX +LIBS += -L/mnt/mxe/usr/i686-w64-mingw32.static/include/boost -lboost_system$$BOOST_LIB_SUFFIX -lboost_filesystem$$BOOST_LIB_SUFFIX -lboost_program_options$$BOOST_LIB_SUFFIX -lboost_thread$$BOOST_THREAD_LIB_SUFFIX windows:LIBS += -lboost_chrono$$BOOST_LIB_SUFFIX contains(RELEASE, 1) { diff --git a/release/Condensation-qt.exe b/release/Condensation-qt.exe old mode 100644 new mode 100755 index 2679d9d..ef82c7a Binary files a/release/Condensation-qt.exe and b/release/Condensation-qt.exe differ diff --git a/src/clientversion.h b/src/clientversion.h index dd91748..8a30c65 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -7,9 +7,9 @@ // These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it #define CLIENT_VERSION_MAJOR 1 -#define CLIENT_VERSION_MINOR 0 +#define CLIENT_VERSION_MINOR 1 #define CLIENT_VERSION_REVISION 1 -#define CLIENT_VERSION_BUILD 0 +#define CLIENT_VERSION_BUILD 12 // Converts the parameter X to a string after macro replacement on X has been performed. // Don't merge these into one macro! diff --git a/src/leveldb/build_detect_platform b/src/leveldb/build_detect_platform old mode 100644 new mode 100755 diff --git a/src/main.cpp b/src/main.cpp index 082249e..298ef20 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1010,12 +1010,30 @@ int64_t GetProofOfWorkReward(int nHeight, int64_t nFees, uint256 prevHash) } // miner's coin stake reward based on coin age spent (coin-days) -int64_t GetProofOfStakeReward(int64_t nCoinAge, int64_t nFees) +int64_t GetProofOfStakeReward(int nHeight, int64_t nCoinAge, int64_t nFees, int64_t supply) { - int64_t nSubsidy = nCoinAge * COIN_YEAR_REWARD / 365; + int64_t nSubsidy = 0; + int64_t nSubsidyn = 0; + if (nHeight <= CONSENSUS_CHANGE_BLOCK) { + nSubsidy = nCoinAge * COIN_YEAR_REWARD / 365; + nSubsidyn = nCoinAge * COIN_YEAR_REWARD_NEW / 365; + } + else if (nHeight > CONSENSUS_CHANGE_BLOCK) { + if (supply >= RAIN_CAP) + nSubsidy = 0; + else + nSubsidy = nCoinAge * COIN_YEAR_REWARD_NEW / 365; + } - if (fDebug && GetBoolArg("-printcreation")) - printf("GetProofOfStakeReward(): create=%s nCoinAge=%"PRId64"\n", FormatMoney(nSubsidy).c_str(), nCoinAge); + if (fDebug && GetBoolArg("-printcreation")) { + printf("GetProofOfStakeReward(): create=%s nCoinAge=%"PRId64" supply=%"PRId64"\n", FormatMoney(nSubsidy).c_str(), nCoinAge,supply); + if (supply >= RAIN_CAP) + printf("Supply cap reached\n"); + else + printf("Supply cap not yet reached\n"); + + printf("GetProofOfStakeReward() Preview: create=%s nCoinAge=%"PRId64" supply=%"PRId64"\n", FormatMoney(nSubsidyn).c_str(), nCoinAge,supply); + } return nSubsidy + nFees; } @@ -1553,7 +1571,9 @@ bool CBlock::ConnectBlock(CTxDB& txdb, CBlockIndex* pindex, bool fJustCheck) if (!vtx[1].GetCoinAge(txdb, nCoinAge)) return error("ConnectBlock() : %s unable to get coin age for coinstake", vtx[1].GetHash().ToString().substr(0,10).c_str()); - int64_t nCalculatedStakeReward = GetProofOfStakeReward(nCoinAge, nFees); + // debug nMoneySupply + printf("Supply: %"PRId64"\n",pindex->pprev->nMoneySupply); + int64_t nCalculatedStakeReward = GetProofOfStakeReward(pindex->nHeight,nCoinAge, nFees,pindex->pprev->nMoneySupply); if (nStakeReward > nCalculatedStakeReward) return DoS(100, error("ConnectBlock() : coinstake pays too much(actual=%"PRId64" vs calculated=%"PRId64")", nStakeReward, nCalculatedStakeReward)); diff --git a/src/main.h b/src/main.h index b1e426e..fcad9fe 100644 --- a/src/main.h +++ b/src/main.h @@ -36,6 +36,10 @@ static const int64_t MIN_TX_FEE = 0.1 * COIN; static const int64_t MIN_RELAY_TX_FEE = MIN_TX_FEE; static const int64_t MAX_MONEY = 500000000 * COIN; static const int64_t COIN_YEAR_REWARD = 200 * CENT; +// implement consensus vote result Option B. Set Max Supply and staking to 10% +static const int64_t COIN_YEAR_REWARD_NEW = 10 * CENT; +static const int64_t RAIN_CAP = 50000000000 * COIN; +static const int CONSENSUS_CHANGE_BLOCK = 2915500; // should be around August 31th 2022 inline bool MoneyRange(int64_t nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); } // Threshold for nLockTime: below this value it is interpreted as block number, otherwise as UNIX timestamp. @@ -112,7 +116,7 @@ bool LoadExternalBlockFile(FILE* fileIn); bool CheckProofOfWork(uint256 hash, unsigned int nBits); unsigned int GetNextTargetRequired(const CBlockIndex* pindexLast, bool fProofOfStake); int64_t GetProofOfWorkReward(int nHeight, int64_t nFees, uint256 prevHash); -int64_t GetProofOfStakeReward(int64_t nCoinAge, int64_t nFees); +int64_t GetProofOfStakeReward(int nHeight, int64_t nCoinAge, int64_t nFees, int64_t supply); unsigned int ComputeMinWork(unsigned int nBase, int64_t nTime); unsigned int ComputeMinStake(unsigned int nBase, int64_t nTime, unsigned int nBlockTime); int GetNumBlocksOfPeers(); diff --git a/src/qt/res/bitcoin-qt.rc b/src/qt/res/bitcoin-qt.rc index a953214..f6fb840 100644 --- a/src/qt/res/bitcoin-qt.rc +++ b/src/qt/res/bitcoin-qt.rc @@ -22,7 +22,7 @@ BEGIN VALUE "FileDescription", "rain-qt (OSS GUI client for rain)" VALUE "FileVersion", VER_FILEVERSION_STR VALUE "InternalName", "rain-qt" - VALUE "LegalCopyright", "2017 bitc0der" + VALUE "LegalCopyright", "2017-2021 Rain community" VALUE "LegalTrademarks1", "Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php." VALUE "OriginalFilename", "rain-qt.exe" VALUE "ProductName", "rain-qt" diff --git a/src/version.h b/src/version.h index d2bf95a..031f274 100644 --- a/src/version.h +++ b/src/version.h @@ -30,7 +30,7 @@ static const int DATABASE_VERSION = 70509; // network protocol versioning // -static const int PROTOCOL_VERSION = 60010; +static const int PROTOCOL_VERSION = 60050; // intial proto version, to be increased after version/verack negotiation static const int INIT_PROTO_VERSION = 209; diff --git a/src/wallet.cpp b/src/wallet.cpp index 6aa1a99..3263a2d 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -2572,8 +2572,8 @@ bool CWallet::CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int if (!txNew.GetCoinAge(txdb, nCoinAge)) return error("CreateCoinStake : failed to calculate coin age"); - int64_t nReward = GetProofOfStakeReward(nCoinAge, nFees); - if (nReward <= 0) + int64_t nReward = GetProofOfStakeReward(pindexPrev->nHeight,nCoinAge, nFees,pindexPrev->nMoneySupply); + if (nReward < 0) return false; nCredit += nReward;