diff --git a/docs/mdx-playground.mdx b/docs/home.mdx similarity index 86% rename from docs/mdx-playground.mdx rename to docs/home.mdx index 0a68f2b..a65bbfd 100644 --- a/docs/mdx-playground.mdx +++ b/docs/home.mdx @@ -1,3 +1,6 @@ +--- +sidebar_position: 1 +--- import {Hero} from '@site/src/components/mdx/Hero'; import {FeatureList} from '@site/src/components/mdx/FeatureList'; import {FeatureCard} from '@site/src/components/mdx/FeatureCard'; @@ -35,20 +38,20 @@ import {TeamList} from '@site/src/components/mdx/TeamList'; ## Resources Read our white-paper to know more about Codex. Play with the first version of Codex. Checkout our research models and track our progress. diff --git a/docs/index.mdx b/docs/index.mdx deleted file mode 100644 index e69de29..0000000 diff --git a/docs/intro.md b/docs/intro.md new file mode 100644 index 0000000..b9b3ab4 --- /dev/null +++ b/docs/intro.md @@ -0,0 +1,147 @@ +--- +sidebar_position: 1 +--- +# How to use Codex + +> The Codex project aims to create a decentralized durability engine that allows persisting data in p2p networks. In other words, it allows storing files and data with predictable durability guarantees for later retrieval. + +> WARNING: This project is under active development and is considered pre-alpha. + +[![License: Apache](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) +[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) +[![Stability: experimental](https://img.shields.io/badge/stability-experimental-orange.svg)](#stability) +[![CI](https://github.com/status-im/nim-codex/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/status-im/nim-codex/actions?query=workflow%3ACI+branch%3Amain) +[![Codecov](https://codecov.io/gh/status-im/nim-codex/branch/main/graph/badge.svg?token=XFmCyPSNzW)](https://codecov.io/gh/status-im/nim-codex) +[![Discord](https://img.shields.io/discord/895609329053474826)](https://discord.gg/CaJTh24ddQ) + + +## Build and Run + +For detailed instructions on preparing to build nim-codex see [*Building Codex*](BUILDING.md). + +To build the project, clone it and run: + +```bash +make update && make exec +``` + +The executable will be placed under the `build` directory under the project root. + +Run the client with: + +```bash +build/codex +``` + +### CLI Options + +``` +build/codex --help +Usage: + +codex [OPTIONS]... command + +The following options are available: + + --log-level Sets the log level [=LogLevel.INFO]. + --metrics Enable the metrics server [=false]. + --metrics-address Listening address of the metrics server [=127.0.0.1]. + --metrics-port Listening HTTP port of the metrics server [=8008]. + -d, --data-dir The directory where codex will store configuration and data.. + -l, --listen-port Specifies one or more listening ports for the node to listen on. [=0]. + -i, --listen-ip The public IP [=0.0.0.0]. + --udp-port Specify the discovery (UDP) port [=8090]. + --net-privkey Source of network (secp256k1) private key file (random|) [=random]. + -b, --bootstrap-node Specifies one or more bootstrap nodes to use when connecting to the network.. + --max-peers The maximum number of peers to connect to [=160]. + --agent-string Node agent string which is used as identifier in network [=Codex]. + -p, --api-port The REST Api port [=8080]. + -c, --cache-size The size in MiB of the block cache, 0 disables the cache [=100]. + --persistence Enables persistence mechanism, requires an Ethereum node [=false]. + --eth-provider The URL of the JSON-RPC API of the Ethereum node [=ws://localhost:8545]. + --eth-account The Ethereum account that is used for storage contracts [=EthAddress.none]. + --eth-deployment The json file describing the contract deployment [=string.none]. + +Available sub-commands: + +codex initNode +``` + +### Example: running two Codex clients + +```bash +build/codex --data-dir="$(pwd)/Codex1" -i=127.0.0.1 +``` + +This will start codex with a data directory pointing to `Codex1` under the current execution directory and announce itself on the DHT under `127.0.0.1`. + +To run a second client that automatically discovers nodes on the network, we need to get the Signed Peer Record (SPR) of first client, Client1. We can do this by querying the `/info` endpoint of the node's REST API. + +`curl http://127.0.0.1:8080/api/codex/v1/info` + +This should output information about Client1, including its PeerID, TCP/UDP addresses, data directory, and SPR: + +```json +{ + "id": "16Uiu2HAm92LGXYTuhtLaZzkFnsCx6FFJsNmswK6o9oPXFbSKHQEa", + "addrs": [ + "/ip4/0.0.0.0/udp/8090", + "/ip4/0.0.0.0/tcp/49336" + ], + "repo": "/repos/status-im/nim-codex/Codex1", + "spr": "spr:CiUIAhIhAmqg5fVU2yxPStLdUOWgwrkWZMHW2MHf6i6l8IjA4tssEgIDARpICicAJQgCEiECaqDl9VTbLE9K0t1Q5aDCuRZkwdbYwd_qLqXwiMDi2ywQ5v2VlAYaCwoJBH8AAAGRAh-aGgoKCAR_AAABBts3KkcwRQIhAPOKl38CviplVbMVnA_9q3N1K_nk5oGuNp7DWeOqiJzzAiATQ2acPyQvPxLU9YS-TiVo4RUXndRcwMFMX2Yjhw8k3A" +} +``` + +Now, let's start a second client, Client2. Because we're already using the default ports TCP (:8080) and UDP (:8090) for the first client, we have to specify new ports to avoid a collision. Additionally, we can specify the SPR from Client1 as the bootstrap node for discovery purposes, allowing Client2 to determine where content is located in the network. + +```bash +build/codex --data-dir="$(pwd)/Codex2" -i=127.0.0.1 --api-port=8081 --udp-port=8091 --bootstrap-node=spr:CiUIAhIhAmqg5fVU2yxPStLdUOWgwrkWZMHW2MHf6i6l8IjA4tssEgIDARpICicAJQgCEiECaqDl9VTbLE9K0t1Q5aDCuRZkwdbYwd_qLqXwiMDi2ywQ5v2VlAYaCwoJBH8AAAGRAh-aGgoKCAR_AAABBts3KkcwRQIhAPOKl38CviplVbMVnA_9q3N1K_nk5oGuNp7DWeOqiJzzAiATQ2acPyQvPxLU9YS-TiVo4RUXndRcwMFMX2Yjhw8k3A +``` + +There are now two clients running. We could upload a file to Client1 and download that file (given its CID) using Client2, by using the clients' REST API. + +## Interacting with the client + +The client exposes a REST API that can be used to interact with the clients. These commands could be invoked with any HTTP client, however the following endpoints assume the use of the `curl` command. + +### `/api/codex/v1/connect/{peerId}` + +Connect to a peer identified by its peer id. Takes an optional `addrs` parameter with a list of valid [multiaddresses](https://multiformats.io/multiaddr/). If `addrs` is absent, the peer will be discovered over the DHT. + +Example: + +```bash +curl "127.0.0.1:8080/api/codex/v1/connect/?addrs=" +``` + +### `/api/codex/v1/download/{id}` + +Download data identified by a `Cid`. + +Example: + +```bash + curl -vvv "127.0.0.1:8080/api/codex/v1/download/" --output + ``` + +### `/api/codex/v1/upload` + +Upload a file, upon success returns the `Cid` of the uploaded file. + +Example: + +```bash +curl -vvv -H "content-type: application/octet-stream" -H Expect: -T "" "127.0.0.1:8080/api/codex/v1/upload" -X POST +``` + +### `/api/codex/v1/info` + +Get useful node info such as its peer id, address and SPR. + +Example: + +```bash +curl -vvv "127.0.0.1:8080/api/codex/v1/info" +``` + diff --git a/docs/intro.mdx b/docs/intro.mdx deleted file mode 100644 index bdc328b..0000000 --- a/docs/intro.mdx +++ /dev/null @@ -1,49 +0,0 @@ ---- -sidebar_position: 1 ---- - -# Tutorial Intro -Let's discover **Docusaurus in less than 5 minutes**. - -## Getting Started - -Get started by **creating a new site**. - -Or **try Docusaurus immediately** with **[docusaurus.new](https://docusaurus.new)**. - -### What you'll need - -- [Node.js](https://nodejs.org/en/download/) version 16.14 or above: -- When installing Node.js, you are recommended to check all checkboxes related to dependencies. - -## Generate a new site - -Generate a new Docusaurus site using the **classic template**. - -The classic template will automatically be added to your project after you run the command: - -```bash -npm init docusaurus@latest my-website classic -``` - -You can type this command into Command Prompt, Powershell, Terminal, or any other integrated terminal of your code editor. - -The command also installs all necessary dependencies you need to run Docusaurus. - -## Start your site - -Run the development server: - -```bash -cd my-website -npm run start -``` - -The `cd` command changes the directory you're working with. In order to work with your newly created Docusaurus site, you'll need to navigate the terminal there. - -The `npm run start` command builds your website locally and serves it through a development server, ready for you to view at http://localhost:3000/. - -Open `docs/intro.md` (this page) and edit some lines: the site **reloads automatically** and displays your changes. - - - diff --git a/docs/student-program.md b/docs/student-program.md new file mode 100644 index 0000000..e042d47 --- /dev/null +++ b/docs/student-program.md @@ -0,0 +1,37 @@ + +# Codex Students Program + +## About Status + +Status is an organization building the tools and infrastructure for the advancement of a secure, private, and open web3. We have been completely distributed since inception. Our team is currently 100+ core contributors strong and welcomes a growing number of community members from all walks of life, scattered all around the globe. We care deeply about open source, and our organizational structure has a minimal hierarchy and no fixed work hours. We believe in working with a high degree of autonomy while supporting the organization's priorities. + +## About Codex + +The Codex team is working on a next-generation storage engine that attempts to “untie the knot” of incentivized storage. We’re building Codex to be a reliable and predictable p2p storage infrastructure that will allow for many business and casual use cases. We rely on strong data possession (PoR and PDP) and incentive schemes to guarantee long-term persistence and data availability. Check some of our current research here: https://github.com/status-im/codex-research + +## Students Program + +This program is available to undergraduate and graduate students officially enrolled in a university, pursuing their B.Sc. or M.Sc. in the field of Computer Sciences or a related domain. The duration of the program could be between 3 and 6 months. + +## Bonus if you have + +* Distributed system +* Storage and I/O +* P2P networking +* Analytical modeling +* Scalable simulations +* Data analytics +* Parallel programming +* Stress testing +* Continuous integration +* Technical writing + +The Codex Student Program aims to do research and development in, but not limited to: + +* P2P and distributed computing scheme: leader election, consensus algorithms +* Proofs of (non-)inclusion, retrievability proofs, availability proofs, fraud proofs +* Game theory, incentivization, tokenomics +* Decentralized storage systems, erasure coding, and storage related proofs +* Storage performance measurement and testing + +> The above is not a requirement we’d still love to hear from you anyway if you think you’d be a great fit for this role! diff --git a/docs/tutorial-extras/_category_.json b/docs/tutorial-extras/_category_.json deleted file mode 100644 index e69de29..0000000 diff --git a/docs/tutorial-extras/img/docsVersionDropdown.png b/docs/tutorial-extras/img/docsVersionDropdown.png deleted file mode 100644 index e69de29..0000000 diff --git a/docs/tutorial-extras/img/localeDropdown.png b/docs/tutorial-extras/img/localeDropdown.png deleted file mode 100644 index e69de29..0000000 diff --git a/docs/tutorial-extras/manage-docs-versions.md b/docs/tutorial-extras/manage-docs-versions.md deleted file mode 100644 index e69de29..0000000 diff --git a/docs/tutorial-extras/translate-your-site.md b/docs/tutorial-extras/translate-your-site.md deleted file mode 100644 index e69de29..0000000 diff --git a/docusaurus.config.js b/docusaurus.config.js index 1d94c75..3c997ee 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -58,6 +58,9 @@ const config = { /** @type {import('@docusaurus/preset-classic').ThemeConfig} */ ({ docs: { sidebar: { hideable: true } }, + colorMode: { + disableSwitch: true, + }, navbar: { title: '', logo: { @@ -69,8 +72,15 @@ const config = { type: 'doc', docId: 'intro', position: 'left', - label: 'Docs', + href: 'https://blog.codex.storage/', + label: 'Blog', }, + // { + // href: 'https://github.com/facebook/docusaurus', + // position: 'right', + // className: 'header-github-link', + // 'aria-label': 'GitHub repository', + // }, { type: 'localeDropdown', position: 'right', diff --git a/src/css/custom.scss b/src/css/custom.scss index 24cefd7..ba8fe9a 100644 --- a/src/css/custom.scss +++ b/src/css/custom.scss @@ -245,3 +245,6 @@ small { .footer__logo { margin: 0 !important; } +.menu_src-theme-Navbar-Content-styles-module svg { + display: none; +} diff --git a/src/theme/DocItem/Layout/index.tsx b/src/theme/DocItem/Layout/index.tsx index 2e943e1..403dd18 100644 --- a/src/theme/DocItem/Layout/index.tsx +++ b/src/theme/DocItem/Layout/index.tsx @@ -58,9 +58,7 @@ export default function DocItemLayout({ children }: Props): JSX.Element { - {windowSize !== 'mobile' && ( - - )} + {windowSize !== 'mobile' &&