Skip to content

Torus Blockchain

Torus’s blockchain Subspace, is built on top of the Rust Substrate framework.

Overview

Subspace is built using Substrate, a framework for developing scalable and upgradeable blockchains. It provides the core functionality and security needed for Commune’s platform:

  1. Implements Commune’s consensus mechanism
  2. Advertises cluster modules and their IP addresses
  3. Enables peer discovery for nodes to connect with each other

Rpc Methods

  • Connect To Mainnet: wss://api.torus.network
  • Connect To Testnet: wss://testnet.api.torus.network

Installation

  1. Complete the basic Rust setup instructions.

  2. Clone this repository:

Terminal window
git clone https://github.com/commune-network/subspace.git
cd subspace/

Usage

Build

To build the node without launching it, run:

Terminal window
cargo build --release

Run

To run a single development node with ephemeral storage:

Terminal window
./target/release/node-subspace --dev

This will start a Subspace node with a clean state. The node’s state will be discarded on exit.

To retain the node’s state between runs, specify a base path:

Terminal window
mkdir my-chain-state/
./target/release/node-subspace --dev --base-path ./my-chain-state/

Other useful commands:

Terminal window
# Purge chain state
./target/release/node-subspace purge-chain --dev
# Detailed logging
RUST_BACKTRACE=1 ./target/release/subspace-ldebug --dev
# Explore parameters and subcommands
./target/release/node-subspace -h

Test

To run all tests:

Terminal window
cargo test --all

To run specific tests:

Terminal window
cargo test -p pallet-subspace --test test_voting

To run tests with detailed logs:

Terminal window
SKIP_WASM_BUILD=1 RUST_LOG=runtime=debug cargo test -- --nocapture

Architecture

Subspace leverages the modular and extensible architecture of Substrate. It uses FRAME pallets to encapsulate domain-specific logic such as consensus, storage, and p2p networking.

Notable components:

  • /node: Implementation of the Subspace node including networking, consensus, and RPC
  • /runtime: The core blockchain logic responsible for validating and executing state transitions
  • /pallets: Custom FRAME pallets with Commune-specific logic