Guide
CKB
Smart Contract

Smart Contract

Introduction

JoyID smart contract is based on Nervos CKB (opens in a new tab) and provides on-chain Passkey crypto verification for JoyID wallet. JoyID smart contract is a Lock Script (opens in a new tab) and it will success when the Passkey signature and CKB transaction are valid, otherwise, it will fail.

The JoyID smart contract has not yet undergone a security audit, so it is not open source now.

Error Codes and Reasons

When the JoyID smart contract verification fails, you will receive an error code. This error code will indicate the cause of the error, which you can use to check and update the CKB transaction accordingly.

The following are the JoyID smart contract common error codes and their corresponding error reasons:

Error CodeReason
6The public key hash parsed from the witness does not match the one requested in the script.
7The length of the witness is invalid
8The unlock mode parsed from the witness is invalid which should be Secp256r1 main key unlock or Secp256r1 sub key unlock
11The Secp256r1 signature verification fails, and please check the WitnessArgs.Lock of the corresponding JoyID input
12The calculated challenge which includes the sigHashAll message cannot be found in WebAuthn ClientData of the witness
13The CoTA SMT root parsed from the CoTA cell dep is invalid
14The sub key SMT proof verification fails
21The CoTA cell lock script from cell deps does not match.

JoyID Smart Contract Deployment Information

JoyID smart contract has been deployed on Nervos CKB Mainnet and Testnet and the following are the deployment information:

Mainnet Deployment

code_hash: 0xd00c84f0ec8fd441c38bc3f87a371f547190f2fcff88e642bc5bf54b9e318323
hash_type: type
 
tx_hash: 0x06d4b4cc802115633b0ed89fac859504b1c08c93869ee9748b1d17c1d0e149ae
index: 0x0
dep_type: dep_group

Testnet Deployment

code_hash: 0xd23761b364210735c19c60561d213fb3beae2fd6172743719eff6920e020baac
hash_type: type
 
tx_hash: 0x759f281588c96979764cb21c196478cf8e13ea81fede7f4ba26d1ff29dbc6a81
index: 0x0
dep_type: dep_group