Skip to content

Commit

Permalink
Add premine
Browse files Browse the repository at this point in the history
  • Loading branch information
Bitcoinx committed Dec 21, 2017
1 parent f859445 commit 08220e2
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 5 deletions.
6 changes: 6 additions & 0 deletions src/chainparams.cpp
Expand Up @@ -107,6 +107,8 @@ class CMainParams : public CChainParams {
consensus.defaultAssumeValid = uint256S("0x0000000000000000003b9ce759c2a087d52abc4266f8f4ebd6d768b89defa50a"); //477890

consensus.hardforkHeight = 501451;
consensus.premineAddress = "18wFZB62chDhYdapBnVEXX4y9hUvWs8yRu";
consensus.premineValue = 2000000 * COIN;

This comment has been minimized.

Copy link
@youngminz

youngminz Dec 23, 2017

What?

This comment has been minimized.

Copy link
@pyrexcoin-project

pyrexcoin-project Dec 24, 2017

just premine of 6 000 000 segwit2x or B2X ;D

This comment has been minimized.

Copy link
@vinniefalco

vinniefalco Dec 24, 2017

Contributor

Only six million? Why not make it an even billion :)

This comment has been minimized.

Copy link
@revskill10

revskill10 Dec 25, 2017

Why premine ? Is it bad ?

This comment has been minimized.

Copy link
@youngminz

youngminz Dec 25, 2017

Premining itself is not bad, but not communicating this to the community is bad. Searching for b2x premine on Google will only find bitcoin gold. Also there is no mention on the official website.

This comment has been minimized.

Copy link
@jschreiber-TS

jschreiber-TS Dec 26, 2017

This is a great way to start your new fork!

This comment has been minimized.

Copy link
@FaysalM

FaysalM Dec 26, 2017

Should have been 1 Trillion. I think the guys are making a big mistake by not doing 1 trillion coins pre-mine.

This comment has been minimized.

Copy link
@serhatates

serhatates Dec 26, 2017

scam coin alert! If algorithm unless not sha-256 it ll not a segwit2x

This comment has been minimized.

Copy link
@revskill10

revskill10 Dec 26, 2017

Anyway, btc to the moon due to this fork.

This comment has been minimized.

Copy link
@ucaglayan

ucaglayan Dec 26, 2017

SCAM COIN!!!

This comment has been minimized.

Copy link
@serhatates

serhatates Dec 26, 2017

This is not Segwit2X. This is a different hard fork of Bitcoin by a different team, but using the same name.

It looks like some people were fooled by this because S2X futures are up to $500:

https://coinmarketcap.com/currencies/segwit2x/

This comment has been minimized.

Copy link
@themotu

themotu Dec 26, 2017

Sad sad sad, grow a pair and get a real job, scamming POS coin

This comment has been minimized.

Copy link
@hershman

hershman Dec 27, 2017

I bought B2X futures but sold them since this hasn't been changed. Any comment from the team? The Reddit is near dead and there are posts there calling it a scam

This comment has been minimized.

Copy link
@bliotti

bliotti Dec 27, 2017

Fake FAke Fake Fake

This comment has been minimized.

Copy link
@bliotti

bliotti Dec 27, 2017

Stealing from satoshi... really...

This comment has been minimized.

Copy link
@ATouhou

ATouhou Dec 27, 2017

xD

This comment has been minimized.

Copy link
@bliotti

bliotti Dec 27, 2017

Fegwit2x

This comment has been minimized.

Copy link
@SMTDDR

SMTDDR Dec 28, 2017

static const CAmount COIN = 100000000;

consensus.premineValue = 2000000 * COIN;

🀣 🀣 🀣 🀣 🀣 🀣 🀣 🀣 🀣 🀣 🀣 🀣 🀣 🀣 🀣 🀣 🀣 🀣 🀣 🀣
laughinganimegirl

This comment has been minimized.

Copy link
@kwirky

kwirky Dec 28, 2017

scam


/**
* The message start string is designed to be unlikely to occur in normal data.
Expand Down Expand Up @@ -223,6 +225,8 @@ class CTestNetParams : public CChainParams {
consensus.defaultAssumeValid = uint256S("0x0000000002e9e7b00e1f6dc5123a04aad68dd0f0968d8c7aa45f6640795c37b1"); //1135275

consensus.hardforkHeight = 1200000;
consensus.premineAddress = "mh7CayYx3J8ofEU5zSZPqJJV65d8ijkJpm";
consensus.premineValue = 2000000 * COIN;

This comment has been minimized.

Copy link
@NicholasKobald

NicholasKobald Dec 28, 2017

lgtm


pchBitcoinMessageStart[0] = 0x0b;
pchBitcoinMessageStart[1] = 0x11;
Expand Down Expand Up @@ -314,6 +318,8 @@ class CRegTestParams : public CChainParams {
consensus.defaultAssumeValid = uint256S("0x00");

consensus.hardforkHeight = 100;
consensus.premineAddress = "ms17iABVQf7RQB8iaxeXPBkFdQQjCv7CmV";
consensus.premineValue = 2000000 * COIN;

This comment has been minimized.

Copy link
@boriskozak

boriskozak Dec 27, 2017

That's reprehensible.

This comment has been minimized.

Copy link
@SMTDDR

SMTDDR Dec 28, 2017

@boriskozak It's beautiful

static const CAmount COIN = 100000000;
🀣


pchBitcoinMessageStart[0] = 0xfa;
pchBitcoinMessageStart[1] = 0xbf;
Expand Down
4 changes: 3 additions & 1 deletion src/consensus/params.h
Expand Up @@ -7,6 +7,7 @@
#define BITCOIN_CONSENSUS_PARAMS_H

#include "uint256.h"
#include "amount.h"
#include <map>
#include <string>

Expand Down Expand Up @@ -65,8 +66,9 @@ struct Params {
uint256 nMinimumChainWork;
uint256 defaultAssumeValid;

/** Block height at which X11 and DGW becomes active */
int hardforkHeight;
std::string premineAddress;
CAmount premineValue;
};
} // namespace Consensus

Expand Down
11 changes: 10 additions & 1 deletion src/miner.cpp
Expand Up @@ -7,6 +7,7 @@

#include "amount.h"
#include "chain.h"
#include "base58.h"
#include "chainparams.h"
#include "coins.h"
#include "consensus/consensus.h"
Expand Down Expand Up @@ -161,10 +162,18 @@ std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(const CScript& sc
CMutableTransaction coinbaseTx;
coinbaseTx.vin.resize(1);
coinbaseTx.vin[0].prevout.SetNull();
coinbaseTx.vin[0].scriptSig = CScript() << nHeight << OP_0;
coinbaseTx.vout.resize(1);
coinbaseTx.vout[0].scriptPubKey = scriptPubKeyIn;
coinbaseTx.vout[0].nValue = nFees + GetBlockSubsidy(nHeight, chainparams.GetConsensus());
coinbaseTx.vin[0].scriptSig = CScript() << nHeight << OP_0;

// Add premine at hardfork height
if (nHeight == chainparams.GetConsensus().hardforkHeight) {
auto pmValue = chainparams.GetConsensus().premineValue;
CBitcoinAddress pmAddr(chainparams.GetConsensus().premineAddress);
coinbaseTx.vout.push_back(CTxOut(pmValue, GetScriptForDestination(pmAddr.Get())));
}

pblock->vtx[0] = MakeTransactionRef(std::move(coinbaseTx));
pblocktemplate->vchCoinbaseCommitment = GenerateCoinbaseCommitment(*pblock, pindexPrev, chainparams.GetConsensus());
pblocktemplate->vTxFees[0] = -nFees;
Expand Down
22 changes: 19 additions & 3 deletions src/validation.cpp
Expand Up @@ -6,6 +6,7 @@
#include "validation.h"

#include "arith_uint256.h"
#include "base58.h"
#include "chain.h"
#include "chainparams.h"
#include "checkpoints.h"
Expand Down Expand Up @@ -1573,7 +1574,7 @@ int32_t ComputeBlockVersion(const CBlockIndex* pindexPrev, const Consensus::Para
}
}

if (pindexPrev->nHeight + 1 >= params.hardforkHeight) {
if (pindexPrev && pindexPrev->nHeight + 1 >= params.hardforkHeight) {
nVersion |= VERSIONBITS_BITCOINX;
}

Expand Down Expand Up @@ -1831,13 +1832,27 @@ static bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockInd
int64_t nTime3 = GetTimeMicros(); nTimeConnect += nTime3 - nTime2;
LogPrint(BCLog::BENCH, " - Connect %u transactions: %.2fms (%.3fms/tx, %.3fms/txin) [%.2fs]\n", (unsigned)block.vtx.size(), 0.001 * (nTime3 - nTime2), 0.001 * (nTime3 - nTime2) / block.vtx.size(), nInputs <= 1 ? 0 : 0.001 * (nTime3 - nTime2) / (nInputs-1), nTimeConnect * 0.000001);

auto isPremineBlock = pindex->nHeight == chainparams.GetConsensus().hardforkHeight;
auto premineValue = chainparams.GetConsensus().premineValue;

CAmount blockReward = nFees + GetBlockSubsidy(pindex->nHeight, chainparams.GetConsensus());
if (isPremineBlock) blockReward += premineValue;
if (block.vtx[0]->GetValueOut() > blockReward)
return state.DoS(100,
error("ConnectBlock(): coinbase pays too much (actual=%d vs limit=%d)",
block.vtx[0]->GetValueOut(), blockReward),
REJECT_INVALID, "bad-cb-amount");

// Check premine tx-out at hardfork height
const auto& coinbaseVouts = block.vtx[0]->vout;
if (isPremineBlock) {
const auto it = std::find(
coinbaseVouts.cbegin(), coinbaseVouts.cend(),
CTxOut(premineValue, GetScriptForDestination(CBitcoinAddress(chainparams.GetConsensus().premineAddress).Get())));
if (it == coinbaseVouts.cend())
return state.DoS(100, error("ConnectBlock(): coinbase has no premine", REJECT_INVALID, "bad-cb-no-premine"));
}

if (!control.Wait())
return state.DoS(100, error("%s: CheckQueue failed", __func__), REJECT_INVALID, "block-validation-failed");
int64_t nTime4 = GetTimeMicros(); nTimeVerify += nTime4 - nTime2;
Expand Down Expand Up @@ -4173,8 +4188,6 @@ void static CheckBlockIndex(const Consensus::Params& consensusParams)
if (pindex->pprev != nullptr && pindexFirstNotScriptsValid == nullptr && (pindex->nStatus & BLOCK_VALID_MASK) < BLOCK_VALID_SCRIPTS) pindexFirstNotScriptsValid = pindex;

// Begin: actual consistency checks.
// Check hardfork version
assert(pindex->nHeight >= consensusParams.hardforkHeight && pindex->IsBitcoinX());
if (pindex->pprev == nullptr) {
// Genesis block checks.
assert(pindex->GetBlockHash() == consensusParams.hashGenesisBlock); // Genesis block's hash must match.
Expand All @@ -4197,6 +4210,9 @@ void static CheckBlockIndex(const Consensus::Params& consensusParams)
assert((pindexFirstNeverProcessed != nullptr) == (pindex->nChainTx == 0)); // nChainTx != 0 is used to signal that all parent blocks have been processed (but may have been pruned).
assert((pindexFirstNotTransactionsValid != nullptr) == (pindex->nChainTx == 0));
assert(pindex->nHeight == nHeight); // nHeight must be consistent.
// Check hardfork version
if (pindex->nHeight >= consensusParams.hardforkHeight)
assert(pindex->IsBitcoinX());
assert(pindex->pprev == nullptr || pindex->nChainWork >= pindex->pprev->nChainWork); // For every block except the genesis block, the chainwork must be larger than the parent's.
assert(nHeight < 2 || (pindex->pskip && (pindex->pskip->nHeight < nHeight))); // The pskip pointer must point back for all but the first 2 blocks.
assert(pindexFirstNotTreeValid == nullptr); // All mapBlockIndex entries must at least be TREE valid
Expand Down

8 comments on commit 08220e2

@erdemserhatergen
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not segwit2x. Some shitty people trying to scam people by pre-mining 2 million coins and using sewgit2x name. Real one has been cancelled and you can find information on different exchange market news.

Here is the statement from bittrex:

https://support.bittrex.com/hc/en-us/articles/115002603211-Statement-on-Bitcoin-Segwit2x-hard-fork

@verretor
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love your shitcoin.

@armujahid
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why why why?

@bliotti
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fake fake fake

@scottdonaldau
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lol w0t m8?

@Cr4bz
Copy link

@Cr4bz Cr4bz commented on 08220e2 Dec 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fvckk your shitcoin,, u're no more than loserrr

@420Lord
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another scam coin

@verretor
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're going to have a problem when you hit 21 million coins.

static const CAmount MAX_MONEY = 21000000 * COIN;

Please sign in to comment.