Skip to content

Commit

Permalink
PPCoin: Official genesis blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnyking committed Aug 16, 2012
1 parent 42ba38f commit b572a18
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 21 deletions.
17 changes: 8 additions & 9 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2252,34 +2252,33 @@ bool LoadBlockIndex(bool fAllowNew)
// vMerkleTree: 4a5e1e

// Genesis block
const char* pszTimestamp = "MarketWatch 07/Nov/2011 Gold tops $1,790 to end at over six-week high";
const char* pszTimestamp = "Matonis 07-AUG-2012 Parallel Currencies And The Roadmap To Monetary Freedom";
CTransaction txNew;
txNew.nTime = 1339538219;
txNew.nTime = 1345083810;
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.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 = 1339540307;
block.nTime = 1345084287;
block.nBits = bnProofOfWorkLimit.GetCompact();
block.nNonce = 1281822831;
block.nNonce = 2179302059;

if (fTestNet)
{
block.nTime = 1296688602;
block.nBits = 0x1d07fff8;
block.nNonce = 384568319;
block.nTime = 1345090000;
block.nNonce = 122894938;
}

//// debug print
printf("%s\n", block.GetHash().ToString().c_str());
printf("%s\n", hashGenesisBlock.ToString().c_str());
printf("%s\n", block.hashMerkleRoot.ToString().c_str());
assert(block.hashMerkleRoot == uint256("0x1557f46a17fcf8843dbe4c0c0edfd1d17eeff2c3c48d73a59d11f5d176e4b54d"));
assert(block.hashMerkleRoot == uint256("0x3c2d8f85fab4d17aac558cc648a1a58acff0de6deb890c29985690052c5993c2"));
block.print();
assert(block.GetHash() == hashGenesisBlock);
assert(block.CheckBlock());
Expand Down
4 changes: 2 additions & 2 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ static const int fHaveUPnP = true;
static const int fHaveUPnP = false;
#endif

static const uint256 hashGenesisBlockOfficial("0x000000007c82d1f0aa2896b01bf533a8cc26a1f44790be4ceb4ecde7bee24add");
static const uint256 hashGenesisBlockTestNet("0x00000007199508e34a9ff81e6ec0c477a4cccff2a4767a8eee39c11db367b008");
static const uint256 hashGenesisBlockOfficial("0x0000000032fe677166d54963b62a4677d8957e87c508eaa4fd7eb1c880cd27e3");
static const uint256 hashGenesisBlockTestNet("0x00000001f757bb737f6596503e17cd17b0658ce630cc727c0cca81aec47c9f06");

extern CScript COINBASE_FLAGS;

Expand Down
4 changes: 2 additions & 2 deletions src/makefile.unix
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ clean:

ppcoin/obj/genesis.o: ppcoin/genesis.cpp
$(CXX) -c $(xCXXFLAGS) -MMD -o $@ $<
$(CXX) -c $(xCXXFLAGS) -MMD -DPPCOIN_GENESIS -o obj/nogui/init.o init.cpp
$(CXX) -c $(xCXXFLAGS) -MMD -DPPCOIN_GENESIS -o obj/init.o init.cpp

genesis: ppcoin/obj/genesis.o $(OBJS:obj/%=obj/nogui/%)
genesis: ppcoin/obj/genesis.o $(OBJS:obj/%=obj/%)
$(CXX) $(CXXFLAGS) -o $@ $^ $(LIBS)
-rm -f obj/init.*
-rm -f ppcoin/obj/genesis.*
Expand Down
23 changes: 15 additions & 8 deletions src/ppcoin/genesis.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) 2011 The PPCoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
#include "../headers.h"
#include "../db.h"
#include "../net.h"
#include "../init.h"
Expand All @@ -17,19 +16,20 @@ int main(int argc, char *argv[])
printf("PPCoin Begin Genesis Block\n");

// Genesis block
const char* pszTimestamp = "MarketWatch 07/Nov/2011 Gold tops $1,790 to end at over six-week high";
const char* pszTimestamp = "Matonis 07-AUG-2012 Parallel Currencies And The Roadmap To Monetary Freedom";
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.vin[0].scriptSig = CScript() << 486604799 << CBigNum(9999) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
txNew.vout[0].SetEmpty();
txNew.nTime = 1345083810; // only for testnet
CBlock block;
block.vtx.push_back(txNew);
block.hashPrevBlock = 0;
block.hashMerkleRoot = block.BuildMerkleTree();
block.nVersion = 1;
block.nBits = 0x1d00ffff;
block.nTime = GetAdjustedTime();
block.nBits = CBigNum(~uint256(0) >> 28).GetCompact(); //0x1d00ffff;
block.nTime = 1345090000; //GetAdjustedTime();
block.nNonce = 0;

CBigNum bnTarget;
Expand All @@ -39,9 +39,16 @@ int main(int argc, char *argv[])
{
if ((block.nNonce >> 20) << 20 == block.nNonce)
{
if (block.vtx[0].nTime + 7200 < GetAdjustedTime() + 60)
block.vtx[0].nTime = GetAdjustedTime();
block.nTime = GetAdjustedTime();
//if (block.vtx[0].nTime + 7200 < GetAdjustedTime() + 60)
//{
// block.vtx[0].nTime = GetAdjustedTime();
// block.hashMerkleRoot = block.BuildMerkleTree();
//}
if (block.nNonce > 4000000000)
{
block.nTime++; // = GetAdjustedTime();
block.nNonce = 0;
}
printf("n=%dM hash=%s\n", block.nNonce >> 20,
block.GetHash().ToString().c_str());
}
Expand Down

0 comments on commit b572a18

Please sign in to comment.