You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Qantum resistant lock script on CKB, using SPHINCS+
3
+
4
+
## SPHINCS+
5
+
6
+
## Build
7
+
8
+
### Compile contract
9
+
```shell
10
+
make all-via-docker
11
+
```
12
+
13
+
### Compile other hash type
14
+
```shell
15
+
make all-via-docker PARAMS=sphincs-shake-256f THASH=robust
16
+
```
17
+
Different hash types will have large performance differences when verifying. For specific performance differences, please refer to the table below. You can also refer to this script to generate and execute contracts (tests/sphincsplus_rust/run_example.sh).
18
+
19
+
20
+
## Performance
21
+
Use items for tests/sphincsplus/optimization/run-all-optimization.sh.
22
+
The script uses fixed signature data (tests/sphincsplus/test_data/), Because different signature data will have subtle differences.
23
+
24
+
|| 128s bit | 128f bit | 192s bit | 192f bit | 256s bit | 256f bit |
* Note: Default hash type: **shake-128f-simple** (Verify cycles: about 70M)
36
+
37
+
## Sample in Dev Blockchain
38
+
**Convert a default Lock to ckb-sphincsplus lock script (in ckb dev)**
39
+
40
+
1. compile. Hera we use the default options.
41
+
</br>
42
+
Here we will get a sphincsplus_lock file, the size is about 85608bytes.
43
+
2. Deploy the compiled contract to the test network.
44
+
</br>
45
+
We use [ckb-cli](https://github.com/nervosnetwork/ckb-cli) to deploy this contract, You can refer to [here](https://github.com/nervosnetwork/ckb-cli/wiki/Handle-Complex-Transaction#a-demo).
46
+
* After the execution is successful, it is recommended to record the tx-hash to facilitate subsequent operations.
47
+
3. Generate key file.
48
+
</br>
49
+
Use this tool: tools/ckb-sphincs-tools.
50
+
```shell
51
+
cargo run -- gen-key key.json
52
+
```
53
+
We can get a set of key files, including public and private keys.
54
+
* If the contract you compile does not use the default value, it needs to be the same here.
55
+
* Need to save this file.
56
+
4. Convert a secp256k1 default lock script to SPHINCS+ lock script.
57
+
```shell
58
+
cargo run -- cc_to_sphincsplus --tx_hash <tx-hash> --tx_index <index> --key_file key.json --prikey <You can use ckb-cli account export>
59
+
```
60
+
5. Convert a SPHINCS+ lock script to secp256k1 default lock script.
61
+
```shell
62
+
cargo run -- cc_to_sphincsplus --tx_hash <tx-hash> --tx_index <index> --key_file key.json --lock_arg <LOCK-ARG> --sp_tx_hash <SPHINCS+ Script in step 2> --sp_tx_index <index>
0 commit comments