An implementation of the CESS network supported by CESS LAB.

Overview

CESS

Substrate version GitHub license

--------- 🌌 ---------An infrastructure of decentralized cloud data network built with Substrate-------- 🌌 --------

---------------- 🌌 ----------------Learn more at cess.cloud & with white-paper---------------- 🌌 ---------------

Getting Started

Install Guide

Follow Setup to guide you install the CESS development.

Build Node

The cargo run command will perform an initial build. Use the following command to build the node without launching it:

# Fetch the code
git clone https://github.com/Cumulus2021/cess.git
cd cess

# Build the node (The first build will be long (~30min))
cargo build --release

Run The CESS Node

After the node has finished compiling, you can follow these steps below to run it.

Generate Keys

If you already have keys for Substrate using the SS58 address encoding format, please see the next section.

Begin by compiling and installing the utility (instructions and more info here).

Generate a mnemonic (Secret phrase) and see the sr25519 key and address associated with it.

# subkey command
subkey generate --scheme sr25519

Now see the ed25519 key and address associated with the same mnemonic (Secret phrase).

# subkey command
subkey inspect --scheme ed25519 "SECRET PHRASE YOU JUST GENERATED"

We recommend that you record the above outputs and keep mnemonic in safe.

Run Testnet C-ALPHA

Launch node on the C-ALPHA with:

# start
./target/release/cess-node --base-path /tmp/cess --chain C-ALPHA

Then you can add an account with:

# create key file
vim secretKey.txt

# add secret phrase for the node in the file
YOUR ACCOUNT'S SECRET PHRASE
# add key to node
./target/release/cess-node key insert --base-path /tmp/cess --chain C-ALPHA --scheme Sr25519  --key-type aura --suri /root/secretKey.txt

./target/release/cess-node key insert --base-path /tmp/cess --chain C-ALPHA --scheme Ed25519  --key-type gran --suri /root/secretKey.txt

Now you can launch node again:

# start
./target/release/cess-node --base-path /tmp/cess --chain C-ALPHA

Run in Docker

Install Docker first, and run the following command to start a node on the C-ALPHA:

docker pull cesstech/c-alpha:v0.0.1
docker run --network host cesstech/c-alpha:v0.0.1 ./CESS-v0.0.1/target/release/cess-node --base-path /tmp/cess --chain C-ALPHA

Run Tests

CESS has Rust unit tests, and can be run locally.

# Run all the Rust unit tests
cargo test --release

Module Documentation

Contribute

Please follow the contributions guidelines as outlined in docs/CONTRIBUTING.adoc. In all communications and contributions, this project follows the Contributor Covenant Code of Conduct.

Comments
  • SBP: Give indexes to you pallets

    SBP: Give indexes to you pallets

    It is a good practice to give indexes to your runtime pallets.

    More info here: https://substrate.stackexchange.com/questions/1163/whats-the-logic-behind-polkadots-choice-in-pallet-indexing

    opened by NachoPal 4
  • SBP: Off-chain worker configuration

    SBP: Off-chain worker configuration

    The use of off-chain worker for fetching the storage price should improved taking into consideration how they work and when they are executed.

    Some context about things to pay attention to when using off-chain workers:

    • https://stackoverflow.com/questions/64772897/offchain-workers-signed-transactions/64772985#64772985
    • https://stackoverflow.com/questions/59401972/role-of-off-chain-workers
    • https://substrate.stackexchange.com/questions/2093/when-does-an-off-chain-worker-get-executed
    opened by NachoPal 3
  • SBP: Block Production time

    SBP: Block Production time

    I noticed that you reduced MILLISECS_PER_BLOCK to 3000. Unless there is a very strong reason to reduce this value and necessary calculations have been done to ensure network stability, I would recommend to keep the default value of 6 seconds.

    More info here: https://substrate.stackexchange.com/questions/1618/what-happens-when-i-decrease-the-millisecs-per-block-parameter-in-runtime-src

    opened by NachoPal 3
  • SBP: Potential overflow issues

    SBP: Potential overflow issues

    Review potential overflow situations where operators +, -, * and / are used. E.g:https://github.com/CESSProject/cess/blob/main/c-pallets/file-bank/src/lib.rs#L550

    If operations are safe it is a good practice to add a comment about why.

    Use checked_add, checked_sub, checked_mul, checked_div, instead.

    opened by NachoPal 2
  • SBP: Off-chain worker documentation is outdated

    SBP: Off-chain worker documentation is outdated

    https://github.com/CESSProject/sbp-code-docs/blob/main/m1/cess-dscm.md

    Your off-chain worker is not signing transactions anymore, it is using unsigned transactions instead.

    opened by NachoPal 2
  • SBP: Review all your `unwrap()`

    SBP: Review all your `unwrap()`

    Avoid panics at almost any cost and add "proofs" for expect() calls on why they cannot fail. The only reason to panic should be in case a block should not be built when that code path is triggered or when it indicates a bug.

    In most cases you should handle the Error.

    e.g: A potential place to handle the error: https://github.com/CESSProject/cess/blob/main/c-pallets/file-bank/src/lib.rs#L537

    opened by NachoPal 2
  • CESS pallet-sminer

    CESS pallet-sminer

    Hi there, I am a cess fan and watched the last week's CESS technology presentation. The speaker has shared a lot of information about CESS how to develop on the substrate at that moment. The best point that makes me interesting is CESS created a pallet of sminer in the substrate.

    opened by Aranck 2
  • SBP: Review all your hashers in storage

    SBP: Review all your hashers in storage

    I noticed that you are using Twox64Concat by default for all your StorageMap keys. Be aware of the potential issues of choosing the incorrect hasher.

    From: https://docs.substrate.io/v3/advanced/cryptography/#xxhash

    Because xxHash is not cryptographically secure, it is possible that the output of the hash algorithm can be reasonably controlled by modifying the input. This can allow a user to attack this algorithm by creating key collisions, hash collisions, and imbalanced storage tries. xxHash is used in places where outside parties cannot manipulate the input of the hash function. For example, it is used to generate the key for runtime storage values, whose inputs are controlled by the runtime developer.

    For those keys that are under the user's control, Blake2 should be used instead.

    E.g: File name is under user's control https://github.com/CESSProject/cess/blob/main/c-pallets/file-bank/src/lib.rs#L258

    opened by NachoPal 1
  • SBP: `UnitPrice` issues

    SBP: `UnitPrice` issues

    • [x] UnitPrice value should be able to be set from genesis or have a default value. If for some reason OCW http request fails, UnitPrice would default to 0.
    • [x] Conditions to fetch price should be modified. In case the first http request fails or it retrieves a wrong value, offchain_fetch_price() will not be run until the next day. Some conditions should be added to automatically check if the retrieved price is under some limits or otherwise to fallback to some default value or perform the http request again. Make sure the results the OCWs generate are validated on-chain (and not assumed to be valid).
    • [x] update_price() is an unsigned dispatchable. Anyone could call to this method and modify the price: https://github.com/CESSProject/cess/blob/main/c-pallets/file-bank/src/lib.rs#L603-L607
    opened by NachoPal 1
  • M2 - SBP review

    M2 - SBP review

    To avoid repeating myself I did not add a comment everywhere with similar issues.

    As an extra suggestion, I would refactor some extrinsics. Some of them are too long and is difficult to follow what it happening. I think some of them can be split. I recommend you to use Pallet’s methods as helpers when the name of the method describes the action

    opened by NachoPal 2
  • The size of hard disk space

    The size of hard disk space

    I have a question when I want put my database to the hard disk space, I have no idea what is the size of the hard disk space is appropriate for my database?

    opened by DaiChibret 0
Releases(v0.5.3)
  • v0.5.3(Nov 14, 2022)

    v0.5.3

    Release for cess-testnet-v0.5.3

    Highlights

    • New Object Storage Service(OSS).
    • Support data ownership transfer.

    Features

    • feat: Add user authorization.
    • Adapt to relevant interfaces of OSS.
      • Added OSS registration, OSS information update and OSS destruction.
    • feat: Add bucket creation function and bucket deletion function.
    • Change the process of uploading files.
      • The user needs to create a bucket first, and then upload the file to the specified bucket
    • feat: Add file ownership transfer.

    Changes

    • fix: scheduler-credit clear counters when period start(#100).
    • feat: object storage service(#102).
    • feat: transfer of ownership of documents(#103).
    • fix: spec_version(#104).
    Source code(tar.gz)
    Source code(zip)
    cess-node(84.15 MB)
  • v0.5.2(Oct 31, 2022)

    v0.5.2

    Release for cess-testnet-v0.5.2

    Highlights

    • To encourage new consensus nodes to join the network, the credit score model of R²S consensus was optimized to reduce the weight of historical contributions.

    Features

    • Optimize file transmission mode: change RPC to self encapsulating TCP.
    • Optimize runtime code to make the chain more secure.
    • Optimize the credit score model of R²S consensus mechanism.
    • Optimize the speed of miners' calculation and certification.

    Changes

    • style: update cess-testnet chain spec (#99)
    • fix: 0.5.2 bug (#98)
    • fix: spec chain (#97)
    • feat: scheduler-credit (#96)
    • fix: m2-sbp (#88)
    Source code(tar.gz)
    Source code(zip)
    cess-node(84.15 MB)
  • v0.5.1(Sep 6, 2022)

    v0.5.1

    Release for cess-testnet-v0.5.1

    Highlights

    • BABE consensus replaced by R²S(Random Rotational Selection Consensus).

    Features

    • Optimized the working mode of the offchain worker.
    • Added a module for consensus reputation calculation.
    • BABE consensus replaced by R²S.
    • The block out time is changed from 3s to 6s.
    • Fixed bug when buying space package.
    • Added the transactional label.

    Changes

    • feat: 0.5.1 release(#83)
    Source code(tar.gz)
    Source code(zip)
    cess-node(82.55 MB)
  • v0.5.0(Aug 9, 2022)

    v0.5.0

    Release for cess-testnet-v0.5.0

    Highlights

    • Updated Storage Pricing Mechanism;
    • Updated Storage Miner Punishment Mechanism;

    Features

    • Unit price alters based on the storage scale acquired and other elements;
    • Optimize the use of constants and naming rules in sminer pallet;
    • Modify the mechanism of reward allocation, and allocate by the sum of miners' service space and idle space;
    • Update benchmark to generate reasonable weights;
    • Improve the test unit of each module.

    Changes

    • feat: 0.5.0 space & punish(#75)
    • style: 0.5.0 benchmark(#78)
    • refactor: optimize code (#79)
    • test: pallet-sminer tests(#80)
    • tests: fix bug and file-bank, segment-book, file-map tests(#81)
    Source code(tar.gz)
    Source code(zip)
    cess-node(74.33 MB)
  • v0.4.4(Jul 19, 2022)

    v0.4.4

    Release for cess-testnet-v0.4.4

    Highlights

    • EVM support.
    • File Instant Transfer function.
    • Batch submission proof and verification result function.
    • File disclosure, users can download files on the chain at will.

    Features

    • EVM is installed on the chain
    • The uploading process of files is optimized, and the backup mechanism is temporarily cancelled, so as to realize the Instant Transfer function of files and improve the speed of users' downloading files.
    • Add test units adapted to the new process.
    • Optimized the storage pool structure of miners and unified the primary key of miners' information.
    • Miners can submit proofs in batches, and dispatchers can submit validation results in batches.
    • After the miner exits, the filler meta information on the chain will be cleared.
    • Optimize random challenges and reduce generation time.

    Changes

    • feat: integrate Frontier for EVM compatible (#64)
    • style: update README.md(#65)
    • refactor: optimize code (#66)
    • refactor: optimize random challenges(#69)
    Source code(tar.gz)
    Source code(zip)
    cess-node(74.31 MB)
  • v0.4.3(Jun 20, 2022)

    v0.4.3

    Release for cess-testnet-v0.4.3

    Features

    • Change the expiration time of random challenges from 1 hour to dynamic adjustment according to the number of proofs of miners. The more proofs to be submitted, the longer the expiration time of challenges.
    • Optimize transaction times, allow miners to submit proofs in batches, and allow schedulers to submit verification results in batches.

    Changes

    • style: runtime pallets indexing (#57)
    • refactor: replace hasher (#58)
    • feat: restrict transactions submitted by off chain workers (#59)
    Source code(tar.gz)
    Source code(zip)
    cess-node(69.37 MB)
  • v0.4.2(Jun 14, 2022)

    v0.4.2

    Release for cess-testnet-v0.4.2

    Features

    • Offchain worker is now responsible for generating random challenges.

    Changes

    • style: modified /runtime/lib.rs configuration of benchmark (#54)
    • refactor: Refactor challenge (#56)
    Source code(tar.gz)
    Source code(zip)
    cess-node(69.38 MB)
  • v0.4.1(Jun 7, 2022)

    v0.4.1

    Release for cess-testnet-v0.4.1

    Features

    • Update comments for code

    • Fixed a bug caused when granting rewards to miners

    • Solved the risk of panic caused by code

    Changes

    • style: solve hidden troubles in code(#49)
    • fix: processing warnings(#50)
    • fix: unsigned and execution time(#51)
    Source code(tar.gz)
    Source code(zip)
  • v0.4.0(May 30, 2022)

    v0.4.0

    Release for cess-testnet-v0.4.0

    Highlights

    • Adapt new proof PoDR2 https://github.com/CESSProject/CIPs/blob/main/CIP-2.md

    • File recovery mechanism

    Features

    • New proof module and new functions

      • Add the random challenge function to extract random files to challenge miners at random time
    • Lower gas fee

    • New file replacement function

    • New functions of clearing invalid files

    • New file backup and recovery function

    Changes

    • update: subtrate to monthly-2022-04(#17)
    • update: chain.rs and ocw(#20)
    • refactor: Point substrte to CESSProject repo(#21)
    • feat: compare the two pricing(#22)
    • style: file map tests(#24)
    • style: update sminer pallet unit tests(#26)
    • feat: new proof PoDR2(#27)(#29)
    • style: update pallet-file-bank unit test(#28)
    • feat: change staking config(#31)
    • style: update segment book tests(#32)
    • fix: bug fix in version 0.4.0(#34)(#45)
    • style: ccg cess-testnet json(#47)
    Source code(tar.gz)
    Source code(zip)
  • v0.3.1(May 5, 2022)

    • Improve the real-time pricing function, read the space unit price of other applications through the offline working machine, and finally confirm our pricing through calculation and comparison.
    • Upgraded the substrate framwork version from monthly-2021-10 to monthly-2022-04.
    • Improve the dispatching registration function, and the registration conditions must be bond pledged first.
    • The function of collecting scheduling reports is added. The dispatchers will supervise each other. If there is only one service running separately, they will be punished when the scheduling error report exceeds half of the total.
    • New scheduling penalty function.
    Source code(tar.gz)
    Source code(zip)
  • v0.3.0(Mar 28, 2022)

    Highlights

    • Miners have more choices and better functional mechanism
      • Added user additional mortgage function.
      • Added user exit function.
      • Added user redemption deposit function.
    • Added the function of giving 1GB space to new users.

    Features

    • It details the different states of miners, such as withdrawal, active, freezing and so on.

    • The reward mechanism for miners is optimized. When miners are frozen, rewards will accumulate, but will not be issued

    • The punishment mechanism for miners has been improved.

      • When the certificate verification fails or the certificate is not submitted for a long time, the miner will be punished and the deposit of 20tcess will be deducted.
      • When the deposit of miners is lower than a certain level, it will be frozen. According to the space provided by the miner.
    Source code(tar.gz)
    Source code(zip)
  • v0.2.0(Feb 18, 2022)

    v0.2.0

    Release for cess-testnet-v0.2.0

    Highlights

    • Added data segment routing module

    • Added real-time pricing module

      • The price is depends on real-time suppy and demand

    Features

    • Optimized both the scheduling and storage interface

    • Added linux client

      • Added linux based client application that allow users to operate space storage, file download and other functions
    • Added storage space leasing function

    • In this Version of v0.2.0, cess testnet and decentralized storage system is achieved the unification

    Source code(tar.gz)
    Source code(zip)
  • v0.1.3(Jan 15, 2022)

  • v0.1.2(Dec 30, 2021)

  • v0.1.1(Dec 21, 2021)

    Release for cess-testnet-v0.1.1.

    Highlights

    • Add segment-book pallet
      • support the submission and verification of proof of storage.
    • Update files-map pallet
      • manage routing of stored files.
    • Update sminer pallet
      • introduce basic operations related to storage miners.

    Features

    • support storage mining.
    • implement BABE consensus module.
    • substrate version updated to monthly-2021-10.
    Source code(tar.gz)
    Source code(zip)
  • v0.0.1(Oct 12, 2021)

    This is the first release that launches test-net C-ALPHA.

    Highlights

    • Add files-bank pallet
      • support uploading and updating info of files.
    • Add files-map pallet
      • manage routing of stored files.
    • Add sminer pallet
      • introduce basic operations related to storage miners.

    Features

    • concise getting started.
    • support docker startup.
    • stable testnet of storage application blockchain.
    • adequate use guidelines.
    Source code(tar.gz)
    Source code(zip)
Owner
Cess Project
CESS Cloud Data Network
Cess Project
A library-first, lightweight, high-performance, cloud-native supported API gateway🪐 by RUST

Preview version, will not guarantee the stability of the API! Do NOT use in production environment! A library-first, lightweight, high-performance, cl

Ideal World 4 May 7, 2023
Docker containers on a synthetic network. Run applications in a context that lets you manipulate their network conditions.

Synthetic Network Docker containers on a synthetic network. Run applications in a context that lets you manipulate their network conditions. Dependenc

Daily 58 Dec 15, 2022
Official Implementation of Findora Network.

Findora Platform Wiki Contribution Guide Licensing The primary license for Platform is the Business Source License 1.1 (BUSL-1.1), see LICENSE. Except

Findora Foundation 61 Dec 9, 2022
Network simulation in Rust

netsim - A Rust library for network simulation and testing (currently linux-only). netsim is a crate for simulating networks for the sake of testing n

Andrew Cann 115 Dec 15, 2022
A private network system that uses WireGuard under the hood.

innernet A private network system that uses WireGuard under the hood. See the announcement blog post for a longer-winded explanation. innernet is simi

Tonari, Inc 4.1k Dec 29, 2022
A Curve-like AMM for Secret Network

A Curve-like AMM for Secret Network. Supports a varibale number of tokens with the same underlying value.

Enigma 16 Dec 11, 2022
A multi-protocol network relay

A multi-protocol network relay

zephyr 43 Dec 13, 2022
A Rust library for parsing the SOME/IP network protocol (without payload interpretation).

someip_parse A Rust library for parsing the SOME/IP network protocol (without payload interpretation). Usage Add the following to your Cargo.toml: [de

Julian Schmid 18 Oct 31, 2022
Computational Component of Polkadot Network

Gear is a new Polkadot/Kusama parachain and most advanced L2 smart-contract engine allowing anyone to launch any dApp for networks with untrusted code.

null 145 Dec 19, 2022
Fullstack development framework for UTXO-based dapps on Nervos Network

Trampoline-rs The framework for building powerful dApps on the number one UTXO chain, Nervos Network CKB. This is an early-stage, currently very incom

TannrA 2 Mar 25, 2022
Simple in-network file transfer with barely any overhead.

fftp fftp is the "Fast File Transport Protocol". It transfers files quickly between computers on a network with low overhead. Motivation FTP uses two

leo 4 May 12, 2022
netavark: A container network stack

netavark: A container network stack Netavark is a rust based network stack for containers. It is being designed to work with Podman but is also applic

Containers 230 Jan 2, 2023
A cross-platform, user-space WireGuard port-forwarder that requires no system network configurations.

Cross-platform, user-space WireGuard port-forwarder that requires no system network configurations.

Aram Peres 629 Jan 4, 2023
A small utility to wake computers up or put them to sleep over the local network

WKSL - a wake and sleep utility An experiment in writing a small CLI utility in Rust. The program lets you wake a machine on your local network up fro

Henrik Ravn 0 Nov 14, 2021
Private swaps for Secret Network using a private entropy pool & differential privacy.

WIP SecretSwap: Anon Edition Private swaps for Secret Network! Uses private entropy pool for differential privacy when reporting pools sizes. Swap amo

SCRT Labs 5 Apr 5, 2022
Common Rust Lightning Network types

Common Rust Lightning Network types Warning: while in a good state, this is still considered a preview version! There are some planned changes. This l

Martin Habovštiak 5 Nov 8, 2022
Shade Protocol is an array of connected privacy-preserving dApps built on Secret Network

Shade Protocol Core Contracts Contract Reference Description mint doc Handles asset burning and silk minting oracle doc Handles asset price queries tr

Secure Secrets 58 Nov 15, 2022
The Safe Network Core. API message definitions, routing and nodes, client core api.

safe_network The Safe Network Core. API message definitions, routing and nodes, client core api. License This Safe Network repository is licensed unde

MaidSafe 101 Dec 19, 2022
Network Block Storage server, written in Rust. Supports pluggable and chainable underlying storage

nbd-rs Disclaimer DO NEVER USE THIS FOR PRODUCTION Do not use this for any data that you cannot afford to lose any moment. Expect data loss, corruptio

Rainlab Inc 10 Sep 30, 2022