Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ashchan/gringotts
UDT Hackathon Team Goblins Codebase
https://github.com/ashchan/gringotts
Last synced: about 1 month ago
JSON representation
UDT Hackathon Team Goblins Codebase
- Host: GitHub
- URL: https://github.com/ashchan/gringotts
- Owner: ashchan
- License: mit
- Archived: true
- Created: 2020-03-26T09:04:27.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-03-10T12:29:32.000Z (almost 4 years ago)
- Last Synced: 2024-08-03T02:09:02.311Z (4 months ago)
- Language: Swift
- Homepage:
- Size: 5.89 MB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-nervos-ckb - Gringotts: Token Renting
README
# Gringotts
UDT Hackathon Team Goblins Codebase
* [Server](server/)
* [Client (macOS)](client/)
* [Document](https://docs.google.com/document/d/1SEV3Ch63QBlb6ij3T_F93DxoOPuBDfk-xgGaeXHyyxA/edit?usp=sharing)# Smart Contracts
This dapp leverages 2 smart contracts:
* [Main contract](https://github.com/ashchan/gringotts/blob/795c693da37bd0c257b3d8a48b35fe523b8c2d80/server/contracts/lock.c): encodes the main validation logic
* [Secp contract](https://github.com/xxuejie/ckb-miscellaneous-scripts/blob/693a76f1609bd64b4cbf428f0ebb77198b8d57bd/c/secp256k1_blake2b_sighash_all_dual.c): encodes secp256k1 validation logicThe main contract uses dynamic linking techniques to load the secp contract and runs the signature verification code. Hence you can notice the main contract is quite small (7.9K in current example).
The secp contract is an interesting one: it can work as a dynamic linked library as shown above; it can also be used as a standalone executable contract by itself, in which case it will perform the secp256k1-blake2b-sighash-all validation just like the default lock.
In our test, the dynamic linking only consumes 2375 more cycles than the version where we combine all the logic in one giant contract. In exchange, our current solution enables multiple smart contracts to share the same secp256k1 verification code on chain, the smart contracts, can then focus on and only include dapp specific logic.