MCPcopy Index your code
hub / github.com/Cyborg-Network/cyborg-parachain

github.com/Cyborg-Network/cyborg-parachain @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
629 symbols 1,001 edges 71 files 188 documented · 30%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Cyborg Network Parachain Implementation

Emblem Green

Distributed AI Computing

Official Repository for the Cyborg Network

💡 Built with Substrate.

Substrate version Medium License Twitter URL Telegram

Getting Started

To test the Cyborg Parachain, please refer to the instructions in this document: https://github.com/Cyborg-Network/cyborg-parachain/blob/master/Local%20Testing.md#local-setup

Blockchain Structure

A Substrate-based project such as Cyborg Network consists of a number of components that are spread across a few directories.

Node

A blockchain node is an application that allows users to participate in a blockchain network. Substrate-based blockchain nodes expose a number of capabilities:

  • Networking: Substrate nodes use the libp2p networking stack to allow the nodes in the network to communicate with one another.
  • Consensus: Blockchains must have a way to come to consensus on the state of the network. Substrate makes it possible to supply custom consensus engines and also ships with several consensus mechanisms that have been built on top of Web3 Foundation research.
  • RPC Server: A remote procedure call (RPC) server is used to interact with Substrate nodes.

There are several files in the node directory. Take special note of the following:

  • chain_spec.rs: A chain specification is a source code file that defines a Substrate chain's initial (genesis) state. Chain specifications are useful for development and testing, and critical when architecting the launch of a production chain. Take note of the development_config and testnet_genesis functions,. These functions are used to define the genesis state for the local development chain configuration. These functions identify some well-known accounts and use them to configure the blockchain's initial state.
  • service.rs: This file defines the node implementation. Take note of the libraries that this file imports and the names of the functions it invokes. In particular, there are references to consensus-related topics, such as the block finalization and forks and other consensus mechanisms such as Aura for block authoring and GRANDPA for finality.
  • cli.rs: This file defines the command-line interface that allows users to interact with the node. Take note of the parameters that this file defines and how they are used to instantiate the node.
  • main.rs: This file defines the main function that starts the node. Take note of the parameters that this file passes to the service.rs file.

Runtime

In Substrate, the terms "runtime" and "state transition function" are analogous. Both terms refer to the core logic of the blockchain that is responsible for validating blocks and executing the state changes they define. The Substrate project in this repository uses FRAME to construct a blockchain runtime. FRAME allows runtime developers to declare domain-specific logic in modules called "pallets". At the heart of FRAME is a helpful macro language that makes it easy to create pallets and flexibly compose them to create blockchains that can address a variety of needs.

Review the FRAME runtime implementation included in this repository and note the following:

  • This file configures several pallets to include in the runtime. Each pallet configuration is defined by a code block that begins with impl $PALLET_NAME::Config for Runtime.
  • The pallets are composed into a single runtime by way of the construct_runtime! macro, which is part of the core FRAME Support system library.

Pallets

The runtime in this project is constructed using many FRAME pallets that ship with the core Substrate repository and a template pallet that is defined in the pallets directory.

A FRAME pallet is compromised of a number of blockchain primitives:

  • Storage: FRAME defines a rich set of powerful storage abstractions that makes it easy to use Substrate's efficient key-value database to manage the evolving state of a blockchain.
  • Dispatchables: FRAME pallets define special types of functions that can be invoked (dispatched) from outside of the runtime in order to update its state.
  • Events: Substrate uses events and errors to notify users of important changes in the runtime.
  • Errors: When a dispatchable fails, it returns an error.
  • Config: The Config configuration interface is used to define the types and parameters upon which a FRAME pallet depends.

Alternatives Installations

Instead of installing dependencies and building this source directly, consider the following alternatives.

Nix

Install nix, and optionally direnv and lorri for a fully plug-and-play experience for setting up the development environment. To get all the correct dependencies, activate direnv direnv allow and lorri lorri shell.

Extension points exported contracts — how you extend this code

WeightInfo (Interface)
Weight functions needed for `pallet_sudo`. [4 implementers]
runtime/src/weights/pallet_sudo.rs
Config (Interface)
(no doc) [7 implementers]
pallets/payment/src/lib.rs
Config (Interface)
(no doc) [27 implementers]
pallets/xcm/src/lib.rs
Config (Interface)
(no doc) [7 implementers]
pallets/task-management/src/lib.rs
OnDepositFail (Interface)
Deposit errors handler for `TransactAsset` implementations. Default impl for `()` returns an `XcmError::FailedToTransact [2 …
pallets/xcm-support/src/currency_adapter.rs
WeightInfo (Interface)
Weight functions needed for `pallet_edge_connect`. [2 implementers]
pallets/edge-connect/src/weights.rs
WeightInfo (Interface)
Weight functions needed for `pallet_zk_verifier`. [2 implementers]
pallets/zk-verifier/src/weights.rs
Config (Interface)
(no doc) [4 implementers]
pallets/status-aggregator/src/lib.rs

Core symbols most depended-on inside this repo

clone
called by 235
pallets/payment/src/lib.rs
from_dec_string
called by 98
pallets/zk-verifier/src/verify.rs
new_test_ext
called by 22
pallets/task-management/src/mock.rs
new_test_ext
called by 19
pallets/payment/src/mock.rs
on_new_data
called by 17
pallets/status-aggregator/src/benchmarking.rs
new_test_ext
called by 15
pallets/zk-verifier/src/mock.rs
new_test_ext
called by 11
pallets/edge-connect/src/mock.rs
zk_events
called by 7
pallets/zk-verifier/src/mock.rs

Shape

Method 328
Function 155
Class 81
Enum 37
Interface 28

Languages

Rust100%

Modules by API surface

runtime/src/weights/pallet_assets.rs34 symbols
node/src/command.rs34 symbols
pallets/edge-connect/src/lib.rs32 symbols
pallets/payment/src/lib.rs27 symbols
pallets/task-management/src/tests.rs25 symbols
runtime/src/weights/pallet_payment.rs22 symbols
pallets/payment/src/weights.rs22 symbols
pallets/zk-verifier/src/tests.rs20 symbols
pallets/payment/src/tests.rs19 symbols
primitives/src/miner.rs18 symbols
pallets/zk-verifier/src/verify.rs18 symbols
pallets/task-management/src/lib.rs18 symbols

For agents

$ claude mcp add cyborg-parachain \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact