Home

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:

  1. Writing a new Type contract
  2. Modify existed contracts

For method 1, the flow is:

  1. Run capsule new-contract YOUR_CONTRACT_NAME to initialize a new contract project
  2. Modify Cargo.toml of your contract, and introduce spore-types,spore-utils, spore-constant
  3. Implementing your contract rules in entry.rs
  4. 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

Deployment

We provided a simple bash script to operate deployment through ckb-cli toolchain, details refer to here