<blockquote>
  <p>it seems the coin amount of vin calculated from vout.</p>
</blockquote>

<p>It is. <code>vin</code> just references a <code>vout</code> from a previous transaction. Each output (<code>vout</code>) are referenced with the <code>txid</code> and an index (e.g. <code>0</code> or <code>1</code>, because there can be multiple outputs in the same tx).</p>

<p>For more information about how transaction inputs and outputs work, see <a href="https://bitcoin.stackexchange.com/questions/11411/in-getrawtransaction-what-is-the-vout-integer-in-the-vin-list">In getrawtransaction, what is the vout integer in the vin list?</a></p>

CC BY-SA 4.0
2018-09-18T17:54:24.387Z
2018-09-18T17:54:24.387Z
JBaczuk
<p>At first I believed the coin amount of vin just based on what the send thinking. but after read some source code, it seems the coin amount of vin calculated from vout. Is anyone clear about this and please explain how the determination process is in source code. Thanks.</p>

<transactions>
How to determine the coin amount needed for vin?
yrm23
# How to determine the coin amount needed for vin?

(Asked by: username_0 on 2018-09-18)

At first I believed the coin amount of vin just based on what the send thinking. but after read some source code, it seems the coin amount of vin calculated from vout. Is anyone clear about this and please explain how the determination process is in source code. Thanks.

**Tags:** transactions


---

## 1 answers

### Answer by username_1 on 2018-09-18. Score: 1

> it seems the coin amount of vin calculated from vout.

It is. `vin` just references a `vout` from a previous transaction. Each output (`vout`) are referenced with the `txid` and an index (e.g. `0` or `1`, because there can be multiple outputs in the same tx).

For more information about how transaction inputs and outputs work, see [In getrawtransaction, what is the vout integer in the vin list?](https://bitcoin.stackexchange.com/questions/11411/in-getrawtransaction-what-is-the-vout-integer-in-the-vin-list)


---

