Let's say BTC TX_1 has an isomophic rgbpp_ckb_tx_virtual. And there is a job of TX_1 in the assets-api's RGB++ CKB transaction Queue, called TX_1's job.
How to automatically add TX_2's job to the RGB++ CKB transaction Queue when TX_1 is replaced by TX_2?
Monitor Bitcoin Mempool, and detect TX_1 Replacement
Continuously monitor the Bitcoin mempool for any new transactions that spend one of the inputs of TX_1.
When a new transaction (TX_2) spending inputs from TX_1 is detected, identify if TX_2 is a replacement for TX_1 based on criteria like higher fee rate, same inputs, etc.
Is there a better replacement detection algorithm?
Verify TX_2 Validity
Verify that TX_2 is a valid RGB++ transaction by checking if it contains the right RGB++ commitment.
Add TX_2's Job to Queue
Add a new job for TX_2 to the RGB++ CKB transaction Queue, including the TX_2_txid and the related rgbpp_ckb_tx_virtual, a.k.a TX_1's rgbpp_ckb_tx_virtual.
Why this feature is required?
Sometimes the RBF BTC transaction is submitted by other BTC RBF service providers, not through rgbpp-sdk. in this case, the TX_2's job may not be processed.
This process ensures that when TX_1 is replaced by TX_2 on the Bitcoin network, the RGB++ CKB transaction Queue is automatically updated with the new job for TX_2, allowing for seamless processing of the BTC RBF workflow.
Discussion
Let's say BTC
TX_1
has an isomophic rgbpp_ckb_tx_virtual. And there is a job of TX_1 in the assets-api's RGB++ CKB transaction Queue, calledTX_1's job
.How to automatically add
TX_2's job
to the RGB++ CKB transaction Queue when TX_1 is replaced by TX_2?Monitor Bitcoin Mempool, and detect TX_1 Replacement Continuously monitor the Bitcoin mempool for any new transactions that spend one of the inputs of TX_1. When a new transaction (TX_2) spending inputs from TX_1 is detected, identify if TX_2 is a replacement for TX_1 based on criteria like higher fee rate, same inputs, etc.
Verify TX_2 Validity Verify that TX_2 is a valid RGB++ transaction by checking if it contains the right RGB++ commitment.
Add TX_2's Job to Queue Add a new job for TX_2 to the RGB++ CKB transaction Queue, including the TX_2_txid and the related rgbpp_ckb_tx_virtual, a.k.a TX_1's rgbpp_ckb_tx_virtual.
Why this feature is required?
Sometimes the RBF BTC transaction is submitted by other BTC RBF service providers, not through rgbpp-sdk. in this case, the TX_2's job may not be processed.
This process ensures that when TX_1 is replaced by TX_2 on the Bitcoin network, the RGB++ CKB transaction Queue is automatically updated with the new job for TX_2, allowing for seamless processing of the BTC RBF workflow.
Priority: Low
Originally posted by @Flouse in https://github.com/ckb-cell/rgbpp-sdk/issues/82#issuecomment-2109074989
References