Coder Social home page Coder Social logo

developer-docs's Introduction

Bittensor Developer Docs


Welcome to Bittensor Developer Docs. These docs are built using Docusaurus. See the below instructions to build these docs locally.

Installation

$ yarn

Local Development

$ yarn start

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

Build

$ yarn build

This command generates static content into the build directory and can be served using any static contents hosting service.

Deployment

Using SSH:

$ USE_SSH=true yarn deploy

Not using SSH:

$ GIT_USER=<Your GitHub username> yarn deploy

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the gh-pages branch.

developer-docs's People

Contributors

0xlindy avatar bcurrent avatar devamin avatar dickmagness avatar gagichce avatar geohotstan avatar hey-michal avatar jackalgirl avatar juniuszhou avatar jurgegod avatar lagunast1 avatar onattech avatar rajkaramchedu avatar steffencruz avatar taoshiken avatar webroot-kaito avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

developer-docs's Issues

Add a QnA section

Community members are asking quite a few questions. Collect key questions, create a QnA section with answers to these questions, with links to documentation sections.

Error on Bittensor Installlation- Using /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/opentensor/bittensor/master/scripts/install.sh)"

Error on Bittensor Installlation

error: subprocess-exited-with-error

× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [6 lines of output]

  Cargo, the Rust package manager, is not installed or is not on PATH.
  This package requires Rust and Cargo to compile extensions. Install it through
  the system's package manager or via https://rustup.rs/

  Checking for Rust toolchain....
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
"" command failed with exit code 1.

Write subtensor installation docs

Community is facing difficulties installing subtensor local nodes or public nodes successfully. Create a separate "Subtensor" section in the docs and cover the following:

Document tested and validated steps of running local blockchain with:

  1. Docker images. Call out which Linux versions and which macOS versions are supported.
  2. Compile and run from source code in subtensor repo. Call out which Linux versions and which macOS versions are supported.
  3. Document the meaning of all the parameters. For example, all the command line parameters in a command like below: ./target/release/node-subtensor --chain raw_spec.json --base-path /tmp/blockchain --sync=warp --execution wasm --wasm-execution compiled --port 30333 --max-runtime-instances 64 --rpc-max-response-size 2048 --rpc-cors all --rpc-port 9933 --ws-port 9944 --bootnodes /ip4/13.58.175.193/tcp/30333/p2p/12D3KooWDe7g2JbNETiKypcKT1KsCEZJbTzEHCn8hpd4PHZ6pdz5 --ws-max-connections 16000 --no-mdns --in-peers 8000 --out-peers 8000 --prometheus-external --rpc-external --ws-external
  4. Clearly specify settings for archive node and lite node. (--sync=warp and pruning set to archive etc.)
    (Update from #192: Done)
  5. Call out how to configure lite node # of blocks. Currently there is an assumption that it is 300 blocks, but where is this setting? Can the user change it? Substantiate the "300 blocks" assumption.
    (Update from #192: This 300 should not be understood as specified anywhere. It is just a soft guideline. In fact both a lite node and an archive node eventually download the entire blockchain from genesis onwards. It is just that a lite node will get up and going immediately. The PR has the description for this.)
  6. Can we provide a way to test and confirm that the archive or lite node is indeed running correctly and syncing blocks accurately? One way would be to look at the block number in the terminal log and compare it to block number on scan.bittensor.com, and if they match or close together, the node is syncing properly. Accurate? Does this apply for both archive and lite nodes?
  7. Provide any helpful links to the substrate docs (which are poorly organized, btw, because I haven't found a way to link to a subsection within those docs. Annoying.)
  8. Also update the README in the subtensor repo.
  9. (Adding from below comment by @sam0x17: Document the process for bootstrapping an archive node from a snapshot and/or where snapshots can be found reliably, especially now that it is no longer possible to just start from genesis (a fact that we should also document somewhere).
  10. Document the fact that it is no longer possible to just start from genesis (taken from immediate above).
  11. Document this → @hey-michal had posted this request in another private thread: "when I run my own local subtensor, can I somehow fill it with a custom chain state? Like wallets, balances, subnets and registered validators and miners? I mean, automatically fill it with this data on each start, and maybe even keep this state in the repo somehow I'd be surprised if this is not possible, I just can't find any information about that"
  12. Also, would we be able to give a solution to this community question? "Does anyone know how to sync local subtensor to current block? My local subtensor seems to be 5000 blocks behind finney." Discord thread: https://discord.com/channels/799672011265015819/799672011814862902/1226233124208513105
  13. Another Discord user who says they are still stuck: https://discord.com/channels/799672011265015819/1222421128417640508/1226835644744073319
  14. Request by the same above user who is stuck: "Just as a suggestion, probably would make life easier for everyone to tag version on the repo?"
  • Anything else?

Diagrams in Opentensor style

  1. Review the diagram style provided by Kurppa Hosk. Make any enhancements if needed. Refer to this as "OT-style" for diagrams.
  2. Check with @unconst and get his okay for the OT style.
  3. Redraw existing diagrams on docs site using the OT-style.

This task is mainly done by Richard Magness. I might do (3) if Richards approves my work quality.

Typo

Section introduction --> How a subnet works -> list point 2 under "The item numbers below.... above diagram:
Entities in the subnet, called subnet miners, each perform useful task, ie.....
Should be:
each perform useful tasks OR each perform a useful task (option 1 preferred)

Enhancement

Please follow the below guidelines while creating the issue.

  1. An enhancement
  2. Correct the text on the {{ https://docs.bittensor.com/subnets/register-validate-mine }} page

Instead of " After

your

register your keys, you can then proceed to become either a subnet miner or a subnet validator, which have
different requirements. See below."

Correct it to " After

Screenshot 2024-03-04 003029

register your keys, you can then proceed to become either a subnet miner or a subnet validator, which have
different requirements. See below."

Correct "the first "your" to "you"

  1. page {{ https://docs.bittensor.com/subnets/register-validate-mine }} , after the Register part.
    Screenshot 2024-03-04 003029

Add a script that allows people to query when the next adjustment interval will be

By: @rajkaramchedu and @Jackalgirl

Purpose: instructions to download and create a script that allows users to query a subnet and discover the future next adjustment interval block will be (and provide an approximate time to adjustment), using a terminal window.

Instructions:

  1. On a macOS or Linux terminal, install "node" if you don't have it (see https://nodejs.org/en/download for help)
  2. If you have not installed yarn yet, run npm install --global yarn (if you are not root, you may need sudo npm install --global yarn)
  3. Run yarn add @polkadot/api
  4. Run yarn add prompt-sync
  5. Save the following into a file (for example: "bittensor_check-interval.js")
const { ApiPromise, WsProvider } = require("@polkadot/api");
const prompt = require("prompt-sync")();

// If you do not want to be prompted for network when running the script,
// change this variable to "finney" to default to the finney endpoint,
//  or "local" if you want to default to your own subtensor endpoint.

let network = "";

// If you have your own local subtensor and want to use its entry point, specify
// your entrypoint's wss address here (e.g., "wss://127.0.0.1:443")

let localNetworkEntryPoint = "";

if (network === "") {
  network = prompt("Enter network (finney, subvortex, local): ");
}

if ((network === "local" || network === "l") && localNetworkEntryPoint != "") {
  networkEntryPoint = localNetworkEntryPoint;
} else {
  networkEntryPoint = "wss://entrypoint-finney.opentensor.ai:443";
}

let subnet = prompt("Enter subnet netuid to query:");

if (!(Number.isInteger(subnet)) || subnet < 1 || subnet > 32) {
  subnet == 1;
} else {
  subnet == subnet;
}

async function queryBittensorData() {
  const wsProvider = new WsProvider(
    networkEntryPoint  );
  const api = await ApiPromise.create({ provider: wsProvider });

  const [
    lastAdjustmentBlock,
    adjustmentInterval,
    currentBlock,
  ] = await Promise.all([
    api.query.subtensorModule.lastAdjustmentBlock(subnet),
    api.query.subtensorModule.adjustmentInterval(subnet),
    api.query.system.number(),
  ]);

  let nextAdjustmentBlock = lastAdjustmentBlock.toNumber() + adjustmentInterval.toNumber();
  let currentBlockNumber = currentBlock.toNumber();
  let blocksToGo = nextAdjustmentBlock - currentBlockNumber;

  console.log(`Information for subnet`,subnet);
  console.log(`-=-=-=-=-=-=-=-=-=-=-=-=-=-`);
  console.log(`Last Adjustment Block: ${lastAdjustmentBlock.toNumber()}`);
  console.log(`Adjustment Interval: ${adjustmentInterval.toNumber()}`);
  console.log(`Next Adjustment Block: `, nextAdjustmentBlock);
  console.log(`Current Block: `, currentBlockNumber);
  console.log(`Blocks to go:`,blocksToGo,`in approximately`,blocksToGo*12,`seconds (`,blocksToGo*12/60,`minutes).`);
}

queryBittensorData()
  .catch(console.error)
  .finally(() => process.exit());

console.warn = () => {};
  1. You can run this file via node <filename> (for example: node bittensor_check-interval.js)

Document how to know when one can register again

Discord thread link: https://discord.com/channels/799672011265015819/917906456261578792/1223047297823412274

"A frequent request we get is for people to be able to find the last adjustment block programatically (via RPC), so that's something you could add to your docs, it would be tremendously helpful!"

"People want to be able to predict when they'll be able to try to register again (probably for their registration scripts).
Right now, we've got TAO4Fun's way (which is to submit a query via polkadot.js.org/apps and then do the math yourself), but they're wanting a way to do that programatically, not manually through the website.
I think it would suffice if you could just find out when the last adjustment occured (block-wise). Everything else would just be comparing current block to that, and doing math in your code (I hope this makes sense)."

Investigate and plan out writing JSON-RPC API docs

Goal: Document and publish OpenAPI-style JSON-RPC API docs for Bittensor API.

Reference material

See this Discord thread: https://discord.com/channels/799672011265015819/1176889641547333683/1222328931718271076

We have:
extrinsics
runtime APIs for info

I think both are good, but runtime APIs might be better to start with as they don't (currently) get detected (and have types filled) by Polkadotjs oracle, unlike the extrinsics.
But both would be good to do
Also, both interfaces are changing based on the recent stao changes

Question: Which ones are runtime APIs in specific? Can you point me to a package in bittensor repo? (if they are there)

https://github.com/opentensor/bittensor/blob/master/bittensor/__init__.py#L129 is a link to the type registry for the runtime APIs
The output types are all Vec (bytes), but they are further decoded to objects
Any of the functions in https://github.com/opentensor/bittensor/blob/master/bittensor/subtensor.py#L2501
that calls query_runtime_api

Open issue: Docs feedback from the community

Dear Bittensor community member:

Topic: Developer docs on docs.bittensor.com . If you have thoughts on where the gaps are in the docs, I want to hear from you. In the below comments section please tell me: What topics are missing in the docs, which docs' sections need better explanation, and anything else you want to say on this topic of docs. Thanks!

Watchmaker

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.