{"id":13706193,"url":"https://github.com/opentensor/subtensor","last_synced_at":"2026-01-30T00:56:41.348Z","repository":{"id":145271173,"uuid":"608683796","full_name":"opentensor/subtensor","owner":"opentensor","description":"Bittensor Blockchain Layer","archived":false,"fork":false,"pushed_at":"2025-10-03T08:52:45.000Z","size":573705,"stargazers_count":260,"open_issues_count":253,"forks_count":244,"subscribers_count":16,"default_branch":"main","last_synced_at":"2025-10-03T10:33:03.033Z","etag":null,"topics":["blockchain","rust","substrate"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/opentensor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"support/linting/Cargo.toml","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-03-02T14:27:24.000Z","updated_at":"2025-10-03T08:11:18.000Z","dependencies_parsed_at":"2025-06-02T09:56:13.068Z","dependency_job_id":"0d98886c-0811-4fb8-bfda-1bed0132c4c4","html_url":"https://github.com/opentensor/subtensor","commit_stats":null,"previous_names":[],"tags_count":53,"template":false,"template_full_name":"polkadot-developers/substrate-node-template","purl":"pkg:github/opentensor/subtensor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentensor%2Fsubtensor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentensor%2Fsubtensor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentensor%2Fsubtensor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentensor%2Fsubtensor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/opentensor","download_url":"https://codeload.github.com/opentensor/subtensor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentensor%2Fsubtensor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278728981,"owners_count":26035559,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockchain","rust","substrate"],"created_at":"2024-08-02T22:00:53.041Z","updated_at":"2026-01-07T00:28:53.939Z","avatar_url":"https://github.com/opentensor.png","language":"Rust","funding_links":[],"categories":["Useful Tools and Platforms"],"sub_categories":[],"readme":"```commandline             _      _\n███████╗██╗   ██╗██████╗ ████████╗███████╗███╗   ██╗███████╗ ██████╗ ██████╗\n██╔════╝██║   ██║██╔══██╗╚══██╔══╝██╔════╝████╗  ██║██╔════╝██╔═══██╗██╔══██╗\n███████╗██║   ██║██████╔╝   ██║   █████╗  ██╔██╗ ██║███████╗██║   ██║██████╔╝\n╚════██║██║   ██║██╔══██╗   ██║   ██╔══╝  ██║╚██╗██║╚════██║██║   ██║██╔══██╗\n███████║╚██████╔╝██████╔╝   ██║   ███████╗██║ ╚████║███████║╚██████╔╝██║  ██║\n╚══════╝ ╚═════╝ ╚═════╝    ╚═╝   ╚══════╝╚═╝  ╚═══╝╚══════╝ ╚═════╝ ╚═╝  ╚═╝\n\n```\n\n# **Subtensor** \u003c!-- omit in toc --\u003e\n[![CodeQL](https://github.com/opentensor/subtensor/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/opentensor/subtensor/actions)\n[![Discord Chat](https://img.shields.io/discord/308323056592486420.svg)](https://discord.gg/bittensor)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nThis repository contains Bittensor's substrate-chain. Subtensor contains the trusted logic which:\n\n1. Runs Bittensor's [consensus mechanism](./docs/consensus.md);\n2. Advertises neuron information, IPs, etc., and\n3. Facilitates value transfer via TAO.\n4. Supports wasm smart contract functionality via `pallet-contracts` (see [contracts documentation](./docs/contracts.md)).\n\n## System Requirements\n\n* The binaries in ./bin/release are x86_64 binaries to be used with the Linux kernel.\n* Subtensor needs ~286 MiB to run.\n*\tSupported Architectures:\n\t-\tLinux: x86_64\n\t-\tMacOS: x86_64 and ARM64 (M series Macs)\n* OSs other than Linux and MacOS are currently not supported.\n\n\n## Architectures\nSubtensor support the following architectures:\n\n## Linux x86_64\nRequirements:\n* Linux kernel 2.6.32+,\n* glibc 2.11+\nA fresh FRAME-based [Substrate](https://www.substrate.io/) node, ready for hacking :rocket:\n\n## MacOS x86_64 \u0026 arm64 (Apple Silicon)\nRequirements:\n*\tmacOS 10.7+ (Lion+) for x86_64\n*\tmacOS 11+ (Big Sur+) for Apple Silicon (M1, M2, and later) with arm64 architecture support.\n\n## Network requirements\n* Subtensor needs access to the public internet\n* Subtensor runs on ipv4\n* Subtensor listens on the following ports:\n  1) 9944 - Websocket. This port is used by bittensor. It only accepts connections from localhost. Make sure this port is firewalled off from the public domain.\n  2) 9933 - RPC. This port is opened, but not used.\n  3) 30333 - p2p socket. This port accepts connections from other subtensor nodes. Make sure your firewall(s) allow incoming traffic to this port.\n* It is assumed your default outgoing traffic policy is ACCEPT. If not, make sure outbound traffic to port 30333 is allowed.\n\n---\n\n## For Subnet Development\n\nIf you are developing and testing subnet incentive mechanism, you will need to run a local subtensor node. Follow the detailed step-by-step instructions provided in the [**Subtensor Nodes** section in Bittensor Developer Documentation](https://docs.bittensor.com/subtensor-nodes).\n\n### Lite node vs Archive node\n\nFor an explanation of lite node, archive node and how you can run your local subtensor node in these modes, see [Lite node vs archive node](https://docs.bittensor.com/subtensor-nodes#lite-node-vs-archive-node) section on [Bittensor Developer Docs](https://docs.bittensor.com/).\n\n---\n\n## For Subtensor Development\n\n### Installation\nFirst, complete the [basic Rust setup instructions](./docs/rust-setup.md).\n\n**Build and Run**\n\nUse Rust's native `cargo` command to build and launch the template node:\n\n```sh\ncargo run --release -- --dev\n```\n\n**Build only**\n\nThe above `cargo run` command will perform an initial build and launch the node. Use the following command to build the node\nwithout launching it:\n\n```sh\ncargo build --release\n```\n\n\u003c!--\n\n/** When I ran \"cargo doc\" it gave me a bunch of errors. And when I did \"cargo doc --open\" it gave same bunch of errors, and did not open. Also, I don't think the binary is \"subtensor\". It is \"node-subtensor\". We should uncomment this section after testing and validating and fixing this section.\n*/\n\n### Embedded Docs\n\nOnce the project has been built, the following command can be used to explore all parameters and\nsubcommands:\n\n```sh\n./target/release/subtensor -h\n```\n--\u003e\n\n## Other ways to launch the node\n\nThe above `cargo run` command will launch a temporary node and its state will be discarded after\nyou terminate the process. After the project has been built, there are other ways to launch the\nnode.\n\n### Single-Node Development Chain\n\nThis command will start the single-node development chain with non-persistent state:\n\n```bash\n./target/release/subtensor --dev\n```\n\nPurge the development chain's state:\n\n```bash\n./target/release/subtensor purge-chain --dev\n```\n\nStart the development chain with detailed logging:\n\n```bash\nRUST_BACKTRACE=1 ./target/release/subtensor-ldebug --dev\n```\n\nRunning debug with logs.\n```bash\nSKIP_WASM_BUILD=1 RUST_LOG=runtime=debug -- --nocapture\n```\n\nRunning individual tests\n```bash\nSKIP_WASM_BUILD=1 \\\n  RUST_LOG=runtime=debug \\\n  cargo test \u003cyour test name\u003e \\\n  -- --nocapture --color always\n```\n\n\u003cdetails\u003e\n  \u003csummary\u003etesting `tests/` tips\u003c/summary\u003e\n\n  **`\u003cpackage-name\u003e`**\n  Available members are found within the project root [`./cargo.toml`](./cargo.toml) file, each\n  point to a sub-directory containing a `cargo.toml` file with a `name` defined.  for example,\n  [`node/cargo.toml`](./node/cargo.toml) has a name of `node-subtensor`\n\n\n  **`\u003ctest-name\u003e`**\n  Available tests are often found within either a `tests/` sub-directory or within the relevant\n  `src/` file.  for example [`./node/tests/chain_spec.rs`](./node/tests/chain_spec.rs) has a test\n  named `chain_spec`\n\n  **example**\n  All together we can run all tests in `chain_spec` file from `node-subtensor` project via\n\n  ```bash\n  skip_wasm_build=1 \\\n    rust_log=runtime=debug \\\n    cargo test \\\n    --package node-subtensor \\\n    --test chain_spec \\\n    -- --color always --nocapture\n  ```\n\u003c/details\u003e\n\n\nRunning code coverage\n```bash\nbash scripts/code-coverage.sh\n```\n\n\u003e Note: They above requires `cargo-tarpaulin` is installed to the host, eg. `cargo install cargo-tarpaulin`\n\u003e Development chain means that the state of our chain will be in a tmp folder while the nodes are\n\u003e running. Also, **alice** account will be authority and sudo account as declared in the\n\u003e [genesis state](https://github.com/substrate-developer-hub/substrate-node-template/blob/main/node/src/chain_spec.rs#L49).\n\u003e At the same time the following accounts will be pre-funded:\n\u003e - Alice\n\u003e - Bob\n\u003e - Alice//stash\n\u003e - Bob//stash\n\nIf we want to maintain the chain state between runs, a base path must be added\nso the db can be stored in the provided folder instead of a temporal one. We could use this folder\nto store different chain databases, as a different folder will be created per different chain that\nis ran. The following commands show how to use a newly created folder as our db base path:\n\n```bash\n# Create a folder to use as the db base path\nmkdir my-chain-state\n\n# Use of that folder to store the chain state\n./target/release/node-template --dev --base-path ./my-chain-state/\n\n# Check the folder structure created inside the base path after running the chain\nls ./my-chain-state\n#\u003e chains\nls ./my-chain-state/chains/\n#\u003e dev\nls ./my-chain-state/chains/dev\n#\u003e db keystore network\n```\n\n**Connect with Polkadot-JS Apps Front-end**\n\nOnce the node template is running locally, you can connect it with **Polkadot-JS Apps** front-end\nto interact with your chain. [Click\nhere](https://polkadot.js.org/apps/#/explorer?rpc=ws://localhost:9944) connecting the Apps to your\nlocal node template.\n\n### Multi-Node Local Testnet\n\nIf you want to see the multi-node consensus algorithm in action, refer to our\n[Simulate a network tutorial](https://docs.substrate.io/tutorials/build-a-blockchain/simulate-network/).\n\n## Template Structure\n\nA Substrate project such as this consists of a number of components that are spread across a few\ndirectories.\n\n### Node Capabilities\n\nA blockchain node is an application that allows users to participate in a blockchain network.\nSubstrate-based blockchain nodes expose a number of capabilities:\n\n- Networking: Substrate nodes use the [`libp2p`](https://libp2p.io/) networking stack to allow the\n  nodes in the network to communicate with one another.\n- Consensus: Blockchains must have a way to come to\n  [consensus](https://docs.substrate.io/main-docs/fundamentals/consensus/) on the state of the\n  network. Substrate makes it possible to supply custom consensus engines and also ships with\n  several consensus mechanisms that have been built on top of\n  [Web3 Foundation research](https://research.web3.foundation/Polkadot/protocols/NPoS/Overview).\n- RPC Server: A remote procedure call (RPC) server is used to interact with Substrate nodes.\n\n**Directory structure**\n\nThere are several files in the [`node`](./node/) directory. Make a note of the following important files:\n\n- [`chain_spec.rs`](./node/src/chain_spec.rs): A\n  [chain specification](https://docs.substrate.io/main-docs/build/chain-spec/) is a\n  source code file that defines a Substrate chain's initial (genesis) state. Chain specifications\n  are useful for development and testing, and critical when architecting the launch of a\n  production chain. Take note of the `development_config` and `testnet_genesis` functions, which\n  are used to define the genesis state for the local development chain configuration. These\n  functions identify some\n  [well-known accounts](https://docs.substrate.io/reference/command-line-tools/subkey/)\n  and use them to configure the blockchain's initial state.\n- [`service.rs`](./node/src/service.rs): This file defines the node implementation. Take note of\n  the libraries that this file imports and the names of the functions it invokes. In particular,\n  there are references to consensus-related topics, such as the\n  [block finalization and forks](https://docs.substrate.io/main-docs/fundamentals/consensus/#finalization-and-forks)\n  and other [consensus mechanisms](https://docs.substrate.io/main-docs/fundamentals/consensus/#default-consensus-models)\n  such as Aura for block authoring and GRANDPA for finality.\n\n### CLI help\n\nAfter the node has been [built](#build), refer to the embedded documentation to learn more about the\ncapabilities and configuration parameters that it exposes:\n\n```shell\n./target/release/node-subtensor --help\n```\n\n### Runtime\n\nIn Substrate, the terms\n\"runtime\" and \"state transition function\"\nare analogous - they refer to the core logic of the blockchain that is responsible for validating\nblocks and executing the state changes they define. The Substrate project in this repository uses\n[FRAME](https://docs.substrate.io/main-docs/fundamentals/runtime-intro/#frame) to construct a\nblockchain runtime. FRAME allows runtime developers to declare domain-specific logic in modules\ncalled \"pallets\". At the heart of FRAME is a helpful\n[macro language](https://docs.polkadot.com/develop/parachains/customize-parachain/overview/#pallet-structure) that makes it easy to\ncreate pallets and flexibly compose them to create blockchains that can address\n[a variety of needs](https://substrate.io/ecosystem/projects/).\n\nReview the [FRAME runtime implementation](./runtime/src/lib.rs) included in this template and note\nthe following:\n\n- This file configures several pallets to include in the runtime. Each pallet configuration is\n  defined by a code block that begins with `impl $PALLET_NAME::Config for Runtime`.\n- The pallets are composed into a single runtime by way of the\n  [`construct_runtime!`](https://crates.parity.io/frame_support/macro.construct_runtime.html)\n  macro, which is part of the core\n  FRAME Support [system](https://docs.substrate.io/reference/frame-pallets/#system-pallets) library.\n\n### Pallets\n\nThe runtime in this project is constructed using many FRAME pallets that ship with the\n[core Substrate repository](https://github.com/paritytech/substrate/tree/master/frame) and a\ntemplate pallet that is [defined in the `pallets`](./pallets/template/src/lib.rs) directory.\n\nA FRAME pallet is compromised of a number of blockchain primitives:\n\n- Storage: FRAME defines a rich set of powerful\n  [storage abstractions](https://docs.substrate.io/main-docs/build/runtime-storage/) that makes\n  it easy to use Substrate's efficient key-value database to manage the evolving state of a\n  blockchain.\n- Dispatchables: FRAME pallets define special types of functions that can be invoked (dispatched)\n  from outside of the runtime in order to update its state.\n- Events: Substrate uses [events and errors](https://docs.substrate.io/main-docs/build/events-errors/)\n  to notify users of important changes in the runtime.\n- Errors: When a dispatchable fails, it returns an error.\n- Config: The `Config` configuration interface is used to define the types and parameters upon\n  which a FRAME pallet depends.\n\n\u003c!--\n### Run in Docker\n\nFirst, install [Docker](https://docs.docker.com/get-docker/) and\n[Docker Compose](https://docs.docker.com/compose/install/).\n\nThen run the following command to start a single node development chain.\n\n```bash\n./scripts/docker_run.sh\n```\n\nThis command will firstly compile your code, and then start a local development network. You can\nalso replace the default command\n(`cargo build --release \u0026\u0026 ./target/release/node-template --dev --ws-external`)\nby appending your own. A few useful ones are as follow.\n\n```bash\n# Run Substrate node without re-compiling\n./scripts/docker_run.sh ./target/release/node-template --dev --ws-external\n\n# Purge the local dev chain\n./scripts/docker_run.sh ./target/release/node-template purge-chain --dev\n\n# Check whether the code is compilable\n./scripts/docker_run.sh cargo check\n```\n--\u003e\n\n## License\nThe MIT License (MIT)\nCopyright © 2021 Yuma Rao\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n## Acknowledgments\n**parralax**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopentensor%2Fsubtensor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopentensor%2Fsubtensor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopentensor%2Fsubtensor/lists"}