rooch-network / rooch

VApp Container with Move Language
https://rooch.network
Apache License 2.0
157 stars 83 forks source link

[Bitcoin] OnChain EventQueue for Ordinals meta protocol #2172

Open yubing744 opened 1 month ago

yubing744 commented 1 month ago

Problem description: Based on the inscription metaprotocol, all historical inscriptions need to be consumed.

Solution: Register an EventQueue for each metaprotocol to store inscription changes. Metaprotocol deletes events after consumption to reduce storage pressure.

yubing744 commented 1 month ago

@jolestar In order to ensure that metaprotocol does not lose data when processing inscriptions, metaprotocol needs to return a snapshot of the current inscription status when registering EventQueue.

yubing744 commented 1 month ago

@jolestar In order to ensure that metaprotocol does not lose data when processing inscriptions, metaprotocol needs to return a snapshot of the current inscription status when registering EventQueue.

Since the inscription is immutable, only the ownership of the inscription changes. In order to realize the snapshot function of the inscription, I thought of a solution: define a global inscription ownership version number, when the inscription ownership changes, the version number +1, and record the ownership relationship of this inscription in this version. In this way, the inscription snapshot can be represented by the self-incrementing serial number of the inscription and the current global inscription ownership version number.

yubing744 commented 1 month ago

In order to prevent the inscription ownership relationship from taking up too much space, we can provide a function to merge historical ownership. The logic of the merge is to merge the inscription ownership before the smallest inscription ownership version number in the snapshot.

yubing744 commented 1 month ago

@jolestar Do you think this snapshot solution is feasible?