Awesome
<p align="center"> Spore Protocol</p>
<p align="center"> A protocol for valuing on-chain contents, build on top of <a href="https://github.com/nervosnetwork/ckb">CKB</a>. Check <a href="https://docs.spore.pro">Spore Docs</a> for a quick start. </p>Developers are recommended to use the Spore SDK for building applications with Spore, instead of directly interacting with the contracts. If you're interested in testing, extending the contracts, or deploying them on a local blockchain, feel free to explore the Development section for guidance.
About
Spore is an on-chain protocol to power digital asset ownership, distribution, and value capture. For more, check out https://spore.pro
This repo contains the Spore RFC, Spore Mutant RFC, Spore Cluster Proxy/Agent RFC, protocol types schema definition and implementation of Spore contracts written in Rust.
⚙️ Development
Before development, basic dependencies are required:
To build contracts, please run one of below commands:
$ capsule build # build in debug mode
$ capsule build --release # build in release mode for testnet
$ capsule build --release -- --features release_export # build in release mode for mainnet
To check native test cases, which are placed in tests, please run:
$ capsule test # test in debug mode
$ capsule test --release # test in release mode
Writing extra contracts
If your development requires to be built on Spore, steps below are recommended:
- Writing a new Type contract
- Modify existed contracts
For method 1, the flow is:
- Run
capsule new-contract YOUR_CONTRACT_NAME
to initialize a new contract project - Modify
Cargo.toml
of your contract, and introducespore-types
,spore-utils
,spore-constant
- Implementing your contract rules in
entry.rs
- Writing new tests in
tests/src/tests.rs
. See existed test cases for how-to
Deployed Code Hashes
The versioning philosophy is "Using code_hash as version" for Spore Protocol, which means the different code hash matches the different version.
Make sure you are using the proper version you want, because there's no such an "upgrade/downgrade" method but we suggest to use "destroy/reconstruct" method instead, which requires no modification of any fields in Spore cell.
Our frozen
versions of contract, which are our prior versions, can be found in directory ./deployment/frozen
. To describe more clearly, the frozen
information contains each avaliable code_hash
generated from Spore contracts. Historical version refers to here.
In addition, using Mutant contract requires the binary of Lua library. Information are recorded here. For simplicity, it's already deployed in the Pudge Testnet:
Spore Lua Lib
- tx_hash:
0x8fb7170a58d631250dabd0f323a833f4ad2cfdd0189f45497e62beb8409e7a0c
- index:
0
- data_hash:
0xed08faee8c29b7a7c29bd9d495b4b93cc207bd70ca93f7b356f39c677e7ab0fc
Deployment
We provided a simple bash script to operate deployment through ckb-cli
toolchain, details refer to here