Skip to content

Utilities for Bitcoin and RGB++ asset integration

License

Notifications You must be signed in to change notification settings

utxostack/rgbpp-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

0aa0641 · Feb 26, 2025
Feb 19, 2025
Jan 3, 2025
May 7, 2024
Aug 19, 2024
Feb 17, 2025
Feb 20, 2025
Feb 17, 2025
Jun 13, 2024
Jul 31, 2024
Jun 13, 2024
Feb 22, 2024
Feb 22, 2024
Jun 13, 2024
Mar 17, 2024
Aug 14, 2024
Feb 14, 2025
Feb 17, 2025
May 25, 2024
Jul 31, 2024
Aug 14, 2024

Repository files navigation

RGB++ SDK

This repository offers utilities for Bitcoin and RGB++ asset integration.

Packages in this repository

RGB++ Code Examples

Related CKB Scripts (Contracts)

RGB++ Asset Workflow Overview

  1. Creation of rgbpp_ckb_tx_virtual using @rgbpp-sdk/ckb

Important

It's recommended to save the rgbpp_ckb_tx_virtual locally in case you need it in the future.

  1. Creation of rgbpp_btc_tx through @rgbpp-sdk/btc

    1. construct isomorphic rgbpp_btc_tx based on rgbpp_ckb_tx_virtual and rgbpp commitment
    2. sign and broadcast rgbpp_btc_tx to obtain rgbpp_btc_txid
  2. JoyID or dApp sends rgbpp_btc_txid and rgbpp_ckb_tx_virtual to RGB++ CKB transaction Queue (API Endpoint: /rgbpp/v1/transaction/ckb-tx)

  3. RGB++ CKB transaction Queue will process the following things:

    1. verify the received requests

    2. continuously fetch request from the queue through a cron job

    3. check whether the confirmations of req.rgbpp_btc_txid is sufficient

    4. generate the witnesses for RgbppLocks in the rgbpp_ckb_tx_virtual

    5. add a paymaster cell into rgbpp_ckb_tx_virtual inputs if the CKB capacity is insufficient

      1. need to verify the existence of paymaster UTXO in the rgbpp_btc_tx

        based on the exchange rates of BTC and CKB, the paymaster BTC UTXO's value required to subsidize a paymaster CKB cell is approximately: paymaster_utxo_sats ~= 316 * ${ckb_price} / ${btc_price} * 100000000

      2. sign the paymaster cell and the entire transaction if needed
    6. finalize the rgbpp_ckb_tx_virtual to a rgbpp_ckb_tx

    7. broadcast rgbpp_ckb_tx and mark the job as completed upon tx-confirmation

Notes

  • Bitcoin/RGB++ Assets Service is an open-source project designed to streamline the transaction workflow for Bitcoin and RGB++ Assets. Developers have the option to enhance it by implementing its features by themselves without limitations.
  • For those who prefer to deploy their own Bitcoin/RGB++ Assets Service, please follow the instructions at the Deployment section in the btc-assets-api repository.

FAQ

How to get an access token of Bitcoin/RGB++ Assets Service?

See Generate a JSON Web Token (JWT) for Bitcoin/RGB++ Assets Service

Where is the error code description for the RgbppLockScript?

See RGB++ Lock Script Error Codes

License

ISC License