Bitcoin Forum
July 03, 2024, 04:43:19 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: « 1 ... 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 [121] 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 »
2401  Alternate cryptocurrencies / Altcoin Discussion / Re: How do you create an altcoin? on: April 14, 2013, 12:13:00 AM
Ive made a discovery... i think??
That's where I derived my information from, by following the functions.
2402  Alternate cryptocurrencies / Altcoin Discussion / Re: How do you create an altcoin? on: April 14, 2013, 12:10:06 AM
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.
2403  Alternate cryptocurrencies / Altcoin Discussion / Re: How do you create an altcoin? on: April 14, 2013, 12:02:26 AM
Ok, so we basically have this

Code:
        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

Code:
    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.

Code:
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

Code:
    uint256 GetHash() const
    {
        return SerializeHash(*this);
    }

which passes the instance of the object to SerializeHash. SerializeHash is located in hash.h

Code:
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,

Code:
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

Code:
    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
2404  Alternate cryptocurrencies / Altcoin Discussion / Re: How do you create an altcoin? on: April 13, 2013, 11:57:21 PM
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 Cheesy Cheesy Cheesy
LOL, I didn't even notice.
2405  Alternate cryptocurrencies / Altcoin Discussion / Re: How do you create an altcoin? on: April 13, 2013, 11:44:25 PM
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.
2406  Alternate cryptocurrencies / Altcoin Discussion / Re: How do you create an altcoin? on: April 13, 2013, 10:56:14 PM
Well you guys are in luck though, I was provided with this piece of code that does what you want, although it's in python AND CPU-based, so it will take some time.

https://github.com/freicoin/freicoin/blob/master/share/find_genesis_block.py of course you still need a valid merkle root, as the one there is just an example.
2407  Alternate cryptocurrencies / Altcoin Discussion / Re: How do you create an altcoin? on: April 13, 2013, 10:53:45 PM
So what exactly should I be doing now?  Huh

Help us look for the damn Start blockchain button  Grin

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.
2408  Alternate cryptocurrencies / Altcoin Discussion / Re: How do you create an altcoin? on: April 13, 2013, 10:50:12 PM


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 Cheesy
2409  Alternate cryptocurrencies / Altcoin Discussion / Re: How do you create an altcoin? on: April 13, 2013, 10:47:50 PM
The genesis block is created from this piece of code

Quote
       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.
2410  Alternate cryptocurrencies / Altcoin Discussion / Re: How do you create an altcoin? on: April 13, 2013, 10:41:29 PM
Ok, should I just change some numbers and letters in this line?

Code:
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.
2411  Alternate cryptocurrencies / Altcoin Discussion / Re: How do you create an altcoin? on: April 13, 2013, 10:40:12 PM
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.
2412  Alternate cryptocurrencies / Altcoin Discussion / Re: How do you create an altcoin? on: April 13, 2013, 10:36:47 PM
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.
2413  Alternate cryptocurrencies / Altcoin Discussion / Re: How do you create an altcoin? on: April 13, 2013, 10:33:06 PM
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 Cheesy
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.
2414  Alternate cryptocurrencies / Altcoin Discussion / Re: How do you create an altcoin? on: April 13, 2013, 10:28:27 PM
And we begin diving into the code, ive got my terminal window open and the git repository cloned Cheesy Lets go! Cheesy
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.
2415  Alternate cryptocurrencies / Altcoin Discussion / Re: How do you create an altcoin? on: April 13, 2013, 10:14:51 PM
Thanks for the interest everyone, it will keep me from giving up Cheesy.

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  Grin Grin Cheesy Cheesy
2416  Alternate cryptocurrencies / Altcoin Discussion / Re: Terracoin. What the hell is going on? on: April 13, 2013, 10:08:47 PM
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.
2417  Bitcoin / Development & Technical Discussion / Re: where to import 10000 addresses?? on: April 13, 2013, 08:45:15 PM
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.
2418  Economy / Economics / Re: = Grand Unified Solution to Lost Coins, Hoarding, Deflation, Speculation = on: April 13, 2013, 05:11:47 PM
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?
2419  Bitcoin / Bitcoin Discussion / Re: Bodybuilding.com Misc forum about Bitcoin on: April 13, 2013, 04:55:02 PM
That forum is most famous for it's "I'm 18 do I have potential?" photoshopped images.
2420  Economy / Service Discussion / Re: It's silly to bash MTGOX on: April 13, 2013, 04:03:04 PM
Why on earth are you out of the newbie section? MtGox are manipulative.
Pages: « 1 ... 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 [121] 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 »
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!