• Stars
    star
    367
  • Rank 116,257 (Top 3 %)
  • Language SCSS
  • License
    Other
  • Created almost 6 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The Filecoin protocol specification

Filecoin Specification

CI

This is the Filecoin Specification, a repository that contains documents, code, models, and diagrams that constitute the specification of the Filecoin Protocol. This repository is the singular source of truth for the Filecoin Protocol. All implementations of the Filecoin Protocol should match and comply with the descriptions, interfaces, code, and models defined in this specification.

https://spec.filecoin.io is the user-friendly website rendering, which we recommend for reading this repository. The website is updated automatically with every merge to master.

Table of Contents

Install

To build the spec website you need

On macOS you can get node from Homebrew

brew install node

Clone the repo, and use npm install to fetch the dependencies

git clone https://github.com/filecoin-project/specs.git
npm install

To run the development server with live-reload locally, run:

npm start

Then open http://localhost:1313 in the browser

Writing the spec

The spec is written in markdown. Each section is markdown document in the content directory. The first level of the directory structure denotes the top level sections of the spec; (Introduction, Systems, etc.) The _index.md file in each folder is used as the starting point for each section. For example the Introduction starts in content/intro/_index.md.

Sections can be split out into multiple markdown documents. The build process combines them into a single html page. The sections are ordered by the weight front-matter property. The introduction appears at the start of the html page because content/intro/_index.md has weight: 1, while content/systems/_index.html has weight: 2 so it appears as the second section.

You can split out sub-sections by adding additional pages to a section directory. The content/intro/concepts.md defines the Key Concepts sub-section of the the Introduction. The order of sub-sections within a section is again controlled by setting the weight property. This pattern repeats for sub sub folders which represent sub sub sections.

The markdown documents should all be well formed, with a single h1, and headings should increment by a single level.

Note: Regular markdown files like content/intro/concepts.md can't reference resources such as images, or other files. Such resources can be referenced only from _index.md files. Given that a folder will have an _index.md file already, there is the following work around to reference resources from any file: create a new sub-folder in the same folder where the initial .md file was, e.g., content/intro/concepts/_index.md, include the content from concepts.md in the _index.md file, add the resource files (for example, images) in the new folder and reference the resource file from the new _index.md file inside the concepts folder. The referencing syntax and everything else works the same way.

Check your markdown

Use npm test to run a markdown linter and prettier to check for common errors. It runs in CI and you can run it locally with:

npm test
content/algorithms/crypto/randomness.md
  15:39-15:46  warning  Found reference to undefined definition  no-undefined-references  remark-lint
  54:24-54:31  warning  Found reference to undefined definition  no-undefined-references  remark-lint

⚠ 2 warnings

Format errors can be fixed by running npm run format.

Checking formatting...
[warn] content/systems/filecoin_token/block_reward_minting.md
[warn] Code style issues found in the above file(s). Forgot to run Prettier?

Page Template

A spec document should start with a YAML front-matter section and contain at least a single h1, as below.

---
title: Important thing
weight: 1
dashboardState: wip
dashboardAudit: missing
---

# Important thing

Code

Wrap code blocks in code fences. Code fences should always have a lang. It is used to provide syntax highlighting. Use text as the language flag for pseudocode for no highlighting.

```text
Your algorithm here
```

You can embed source code from local files or external other repos using the embed shortcode.

{{<embed src="/path/to/local/file/types.go"  lang="go" symbol="Channel">}}

{{<embed src="https://github.com/filecoin-project/lotus/blob/master/build/bootstrap.go" lang="go">}}

Images

Use normal markdown syntax to include images.

For dot and mermaid diagrams you link to the source file and the pipelines will handle converting that to svg.

# relative to the markdown file

![Alt text](picture.jpg)

# relative to the content folder

![Alt text](/content/intro/diagram1.mmd)

![Alt text](graph.dot 'Graph title')

The alt text is used as the title if not provided.

Links

Use markdown syntax [text](markdown-document-name).

These links use "portable links" just like relref. Just give it the name of the file and it will fetch the correct relative path and title automatically. You can override the title by passing a second string in the link definition.

Note: When using anchors the title can't be fetched automatically.

[](storage_power_consensus)

# Renders to

<a href="/systems/filecoin_blockchain/storage_power_consensus" title="Storage Power Consensus">Storage Power Consensus</a>

[Storage Power](storage_power_consensus 'Title to override the page original title')

# Renders to

<a href="/systems/filecoin_blockchain/storage_power_consensus" title="Title to override the page original title">Storage Power</a>

[Tickets](storage_power_consensus#the-ticket-chain-and-drawing-randomness 'The Ticket chain and drawing randomness')

# Renders to

<a href="/systems/filecoin_blockchain/storage_power_consensus#the-ticket-chain-and-drawing-randomness" title="The Ticket chain and drawing randomness">Tickets</a>

Shortcodes

hugo shortcodes you can add to your markdown.

embed

# src relative to the page

{{<embed src="piece_store.go" lang="go">}}

# src relative to content folder

{{<embed src="/systems/piece_store.go" lang="go">}}

# can just embed a markdown file

{{<embed src="section.md" markdown="true">}}

# can embed symbols from Go files

# extracts comments and symbol body

{{<embed src="types.go"  lang="go" symbol="Channel">}}

# can embed from external sources like github

{{<embed src="https://github.com/filecoin-project/lotus/blob/master/build/bootstrap.go" lang="go">}}

This shortcode also supports the property title to add a permalink below the embed.

listing

The listing shortcode creates tables from externals sources, supports Go struct.

# src relative to the page

{{<listing src="piece_store.go" symbol="Channel">}}

# src relative to content folder

{{<listing src="/systems/piece_store.go" symbol="Channel">}}

# src can also be from the externals repos

{{<listing src="/externals/go-data-transfer/types.go"  symbol="Channel">}}

mermaid

Inline mermaid syntax rendering

{{< mermaid >}}
graph TD
  A[Christmas] -->|Get money| B(Go shopping)
  B --> C{Let me think}
  C -->|One| D[Laptop]
  C -->|Two| E[iPhone]
  C -->|Three| F[fa:fa-car Car]

{{</ mermaid >}}

hint

<!-- info|warning|danger -->

{{< hint info >}}
**Markdown content**  
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
{{< /hint >}}

katex

We should only use inline mode for now! Display mode has a bug and is not responsive the formulas don't break in small screen. Track: KaTeX/KaTeX#2271

<!-- Use $ math $ for inline mode-->

{{<katex>}}
$SectorInitialConsensusPledge = \\[0.2cm] 30\% \times FILCirculatingSupply \times \frac{SectorQAP}{max(NetworkBaseline, NetworkQAP)}$
{{</katex >}}

<!-- Use $$ math $$ for display mode-->

{{<katex>}}
$$SectorInitialConsensusPledge = \\[0.2cm] 30\% \times FILCirculatingSupply \times \frac{SectorQAP}{max(NetworkBaseline, NetworkQAP)}$$
{{</katex >}}

Math mode

For short snippets of math text (e.g., inline reference to parameters, or single formulas) it is easier to use the {{<katex>}}/{{/katex}} shortcode (as described just above). Check how KaTeX parses math typesetting here.

For extensive blocks of math content it is more convenient to use math-mode to avoid having to repeat the katex shortcode for every math formula.

Check this example example

Some syntax like \_ can't go through HUGO markdown parser and for that reason we need to wrap math text with code blocks, code fendes or the shortcode {{<plain>}}. See examples below.

Add math-mode prop to the Frontmatter

---
title: Math Mode
math-mode: true
---

Wrap def, gdef, etc.

Math text needs to be wrapped to avoid Hugo's Markdown parser. When wrapping defs or any math block that doesn't need to be rendered the recommended option is to use the shortcode {{<plain hidden}} with the hidden argument.

{{<plain hidden>}}

$$
\gdef\createporepbatch{\textsf{create_porep_batch}}
\gdef\GrothProof{\textsf{Groth16Proof}}
\gdef\Groth{\textsf{Groth16}}
\gdef\GrothEvaluationKey{\textsf{Groth16EvaluationKey}}
\gdef\GrothVerificationKey{\textsf{Groth16VerificationKey}}
{{</plain>}}
$$

Wrap inline math text with code blocks

The index of a node in a `$\BinTree$` layer `$l$`. The leftmost node in a tree has `$\index_l = 0$`.

Wrap math blocks with code fences

```text
$\overline{\underline{\Function \BinTree\dot\createproof(c: \NodeIndex) \rightarrow \BinTreeProof_c}}$
$\line{1}{\bi}{\leaf: \Safe = \BinTree\dot\leaves[c]}$
$\line{2}{\bi}{\root: \Safe = \BinTree\dot\root}$

$\line{3}{\bi}{\path: \BinPathElement^{[\BinTreeDepth]}= [\ ]}$
$\line{4}{\bi}{\for l \in [\BinTreeDepth]:}$
$\line{5}{\bi}{\quad \index_l: [\len(\BinTree\dot\layer_l)] = c \gg l}$
$\line{6}{\bi}{\quad \missing: \Bit = \index_l \AND 1}$
$\line{7}{\bi}{\quad \sibling: \Safe = \if \missing = 0:}$
$\quad\quad\quad \BinTree\dot\layer_l[\index_l + 1]$
$\quad\quad\thin \else:$
$\quad\quad\quad \BinTree\dot\layer_l[\index_l - 1]$
$\line{8}{\bi}{\quad \path\dot\push(\BinPathElement \thin \{\ \sibling, \thin \missing\ \} \thin )}$

$\line{9}{\bi}{\return \BinTreeProof_c \thin \{\ \leaf, \thin \root, \thin \path\ \}}$
```

Front-matter

Description for all the available frontmatter properties

# Page Title to be used in the navigation
title: Libraries
# Small description for html metadata, if not present the first couple of paragraphs will be used instead
description: Libraries used from Filecoin
# This will be used to order the ToC, navigation and any other listings of pages
weight: 3
# This will make a page section collapse in the navigation
bookCollapseSection: true
# This will hidden the page from the navigation
bookhidden: true
# This is used in the dashboard to describe the importance of the page content
dashboardWeight: 2
# This is used in the dashboard to describe the state of the page content options are "missing", "incorrect", "wip", "reliable", "stable" or "n/a"
dashboardState: stable
# This is used in the dashboard to describe if the theory of the page has been audited, options are "missing", "wip", "done" or "n/a"
dashboardAudit: wip
# When dashboardAudit is stable we should have a report url
dashboardAuditURL: https://url.to.the.report
# The date that the report at dashboardAuditURL was completed
dashboardAuditDate: '2020-08-01'
# This is used in the dashboard to describe if the page content has compliance tests, options are 0 or numbers of tests
dashboardTests: 0

References

More Repositories

1

lotus

Reference implementation of the Filecoin protocol, written in Go
Go
2,839
star
2

venus

Filecoin Full Node Implementation in Go
Go
2,057
star
3

slate

WIP - We're building the place you go to discover, share, and sell files on the web.
JavaScript
526
star
4

rust-fil-proofs

Proofs for Filecoin in Rust
Rust
490
star
5

community

Filecoin community and ecosystem channels, discussion forums, and more
478
star
6

community-china

Resources and forum for the Chinese community, maintained and moderated by CoinSummer & PL.
C
437
star
7

ref-fvm

Reference implementation of the Filecoin Virtual Machine
Rust
378
star
8

devgrants

πŸ‘Ÿ Apply for a Filecoin devgrant. Help build the Filecoin ecosystem!
375
star
9

FIPs

The Filecoin Improvement Proposal repository
Jupyter Notebook
288
star
10

filecoin-docs

Filecoin Docs
Shell
220
star
11

fevm-hardhat-kit

A starter hardhat project for developing, deploying, and testing Solidity smart contracts on the FEVM (Ethereum Virtual Machine on Filecoin)
Solidity
186
star
12

fvm-specs

home of the FVM (Filecoin Virtual Machine) project βš™οΈ
168
star
13

cpp-filecoin

C++17 implementation of Filecoin
C++
126
star
14

neptune

Rust Poseidon implementation.
Rust
125
star
15

notary-governance

114
star
16

filecoin-plus-large-datasets

Hub for client applications for DataCap at a large scale
110
star
17

boost

Boost is a tool for Filecoin storage providers to manage data storage and retrievals on Filecoin.
Go
110
star
18

lassie

A minimal universal retrieval client library for IPFS and Filecoin
Go
109
star
19

filecoin-ffi

C and CGO bindings for Filecoin's Rust libraries
Rust
94
star
20

specs-actors

DEPRECATED Specification of builtin actors, in the form of executable code.
Go
86
star
21

filecoin-plus-client-onboarding

79
star
22

builtin-actors

The Filecoin built-in actors
Rust
78
star
23

go-fil-markets

Shared Implementation of Storage and Retrieval Markets for Filecoin Node Implementations
Go
78
star
24

research

Home for Filecoin Research
74
star
25

go-jsonrpc

Low Boilerplate JSON-RPC 2.0 library
Go
74
star
26

bls-signatures

BLS Signatures in Rust
Rust
74
star
27

ec-gpu

OpenCL code generator for finite-field arithmetic over arbitrary prime fields
Rust
69
star
28

rust-gpu-tools

Rust tools for OpenCL and GPU management.
Rust
66
star
29

replication-game

Compete on the fastest replication algorithm
Rust
59
star
30

slingshot

Official repository for Filecoin's Space Race 2: Slingshot
58
star
31

filecoin

GitHub home for the Filecoin Project
52
star
32

starling

Demo storage client for archival video data
JavaScript
51
star
33

lily

capturing on-chain state for the filecoin network
Go
49
star
34

venus-docs

Content for Venus tutorial
Shell
49
star
35

rust-filecoin-proofs-api

Rust
43
star
36

consensus

Filecoin consensus work
Python
42
star
37

blstrs

Rust
40
star
38

mir

Go
40
star
39

go-data-transfer

Data Transfer Shared Component for go-filecoin & go-lotus
Go
39
star
40

dagstore

a sharded store to hold large IPLD graphs efficiently, packaged as location-transparent attachable CAR files, with mechanical sympathy
Go
39
star
41

storetheindex

A storethehash based directory of CIDs
Go
36
star
42

fvm-starter-kit-deal-making

Full dapp starter kit for automating Filecoin deal making
JavaScript
36
star
43

go-statemachine

Go
34
star
44

dealbot

πŸ€–πŸ€ A bot for making deals
Go
32
star
45

benchmarks

A place for community-submitted Filecoin benchmarks
JavaScript
32
star
46

core-devs

Technical Project Management: Meeting notes and agenda items
32
star
47

lotus-docs

Documentation for Lotus
HTML
29
star
48

fevm-data-dao-kit

A kit to demonstrate the basics of getting a DataDAO up and running on the Filecoin Virtual Machine (FVM).
JavaScript
29
star
49

go-hamt-ipld

An implementation of a HAMT using ipld
Go
28
star
50

sentinel

Filecoin Network monitoring and analysis tools.
27
star
51

filecoin-explorer

Filecoin block explorer
JavaScript
26
star
52

motion

🏍️ Accelerating Data onto FileCoin
Go
25
star
53

rust-fil-nse-gpu

Rust interface to GPU implementation of Filecoin's Narrow Stacked Expander (NSE) sealing algorithm
Rust
24
star
54

testnet-hyperspace

Meta info about the developer-focused Hyperspace testnet for Filecoin developers
24
star
55

sector-storage

A concrete implementation of the specs-storage interface
Go
24
star
56

fevm-foundry-kit

A starter foundry project for developing, deploying, and testing Solidity smart contracts on the FEVM (Ethereum Virtual Machine on Filecoin)
Solidity
23
star
57

testnet-wallaby

Meta info about the Wallaby testnet for FVM developers
20
star
58

go-legs

Does the legwork for go-data-transfer
Go
20
star
59

filecoin-client-tutorial

Store data on the Filecoin Network in under 5 minutes.
JavaScript
20
star
60

go-leb128

LEB128 integer encoding
Go
20
star
61

awesome-filecoin

Curated list of useful resources for Filecoin
19
star
62

venus-wallet

a remote wallet for provider sign service
Go
19
star
63

eudico

lotus, but also other things
Go
19
star
64

go-state-types

Primitive and low level types used in chain state and actor method parameters
Go
19
star
65

designdocs

Docs that capture the design intent for important components
18
star
66

neptune-triton

Futhark implementation of neptune-compatible Poseidon.
C
18
star
67

orient

↻Observe-Orient-Decide-Act↩
Common Lisp
18
star
68

test-vectors

πŸ’Ž VM and Chain test vectors for Filecoin implementations
Go
18
star
69

filecoin-solidity

Filecoin Solidity API Library
Solidity
17
star
70

filsnap

MetaMask snap for interacting with Filecoin dapps.
TypeScript
17
star
71

go-address

Go
17
star
72

venus-sealer

Go
17
star
73

data-prep-tools

Python
17
star
74

fvm-evm

EVM runtime for the Filecoin Virtual Machine
Rust
15
star
75

actors-utils

Collection of libraries to implement common patterns and standards on the Filecoin Virtual Machine
Rust
15
star
76

filecoin-network-viz

Filecoin Network Visualization Frontend
JavaScript
14
star
77

rust-fil-sector-builder

Rust
13
star
78

filecoin-fvm-localnet

A complete filecoin lotus and boost docker image to spin up a localnet for smart contract development
Shell
13
star
79

fvm-docs

Documentation and website build scripts for the Filecoin Virtual Machine (FVM) project.
HTML
12
star
80

chain-validation

(DEPRECATED) See https://github.com/filecoin-project/test-vectors instead. (was: chain validation tools)
Go
11
star
81

fvm-runtime-experiment

Rust
11
star
82

fungi

A distributed task runner
Go
11
star
83

go-dagaggregator-unixfs

Go
10
star
84

go-fil-commp-hashhash

A hash.Hash implementation of fil-commitment-unsealed
Go
10
star
85

lua-filecoin

Prototype of Filecoin in Lua
Lua
10
star
86

statediff

State Inspector πŸ•΅οΈβ€
Go
10
star
87

go-amt-ipld

Implementation of an array mapped trie using go and ipld
Go
9
star
88

fil-blst

Assembly
9
star
89

go-sectorbuilder

Go
8
star
90

sp-automation

Jinja
8
star
91

go-f3

Golang implementation of Fast Finality in Filecoin (F3)
Go
8
star
92

oni

πŸ‘Ή (DEPRECATED; see README) Project Oni | Network Validation
Go
7
star
93

helm-charts

Smarty
7
star
94

boost-docs

Documentation for Boost
7
star
95

slate-react-system

A component, constants, and experience library for the Filecoin Network / Textile Services
7
star
96

go-storage-miner

A Filecoin storage miner
Go
7
star
97

system-test-matrix

The Filecoin System Test Matrix is a dashboard with a detailed list of Filecoin features and behaviors and a mapping between those features and test suites, systems and subsystems that those features are related to.
TypeScript
7
star
98

go-data-segment

Go
6
star
99

raas-starter-kit

JavaScript
6
star
100

fvm-example-actors

A collection of actors, created and maintained by the FVM community.
Solidity
6
star