Ive made a discovery... i think??
That's where I derived my information from, by following the functions.
|
|
|
If Sunny King can help us, it'd be nice. But I guess the reason the genesis block creation information is not found easily is because every noob(me included) on the block will have an alt-currency out by the end of the day.
|
|
|
Ok, so we basically have this const char* pszTimestamp = "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks"; 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.vout[0].nValue = 50 * COIN; txNew.vout[0].scriptPubKey = CScript() << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f") << OP_CHECKSIG; CBlock block; block.vtx.push_back(txNew); block.hashPrevBlock = 0; block.hashMerkleRoot = block.BuildMerkleTree(); What we are interested in is, BuildMerkleTree which is found in main.h uint256 BuildMerkleTree() const { vMerkleTree.clear(); BOOST_FOREACH(const CTransaction& tx, vtx) vMerkleTree.push_back(tx.GetHash()); int j = 0; for (int nSize = vtx.size(); nSize > 1; nSize = (nSize + 1) / 2) { for (int i = 0; i < nSize; i += 2) { int i2 = std::min(i+1, nSize-1); vMerkleTree.push_back(Hash(BEGIN(vMerkleTree[j+i]), END(vMerkleTree[j+i]), BEGIN(vMerkleTree[j+i2]), END(vMerkleTree[j+i2]))); } j += nSize; } return (vMerkleTree.empty() ? 0 : vMerkleTree.back()); } Next we are interested in this, I believe. vMerkleTree.push_back(tx.GetHash()); since we have only one transaction, this will return as soon as it computes the has. So we see tx.GetHash, and that tx is of type CTransaction, so we head in that class, which is in main.h again and see this coide uint256 GetHash() const { return SerializeHash(*this); } which passes the instance of the object to SerializeHash. SerializeHash is located in hash.h template<typename T> uint256 SerializeHash(const T& obj, int nType=SER_GETHASH, int nVersion=PROTOCOL_VERSION) { CHashWriter ss(nType, nVersion); ss << obj; return ss.GetHash(); } Here we see that the object is written(I think, not sure) to ss which is an instance of CHashWriter which is also in main.h and that is where the funky business happens that is uber hard to understand. But here we go, class CHashWriter { private: SHA256_CTX ctx;
public: int nType; int nVersion;
void Init() { SHA256_Init(&ctx); }
CHashWriter(int nTypeIn, int nVersionIn) : nType(nTypeIn), nVersion(nVersionIn) { Init(); }
CHashWriter& write(const char *pch, size_t size) { SHA256_Update(&ctx, pch, size); return (*this); }
// invalidates the object uint256 GetHash() { uint256 hash1; SHA256_Final((unsigned char*)&hash1, &ctx); uint256 hash2; SHA256((unsigned char*)&hash1, sizeof(hash1), (unsigned char*)&hash2); return hash2; }
template<typename T> CHashWriter& operator<<(const T& obj) { // Serialize to this stream ::Serialize(*this, obj, nType, nVersion); return (*this); } }; CHashWriter, small, but deadly. I guess what we are further interested in, is template<typename T> CHashWriter& operator<<(const T& obj) { // Serialize to this stream ::Serialize(*this, obj, nType, nVersion); return (*this); } which as you calls some global function Serialize that may or may not be located in serialize.h
|
|
|
In addition 5th said you need a valid Merkle root... that the one in his code was for illustration. Someone with experience will need to chime in on that one.
Truth be told I dig deep and deep in Bitcoin's source and it does some kind of serialization of objects and stuff and finally produces a merkle root hash..seriously ridiculously hard to even figure out what the hell happens. Your post count is 666 and you mentioned hell on your 666 post. :| OMG! I was just thinking this LOL, I didn't even notice.
|
|
|
In addition 5th said you need a valid Merkle root... that the one in his code was for illustration. Someone with experience will need to chime in on that one.
Truth be told I dig deep and deep in Bitcoin's source and it does some kind of serialization of objects and stuff and finally produces a merkle root hash..seriously ridiculously hard to even figure out what the hell happens.
|
|
|
So what exactly should I be doing now? Help us look for the damn Start blockchain button But what if you compile your code, start it with the -server function and try to mine it? I don't think it can work like that, since the client assumes that a genesis block already exists. Since it doesn't in your case, you need a custom miner.
|
|
|
Yes... I read it's common practice (as it were) to put the headline from the current newspaper in the genesis block code.
Not necessarily, for instance Litecoin used Steve Jobs's death. If it was me, I'd have chosen Cypress's bailout. It would've been the equivalent to satoshi's message and would've guaranteed you success
|
|
|
The genesis block is created from this piece of code const char* pszTimestamp = "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks" //<- change this to something else; 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.vout[0].nValue = 50 * COIN //your premine basically; txNew.vout[0].scriptPubKey = CScript() << ParseHex("<public key from an ECDSA keypair>") << OP_CHECKSIG; CBlock block; block.vtx.push_back(txNew); block.hashPrevBlock = 0; block.hashMerkleRoot = block.BuildMerkleTree(); Now you mine that.
|
|
|
Ok, should I just change some numbers and letters in this line? 32 uint256 hashGenesisBlock("0x12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2"); No!!!. The genesis block process is not as simple as that. You ACTUALLY need to mine it as a regular block. It's also a process that I don't understand. This is probably the thing that will slow you down the most.
|
|
|
The problem with github, is it's really really hard to use. I am on Windows, and have absolutely no idea how to use it in terms of committing/merging and so on.
|
|
|
Should I put the binaries and etc. up in this thread when im done?
You first need to create a genesis block. Even when I asked I couldn't fully understand the process.
|
|
|
Lol... people will say all kinds of stuff... I like the thought of exploring the settings for a 'fun coin'.
My guess (and please don't shoot me).... is most of what is needed is in main.cpp as far as default settings go. Someone with a bit more experience will need to chime in on this one:
32 uint256 hashGenesisBlock("0x12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2"); 33 static CBigNum bnProofOfWorkLimit(~uint256(0) >> 20); // Litecoin: starting difficulty is 1 / 2^12
59 int64 nTransactionFee = 0; 60 int64 nMinimumInputValue = CENT / 100;
Block Reward 831 int64 nSubsidy = 50 * COIN;
It seems that everything you need is in main.ccp and main.h. Every other files are "support" files, like to build the keys, define the algorithm and other support functionalities. As for changing the algorithm, I don't think it's going to be that easy to remove Scrypt and put something else. That Scrypt.c file is scary as hell To be honest I was thinking of doing an alt-coin myself, but ultimately wanted to bring something new on the table in terms of proof-of-work algorithm, as even scrypt proved useless against GPUs.
|
|
|
And we begin diving into the code, ive got my terminal window open and the git repository cloned Lets go! Usually when you start making a coin, you have to realize that there are more people on Windows here than on Unix/Unix-like platforms, so a Windows binary is a must. Whereas Linux users can most of the time make;make install it very easily.
|
|
|
Thanks for the interest everyone, it will keep me from giving up . Ive decided on a 50 coin reward for each solved block and that will half every 4-5 years. As for the total amount of coins i think i'll go with 25 million coins. Does this sound good? Sounds genius, something which we have not seen before
|
|
|
You know, in my opinion, it's likely this guy who is taking advantage of Terracoin's diff is Luke-jr, he's done it before on other alt-coins, no reason he can't spare 100gh/s to do it again.
|
|
|
OP, the only way to import keys into the standard Bitcoin-Qt/Bitcoind client is to do it manually one by one, or do it via a script, where usually it's 2 keys per second that are imported.
So basically you are looking at over an hour of importing.
|
|
|
This is probably the most evil thing I can imagine. But this one simple change would solve every single thing below:
- Solve the problem of lost coins / lost keys - Prevent hoarding of coins / make it unprofitable in the long run to hoard them - Encourage people to spend their coins as a currency - Prevent over-speculation leading to volatility - Create greater incentives for miners and give miners a reason to mine past 2140 - Eliminate transaction fees completely - Solve the problem of deflation, while still preventing inflation at the same time (sound impossible? Not with this solution!)
If all those things are solved, mainstream economists would actually take Bitcoin seriously as an economic model, meanwhile the technological protocol and decentralization would be preserved. With this solution, we would still enjoy the benefits of the currency being decentralized, crpytographic, and pseudonymous, while mainstream economists would be more likely to endorse it as a practical currency rather than view it as the commodity / collectible that it currently is.
The grand unified solution is: Have the coins in circulation naturally "decay" over a very long period of time, like a radioactive isotope. Over the course of a year or so, each coin in existence would lose around 0.5%-1% of it's present value. That 1% or so would be re-issued as network fees and greater mining rewards, to the nodes that are actually responsible for sustaining the network. The exact decay rate could be variable based on an algorithm that takes into account the network hash rate and/or transaction volume, or it could be a fixed rate. The decay would have to be calculated at each block, but it should take at least a year to lose the 0.5%-1%.
A simple balance = balance * e^(-bt) where t is the number of seconds elapsed since the last block was created, and b is a very small number (0.00000001-ish) would do the trick.
This would make it so that the value of lost coins asymptotically approaches 0 over a very long period of time, eliminating the need to worry about lost coins causing deflation in the long run. Hoarders will have an incentive to invest rather than hoard. People would spend their currency as a currency rather than speculate and day trade. There would be no need to charge transaction fees since the nodes would be rewarded for moving transactions to blocks this way instead. This will further incentivize spending since users won't be dissuaded by transaction fees.
There would be no inflation, since the number is still capped at 21 million, but all the things that built-in inflation tries to solve in fiat systems, this would solve.
If Bitcoin is going to be adopted by the mainstream, we have to take action to solve every single one of those issues listed above. They are going to be solved anyway, whether it's by us or by them. The world is eventually going to move to a digital currency whether it's ours or theirs, this is beyond question. But if they get to it first and create something that eliminates those issues, it's going to be centralized, not anonymous, not cryptographically secured and will involve banks. If it's going to be us, we have to solve those issues some way soon, and there's not a whole lot of viable solutions for each, let alone singular solutions that fix every one.
Since this is possibly going to upset the "How dare you blaspheme the Sacred Cow by suggesting we change the rules for Bitcoin!" crowd, I humbly add this following. I think we need to let go of this idea that the current rules of Bitcoin are somehow sacred and holy, not to ever be touched because doing so would revile the spirit of the Almighty Satoshi. There is nothing wrong with recognizing a set of flaws in a system and taking action to fix those flaws. They need to be fixed somehow, and the sooner we do it, the easier it will be. If you have a better solution to all of the above, I encourage you to post it.
And what algorithm do you use to determine if keys were lost?
|
|
|
That forum is most famous for it's "I'm 18 do I have potential?" photoshopped images.
|
|
|
Why on earth are you out of the newbie section? MtGox are manipulative.
|
|
|
|