<p>1) Nodes need not to know its your message, nodes are ok as long as your message is in correct format and satisfying the conditions.</p>

<p>2) When you broadcast transaction, your wallet will provide previous unspent transaction reference in the input section. Nodes will verify if those are really unspent and if the amount in output section is less than the total amount in the referenced input transactions.</p>

CC BY-SA 3.0
2017-09-11T07:49:22.997Z
2017-09-11T07:49:22.997Z
ManasMi
<p>1] Your public key is your identity on blockchain. No one can know whether the message was actually sent by whom? What they can know is that the message was sent by the owner of a particular public Key. You can sign the message using your private key, which can later be decrypted by the public key. Only a true owner of the public key can sign the message hence it proves that the message was indeed send by you. You can read about Digital Signature to understand better.</p>

<p>2] In the transaction, you are spending money by referring to a previous Tx. </p>

<p>Every full Bitcoin node maintains a database of which unspent outputs are left.
When verifying a transaction, all its inputs are fetched from the database. If one is missing, validation fails. Among the data retrieved is the value of those unspent outputs, and their script (od address), which define the conditions under which the output can be spent. This information is necessary to validate whether the spending transaction has the correct signatures and does not create more bitcoin than it consumes.</p>

CC BY-SA 3.0
2017-09-11T09:03:25.933Z
2017-09-11T09:03:25.933Z
pratiklodha
<p>Here are (overly) simplified answers:</p>

<ol>
<li>You signed your transaction with your (secret) private key, so that others can verify that signature using your public key which is in the transaction.</li>
<li>Nodes verify that the coins you want to spend were previously sent to you.</li>
</ol>

<p>And here are more details...</p>

<p>Most transactions (all those that transfer bitcoin -- that is, not those that create bitcoins) consist of a list of inputs and a list of outputs.  The inputs refer to (unspent) outputs from previous transactions, and together constitute the whole value that is transferred. In addition to the amount for this particular output, each output specifies the conditions under which the output can be spent. The simplest condition is 'you own the address specified in the output'.  Given that an address is the hash of a public key, what this condition actually means is that you know the private key for a public key that hashes to the given address.</p>

<p>In order to allow the nodes to check this condition, each input in a transaction is accompanied with the public key that hashes to the address to which this input was sent, and a signature of a simplified view of the transaction. This signature is created using the private key corresponding to this public key. The verifying node can build this same simplified view, and use the public key to verify that the signature is valid. This validates that you 'own' the address to which the coins were previously sent.</p>

<p>In order to be valid, a transaction must have enough inputs to cover all the outputs, and these inputs must refer to unspent outputs. That is, outputs from previous transactions that never appeared as input in any other transaction.</p>

<p>Note that nothing is encrypted, here.  Everybody can see the source and destination addresses, as well as the amounts.</p>

<p>You will find more details in <a href="https://en.bitcoin.it/wiki/Transaction" rel="nofollow noreferrer">https://en.bitcoin.it/wiki/Transaction</a>.</p>

CC BY-SA 3.0
2017-09-13T20:35:53.947Z
2017-09-13T20:46:35.997Z
2017-09-13T20:46:35.997Z
X. N.
<p>So I realize that the Bitcoin transaction I make has information such as my wallet number, the amount of BTC being sent, and the recipient wallet number, and this whole message is encrypted using my own private key. And that this message can be decrypted with a public key.</p>

<p>Now, how do all the other nodes who need to verify my message
1) Know that this message is actually from me? When did I ever send them my public key?</p>

<p>2)J Know that I actually have enough funds to cover the transaction?</p>

<blockchain>
How does Bitcoin verify each transaction?
Just curious
# How does Bitcoin verify each transaction?

(Asked by: username_0 on 2017-09-11)

So I realize that the Bitcoin transaction I make has information such as my wallet number, the amount of BTC being sent, and the recipient wallet number, and this whole message is encrypted using my own private key. And that this message can be decrypted with a public key.

Now, how do all the other nodes who need to verify my message
1) Know that this message is actually from me? When did I ever send them my public key?

2)J Know that I actually have enough funds to cover the transaction?

**Tags:** blockchain


---

## 3 answers

### Answer by username_1 on 2017-09-11. Score: 1

1) Nodes need not to know its your message, nodes are ok as long as your message is in correct format and satisfying the conditions.

2) When you broadcast transaction, your wallet will provide previous unspent transaction reference in the input section. Nodes will verify if those are really unspent and if the amount in output section is less than the total amount in the referenced input transactions.


---

### Answer by username_2 on 2017-09-11. Score: 1

1] Your public key is your identity on blockchain. No one can know whether the message was actually sent by whom? What they can know is that the message was sent by the owner of a particular public Key. You can sign the message using your private key, which can later be decrypted by the public key. Only a true owner of the public key can sign the message hence it proves that the message was indeed send by you. You can read about Digital Signature to understand better.

2] In the transaction, you are spending money by referring to a previous Tx.

Every full Bitcoin node maintains a database of which unspent outputs are left.
When verifying a transaction, all its inputs are fetched from the database. If one is missing, validation fails. Among the data retrieved is the value of those unspent outputs, and their script (od address), which define the conditions under which the output can be spent. This information is necessary to validate whether the spending transaction has the correct signatures and does not create more bitcoin than it consumes.


---

### Answer by username_3 on 2017-09-13. Score: 0

Here are (overly) simplified answers:

1. You signed your transaction with your (secret) private key, so that others can verify that signature using your public key which is in the transaction.
2. Nodes verify that the coins you want to spend were previously sent to you.

And here are more details...

Most transactions (all those that transfer bitcoin -- that is, not those that create bitcoins) consist of a list of inputs and a list of outputs. The inputs refer to (unspent) outputs from previous transactions, and together constitute the whole value that is transferred. In addition to the amount for this particular output, each output specifies the conditions under which the output can be spent. The simplest condition is 'you own the address specified in the output'. Given that an address is the hash of a public key, what this condition actually means is that you know the private key for a public key that hashes to the given address.

In order to allow the nodes to check this condition, each input in a transaction is accompanied with the public key that hashes to the address to which this input was sent, and a signature of a simplified view of the transaction. This signature is created using the private key corresponding to this public key. The verifying node can build this same simplified view, and use the public key to verify that the signature is valid. This validates that you 'own' the address to which the coins were previously sent.

In order to be valid, a transaction must have enough inputs to cover all the outputs, and these inputs must refer to unspent outputs. That is, outputs from previous transactions that never appeared as input in any other transaction.

Note that nothing is encrypted, here. Everybody can see the source and destination addresses, as well as the amounts.

You will find more details in <https://en.bitcoin.it/wiki/Transaction>.


---

