Initial commit

This commit is contained in:
Hossein Mehrabi 2022-10-31 14:59:47 +03:30 committed by GitHub
commit 3e6a32c71d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 8604 additions and 0 deletions

26
.gitignore vendored Normal file
View File

@ -0,0 +1,26 @@
# Dependencies
/node_modules
# Production
/build
# Generated files
.docusaurus
.cache-loader
# Misc
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.yalc
yalc.lock
.idea
static/search-index.json

2
.husky/commit-msg Executable file
View File

@ -0,0 +1,2 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

5
.husky/pre-commit Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
yarn prettier:staged
yarn typecheck

2
.prettierignore Normal file
View File

@ -0,0 +1,2 @@
*.mdx
*.md

6
.prettierrc Normal file
View File

@ -0,0 +1,6 @@
{
"tabWidth": 2,
"semi": false,
"singleQuote": true,
"trailingComma": "all"
}

45
README.md Normal file
View File

@ -0,0 +1,45 @@
- [Description](#description)
- [How to Run Locally](#how-to-run-locally)
- [Configuration](#configuration)
- [Customization](#customization)
## Description
This repository contains the content of your documentation website.
## How to Run Locally
1. Clone this repository.
2. Install the dependencies:
```bash
$ yarn
```
3. Start and open the website in your browser:
```bash
$ yarn start
```
## Configuration
Edit the `docusaurus.config.js` file in the repository's root directory, and update the value of the `businessUnit` field in presets section; below is a list of valid values:
- Codex
- Waku
Example:
```js
presets: [
[
'@acid-info/logos-docusaurus-preset',
{
businessUnit: 'Codex',
},
],
],
```
This is probably enough in most cases, as the Logos plugins will fill in other configurations related to the specified business unit. If you find any error in the information coming from Logos Plugins, please head over to [Logos Docusaurus Plugins](https://github.com/acid-info/logos-docusaurus-plugins) and create an issue.
## Customization
You can find the instructions on adding more documentation sections, localization, and versioning on the [Docusaurus](https://docusaurus.io/docs) website.
> Note that theme customization is limited; for further instructions on customizing your theme, head over to [Logos Docusaurus Theme](https://github.com/acid-info/logos-docusaurus-plugins/tree/main/packages/logos-docusaurus-theme/).

3
babel.config.js Normal file
View File

@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve("@docusaurus/core/lib/babel/preset")],
};

9
docs/blog.mdx Normal file
View File

@ -0,0 +1,9 @@
---
sidebar_position: 4
title: Blog
description: Codex is building a Decentralized Durability Storage Engine
---
import {BlogPosts} from '@site/src/components/mdx';
# Blog Posts
<BlogPosts/>

147
docs/how.md Normal file
View File

@ -0,0 +1,147 @@
---
sidebar_position: 2
description: Codex is building a Decentralized Durability Storage Engine
---
# 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|<path>) [=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/<peer id>?addrs=<multiaddress>"
```
### `/api/codex/v1/download/{id}`
Download data identified by a `Cid`.
Example:
```bash
curl -vvv "127.0.0.1:8080/api/codex/v1/download/<Cid of the content>" --output <name of output file>
```
### `/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 "<path to file>" "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"
```

70
docs/index.mdx Normal file
View File

@ -0,0 +1,70 @@
---
sidebar_position: 1
title: Home
description: Codex is building a Decentralized Durability Storage Engine
---
import {Hero} from '@site/src/components/mdx';
import {FeatureList} from '@site/src/components/mdx';
import {FeatureCard} from '@site/src/components/mdx';
import {Quote} from '@site/src/components/mdx';
import {ExternalReferenceCard} from '@site/src/components/mdx';
import {TeamList} from '@site/src/components/mdx';
import {BlogPosts} from '@site/src/components/mdx';
<Hero title={"Codex"}
subtitle={"Codex is building a Decentralized Durability Storage Engine"}
linkText={"PoC Dagger"}
label={"Introduction"}
linkUrl={"https://github.com/status-im/nim-codex"}/>
## What is Codex?
<Quote>
<ul>
<li>Codex is aiming to solve the fundamental issues of data durability in decentralized systems.</li>
<li>Codex is a research group working in all areas of decentralized storage.</li>
<li>Codex is a decentralized storage protocol for durable information.</li>
</ul>
</Quote>
## Features
<FeatureList>
<FeatureCard title={"Fast erasure coding"}
index={0}
text={"Codex uses high-performance Reed-Solomon encoding to guarantee the durability of the datasets."}/>
<FeatureCard title={"SNARK-based proof of retrievability"}
index={1}
text={"To implement space-efficient data retrievability, Codex leverages state-of-the-art SNARK-based proofs."}/>
<FeatureCard title={"Low-overhead lazy repair"}
index={2}
text={"Data repairs in Codex are grouped through lazy repair to decrease network bandwidth overhead."}/>
<FeatureCard title={"Data Availability Sampling"}
index={3}
text={"Codex samples datasets frequently to guarantee data durability in a Byzantine environment."}/>
</FeatureList>
## Blog Posts
<BlogPosts/>
## Resources
<ExternalReferenceCard linkUrl={"/docs/codex-whitepaper.pdf"}
linkText={"White-paper"}
referenceType={"pdf"}
>
Read our white-paper to know more about Codex.
</ExternalReferenceCard>
<ExternalReferenceCard linkUrl={"https://github.com/status-im/nim-codex"}
linkText={"Nim Codex"}
referenceType={"github"}
>
Play with the first version of Codex.
</ExternalReferenceCard>
<ExternalReferenceCard linkUrl={"https://github.com/status-im/codex-research"}
linkText={"Codex Research"}
referenceType={"github"}
>
Checkout our research models and track our progress.
</ExternalReferenceCard>
## The Codex Team
<TeamList/>

42
docs/student-program.md Normal file
View File

@ -0,0 +1,42 @@
---
description: Codex is building a Decentralized Durability Storage Engine
---
# 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. Were 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.
Apply [HERE](https://jobs.status.im/?gh_jid=4603013).
## 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 wed still love to hear from you anyway if you think youd be a great fit for this role!

44
docusaurus.config.js Normal file
View File

@ -0,0 +1,44 @@
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion
require('dotenv').config()
/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'TITLE',
url: 'https://url',
baseUrl: '/',
customFields: {
ghostAPiKey: process.env.GHOST_API_KEY,
},
// Even if you don't use internalization, you can use this field to set useful
// metadata like html lang. For example, if your site is Chinese, you may want
// to replace "en" with "zh-Hans".
i18n: {
defaultLocale: 'en',
locales: ['en'],
},
presets: [
[
'@acid-info/logos-docusaurus-preset',
/** @type {import('@acid-info/logos-docusaurus-preset').PluginOptions} */
({
businessUnit: 'Codex',
theme: {
name: 'default',
options: {
customCss: [require.resolve('./src/css/custom.scss')],
},
},
}),
],
],
themeConfig:
/** @type {import('@acid-info/logos-docusaurus-preset').ThemeConfig} */
({}),
}
module.exports = config

55
package.json Normal file
View File

@ -0,0 +1,55 @@
{
"name": "logos-documentation-website-template",
"version": "0.0.0",
"private": true,
"scripts": {
"docusaurus": "docusaurus",
"start": "docusaurus start",
"build": "docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
"serve": "docusaurus serve",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"typecheck": "tsc",
"prepare": "husky install",
"prettier": "pretty-quick",
"prettier:staged": "pretty-quick --staged"
},
"dependencies": {
"@acid-info/logos-docusaurus-preset": "^0.1.6",
"@docusaurus/core": "2.1.0",
"@docusaurus/preset-classic": "2.1.0",
"@mdx-js/react": "^1.6.22",
"dotenv": "^16.0.3",
"prism-react-renderer": "^1.3.5",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "2.1.0",
"@tsconfig/docusaurus": "^1.0.5",
"docusaurus-plugin-sass": "^0.2.2",
"husky": "^8.0.1",
"prettier": "^2.7.1",
"pretty-quick": "^3.1.3",
"sass": "^1.55.0",
"typescript": "^4.7.4"
},
"browserslist": {
"production": [
">0.5%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"engines": {
"node": ">=16.14"
}
}

33
sidebars.js Normal file
View File

@ -0,0 +1,33 @@
/**
* Creating a sidebar enables you to:
- create an ordered group of docs
- render a sidebar for each doc of that group
- provide next/previous navigation
The sidebars can be generated from the filesystem, or explicitly defined here.
Create as many sidebars as you want.
*/
// @ts-check
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
const sidebars = {
// By default, Docusaurus generates a sidebar from the docs folder structure
tutorialSidebar: [{ type: 'autogenerated', dirName: '.' }],
// But you can create a sidebar manually
/*
tutorialSidebar: [
'intro',
'hello',
{
type: 'category',
label: 'Tutorial',
items: ['tutorial-basics/create-a-document'],
},
],
*/
}
module.exports = sidebars

View File

@ -0,0 +1 @@
export * from '@acid-info/logos-docusaurus-theme/lib/client/components/mdx'

2
src/css/custom.scss Normal file
View File

@ -0,0 +1,2 @@
:root {
}

Binary file not shown.

4
tsconfig.json Normal file
View File

@ -0,0 +1,4 @@
{
// This file is not used in compilation. It is here just for a nice editor experience.
"extends": "@tsconfig/docusaurus/tsconfig.json"
}

8108
yarn.lock Normal file

File diff suppressed because it is too large Load Diff