Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/doitian/ckb-sdk-examples-capacity-diff
https://github.com/doitian/ckb-sdk-examples-capacity-diff
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/doitian/ckb-sdk-examples-capacity-diff
- Owner: doitian
- Created: 2023-08-14T04:56:48.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-15T07:54:07.000Z (over 1 year ago)
- Last Synced: 2024-04-14T18:13:05.967Z (7 months ago)
- Language: Rust
- Size: 18.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ckb-sdk-examples-capacity-diff
This is an example lock script which verifies the witness matches the capacity difference.
- The script loads the witness for the first input in the script group using the WitnessArgs layout.
- The total input capacity is the sum of all the input cells in the script group.
- The total output capacity is the sum of all the output cells having the same lock script as the script group.
- The capacity difference is a 64-bit signed integer which equals to total output capacity minus total input capacity.
- The witness is encoded using two's complement and little endian.## Build contracts
``` sh
capsule build
```Run tests:
``` sh
capsule test
```