1 /********************************************************************
2 * (C) 2018 Michael Toutonghi
4 * Distributed under the MIT software license, see the accompanying
5 * file COPYING or http://www.opensource.org/licenses/mit-license.php.
7 * This crypto-condition eval solves the problem of nothing-at-stake
8 * in a proof of stake consensus system.
17 #include "CCinclude.h"
19 #include "script/script.h"
21 #define DEFAULT_STAKE_TXFEE 0
23 bool UnpackStakeOpRet(const CTransaction &stakeTx, std::vector<std::vector<unsigned char>> &vData);
25 bool GetStakeParams(const CTransaction &stakeTx, CStakeParams &stakeParams);
27 bool ValidateStakeTransaction(const CTransaction &stakeTx, CStakeParams &stakeParams, bool validateSig = true);
29 bool ValidateMatchingStake(const CTransaction &ccTx, uint32_t voutNum, const CTransaction &stakeTx, bool &cheating);
31 bool MakeGuardedOutput(CAmount value, CPubKey &dest, CTransaction &stakeTx, CTxOut &vout);
33 bool MakeCheatEvidence(CMutableTransaction &mtx, const CTransaction &ccTx, uint32_t voutNum, const CTransaction &cheatTx);
35 bool StakeGuardValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn);
37 bool IsStakeGuardInput(const CScript &scriptSig);
39 UniValue StakeGuardInfo();