tapyrus-core icon indicating copy to clipboard operation
tapyrus-core copied to clipboard

Add UTXO snapshot creation

Open azuchi opened this issue 1 year ago • 3 comments

Introducing the dumptxoutset RPC added to Bitcoin Core.

https://github.com/bitcoin/bitcoin/pull/16899

azuchi avatar Dec 18 '23 05:12 azuchi

In bitcoin the snapshot metadata contains base_blockhash and coins_count. In Tapyrus it would be necessary to store networkid and whether it is prod or dev mode.

So these are the meta data stored:

  • networkid - tapyrus network id. It is necessary to verify that the snapshot is from the correct network.
  • mode - prod/dev
  • snapshot_time - median tome of the node when snapshot was created. This data is stored with the hope that it would be useful when loading the snapshot.
  • base_blockhash - block hash of the last confirmed block in the snapshot
  • coins_count

Naviabheeman avatar Mar 26 '24 13:03 Naviabheeman

mode - prod/dev

This would be unnecessary. Even in Bitcoin, snapshots do not include data that distinguishes between mainnet and testnet.

snapshot_time

Since base_blockhash is present, this is also unnecessary.

azuchi avatar Mar 27 '24 06:03 azuchi

In PR #29612 from bitcoin-core ( Optimize serialization and enhance metadata of dumptxoutset output) utxo snapshot metadata is enhanced to include

  1. version
  2. network magic bytes
  3. block height

In Tapyrus version is added. Network magic bytes depend on network id. So we use network mode instead. Block height can be deduced from block hash. This is not added.

Naviabheeman avatar Jun 11 '24 13:06 Naviabheeman