CCC (Common Chains Connector) helps developers interoperate wallets from different chain ecosystems with CKB, fully enabling CKB's cryptographic freedom power. In this overview specification, we describe some common designs, definitions, and conventions. The lock specifications for dedicated chains can be found in other documents. The definitions and conventions in this section apply to all CCC lock specifications, including BTC, ETH, and more.
CKB uses blake2b as the default hash algorithm. We use ckbhash
to denote the
blake2b hash function with following configuration:
- output digest size: 32
- personalization: ckb-default-hash
The blake160
function is defined to return the leading 20 bytes of the ckbhash
result.
A 32-byte sighash_all
message can be calculated via ckbhash
with following data:
- Transaction hash
- Witness length and content in same script group covered by inputs, excluding lock field
- Other witness length and content that not covered by inputs
A reference implementation in C can be found here.
When unlocking a CCC lock script, the corresponding witness must be a proper
WitnessArgs
data structure in molecule format. In the lock field of the
WitnessArgs, a signature must be present. Signatures can be different for
different chains.
Only lowercase letters can be used in hexadecimal strings. For example, "00" and "ffee" are valid hexadecimal strings, while "FFEE" and "hello world" are not valid.
- BTC
- ETH