- Find code examples at https://github.com/ckb-cell/rgbpp-sdk/tree/develop/examples/rgbpp
-
CKB Scripts (Contracts)
-
CKB Bitcoin SPV Type Script: A type script for Bitcoin SPV clients which synchronize Bitcoin state into CKB
-
-
The RGB++ SDK repository offers utilities for Bitcoin and RGB++ asset integration:
- @rgbpp-sdk/btc: Bitcoin part of the SDK
- @rgbpp-sdk/ckb: Nervos CKB part of the SDK
- @rgbpp-sdk/service: Wrapped interfaces of Bitcoin/RGB++ Assets Service
-
Bitcoin/RGB++ Assets Service offers various features for interacting with Bitcoin and RGB++ assets:
- Retrieve Blockchain Information including Bitcoin chain info, blocks, headers, transactions, addresses, and RGB++ assets
- Handle transactions by posting to
/bitcoin/v1/transaction
or/rgbpp/v1/transaction/ckb-tx
- Generate Bitcoin transaction Proof via
/rgbpp/v1/btc-spv/proof
through Bitcoin SPV Service on CKB - Simplify RGB++ assets workflows with RGB++ CKB transaction Queue and cron jobs
- More detailed API documentation can be found on Testnet and Mainnet
-
Creation of
rgbpp_ckb_tx_virtual
using @rgbpp-sdk/ckb
Important
It's recommended to store the rgbpp_ckb_tx_virtual
locally in case you need it in the future.
-
Creation of
rgbpp_btc_tx
through @rgbpp-sdk/btc- construct isomorphic rgbpp_btc_tx based on rgbpp_ckb_tx_virtual and rgbpp commitment
- sign and broadcast rgbpp_btc_tx to obtain
rgbpp_btc_txid
-
JoyID or dApp sends
rgbpp_btc_txid
andrgbpp_ckb_tx_virtual
to RGB++ CKB transaction Queue (API Endpoint:/rgbpp/v1/transaction/ckb-tx
) -
RGB++ CKB transaction Queue
will process the following things:- verify the received requests
- continuously fetch request from the queue through a cron job
- check whether the confirmations of req.rgbpp_btc_txid is sufficient
- generate the witnesses for RgbppLocks in the rgbpp_ckb_tx_virtual
- add a paymaster cell into rgbpp_ckb_tx_virtual.inputs if the CKB capacity is insufficient
- need to verify the existence of paymaster UTXO in the rgbpp_btc_tx
- sign the paymaster cell and the entire transaction if needed
- finalize the rgbpp_ckb_tx_virtual to a rgbpp_ckb_tx
- broadcast rgbpp_ckb_tx and mark the job as completed upon tx-confirmation
- The RGB++ CKB transaction Queue is designed to streamline the transaction workflow. Developers have the option to implement its features by themselves without limitation.
btc_time_lock → target_ckb_address
automation for theBTC → CKB
workflow- every 10 minutes, a cron job queries mature btc_time_lock cells, which means the related btc_txid in btc_time_lock.args has 6+ confirmations
- construct a transaction converting the mature btc_time_lock cells to the target_ckb_addresses
See also https://github.com/utxostack/rgbpp-sdk?tab=readme-ov-file#rgb-asset-workflow-overview