safety – Taking the prevailing INPUT and altering the OUTPUT to steal bitcoins. Is that this a attainable bitcoin theft state of affairs and the right way to forestall it?

0
62


I am comparatively new to Bitcoin and I am questioning how Bitcoin defends in opposition to the next state of affairs and if it is even attainable.

Earlier than I begin with the state of affairs, simply two notes:

1. There may be loads of textual content as a result of I simply tried to clarify intimately what I imply.

2. Please observe that I’m comparatively new to bitcoin

So let’s begin.

Suppose we’ve got an preliminary transaction (T1) from which the whole lot begins. This transaction has been a part of the blockchain for a while and has the next 2 inputs and three outputs. So we are able to write this transaction as follows:

T1(T1I1, T1I2; T1O1, T1O2, T1O3)

To spend funds from any of those outputs it’s vital to unravel cryptographic puzzle set by locking script in corresponding output. For instance, if we wish to spend funds from T1O2, we might want to create an enter in a brand new transaction with an unlocking script that solves the cryptographic puzzle set by T1O2.

Now, as an instance somebody who is aware of the right way to remedy all these cryptographic puzzles needs to spend outputs 2 and three from the earlier transaction (T1). So a brand new transaction shall be created and, for instance, it’ll appear to be this:

T2(T2I1, T2O2; T2O1, T2O2)
  • T2I1 solves the cryptographic puzzle from T1O2
  • T2I2 solves the cryptographic puzzle from T1O3

Additionally, let’s assume that the charge for this transaction is ready to 1 BTC which signifies that this transaction shall be accepted inside 6 blocks (this can be a very excessive charge, however for simplicity I put 1 BTC). So, with this assumption, the transaction is put into the mempool and shall be accepted within the subsequent, say, 1-2 hours.

Now we come to the crux of the entire story. Suppose a hacker has entry to the mempool and displays all new transactions. As he watches, he notices our transaction T2 and needs to steal funds from it, that’s, from T1 whose funds transaction T2 is consuming. He cannot do that within the regular method as a result of he’s unable to unravel the cryptographic puzzles from the outputs O2 and O3 in T1, so he cannot make “legitimate” inputs. He can also’t steal funds utilizing the outputs from T2 as a result of he would not know the answer to those cryptographic puzzles both. However what he can do is the next (I assume he can, that is my query). The process that the hacker does is offered in steps

  1. For the reason that hacker doesn’t know the right way to create unlocking scripts to unravel the cryptographic puzzles set by locking scripts within the outputs of transaction T1, he’ll simply take the options (inputs, unlocking scripts) from T2. For example he solely takes the primary enter (T2I1).

  2. After that, he creates new outputs with locking scripts that he’ll know the right way to remedy.

  3. Since he has inputs and outputs, he creates a transaction that can appear to be this:

    T3(T2I1, T3O1)

  • enter T2I1 hacker took from legitimate transaction T2
  • output T3O1 he simply created with locking script he is aware of resolution to
  1. Hacker now takes this transaction and sends it by means of the bitcoin community and units the charge at 5 bitcoins (5 occasions the unique transaction) which ensures that the transaction is straight away accepted within the subsequent block.

These steps result in the truth that there are two conflicting transactions within the mempool as a result of they eat the identical enter (T2I1). When a miner creates a brand new block, he’ll choose a set of transactions to incorporate within the new block based mostly on the charge. Since a malicious transaction (hacker transaction) has a excessive charge, will probably be instantly included within the subsequent block. On this method, a hacker’s transaction is one that’s included within the blockchain and its outputs (for which he is aware of the answer) change into a part of the blockchain, whereas a legitimate transaction and people outputs are discarded as malicious. By doing so, he stole bitcoins.

Based mostly on the whole lot written, I’ve two questions:

1. Is that this a attainable state of affairs?

2. How does Bitcoin defend in opposition to this state of affairs?

LEAVE A REPLY

Please enter your comment!
Please enter your name here