Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix btc time lock rgbpp transaction query #85

Merged
merged 2 commits into from
Aug 7, 2024

Conversation

ahonn
Copy link
Collaborator

@ahonn ahonn commented Aug 7, 2024

The previously implemented RGB++ transaction query logic omitted the BTCTimeLock transaction of L1 -> L2, resulting in the inability to return the RGB++ related CKB transaction.

The PR realizes the search for the CKB transaction containing BTCTimeLock Cell through BTC txid.

The implementation is as follows:

  • Get BTC transaction through txid
  • Use CKB RPC to query the CKB transaction corresponding to the input containing the BTC transaction
    • For any RgbppLock cell, there are up to two transactions on CKB that contain it. One may be an L2->L1/L1->L1 transaction, and the other may be an L1->L1/L1-> L2 transaction.
    • We can determine which transaction they are by parsing the input/output cell lock script of these two transactions.
    • In this PR, we use the CKB Explorer API to simplify the process
  • Get the details of the CKB transaction and determine whether it contains BTCTimeLock Cell output
  • Build RgbppTransaction through CKB transactions

Copy link

vercel bot commented Aug 7, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
utxo-stack-explorer ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 7, 2024 8:31am

@Flouse Flouse merged commit 1e00d45 into develop Aug 7, 2024
3 checks passed
@Flouse Flouse deleted the fix/rgbpp-transaction-query branch August 7, 2024 08:42
@Flouse
Copy link
Contributor

Flouse commented Aug 21, 2024

The PR realizes the search for the CKB transaction containing BTCTimeLock Cell through BTC txid.

The implementation is as follows:

  • Get BTC transaction through txid

  • Use CKB RPC to query the CKB transaction corresponding to the input containing the BTC transaction

    • For any RgbppLock cell, there are up to two transactions on CKB that contain it. One may be an L2->L1/L1->L1 transaction, and the other may be an L1->L1/L1-> L2 transaction.
    • We can determine which transaction they are by parsing the input/output cell lock script of these two transactions.
  • Get the details of the CKB transaction and determine whether it contains BTCTimeLock Cell output
  • Build RgbppTransaction through CKB transactions

https://github.com/ckb-cell/rgbpp-explorer/blob/86fd417eaecc6da626939bab34bf348a6e79cd1e/backend/src/modules/rgbpp/transaction/transaction.service.ts#L214-L246

@ShookLyngs Do you think this function could help fix utxostack/btc-assets-api#45 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants