hirosystems / chainhook

Extract transactions from Stacks and Bitcoin and build event driven re-org resistant indexers and databases.
GNU General Public License v3.0
147 stars 60 forks source link

[Chainhook] Events after a number of confirmation #220

Open friedger opened 1 year ago

friedger commented 1 year ago

I would like to use chainhooks to trigger an action only when a transaction was confirmed on bitcoin say 2 times.

Is there a way to express that in a predicate? Do chainhooks support it?

lgalabru commented 1 year ago

hey @friedger! there is a field available in the chainhook specifications payload, but the mechanic behind it is not yet implemented. we can definitely increase the priority of this feature if this requirement is important for you!

sabbyanandan commented 1 year ago

@lgalabru: This has come up from Emil & Tycho from the Zest team, and they have expressed a similar need. +1 to looking into it.

friedger commented 1 year ago

@lgalabru The use case is for register and reveal (e.g. BNS, or random NFT tiers) where 1 tx has to be placed in a block after the first tx or later

lgalabru commented 1 year ago

I see. In that case you'd be registering 2 chainhooks predicates, no? The first predicate would be watching commit operations being mined. The chainhook handler would broadcast the reveal transaction. The second predicate would be watching reveal operations and run whatever actions that your service have to perform when BNS names are registered. Does that make sense? What was the confirmation based design you had in mind?

friedger commented 1 year ago

A predicate where I can specify the number of required confirmations.

Your proposal would make it 3 txs? Not sure I understood correctly. @lgalabru

smcclellan commented 4 months ago

@MicaiahReid Is this complete?

MicaiahReid commented 4 months ago

@smcclellan No, this hasn't been started.