forked from ckb-devrel/ccc-locks
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# CCC Solana Lock Specification | ||
|
||
This specification describes a CCC lock script that can interoperate with the Solana blockchain. Some common designs, definitions, and conventions can be found in the [overview](./overview.md). | ||
|
||
## Lock Script | ||
|
||
A CCC Solana lock script has following structure: | ||
|
||
``` | ||
Code hash: CCC Solana lock script code hash | ||
Hash type: CCC Solana lock script hash type | ||
Args: <ed25519 pubkey, 32 bytes> | ||
``` | ||
|
||
The ed25519 pubkey can be also decoded from an Solana address by base58 decoding. | ||
|
||
## Witness | ||
|
||
The corresponding witness must be a proper `WitnessArgs` data structure in molecule format. In the lock field of the WitnessArgs, a 64 bytes ed25519 signature must be present. | ||
|
||
## Unlocking Process | ||
|
||
The following bytes are verified: | ||
|
||
"Signing a CKB transaction: 0x{sigh_hash}\n\nIMPORTANT: Please verify the integrity and authenticity of connected SOL wallet before signing this message\n" | ||
|
||
The `{sighasl_all}` is replaced by `sighash_all` in hexadecimal string, with length 64. The string in the last part can be displayed in wallet UIs. | ||
|
||
## Examples | ||
|
||
```yaml | ||
CellDeps: | ||
<vec> CCC Solana lock script cell | ||
Inputs: | ||
<vec> Cell | ||
Data: <...> | ||
Type: <...> | ||
Lock: | ||
code_hash: <CCC Solana lock script code hash> | ||
args: <ed25519 pubkey, 32 bytes> | ||
Outputs: | ||
<vec> Any cell | ||
Witnesses: | ||
<vec> WitnessArgs | ||
Lock: <signature, 64 bytes> | ||
``` | ||
## Notes | ||
An implementation of the lock script spec above has been deployed to CKB mainnet and testnet: | ||
- mainnet | ||
| parameter | value | | ||
| ----------- | -------------------------------------------------------------------- | | ||
| `code_hash` | TODO | | ||
| `hash_type` | `type` | | ||
| `tx_hash` | TODO | | ||
| `index` | `0x0` | | ||
| `dep_type` | `code` | | ||
|
||
- testnet | ||
|
||
| parameter | value | | ||
| ----------- | -------------------------------------------------------------------- | | ||
| `code_hash` | TODO | | ||
| `hash_type` | `type` | | ||
| `tx_hash` | TODO | | ||
| `index` | `0x0` | | ||
| `dep_type` | `code` | | ||
|
||
Reproducible build is supported to verify the deployed script. To build the deployed script above, one can use the following steps: | ||
|
||
```bash | ||
TODO | ||
``` |