This 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
- Find code examples at https://github.com/ckb-cell/rgbpp-sdk/tree/develop/examples/rgbpp
-
CKB Bitcoin SPV Type Script: A type script for Bitcoin SPV clients which synchronize Bitcoin state into CKB
-
RGB++ scripts/contracts: RgbppLockScript and BtcTimeLockScript
- design docs: https://github.com/ckb-cell/RGBPlusPlus-design/blob/main/docs/lockscript-design-prd-en.md
- testnet deployment: https://pudge.explorer.nervos.org/scripts#RGB++
- mainnet deployment: https://explorer.nervos.org/scripts#RGB++
- Creation of
rgbpp_ckb_tx_virtual
using @rgbpp-sdk/ckb
-
xUDT
-
Spore
Important
It's recommended to save 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 onrgbpp_ckb_tx_virtual
and rgbpp commitment - sign and broadcast
rgbpp_btc_tx
to obtainrgbpp_btc_txid
- construct isomorphic
-
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
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
- sign the paymaster cell and the entire transaction if needed
- need to verify the existence of paymaster UTXO in the rgbpp_btc_tx
-
finalize the
rgbpp_ckb_tx_virtual
to argbpp_ckb_tx
-
broadcast
rgbpp_ckb_tx
and mark the job as completed upon tx-confirmation
-
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.
See Generate a JSON Web Token (JWT) for Bitcoin/RGB++ Assets Service
See RGB++ Lock Script Error Codes
ISC License