Post
Topic
Board Development & Technical Discussion
Re: Some odd blockchain questions
by
DannyHamilton
on 15/04/2014, 17:29:33 UTC
Thanks for sharing your wisdom, mister guru.  Smiley

Code:
That depends on what you're trying to accomplish, why you're trying to accomplish it, and how you want it to work.

I'm trying to figure out a way for a compromised currency to be "repaired". What I want to do is to copy the blockchain into the new currency. Almost all of the last blocks of that chain were faked by an attack, so I want to revert the blockchain to a specific height. As far as I understand this is not a problem.
BUT this will also mean, that some transactions are lost and some funds remain in wallets of pools (unpaid rewards) and other services like exchanges. I think it's impossible to transfer them to the correct addresses, and that's why I want to delete these balances, because noone can guarantee that the owners of those "3rd party wallets" would be fair and redistribute the coins. it also would require them to adjust their databases, if they want to continue their service with the new coin. i doubt admins would be willing to do that.

It should be possible to be done, but how would you estimate the effort?
I can imagine the analysis of the data alone would take a lot of time.

And if I got you right, I would have to invalidate all the unwanted (unspent) inputs of an address to set the balance of an address to zero.
This has to be hardcoded (OMG) to make it work, and there is no easy way of just manipulating the block data / berkeley db?

So in case of several addresses with tens of thousands of unwanted inputs this would mean endless spaghetti code in the protocol.
Not only that it would look horrible, wouldn't it also be a performance issue, because every single future transaction would have to be checked against them?

You already said it wouldn't be working, but I thought it might be as simple as to make certain addresses inaccessible by changing the public key of those addresses and making the import of a private key impossible. But this would probably break the chain, right?

Is it worth poking around in that matter or would it just end up with headaches and wasting a lot of time, if you're all new to that crypto stuff?
I just cannot afford to spend weeks on that.

I've lost track at this point of whether we are talking about Bitcoin, or some altcoin.

Assuming we are talking about bitcoin, then the "repair" that you are suggesting is going to depend a lot on exactly what the attacker did, and how far back in the blockchain you need to change things.

If the "attack" is discovered before 100 blocks have occurred, the "repair" won't be quite as bad, since none of the outputs of any of the coinbase transactions will have been spent yet.  This means that nearly all the transactions in the blocks are valid.  The blockchain can be rolled back to the last "valid" block, and all the transactions can be confirmed again in the new blockchain.

Once you get beyond 100 blocks, it starts to get a lot messier.  At that point, the attacker could have spent the outputs that they received in the coinbase transactions.  The value from those spent outputs would then be cycled through more and more transactions as people spend what they receive.  If you roll the blockchain back past spent coinbase outputs, those outputs vanish and no longer exist.  That means that any transaction that includes any portion of the value from those coinbase transactions becomes invalid and ceases to exist.

If the attacker just used their hash power to reverse a few of their own recent transactions, I suspect that very little would be attempted to fix it.  The user's that are defrauded by the attacker would be scolded by the community and told that they should have waited for more confirmations.