Post
Topic
Board Development & Technical Discussion
Re: Stupid question re: "script," "unspent outputs," and the divisibility of bitcoin
by
DannyHamilton
on 03/06/2014, 01:35:29 UTC
Just think of it as inputs and outputs.   Your inputs and outputs are in decimal form up to
8 decimals in precision, so they never really need to get divided into satoshis.  They sort of already are.
You can initiate a transaction of say 4.3164 BTC and that's the output. Pretty much end of story unless
That wasn't the full unspent output (balance) in the address and you want to send that back to yourself.

Close, but there are a few important things to keep in mind if we are going to start talking at this detail level about the protocol.

First, as represented in transactions in the blockchain, outputs are not in decimal form.  The concept of 1 BTC is just a way to make it easier for humans to deal with the otherwise really big numbers that would have been involved when bitcoin started out.  The outputs are actually represented as an integer number of satoshis.  So if you want an output to assign 0.0324 BTC to the control of the private key associated with a particular address, then the value that is actually assigned in that output is 2340000.

Second, inputs are just references to a previously received output.  The transaction does not specify values in the inputs (in decimal form or otherwise).  The inputs are simply a SHA-256 hash that can be looked up in the blockchain (or the UTXO set) to identify the transaction with the particular previously unspent output that's being spent, and an index indicating which output from that transaction is being spent (0=first output, 1=second output, 2=third output, etc).