<p>The Bitcoin protocol follows a Unspent Transaction Output system to track the existence and state of all Bitcoin in the system. These are known as UTXOs.</p>

<p>All transactions that transfer Bitcoin do so by consuming one or more UTXOs, and create one or more new UTXOs. The only exception to this is the Coinbase transaction, which is limited to being the first transaction in a block, and is only allowed to create UTXOs that total <code>block reward + block fees</code> or less.</p>

<p>Due to this basic structure of a transaction, it is impossible to create a bitcoin transaction that spends non-existent bitcoin. As the UTXOs being consumed do not exist, the transaction is rendered invalid the moment it is created.</p>

<p>Although this is impossible, <em>why</em> it is impossible is not immediately obvious to people unfamiliar with the details of how Bitcoin works - thus, many people, especially newcomers to the space, seek out such things as a way to quickly get some Bitcoin at no or low cost. Several scammer groups are aware of this, and put out videos showing edited block explorers/wallets that seem to allow them to initiate fake transactions. </p>

<p>These groups then offer to give you access to this software for a small fee, or just let you download it for free - however, not only does it not work as advertised, most of these programs are trojan horses, and contain code to steal Bitcoin wallets on your system, or grant the scammers persistent remote access to your machine.</p>

<p>Answering each point directly:</p>

<blockquote>
  <p>Why can I not just make up bitcoins?</p>
</blockquote>

<p>As all bitcoin in the system are the result of either a coinbase transaction, or the outputs of a transaction that moved previously extant bitcoin, it is not possible to introduce new Bitcoin into the system without being detected. Any UTXO at any point of time <em>must</em> always be traced back to one or more coinbase outputs. </p>

<blockquote>
  <p>Why will fraudulent transactions not get relayed on the network?</p>
</blockquote>

<p>All well behaved nodes on the network validate transactions before accepting them to their mempool, or rebroadcasting them further - part of this validation is checking all utxos in the transaction against the node's own list of valid utxos. If the transaction claims to spend a UTXO that does not exist in the node's list, the transaction is deemed invalid and dropped.</p>

<blockquote>
  <p>Why can only the owner spend their funds?</p>
</blockquote>

<p>Standard Bitcoin addresses rely on one (single key addresses) or more (multisig addresses) private keys. The public keys corresponding to these private keys are encoded into the address itself, inside its locking script (also known as the <code>scriptPubKey</code>). During the evaluation of these scripts, the signature on that input is matched against the embedded public key(s). If the signature does not match, the transaction is deemed invalid.</p>

<p>Note that it is possible to create outputs with no "owner" - The Bitcoin script does not require all locking scripts to include a key check, and it is possible to construct a non-standard script that requires no signatures to spend. However, no consumer wallet does this, and essentially all addresses a normal user will encounter will be backed by one or more private keys.</p>

<blockquote>
  <p>Why can a third party not alter the recipients of a transaction?</p>
</blockquote>

<p>Standard transactions are signed using the <code>SIGHASH_ALL</code> signature flag. This means that the signature for any one input signs <em>all</em> inputs and outputs (in effect, signing all material aspects of the transaction). If any input or output is altered, removed, or otherwise changed, the signature is no longer valid as the data it signs has changed.</p>

<p>It is possible to construct a transaction using other signature flags, as described in my blog post <a href="https://raghavsood.com/blog/2018/06/10/bitcoin-signature-types-sighash" rel="noreferrer">here</a>. However, once again, no consumer wallet uses anything except <code>SIGHASH_ALL</code>.</p>

<blockquote>
  <p>What prevents a miner from taking the funds of your transaction when creating a block?</p>
</blockquote>

<p>Similar to the previous point, a miner is also unable to alter the outputs of your transactions due <code>SIGHASH_ALL</code> signing the entire transaction. If a transaction is intentionally signed with <code>SIGHASH_NONE</code>, a miner could very well take the funds. However, as no sane wallets performs such a signature, this does not happen.</p>

CC BY-SA 4.0
2020-04-28T07:33:26.077Z
2020-04-28T09:00:10.100Z
2020-04-28T09:00:10.100Z
Raghav Sood
<p>In the past, we had numerous questions about "fake" or "forged" transactions. Such transactions could supposedly be created even without holding any bitcoins, yet would end up in the mempool or even get accepted by the network once they are mined into a block. Other times, the recipient creates a conflicting version of the sender's transaction, or a majority attacking miner would simply redirect all transaction outputs to themselves.</p>

<p>With this topic I mean to create a canonical question for a topic which is described by the following variants of a questions:</p>

<ul>
<li>Why can I not just make up bitcoins?</li>
<li>Why will fraudulent transactions not get relayed on the network?</li>
<li>Why can only the owner spend their funds?</li>
<li>Why can a third party not alter the recipients of a transaction?</li>
<li>What prevents a miner from taking the funds of your transaction when creating a block?</li>
</ul>

<p>In other words, let's comprehensively explain: </p>

<h2>What makes a transaction valid, how is a transaction protected against tampering, and how can nodes tell?</h2>

<p>Here are some examples of topics that might be redirected here in the future: 
<a href="https://bitcoin.stackexchange.com/q/95495/5406">1</a>, 
<a href="https://bitcoin.stackexchange.com/q/71433/5406">2</a>, 
<a href="https://bitcoin.stackexchange.com/q/38561/5406">3</a>, 
<a href="https://bitcoin.stackexchange.com/q/11732/5406">4</a>, 
<a href="https://bitcoin.stackexchange.com/q/41825/5406">5</a>, 
<a href="https://bitcoin.stackexchange.com/q/21445/5406">6</a>, 
<a href="https://bitcoin.stackexchange.com/q/71436/5406">7</a>, 
<a href="https://bitcoin.stackexchange.com/q/68543/5406">8</a>,
<a href="https://bitcoin.stackexchange.com/q/64605/5406">9</a>,
<a href="https://bitcoin.stackexchange.com/q/23430/5406">10</a>,
<a href="https://bitcoin.stackexchange.com/q/71961/5406">11</a>, 
<a href="https://bitcoin.stackexchange.com/q/72585/5406">12</a>, 
<a href="https://bitcoin.stackexchange.com/q/73468/5406">12</a>, 
<a href="https://bitcoin.stackexchange.com/q/21445/5406">13</a>, 
<a href="https://bitcoin.stackexchange.com/q/95512/5406">14</a>,
<a href="https://bitcoin.stackexchange.com/q/87513/5406">15</a>,
<a href="https://bitcoin.stackexchange.com/q/11323/5406">16</a>,
<a href="https://bitcoin.stackexchange.com/q/18900/5406">17</a>,…</p>

CC BY-SA 4.0
2020-04-28T07:17:46.817Z
related:

https://bitcoin.stackexchange.com/q/54253/5406,
https://bitcoin.stackexchange.com/q/23430/5406,
https://bitcoin.stackexchange.com/q/62275/5406,
https://bitcoin.stackexchange.com/q/41165/5406,
https://bitcoin.stackexchange.com/q/36152/5406,
https://bitcoin.stackexchange.com/q/51231/5406,
Murch
<signature><transaction-verification><utxo><block-validity><canonical-question>
Why is there no such thing as a redirected, forged, or fake transaction?
Murch
# Why is there no such thing as a redirected, forged, or fake transaction?

(Asked by: username_0 on 2020-04-28)

In the past, we had numerous questions about "fake" or "forged" transactions. Such transactions could supposedly be created even without holding any bitcoins, yet would end up in the mempool or even get accepted by the network once they are mined into a block. Other times, the recipient creates a conflicting version of the sender's transaction, or a majority attacking miner would simply redirect all transaction outputs to themselves.

With this topic I mean to create a canonical question for a topic which is described by the following variants of a questions:

* Why can I not just make up bitcoins?
* Why will fraudulent transactions not get relayed on the network?
* Why can only the owner spend their funds?
* Why can a third party not alter the recipients of a transaction?
* What prevents a miner from taking the funds of your transaction when creating a block?

In other words, let's comprehensively explain:

## What makes a transaction valid, how is a transaction protected against tampering, and how can nodes tell?

Here are some examples of topics that might be redirected here in the future:
[1](https://bitcoin.stackexchange.com/q/95495/5406),
[2](https://bitcoin.stackexchange.com/q/71433/5406),
[3](https://bitcoin.stackexchange.com/q/38561/5406),
[4](https://bitcoin.stackexchange.com/q/11732/5406),
[5](https://bitcoin.stackexchange.com/q/41825/5406),
[6](https://bitcoin.stackexchange.com/q/21445/5406),
[7](https://bitcoin.stackexchange.com/q/71436/5406),
[8](https://bitcoin.stackexchange.com/q/68543/5406),
[9](https://bitcoin.stackexchange.com/q/64605/5406),
[10](https://bitcoin.stackexchange.com/q/23430/5406),
[11](https://bitcoin.stackexchange.com/q/71961/5406),
[12](https://bitcoin.stackexchange.com/q/72585/5406),
[12](https://bitcoin.stackexchange.com/q/73468/5406),
[13](https://bitcoin.stackexchange.com/q/21445/5406),
[14](https://bitcoin.stackexchange.com/q/95512/5406),
[15](https://bitcoin.stackexchange.com/q/87513/5406),
[16](https://bitcoin.stackexchange.com/q/11323/5406),
[17](https://bitcoin.stackexchange.com/q/18900/5406),…

**Tags:** signature, transaction-verification, utxo, block-validity, canonical-question

> **Comments:**
> **username_0**: related:  https://bitcoin.stackexchange.com/q/54253/5406, https://bitcoin.stackexchange.com/q/23430/5406, https://bitcoin.stackexchange.com/q/62275/5406, https://bitcoin.stackexchange.com/q/41165/5406, https://bitcoin.stackexchange.com/q/36152/5406, https://bitcoin.stackexchange.com/q/51231/5406,  

---

## 1 answers

### Answer by username_1 on 2020-04-28. Score: 6 | Accepted answer

The Bitcoin protocol follows a Unspent Transaction Output system to track the existence and state of all Bitcoin in the system. These are known as UTXOs.

All transactions that transfer Bitcoin do so by consuming one or more UTXOs, and create one or more new UTXOs. The only exception to this is the Coinbase transaction, which is limited to being the first transaction in a block, and is only allowed to create UTXOs that total `block reward + block fees` or less.

Due to this basic structure of a transaction, it is impossible to create a bitcoin transaction that spends non-existent bitcoin. As the UTXOs being consumed do not exist, the transaction is rendered invalid the moment it is created.

Although this is impossible, *why* it is impossible is not immediately obvious to people unfamiliar with the details of how Bitcoin works - thus, many people, especially newcomers to the space, seek out such things as a way to quickly get some Bitcoin at no or low cost. Several scammer groups are aware of this, and put out videos showing edited block explorers/wallets that seem to allow them to initiate fake transactions.

These groups then offer to give you access to this software for a small fee, or just let you download it for free - however, not only does it not work as advertised, most of these programs are trojan horses, and contain code to steal Bitcoin wallets on your system, or grant the scammers persistent remote access to your machine.

Answering each point directly:

> Why can I not just make up bitcoins?

As all bitcoin in the system are the result of either a coinbase transaction, or the outputs of a transaction that moved previously extant bitcoin, it is not possible to introduce new Bitcoin into the system without being detected. Any UTXO at any point of time *must* always be traced back to one or more coinbase outputs.

> Why will fraudulent transactions not get relayed on the network?

All well behaved nodes on the network validate transactions before accepting them to their mempool, or rebroadcasting them further - part of this validation is checking all utxos in the transaction against the node's own list of valid utxos. If the transaction claims to spend a UTXO that does not exist in the node's list, the transaction is deemed invalid and dropped.

> Why can only the owner spend their funds?

Standard Bitcoin addresses rely on one (single key addresses) or more (multisig addresses) private keys. The public keys corresponding to these private keys are encoded into the address itself, inside its locking script (also known as the `scriptPubKey`). During the evaluation of these scripts, the signature on that input is matched against the embedded public key(s). If the signature does not match, the transaction is deemed invalid.

Note that it is possible to create outputs with no "owner" - The Bitcoin script does not require all locking scripts to include a key check, and it is possible to construct a non-standard script that requires no signatures to spend. However, no consumer wallet does this, and essentially all addresses a normal user will encounter will be backed by one or more private keys.

> Why can a third party not alter the recipients of a transaction?

Standard transactions are signed using the `SIGHASH_ALL` signature flag. This means that the signature for any one input signs *all* inputs and outputs (in effect, signing all material aspects of the transaction). If any input or output is altered, removed, or otherwise changed, the signature is no longer valid as the data it signs has changed.

It is possible to construct a transaction using other signature flags, as described in my blog post [here](https://username_1.com/blog/2018/06/10/bitcoin-signature-types-sighash). However, once again, no consumer wallet uses anything except `SIGHASH_ALL`.

> What prevents a miner from taking the funds of your transaction when creating a block?

Similar to the previous point, a miner is also unable to alter the outputs of your transactions due `SIGHASH_ALL` signing the entire transaction. If a transaction is intentionally signed with `SIGHASH_NONE`, a miner could very well take the funds. However, as no sane wallets performs such a signature, this does not happen.


---

