Bitcoin Forum
May 21, 2024, 06:37:45 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: UTXO storing  (Read 182 times)
bondcoder (OP)
Newbie
*
Offline Offline

Activity: 11
Merit: 1


View Profile WWW
June 24, 2019, 02:50:58 PM
 #1

I started my impementation of blockchain and I have question about UTXO storing. Do I need to store outputs after it was used? Or maybe I need to change them status on "used", or transfer into another collection (NoSQL )or table (relation)  of database?
RHavar
Legendary
*
Offline Offline

Activity: 2557
Merit: 1886



View Profile
June 24, 2019, 04:05:14 PM
Merited by malevolent (1)
 #2

You need to look at it in terms of operations you need to support. If you're doing your own validation, you need to be able to lookup any unspent utxo by (txid,vout). You also need to be sure it was only spent once.


There's probably a dozen decent ways to do this, so it's hard to advise you. One thing I'll mention though, that makes it tricky is you generally need to handle "reorgs" where the blockchain literally shifts under your feet.

Generally I've found the easiest way to work with something like the blockchain, is an append-only immutable database. And then you just  put indexes for all queries you need to do, to make it fast.

(And the one exception to "immutable" I like to make, is adding a field `isBest` for each block I have, which represents if it's in the most-proof-of-work chain, which makes queries a lot easier and faster)

Check out gamblingsitefinder.com for a decent list/rankings of crypto casinos. Note: I have no affiliation or interest in it, and don't even agree with all the rankings ... but it's the only uncorrupted review site I'm aware of.
bondcoder (OP)
Newbie
*
Offline Offline

Activity: 11
Merit: 1


View Profile WWW
June 25, 2019, 06:59:44 AM
 #3

Thank you. I will use your advices in my implementation!
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!