>> (p.1)
    Author Topic: A proposal for a scalable blockchain.  (Read 6250 times)
    piuk (OP)
    Hero Member
    *****
    expert
    Offline Offline

    Activity: 910
    Merit: 1005



    View Profile WWW
    November 25, 2011, 05:42:17 PM
    Last edit: November 26, 2011, 04:51:58 PM by piuk
    Merited by ABCbits (1)
     #1

    The problem:

    The blockchain will not scale how it is used currently. There is some mention of pruning unspent outputs mention on https://en.bitcoin.it/wiki/Scalability however this method still requires storage of all blockheaders, meaning there is still a unlimited cap on the blockchain size. Merkel tree pruning will not help to any significant extent as you maybe be able to tell if a transaction is in a block, however you cannot validate that block without all transactions. If lightweight clients cannot validate blocks then they cannot mine, relay blocks or relay transactions there is almost not point to them validating anything at all and might as well use a centralised blockchain.

    a) A smaller blockchain helps lower the barrier of entry for the new users.
    b) With less risk of blockchain bloat transaction fees could be lowered
    c) The larger the blockchain the less users who will run the client and the more centralised the network becomes.

    Proposed solution.

    At certain points in time the client generates a snapshot of the of every unspent tx output in the chain. This snapshot encapsulates the state of the blockchain upto, but not including, that block.  When a miner produces a block he generates a SHA256 hash of this ledger and includes the hash it in the blocks coinbase.

    When a client begins the initial block chain download it starts from the chain head and works backwards. The client downloads a minimum of 2016 blocks before it will accept a ledger hash. If there is a fork in the chain the client will continue to download blocks until it finds a pair of blocks that at least one ledger hash can be agreed upon. When an identical ledger is found the chain with the best proof of work wins. When the client accepts a hash it will ask the node to provide it with the full ledger corresponding to it which can be self hashed and verified. If the node doesn't have the ledger for that hash it may ask other nodes, if no nodes have a copy then it should continue to download past blocks until it can find a hash and a full copy of the ledger.

    To validate a transaction the client locates the each txIn outpoint in the unspent ledger and checks the corresponding script for validity. The client checks the validity of a transaction by looking at the txOutputs in it's latest ledger and at in the transactions included in blocks after. Therefore nodes do need to not generate a balance sheet every transaction instead they would keep a balance sheet for approximately two weeks (2016 blocks) before regenerating. Two weeks has been chosen as a base value because it provides enough blocks to use for difficulty targeting, however nodes are free to keep more or less blocks depending on their storage capacity.

    When the client decides it is time to generate a new ledger it looks through the chain for a more recent block which has a ledger hash in it's coinbase and is at least 2016 blocks behind the chain head. It then generates a new ledge sheet for that block and checks that the hash matches. It if matches then it is free to purge all transactions/blocks before that time. If the hash does not match then it is important to note the client does not reject the chain, as long as the proof of work is valid. The order of transactions is already decided by the order in the blockchain so the client would simply wait until a miner produces a hash it can agree with, it should not purge transactions until a hash is found. Miners may want to keep blocks for a longer period of time to ensure they have the necessary proof of work should it be needed.

    Would this fork the chain?

    No. Miners are free to insert whatever data they like into their block's coinbase. Clients that wish to hold a entire blockchain history can simply ignore it.

    How much data would clients need to hold?

    Quote
    Approximately 4.5 million txOuts and 3.3 million txIns - so ~1.2 million unspent outputs.

    At the present blockchain size, the ledger would consume at most:

    (256 + 160 + 16 + 64) * 1.2 million = 71MB

    + Approximatly two weeks worth of blocks = 100 MB total

    This is the initial estimate with compression it maybe possible to halve this value.

    Could you mine without the entire blockchain?
    Yes. The network could operate fully without any node having the entire blockchain. It is possible that a chain fork could go so far into the past that no nodes have a copy of the chain long enough to resolve the split, however this is extremely unlikely without a malicious attacker having 51% hashing power for a significant period of time.

    How would this be adopted, would all miners need to switch immediately?
    There needs to be at least one miner producing a ledger hash around every two weeks. So initially this would be possible to implement with only a small pool adopting the scheme. The more frequent miners produce a ledger the more efficiently clients will be able to prune old transactions.

    File format
    The initial proposed file format would simply be a dump of all unspent txOutputs, in the order they appeared in the blockchain, in the same format as they are serialised over the nework. This has the advantage that any bitcoin client that participates on a network level can decode the file with minimum effort.

    The file will probably need to be indexed after it is downloaded as it will not be suitable for locating a txOutput efficiently. The file format for the ledger will be included in the coinbase along with the hash. In the file there will be many duplicate scripts and transaction hashes giving the possibility of much greater compression in future.

    Coinbase
    Magic Value - File format - Ledger size - Hash
    uint32_t, uint16_t, uint64_t, uint256_t

    ** magic value is a flag indicating this coinbase holds a ledger hash


    /Discuss. Feel free to point out any glaringly obvious flaws Smiley


Page 1
Viewing Page: 1