Bitcoin Forum
April 26, 2024, 09:02:06 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Unspent outputs  (Read 2075 times)
jackjack (OP)
Legendary
*
Offline Offline

Activity: 1176
Merit: 1233


May Bitcoin be touched by his Noodly Appendage


View Profile
June 02, 2013, 12:12:42 PM
 #1

I saw once that there are about 6 millions of unspent outputs
Is it true? How can I check that?

Own address: 19QkqAza7BHFTuoz9N8UQkryP4E9jHo4N3 - Pywallet support: 1AQDfx22pKGgXnUZFL1e4UKos3QqvRzNh5 - Bitcointalk++ script support: 1Pxeccscj1ygseTdSV1qUqQCanp2B2NMM2
Pywallet: instructions. Encrypted wallet support, export/import keys/addresses, backup wallets, export/import CSV data from/into wallet, merge wallets, delete/import addresses and transactions, recover altcoins sent to bitcoin addresses, sign/verify messages and files with Bitcoin addresses, recover deleted wallets, etc.
1714165326
Hero Member
*
Offline Offline

Posts: 1714165326

View Profile Personal Message (Offline)

Ignore
1714165326
Reply with quote  #2

1714165326
Report to moderator
1714165326
Hero Member
*
Offline Offline

Posts: 1714165326

View Profile Personal Message (Offline)

Ignore
1714165326
Reply with quote  #2

1714165326
Report to moderator
1714165326
Hero Member
*
Offline Offline

Posts: 1714165326

View Profile Personal Message (Offline)

Ignore
1714165326
Reply with quote  #2

1714165326
Report to moderator
Each block is stacked on top of the previous one. Adding another block to the top makes all lower blocks more difficult to remove: there is more "weight" above each block. A transaction in a block 6 blocks deep (6 confirmations) will be very difficult to remove.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714165326
Hero Member
*
Offline Offline

Posts: 1714165326

View Profile Personal Message (Offline)

Ignore
1714165326
Reply with quote  #2

1714165326
Report to moderator
1714165326
Hero Member
*
Offline Offline

Posts: 1714165326

View Profile Personal Message (Offline)

Ignore
1714165326
Reply with quote  #2

1714165326
Report to moderator
keis
Newbie
*
Offline Offline

Activity: 12
Merit: 0


View Profile
June 02, 2013, 12:53:10 PM
 #2

Should be closer to 11M, the same as the total number of bitcoins in circulation.
jackjack (OP)
Legendary
*
Offline Offline

Activity: 1176
Merit: 1233


May Bitcoin be touched by his Noodly Appendage


View Profile
June 02, 2013, 04:10:25 PM
 #3

Should be closer to 11M, the same as the total number of bitcoins in circulation.
There's no reason it would be the same

Own address: 19QkqAza7BHFTuoz9N8UQkryP4E9jHo4N3 - Pywallet support: 1AQDfx22pKGgXnUZFL1e4UKos3QqvRzNh5 - Bitcointalk++ script support: 1Pxeccscj1ygseTdSV1qUqQCanp2B2NMM2
Pywallet: instructions. Encrypted wallet support, export/import keys/addresses, backup wallets, export/import CSV data from/into wallet, merge wallets, delete/import addresses and transactions, recover altcoins sent to bitcoin addresses, sign/verify messages and files with Bitcoin addresses, recover deleted wallets, etc.
jl2012
Legendary
*
Offline Offline

Activity: 1792
Merit: 1092


View Profile
June 02, 2013, 04:22:51 PM
 #4

Should be closer to 11M, the same as the total number of bitcoins in circulation.
There's no reason it would be the same

By the definition of "unspent outputs", there's no reason it would not be the same

Donation address: 374iXxS4BuqFHsEwwxUuH3nvJ69Y7Hqur3 (Bitcoin ONLY)
LRDGENPLYrcTRssGoZrsCT1hngaH3BVkM4 (LTC)
PGP: D3CC 1772 8600 5BB8 FF67 3294 C524 2A1A B393 6517
grue
Legendary
*
Offline Offline

Activity: 2058
Merit: 1431



View Profile
June 02, 2013, 04:27:27 PM
 #5

There's no reason it would be the same

By the definition of "unspent outputs", there's no reason it would not be the same
correction: value of unspent outputs is equal to the coins in circulation

however

The number of unspent outputs can differ from that. It's possible for all unspent outputs to be located at one address or a million.

It is pitch black. You are likely to be eaten by a grue.

Adblock for annoying signature ads | Enhanced Merit UI
jackjack (OP)
Legendary
*
Offline Offline

Activity: 1176
Merit: 1233


May Bitcoin be touched by his Noodly Appendage


View Profile
June 02, 2013, 04:30:23 PM
 #6

Should be closer to 11M, the same as the total number of bitcoins in circulation.
There's no reason it would be the same

By the definition of "unspent outputs", there's no reason it would not be the same
The value of an output not being forced to be 1btc each time is a pretty good reason actually


If you buy all the 11M BTC and send them to a single address there's only 1 unspent output
If you buy all the 11M BTC and send 1satoshi to 10^15 different addresses there are 10^15 unspent outputs

Own address: 19QkqAza7BHFTuoz9N8UQkryP4E9jHo4N3 - Pywallet support: 1AQDfx22pKGgXnUZFL1e4UKos3QqvRzNh5 - Bitcointalk++ script support: 1Pxeccscj1ygseTdSV1qUqQCanp2B2NMM2
Pywallet: instructions. Encrypted wallet support, export/import keys/addresses, backup wallets, export/import CSV data from/into wallet, merge wallets, delete/import addresses and transactions, recover altcoins sent to bitcoin addresses, sign/verify messages and files with Bitcoin addresses, recover deleted wallets, etc.
jl2012
Legendary
*
Offline Offline

Activity: 1792
Merit: 1092


View Profile
June 02, 2013, 04:36:22 PM
 #7

Should be closer to 11M, the same as the total number of bitcoins in circulation.
There's no reason it would be the same

By the definition of "unspent outputs", there's no reason it would not be the same
The value of an output not being forced to be 1btc each time is a pretty good reason actually


If you buy all the 11M BTC and send them to a single address there's only 1 unspent output
If you buy all the 11M BTC and send 1satoshi to 10^15 different addresses there are 10^15 unspent outputs

ok. You are talking about the "total number of outputs", while I am talking about the "total number of bitcoins in outputs"

Donation address: 374iXxS4BuqFHsEwwxUuH3nvJ69Y7Hqur3 (Bitcoin ONLY)
LRDGENPLYrcTRssGoZrsCT1hngaH3BVkM4 (LTC)
PGP: D3CC 1772 8600 5BB8 FF67 3294 C524 2A1A B393 6517
piotr_n
Legendary
*
Offline Offline

Activity: 2053
Merit: 1354


aka tonikt


View Profile WWW
June 02, 2013, 06:10:55 PM
Last edit: June 02, 2013, 06:25:39 PM by piotr_n
 #8

I saw once that there are about 6 millions of unspent outputs
Is it true? How can I check that?
At block #239314 there are 6187163 unspent outputs (plus 2 that had been abandoned because of non-unique TXID)

There is an RPC command in the official client that can print it, after awhile.
I don't remember the exact word, but I'm almost sure that is starts with "get" and does not take any parameters - see "help" and you should find it easily.

Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.
PGP fingerprint: AB9E A551 E262 A87A 13BB  9059 1BE7 B545 CDF3 FD0E
binaryFate
Legendary
*
Offline Offline

Activity: 1484
Merit: 1003


Still wild and free


View Profile
June 02, 2013, 07:06:58 PM
 #9

(plus 2 that had been abandoned because of non-unique TXID)

Didn't know this has happened! Could you tell me more or point me to a relevant source?

Monero's privacy and therefore fungibility are MUCH stronger than Bitcoin's. 
This makes Monero a better candidate to deserve the term "digital cash".
piotr_n
Legendary
*
Offline Offline

Activity: 2053
Merit: 1354


aka tonikt


View Profile WWW
June 02, 2013, 07:10:02 PM
 #10

(plus 2 that had been abandoned because of non-unique TXID)

Didn't know this has happened! Could you tell me more or point me to a relevant source?
I dont know. Maybe something like: https://en.bitcoin.it/wiki/BIP_0034
I think it happened in the code, when they switched to LevelDB.

It doesn't matter - whoever had that coins didn't bother to spend them on time, or more likely, nobody had them anyway.
And besides, he can always go to Gavin for a refund Smiley

Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.
PGP fingerprint: AB9E A551 E262 A87A 13BB  9059 1BE7 B545 CDF3 FD0E
gmaxwell
Moderator
Legendary
*
expert
Offline Offline

Activity: 4158
Merit: 8382



View Profile WWW
June 02, 2013, 11:29:43 PM
 #11

I think it happened in the code, when they switched to LevelDB.

It doesn't matter - whoever had that coins didn't bother to spend them on time, or more likely, nobody had them anyway.
And besides, he can always go to Gavin for a refund Smiley
You are throughly confused. We would never change the software in way that stole coin from someone, and no one would adopt the software if they did.

There were two instances of broken miners which created the same coins twice. Because of the way the software was written, with an implicit assumption that txids were unique, the second coins overwrote the first. The creator of those coins destroyed them, not anyone else.
mr_john
Newbie
*
Offline Offline

Activity: 41
Merit: 0



View Profile
June 03, 2013, 05:59:15 AM
 #12

There is an RPC command in the official client that can print it, after awhile.
I don't remember the exact word, but I'm almost sure that is starts with "get" and does not take any parameters - see "help" and you should find it easily.
The command you are looking for is "gettxoutsetinfo" (you can enter it also in the debug console of bitcoin-qt).


Didn't know this has happened! Could you tell me more or point me to a relevant source?
AFAIK:
This had nothing to do with LevelDB. As gmaxwell said, due to an error of miners it happened 2 times that a new transaction was created having the same transaction hash as existing transactions before (which in fact means that the previous transaction got overwritten). While it's normally not easy or practically impossible to produce 2 transactions with the same hash value this is not true for coinbase transactions (which can be more easily duplicated - as one can freely enter anything into the coinbase field thus influencing the resulting transaction hash value).

To avoid that this can happen again, a new check was introduced which checks, if the transaction hash exists already in the chain (and has unspent outputs IIRC). But as already 2 transactions existed which broke this rule, these 2 cases are specially handled in code now (you can see this in line 1622 here: https://github.com/bitcoin/bitcoin/blob/v0.8.2/src/main.cpp#L1622 ).

So nothing bad here, one check was missing and got fixed (already some time ago).

Please correct me, if I got something wrong.

John Smiley
piotr_n
Legendary
*
Offline Offline

Activity: 2053
Merit: 1354


aka tonikt


View Profile WWW
June 03, 2013, 08:05:06 AM
Last edit: June 03, 2013, 08:31:00 AM by piotr_n
 #13

There were two instances of broken miners which created the same coins twice. Because of the way the software was written, with an implicit assumption that txids were unique, the second coins overwrote the first. The creator of those coins destroyed them, not anyone else.
Are you sure?
My understanding was that the previous Berkeley DB could handle no-unique keys and up to that moment all those transactions were spendable.
Moreover it was a well known fact that coinbase transactions could have the same ID and it was just openly allowed by the protocol, though not used too often. I believe there was even an explicit comment in the source code saying that same TXID is allowed for coinbase transactions.
So that could had been a design or implementation flaw, but it definitely was not considered as a "broken miner", neither "the same coins twice" - at least like two years ago, but I understand that history books can adopt quickly to a new reality Wink

After switching to LevelDB the same keys (representing TXID) just merged into each other, became undistinguished in the DB, and only since that very moment coinbase with same ID have not been spendable anymore.
But before, with Berkeley DB you could spend them, as many times as they had been mined - at least that was my understanding, so please correct me if I'm wrong.

Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.
PGP fingerprint: AB9E A551 E262 A87A 13BB  9059 1BE7 B545 CDF3 FD0E
jackjack (OP)
Legendary
*
Offline Offline

Activity: 1176
Merit: 1233


May Bitcoin be touched by his Noodly Appendage


View Profile
June 03, 2013, 08:31:39 AM
 #14

I didn't study a lot about what happen but I don't see how two different transactions with same hash can be spent, because of the uniqueness of txids as gmaxwell pointed out

This raises a question: is this uniqueness part of the bitcoin protocol or only part of the current clients?
Because allowing same txid for different transactions could be possible in theory. By starting the output indexes at the last output index of the previous tx for example (not sure if clear)


Btw thanks you guys for the number of unspent outputs and the rpc command

Own address: 19QkqAza7BHFTuoz9N8UQkryP4E9jHo4N3 - Pywallet support: 1AQDfx22pKGgXnUZFL1e4UKos3QqvRzNh5 - Bitcointalk++ script support: 1Pxeccscj1ygseTdSV1qUqQCanp2B2NMM2
Pywallet: instructions. Encrypted wallet support, export/import keys/addresses, backup wallets, export/import CSV data from/into wallet, merge wallets, delete/import addresses and transactions, recover altcoins sent to bitcoin addresses, sign/verify messages and files with Bitcoin addresses, recover deleted wallets, etc.
piotr_n
Legendary
*
Offline Offline

Activity: 2053
Merit: 1354


aka tonikt


View Profile WWW
June 03, 2013, 08:34:27 AM
Last edit: June 03, 2013, 09:12:55 AM by piotr_n
 #15

I didn't study a lot about what happen but I don't see how two different transactions with same hash can be spent, because of the uniqueness of txids
It's very simple. If it has the same ID, then it must have everything else also the same - pk_script(s), the value(s)...  whatever
So it doesn't matter which one of the two gets into an actual input while being spent, since they are both identical.

You have an index of unspent outputs, where each key consists of 36 bytes (TXID+Vout).
Now when you have a database that allows you to have duplicate indexes - then you just don't need to do anything. When you see the same TXID being mined, you just append it to the table. When you spend it, just make sure to delete only one record from it.

But if one day you switch to a database engine that enforces you to use a unique indexes - then you have a problem. Not a big one, you can work around it by adding a count filed to the unspent record, but nobody bothered.
It's OK that nobody bothered, it wasn't worth it, but my point is that blaming your (a developer's) problem on "broken miners" is just not fair, since they were not broken, but 100% protocol compliant at that time.

So yeah, since you used this word already, IMO you did steal that coins, and that is why when this, as you call him, "broken miner" would realize it one day, he should be entitled to a refund Smiley

Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.
PGP fingerprint: AB9E A551 E262 A87A 13BB  9059 1BE7 B545 CDF3 FD0E
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!