Author

Topic: Stupid question re: "script," "unspent outputs," and the divisibility of bitcoin (Read 1166 times)

full member
Activity: 129
Merit: 100
sr. member
Activity: 250
Merit: 253
Quote
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

@DannyHamilton:
Do you by any chance know why was it implemented this way? What if some day in the year 2400 the value of one satoshi will be greater than a value of a house?
Bitcoins could be divided further. E.g. let's say we wanted to add 7 more zeroes to the end. From people's perspective, this would mean that instead of 0.000 000 01 being the smallest possible value, 0.000 000 000 000 001 is. From the technical perspective, this would mean that each old unit (satoshi) is now worth 10^7 units, so an old output of 20 satoshi (0.000 000 20 BTC) can be spent as up to 2*10^8 units (probably with a new transaction version number, to help prevent software from confusing things).

This increased divisibility would not be a hard thing to agree on.

I think this would be implemented if a satoshi approached the value of US$0.01 today, and/or transaction fees approached a satoshi; both long before the value of a house is a satoshi.
member
Activity: 96
Merit: 10
esotericnonsense
Do you by any chance know why was it implemented this way? What if some day in the year 2400 the value of one satoshi will be greater than a value of a house?

The protocol hits various other limits before that would ever be an issue. However...

The value is stored in an 8-byte field, which is enough to store all values that could be possible (large enough for 21 million * 10**8 satoshis).
I imagine it was just deemed better/safer overall to use an int rather than deal with floating point or some form of odd encoding, for such a crucial field.

I'm not quite sure why it's 8-bytes and not 7-bytes, though. Could simply be that 64bit is a nice size.
full member
Activity: 129
Merit: 100
Quote
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

@DannyHamilton:
Do you by any chance know why was it implemented this way? What if some day in the year 2400 the value of one satoshi will be greater than a value of a house?
newbie
Activity: 57
Merit: 0
Thanks so much!  I think I get it now.
legendary
Activity: 3472
Merit: 4801
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).
legendary
Activity: 1302
Merit: 1008
Core dev leaves me neg feedback #abuse #political
Hi All,

I have a stupid question: I don't understand how one bitcoin can be divided into satoshis.

Based on my basic understanding of how bitcoin works, it seems like each bitcoin is associated with an address (a hash of someone's public key?) in the public ledgor (the block chain?).  If this association happens at the coin level, how can a bitcoin be divided into satoshis that can be associated with different addresses?

The whitepaper suggests it has to do with  "script," "inputs" and "outputs."  But my brain explodes when I read this on the Bitcoin wiki:

Quote
Bitcoin uses a scripting system for transactions. Forth-like, Script is simple, stack-based, and processed from left to right. It is purposefully not Turing-complete, with no loops.

WTF?!

Can someone please point me to resources on bitcoin divisibility that are more easily understandable?  Thanks!



Each bitcoin isn't associated with an address per se....don't think of it that way...
(and Forget about the scripting system for now)

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.

Here is an interesting thread when it comes to breaking down the code:

https://bitcointalksearch.org/topic/satoshi-client-operation-overview-41718


kjj
legendary
Activity: 1302
Merit: 1026
"coin" has many meanings.

A transaction creates "coins" as outputs, and the values of these outputs are granular (currently) in lumps of 0.000 000 01 "(bit)coins".

So, skip over the chicken/egg problem for a moment.  Say you have keys to 3 unspent outputs, 1 BTC, 2 BTC and 3 BTC.  You want to pay someone 4.5 BTC.  Your wallet creates a new transaction that spends the 2 BTC and 3 BTC "coins" and creates two new ones: 4.5 (sent to the recipient) and 0.5 (sent back to you).
newbie
Activity: 57
Merit: 0
Hi All,

I have a stupid question: I don't understand how one bitcoin can be divided into satoshis.

Based on my basic understanding of how bitcoin works, it seems like each bitcoin is associated with an address (a hash of someone's public key?) in the public ledgor (the block chain?).  If this association happens at the coin level, how can a bitcoin be divided into satoshis that can be associated with different addresses?

The whitepaper suggests it has to do with  "script," "inputs" and "outputs."  But my brain explodes when I read this on the Bitcoin wiki:

Quote
Bitcoin uses a scripting system for transactions. Forth-like, Script is simple, stack-based, and processed from left to right. It is purposefully not Turing-complete, with no loops.

WTF?!

Can someone please point me to resources on bitcoin divisibility that are more easily understandable?  Thanks!

Jump to: