Skip to content

Commit

Permalink
Merge pull request #96 from anonymousbitcoin/development
Browse files Browse the repository at this point in the history
Anon v2
  • Loading branch information
thomasluis authored Jan 18, 2019
2 parents 25414cd + 264be89 commit 9544cf6
Show file tree
Hide file tree
Showing 37 changed files with 690 additions and 258 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Build Status](https://travis-ci.com/ByeBugDevelopment/anon-backup.svg?token=WBBgtRXJbdCRsjxqqhJy&branch=master)](https://travis-ci.com/ByeBugDevelopment/anon-backup)

**Anonymous Bitcoin v.1.3.0**
**Anonymous Bitcoin v.2.0.0**

ANON is an implementation of the zerocash protocol, bootstrapped with a merge of the Official Bitcoin and Zclassic UTXO sets via a snapshot and airdrop, and with the additional implementation of masternodes.

Expand Down
8 changes: 4 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 1)
define(_CLIENT_VERSION_MAJOR, 2)
define(_CLIENT_VERSION_MINOR, 0)
define(_CLIENT_VERSION_REVISION, 12)
define(_CLIENT_VERSION_BUILD, 51)
define(_CLIENT_VERSION_REVISION, 0)
define(_CLIENT_VERSION_BUILD, 0)
define(_ZC_BUILD_VAL, m4_if(m4_eval(_CLIENT_VERSION_BUILD < 25), 1, m4_incr(_CLIENT_VERSION_BUILD), m4_eval(_CLIENT_VERSION_BUILD < 50), 1, m4_eval(_CLIENT_VERSION_BUILD - 24), m4_eval(_CLIENT_VERSION_BUILD == 50), 1, , m4_eval(_CLIENT_VERSION_BUILD - 50)))
define(_CLIENT_VERSION_SUFFIX, m4_if(m4_eval(_CLIENT_VERSION_BUILD < 25), 1, _CLIENT_VERSION_REVISION-beta$1, m4_eval(_CLIENT_VERSION_BUILD < 50), 1, _CLIENT_VERSION_REVISION-rc$1, m4_eval(_CLIENT_VERSION_BUILD == 50), 1, _CLIENT_VERSION_REVISION, _CLIENT_VERSION_REVISION-$1)))
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2018)
define(_COPYRIGHT_YEAR, 2019)
AC_INIT([Anon],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_SUFFIX(_ZC_BUILD_VAL)],[https://github.com/anon/issues],[anon])
AC_CONFIG_SRCDIR([src/main.cpp])
AC_CONFIG_HEADERS([src/config/bitcoin-config.h])
Expand Down
2 changes: 1 addition & 1 deletion contrib/gitian-descriptors/gitian-linux.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: "zcash-1.0.12-1"
name: "ANON-2.0.0"
enable_cache: true
distro: "debian"
suites:
Expand Down
11 changes: 7 additions & 4 deletions src/activemasternode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,12 @@ void CActiveMasternode::ManageStateInitial()
LogPrintf("CActiveMasternode::ManageStateInitial -- %s: Wallet is locked\n", GetStateString());
return;
}
if(pwalletMain->GetBalance() < 500*COIN) {
LogPrintf("CActiveMasternode::ManageStateInitial -- %s: Wallet balance is < 500 ANON\n", GetStateString());
return;
{
LOCK(cs_main);
if(pwalletMain->GetBalance() < Params().GetMasternodeCollateral(chainActive.Height())*COIN) {
LogPrintf("CActiveMasternode::ManageStateInitial -- %s: Wallet balance is < %d ANON\n", GetStateString(), Params().GetMasternodeCollateral(chainActive.Height()));
return;
}
}

// Choose coins to use
Expand All @@ -223,7 +226,7 @@ void CActiveMasternode::ManageStateInitial()

void CActiveMasternode::ManageStateRemote()
{
LogPrint("masternode", "CActiveMasternode::ManageStateRemote -- Start status = %s, type = %s, pinger enabled = %d, pubKeyMasternode.GetID() = %s\n",
LogPrint("masternode", "CActiveMasternode::ManageStateRemote -- Start status = %s, type = %s, pinger enabled = %d, pubKeyMasternode.GetID() = %s\n",
GetStatus(), fPingerEnabled, GetTypeString(), pubKeyMasternode.GetID().ToString());


Expand Down
129 changes: 126 additions & 3 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include "main.h"
#include "base58.h"
#include "crypto/equihash.h"
#include "util.h"
#include "utilstrencodings.h"
Expand Down Expand Up @@ -33,7 +34,14 @@ class CMainParams : public CChainParams {
strCurrencyUnits = "ANON";
consensus.fCoinbaseMustBeProtected = true;
consensus.nSubsidySlowStartInterval = 1;
consensus.nSubsidyHalvingInterval = 134000;
consensus.nSubsidyHalvingInterval = 134000; //1st halving occurs after block 150,740 (airdropped blocks offset)

// Budget related
consensus.nBudgetPaymentsStartBlock = 39420; // (coinburn block [37,000] + [2,420] (~16 days)
consensus.nBudgetPaymentsCycleBlocks = 4380; // (blocks per day times ~ days in a month) 144 * (365/12)
consensus.nSuperblockStartBlock = 43800; // The block at which 1st superblock goes live
consensus.nSuperblockCycle = 4380; // (blocks per day times ~ days in a month) 144 * (365/12)

consensus.nMajorityEnforceBlockUpgrade = 750;
consensus.nMajorityRejectBlockOutdated = 950;
consensus.nMajorityWindow = 4000;
Expand All @@ -54,7 +62,7 @@ class CMainParams : public CChainParams {

consensus.nForkStartHeight = 3;
consensus.nForkHeightRange = 16737;

pchMessageStart[0] = 0x83;
pchMessageStart[1] = 0xD8;
pchMessageStart[2] = 0x47;
Expand Down Expand Up @@ -149,6 +157,10 @@ class CMainParams : public CChainParams {
fTestnetToBeDeprecatedFieldRPC = false;

nFulfilledRequestExpireTime = 60*60; // fulfilled requests expire in 1 hour

// Spork
strSporkPubKey = "04859b86231cc91816c4ca2be433030fc0d544fcd712c3ffd9b099c496a693ddc720533acd5d9d77b6b1bf50c52cc44351bc166afb040c3725f4dcd2b5e57c83a7";

checkpointData = {
{
{ 0, consensus.hashGenesisBlock }
Expand All @@ -166,11 +178,46 @@ class CMainParams : public CChainParams {
nZtransparentStartBlock = 9893 + nForkStartHeight;
nZshieldedStartBlock = 10132 + nForkStartHeight;

// masternode related
masternodeCollateralChangeBlock = 37000;
masternodeCollateralOld = 500;
masternodeCollateralNew = 10000;

eh_epoch_1 = eh200_9;
eh_epoch_2 = eh144_5;
eh_epoch_1_endblock = nForkStartHeight + nForkHeightRange;
eh_epoch_2_startblock = nForkStartHeight + nForkHeightRange + 1;


// Don't expect founders reward prior this block
nFoundersRewardBlockStart = 37000; // actual block may vary, due to using SPORK to activate founders reward

// choose new founders address every ~6 months.
foundersRewardAddressPeriod = 25000;

// Founders reward
// ~ 6 months per each address
vFoundersRewardAddress = {
"AnNhQ4bYHtdPiWfjXEr6GN4kfYxwUP8sf2g", /* main-index: 0*/
"AnUMeF4PzFSxdhrG1dFxg9L1hgEs1xC32mA", /* main-index: 1*/
"AnTBoW13Mf5NNPgsnDsvcbkyWt3ERNCSFUq", /* main-index: 2*/
"AnggA4wFWzd8GMcPHiigdiU59cQKb9asq2n", /* main-index: 3*/
"AnaEq58AGA5BvjyQQ1tiYRtTp3AJBbZn8kY", /* main-index: 4*/
"AnhUL1HEgcvGADi2DuDEUvMBKvNcQjto3sR", /* main-index: 5*/
"AncyG25fWsH2zzX5WhAidkAQtjfAVaZaMcj", /* main-index: 6*/
"AnaTx6oHTggyWifNYirpeWjwUhPaLjWpXYq", /* main-index: 7*/
"AnPcwA8LyaM79bECmDzf6hESCzuM7Bcog7d", /* main-index: 8*/
"AnQFWT4b7foe75eUFnS3YFwcZmzMyRYTnfq", /* main-index: 9*/
"AnRQdA7CEYXJ5qBUGRAACKA5SKBW2rDLUEc", /* main-index: 10*/
"AnRqy2LczE5DV8RRydXLGSTRaZpszMwdGbf", /* main-index: 11*/
"AnaY5PzxKSQH9MdevwfFxVBdX2qKiiR89YK", /* main-index: 12*/
"Ani2bk41GKoteRfoYedoP4aaS2r888CDbic", /* main-index: 13*/
"AnQ3G8U31m3jmqRfQjZ4XgbQEMNX4TW8Jz3", /* main-index: 14*/
"AnZYnEcr1mat4EWDXUXu2ZY54ARJ7NmjB1A", /* main-index: 15*/
"AnVwcAzC9ounFAzKaCDtQjhZTZCugSqvFzo", /* main-index: 16*/
"AnVBJ5oRrdvdTWDtb41eL6cCaSU3qAfM4VY", /* main-index: 17*/
"Anc4J1Snvs9buX8FeFMM2tZC9G1cie3wUn2", /* main-index: 18*/
"Ani1avTH5BFDEiZRWUpaaLEeqpHVCo9dn2V" /* main-index: 19*/
};
}
};
static CMainParams mainParams;
Expand All @@ -189,6 +236,12 @@ class CTestNetParams : public CMainParams {
consensus.nMajorityWindow = 400;
consensus.powLimit = uint256S("07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");

// Budget related
consensus.nBudgetPaymentsStartBlock = 20;
consensus.nBudgetPaymentsCycleBlocks = 10;
consensus.nSuperblockStartBlock = 30; // NOTE: Should satisfy nSuperblockStartBlock > nBudgetPaymentsStartBlock
consensus.nSuperblockCycle = 10; // Superblocks can be issued hourly on testnet

consensus.prePowLimit = consensus.powLimit;
assert(maxUint/UintToArith256(consensus.powLimit) >= consensus.nPowAveragingWindow);
consensus.fPowAllowMinDifficultyBlocks = false;
Expand Down Expand Up @@ -257,6 +310,9 @@ class CTestNetParams : public CMainParams {
fTestnetToBeDeprecatedFieldRPC = true;
nFulfilledRequestExpireTime = 5*60; // fulfilled requests expire in 5 minutes

// Spork
strSporkPubKey = "04b8c57d8921b9ecd769052739f8d137104b68f68714f4d4ca3219c5664a74048bd7cbe8badbe0baeee17ec463a13f3d0f5964f56d68317fd6ef14e86380383c74";

checkpointData = (Checkpoints::CCheckpointData) {
boost::assign::map_list_of
( 0, consensus.hashGenesisBlock),
Expand All @@ -265,10 +321,48 @@ class CTestNetParams : public CMainParams {
0
};

//setup airdrop blocks range
nForkStartHeight = 2;
nForkHeightRange = 1;
nZtransparentStartBlock = 5;
nZshieldedStartBlock = 6;

//masternode collateral
masternodeCollateralChangeBlock = 1;
masternodeCollateralOld = 500;
masternodeCollateralNew = 10000;

// Don't expect founders reward prior this block
nFoundersRewardBlockStart = 100; // actual block may vary, due to using SPORK to activate founders reward

// choose new founders address every ~6 months.
foundersRewardAddressPeriod = 25000;

// Founders reward
// ~ 6 months per each address
vFoundersRewardAddress = {
"tAHLDZxnjpuQah28VMDnWsrK747j4kg8YzV", /* test-index: 0*/
"tAHUxqMjG6tUSyjfpH2dTUHBk2gAoKQckdF", /* test-index: 1*/
"tAKFCqQa5n9oCcTBVdxbj4z651CqvYDjfyS", /* test-index: 2*/
"tAGnnENyonMAFV5c6EjnZUf9mvacWF4Qf6z", /* test-index: 3*/
"tASoVFeMmWXrn19PkDaGK67d671jveudMMq", /* test-index: 4*/
"tAA95SwRY47M6neVn81hoUzvANx1q4udt9q", /* test-index: 5*/
"tAGt9vmkkyPfu8Tc6K3Fnw1cYebaUWRaDBv", /* test-index: 6*/
"tAF1hUrjqfjoN5GGmDvNP3yG1zzigZ5u9YP", /* test-index: 7*/
"tATSk8P4c4SVUcwA9oobkqgNoHtu8xT4mvc", /* test-index: 8*/
"tAPVBCyvugQE91FDYRJtP5h2WvPJtVe2L3Z", /* test-index: 9*/
"tANDfgz3pw6et13sEcW2DPcNU6rTho6RgZe", /* test-index: 10*/
"tAPmN5w385eBWPc1LDVhHTUe2JANvSnFBuT", /* test-index: 11*/
"tAXMHLHroZVhTv3GM9hnbtrmHCGuG6Wmm6i", /* test-index: 12*/
"tALG9FCG8EUQ38LXku99rbtqbmgQhyvLzoH", /* test-index: 13*/
"tAHVQvDrbayCQKc1pfakopQak87QgvhVCay", /* test-index: 14*/
"tA9xYZ2KCBayYwPRhjYwmuytk4q5djpcD1A", /* test-index: 15*/
"tAXDnj3JTNassQY7ffGeC3wZ3DPGybyXYqB", /* test-index: 16*/
"tABJBqFqvjRFoPeaWP4bspxnKZmK5gnNA8G", /* test-index: 17*/
"tAKpajpeJzp4aZUpe35ymKtAwk7WheA3aTu", /* test-index: 18*/
"tANq6WULf5eaTSvTt7jP2XjQ85VwEoZCHJn" /* test-index: 19*/
};

}
};
static CTestNetParams testNetParams;
Expand Down Expand Up @@ -399,3 +493,32 @@ int validEHparameterList(EHparameters *ehparams, unsigned long blockheight, cons
ehparams[1]=params.eh_epoch_1_params();
return 2;
}

std::string CChainParams::GetFoundersRewardAddressAtHeight(int nHeight) const {

// asserts if node runs out of the founder addresses
assert(nHeight >= nFoundersRewardBlockStart && ((nHeight - nFoundersRewardBlockStart) / foundersRewardAddressPeriod) < vFoundersRewardAddress.size());

int vFoundersRewardAddressIndex = (nHeight - nFoundersRewardBlockStart) / foundersRewardAddressPeriod;

return vFoundersRewardAddress[vFoundersRewardAddressIndex];
}

CScript CChainParams::GetFoundersRewardScriptAtHeight(int nHeight) const {

CKeyID keyID;
CBitcoinAddress addr;

addr.SetString(GetFoundersRewardAddressAtHeight(nHeight).c_str());
addr.GetKeyID(keyID);

CScript scriptPubKey = CScript() << OP_DUP << OP_HASH160 << ToByteVector(keyID) << OP_EQUALVERIFY << OP_CHECKSIG;
return scriptPubKey;
}

int CChainParams::GetMasternodeCollateral(int nHeight) const {

if(nHeight >= masternodeCollateralChangeBlock)
return masternodeCollateralNew;
return masternodeCollateralOld;
}
24 changes: 24 additions & 0 deletions src/chainparams.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,22 @@ class CChainParams
void SetRegTestCoinbaseMustBeProtected() { consensus.fCoinbaseMustBeProtected = true; }
int FulfilledRequestExpireTime() const { return nFulfilledRequestExpireTime; }

//Sporks
std::string SporkPubKey() const { return strSporkPubKey; }

uint64_t ForkStartHeight() const { return nForkStartHeight; };
uint64_t ForkHeightRange() const { return nForkHeightRange; };
uint64_t ZshieldedStartBlock() const { return nZshieldedStartBlock; };
uint64_t ZtransparentStartBlock() const { return nZtransparentStartBlock; };

/** Return the founder's reward address and script for a given block height */
std::string GetFoundersRewardAddressAtHeight(int height) const;
CScript GetFoundersRewardScriptAtHeight(int height) const;
std::string GetFoundersRewardAddressAtIndex(int i) const;
int GetMasternodeCollateral(int nHeight) const;

int GetFoundersRewardBlockStart() const { return nFoundersRewardBlockStart; };

protected:
CChainParams() {}

Expand Down Expand Up @@ -136,10 +147,23 @@ class CChainParams
int nFulfilledRequestExpireTime;
std::vector<std::string> vFoundersRewardAddress;

//Sporks
std::string strSporkPubKey;

uint64_t nForkStartHeight;
uint64_t nForkHeightRange;
uint64_t nZshieldedStartBlock;
uint64_t nZtransparentStartBlock;

//Masternode related
int masternodeCollateralChangeBlock;
int masternodeCollateralOld;
int masternodeCollateralNew;

//Founders reward
int nFoundersRewardBlockStart;
int foundersRewardAddressPeriod;

};

/**
Expand Down
12 changes: 6 additions & 6 deletions src/clientversion.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2018 ANON Core developers
// Copyright (c) 2018-2019 ANON Core developers
// Copyright (c) 2017-2018 The Bitcoin Private developers
// Copyright (c) 2009-2014 The Bitcoin Core developers
// Copyright (c) 2016-2017 The Zcash developers
Expand All @@ -18,10 +18,10 @@
*/

//! These need to be macros, as clientversion.cpp's and bitcoin*-res.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR 1
#define CLIENT_VERSION_MAJOR 2
#define CLIENT_VERSION_MINOR 0
#define CLIENT_VERSION_REVISION 12
#define CLIENT_VERSION_BUILD 51
#define CLIENT_VERSION_REVISION 0
#define CLIENT_VERSION_BUILD 0

//! Set to true for release, false for prerelease or test build
#define CLIENT_VERSION_IS_RELEASE true
Expand All @@ -30,7 +30,7 @@
* Copyright year (2009-this)
* Todo: update this when changing our copyright comments in the source
*/
#define COPYRIGHT_YEAR 2018
#define COPYRIGHT_YEAR 2019

#endif //HAVE_CONFIG_H

Expand All @@ -42,7 +42,7 @@
#define DO_STRINGIZE(X) #X

//! Copyright string used in Windows .rc files
#define COPYRIGHT_STR "2009-" STRINGIZE(COPYRIGHT_YEAR) " The Bitcoin Core Developers and The Zcash developers"
#define COPYRIGHT_STR "2009-" STRINGIZE(COPYRIGHT_YEAR) " The Bitcoin Core Developers, The Zcash developers and The Anon developers"

/**
* bitcoind-res.rc includes this file, but it cannot cope with real c++ code.
Expand Down
7 changes: 6 additions & 1 deletion src/consensus/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,13 @@ struct Params {
int nMasternodePaymentsStartBlock;
int nMasternodePaymentsIncreaseBlock;
int nMasternodePaymentsIncreasePeriod; // in blocks

// Budget related
int nBudgetPaymentsStartBlock;
int nBudgetPaymentsCycleBlocks;
int nSuperblockStartBlock;
int nSuperblockCycle; // in blocks
int nSuperblockCycle; // in blocks

int nMasternodeMinimumConfirmations;
// int nGovernanceFilterElements;
// int nGovernanceMinQuorum;
Expand Down
14 changes: 10 additions & 4 deletions src/darksend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ CDarkSendSigner darkSendSigner;

// void CDarksendPool::ProcessMessage(CNode* pfrom, std::string& strCommand, CDataStream& vRecv)
// {
// if(fLiteMode) return; //
// if(fLiteMode) return; //
// if(!masternodeSync.IsBlockchainSynced()) return;

// if(strCommand == NetMsgType::DSACCEPT) {
Expand Down Expand Up @@ -2262,9 +2262,12 @@ bool CDarkSendSigner::IsVinAssociatedWithPubkey(const CTxIn& txin, const CPubKey

CTransaction tx;
uint256 hash;
if(GetTransaction(txin.prevout.hash, tx, hash, true)) {
BOOST_FOREACH(CTxOut out, tx.vout)
if(out.nValue == 500*COIN && out.scriptPubKey == payee) return true;
{
LOCK(cs_main);
if(GetTransaction(txin.prevout.hash, tx, hash, true)) {
BOOST_FOREACH(CTxOut out, tx.vout)
if(out.nValue == Params().GetMasternodeCollateral(chainActive.Height())*COIN && out.scriptPubKey == payee) return true;
}
}
return false;
}
Expand Down Expand Up @@ -2302,6 +2305,9 @@ bool CDarkSendSigner::VerifyMessage(CPubKey pubkey, const std::vector<unsigned c
return false;
}

pubkey.Decompress();
pubkeyFromSig.Decompress();

if(pubkeyFromSig.GetID() != pubkey.GetID()) {
strErrorRet = strprintf("Keys don't match: pubkey=%s, pubkeyFromSig=%s, strMessage=%s, vchSig=%s",
pubkey.GetID().ToString(), pubkeyFromSig.GetID().ToString(), strMessage,
Expand Down
Loading

0 comments on commit 9544cf6

Please sign in to comment.