spruned icon indicating copy to clipboard operation
spruned copied to clipboard

Add utxo set soft validation.

Open gdassori opened this issue 3 years ago • 3 comments

Do checkpoints based soft validation (no scripts evaluation) and track the utxo set.

gdassori avatar May 25 '21 01:05 gdassori

  • [x] Drop the existing UTXO storage.
  • [x] Redesign the blockchain .repository.
  • [x] Deserialize Blocks to the UTXO.
  • [x] Design the UTXO repository w/ UTXO sharding.
  • [ ] Avoid validation before the checkpoints.
  • [ ] Save the UTXO status when saving a block.
  • [ ] Ensure a spent UTXO exists (soft validation) when saving a block.

gdassori avatar Jun 13 '21 10:06 gdassori

A tiny hint for performance improvement: if the block is old in the chain, the "Ensure a spent UTXO exists (soft validation) when saving a block." can be neglected without loosing on security. Btw when saving a block you need to mark all spent utxo as spent

dakk avatar Jun 14 '21 06:06 dakk

Let me see if I understand your point... are you suggesting to avoid the READ on the UTXO, and just hit a DELETE, basically to spend it, when the block height is, let's say... 100 blocks behind? (magic number).

So, when I receive a block with height = maxheight - 100:

for spent_utxo in block:
   repo.delete(spent_utxo)

else, with a recent block:

for spent_utxo in block:
   repo.ensure_utxo_exists(spent_utxo)
   repo.delete(spent_utxo)

Sort of? Sounds good to me.

gdassori avatar Jun 14 '21 11:06 gdassori