Skip to content

Commit

Permalink
chore: fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
RetricSu committed Jul 1, 2024
1 parent 779ad2b commit 6bd7af4
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions website/docs/common-scripts/omnilock.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,35 +36,28 @@ Depending on the value of the flag, the auth content has the following interpret
lock](https://github.com/nervosnetwork/rfcs/blob/780b2f98068ed2337f3a97b02ec6b5336b6fb143/rfcs/0024-ckb-genesis-script-list/0024-ckb-genesis-script-list.md#secp256k1blake160).
- 0x01: It follows the unlocking method used by Ethereum. The signing message
hash(sighash_all, see [reference implementation](https://github.com/nervosnetwork/ckb-system-scripts/blob/a7b7c75662ed950c9bd024e15f83ce702a54996e/c/secp256k1_blake160_sighash_all.c#L219)) is converted as following:
```
"0x" + hex(signing message hash)
```
`"0x" + hex(signing message hash)`

The hex operator is to convert binary into hex string.

- 0x03: It follows the unlocking method used by Tron. The signing message hash
is converted as following:
```
"0x" + hex(signing message hash)
```
`"0x" + hex(signing message hash)`
- 0x04: It follows the unlocking method used by Bitcoin. The signing message
hash is required to be converted as following:
```
"CKB (Bitcoin Layer) transaction: 0x" + hex(signing message hash)
```
`"CKB (Bitcoin Layer) transaction: 0x" + hex(signing message hash)`

In this way, it can show message on wallets(e.g. UniSat, OKX) nicely.

- 0x05: It follows the unlocking method used by dogecoin. The signing message
hash is converted as following:
```
"0x" + hex(signing message hash)
```
`"0x" + hex(signing message hash)`
- 0x12: It follows the unlocking method same to 0x02 with the signing message hash
to be converted as following:
```
"CKB transaction: 0x" + hex(signing message hash)
```
`"CKB transaction: 0x" + hex(signing message hash)`

In this way, it can show message on wallets(e.g. MetaMask) nicely.

- 0x06: It follows the same unlocking method used by [CKB MultiSig](https://github.com/nervosnetwork/ckb-system-scripts/blob/master/c/secp256k1_blake160_multisig_all.c) with a little modification. When a message is calculated for signing, there is a step to clear witness. In omnilock, it clears the whole field `lock` in `witness`. But in CKB MultiSig script, it only clears part of `lock` in `witness`. This part is used as `signatures` followed by `multisig_script`.
- 0xFC: The auth content that represents the blake160 hash of a lock script. The lock script will check if the current transaction contains an input cell with a matching lock script. Otherwise, it would return with an error. It's similar to [P2SH in BTC](https://en.bitcoin.it/wiki/Pay_to_script_hash).
- 0xFD: The auth content that represents the blake160 hash of a preimage. The preimage contains [exec](https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0034-vm-syscalls-2/0034-vm-syscalls-2.md#exec) information that is used to delegate signature verification to
Expand Down

0 comments on commit 6bd7af4

Please sign in to comment.