Guide
CKB
Sign Raw Transaction

Sign Raw Transaction

The @joyid/ckb SDK provides the signRawTransaction function to sign CKB raw transaction with JoyID Wallet.

But we DO NOT recommend developers directly use the signRawTransaction function, because the JoyID wallet cannot add extra information to the CKB transaction, such as cell deps, etc. Otherwise, it will increase the CKB transaction size, potentially leading to insufficient original CKB transaction fees and causing the transaction to fail.

Unless you are sufficiently familiar with assembling CKB transactions with JoyID Wallet, we suggest using lumos (opens in a new tab) to assemble CKB transaction and the JoyID Example with Lumos (opens in a new tab) can be helpful for you.

If you are using ckb-ccc (opens in a new tab) to connect JoyID wallet, you can use ckb-ccc/lumos-patche (opens in a new tab) and lumos (opens in a new tab) to build you DApps.

SubKey unlock

If you are using the signRawTransaction of @joyid/ckb to sign CKB transaction, please remember to handle the situation of unlocking transactions with SubKey. You can refer to the SubKey Docs for specific code and documentation.

Two things you should handle are:

  • Fetch subkey unlock entry from CoTA aggregator and append it to the witness, reference: SubKey Docs
  • Add CoTA cell to the first place of the cellDeps, reference: SubKey Docs