Bitcoin Forum
May 04, 2024, 04:48:59 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: blockchain improvement - speed up transaction verification  (Read 1903 times)
fergalish (OP)
Sr. Member
****
Offline Offline

Activity: 440
Merit: 250


View Profile
February 22, 2013, 04:02:26 PM
Last edit: February 22, 2013, 04:19:24 PM by fergalish
 #1

Here's a suggestion - please bear in mind I don't know exactly how transactions are stored in the database, so it could be this is already incorporated. Also, I know 0.8 stores the data in a different container which I have not yet studied.

At the moment, in order to verify a transaction, a bitcoin client has to dereference the inputs, then trawl the whole blockchain making sure it has not already been redeemed. Is that correct?  If so, then: wouldn't it be clever to leave enough bytes (50 or so) inside each transaction output in the blockchain, to store the eventual redeeming transaction & vin?

So for example, at the moment, transactions are stored as (simplified):
       txid, (txid:vout, txid:vout, ...), (addr:value, addr:value, ...)
where the first parenthesis are the inputs, and the second the outputs.

I would change that to:
       txid, (txid:vout, txid:vout, ...), (addr:value:0x00000, addr:value:txid:vin, ....)

where the first output has not yet been redeemed and has 50 bytes of empty 0x0. The second output has been redeemed and the 50 bytes of 0x0 have been overwritten with the (txid,vin) with which this transaction output has been redeemed.  This would reduce verification on each transaction input to a single db lookup on a unique index (the txid).

edit: from https://en.bitcoin.it/wiki/Protocol_rules#.22tx.22_messages, step 14 of verifying a transaction is:
"For each input, if the referenced output has already been spent by a transaction in the main branch, reject this transaction"
I suppose this is just one more database query, right? So maybe this suggestion is not so useful given that it would add 50 bytes or so for each tx output. ok, never mind.
1714841339
Hero Member
*
Offline Offline

Posts: 1714841339

View Profile Personal Message (Offline)

Ignore
1714841339
Reply with quote  #2

1714841339
Report to moderator
1714841339
Hero Member
*
Offline Offline

Posts: 1714841339

View Profile Personal Message (Offline)

Ignore
1714841339
Reply with quote  #2

1714841339
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714841339
Hero Member
*
Offline Offline

Posts: 1714841339

View Profile Personal Message (Offline)

Ignore
1714841339
Reply with quote  #2

1714841339
Report to moderator
1714841339
Hero Member
*
Offline Offline

Posts: 1714841339

View Profile Personal Message (Offline)

Ignore
1714841339
Reply with quote  #2

1714841339
Report to moderator
DannyHamilton
Legendary
*
Offline Offline

Activity: 3388
Merit: 4616



View Profile
February 22, 2013, 05:00:27 PM
 #2

I suppose this is just one more database query, right? So maybe this suggestion is not so useful given that it would add 50 bytes or so for each tx output. ok, never mind.
Also how would you keep me from overwriting the "txid:vin" with 0x00000 so I could double-spend the output?
fergalish (OP)
Sr. Member
****
Offline Offline

Activity: 440
Merit: 250


View Profile
February 22, 2013, 11:10:04 PM
 #3

I suppose this is just one more database query, right? So maybe this suggestion is not so useful given that it would add 50 bytes or so for each tx output. ok, never mind.
Also how would you keep me from overwriting the "txid:vin" with 0x00000 so I could double-spend the output?
Well, once your transaction gets into the blockchain, that's when everyone's client will write (txid,vin) to the appropriate input transactions. You'd have to exploit some bug in the code to convince the client to do that, but presumably there would be no code written which would actually re-overwrite with 0x00... since that's never a thing you'd want to do. Oh, except in blockchain reorgs maybe.

I mean, you could write whatever values you wanted into *your* copy of the blockchain. But that's not really much use to you - you'd have to convince everyone's client to do so.
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!