• Stars
    star
    553
  • Rank 77,359 (Top 2 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created over 4 years ago
  • Updated 10 months ago

Reviews

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

Repository Details

๐ŸŒฒ Rust Filecoin Node Implementation

GitHub Workflow Status Latest release Docs Rust Docs

License Apache 2.0 License MIT Discord Twitter

Forest is a Filecoin node written in Rust. With Forest, you can:

  • Send and receive FIL (at your own risk - Forest is experimental),
  • validate the Filecoin blockchain,
  • generate blockchain snapshots.

While less feature-complete than the canonical Filecoin node, Lotus, Forest aims to be the faster and easier-to-use alternative.

Questions

Have questions? Feel free to post them in Forest Q&A!

Run with Docker

No need to install Rust toolchain or other dependencies, you will need only Docker - works on Linux, macOS and Windows.

# daemon
โฏ docker run --init -it --rm ghcr.io/chainsafe/forest:latest --help
# cli
โฏ docker run --init -it --rm --entrypoint forest-cli ghcr.io/chainsafe/forest:latest --help

Next, run a Forest node in a CLI window. E.g. Run calibration network

Thereafter, in another terminal, you will be able to use the forest-cli binary directly by launching bash in the forest container:

docker exec -it forest /bin/bash

For more in-depth usage and sample use cases, please refer to the Forest Docker documentation in the Forest Book. Keep in mind that the latest tag is the latest stable release. If you want to use the current development build, use the edge tag.

Dependencies

  • Rust (toolchain version is specified in rust-toolchain.toml)

Install rustup

  • OS Base-Devel/Build-Essential
  • Clang compiler

Ubuntu (20.04)

sudo apt install build-essential clang

Archlinux

sudo pacman -S base-devel clang

Fedora (36)

sudo dnf install -y clang-devel

Alpine

apk add git curl make gcc clang clang-dev musl-dev

Installation

# Clone repository
git clone --recursive https://github.com/chainsafe/forest
cd forest

# Install binary to $HOME/.cargo/bin
make install

# Run the node on mainnet
forest

To create release binaries, checkout the latest tag and compile with the release feature. GitHub release (latest by date)

git checkout $TAG
make build # make debug build of forest daemon and cli
# or
make release # make release build of forest daemon and cli
# or
make install # install forest daemon and cli

Config

Keystore

To encrypt the keystore while in headless mode, set the FOREST_KEYSTORE_PHRASE environmental variable. Otherwise, skip the encryption (not recommended in production environments) with --encrypt-keystore false.

Network

Run the node with custom config and bootnodes

forest --config /path/to/your_config.toml

Example of config options available:

data_dir = "<directory for all chain and networking data>"
genesis_file = "<relative file path of genesis car file>"

[network]
listening_multiaddr = "<multiaddress>"
bootstrap_peers = ["<multiaddress>"]

Example of a multiaddress: "/ip4/54.186.82.90/tcp/1347/p2p/12D3K1oWKNF7vNFEhnvB45E9mw2B5z6t419W3ziZPLdUDVnLLKGs"

Configuration sources

Forest will look for config files in the following order and priority:

  • Paths passed to the command line via the --config flag.
  • The environment variable FOREST_CONFIG_PATH, if no config was passed through command line arguments.
  • If none of the above are found, Forest will look in the systems default configuration directory ($XDG_CONFIG_HOME on Linux systems).
  • After all locations are exhausted and a config file is not found, a default configuration is assumed and used.

Logging

The Forest logger uses Rust's log filtering options with the RUST_LOG environment variable. For example:

RUST_LOG="debug,forest_libp2p::service=info" forest

Will show all debug logs by default, but the forest_libp2p::service logs will be limited to info

Forest can also send telemetry to the endpoint of a Loki instance or a Loki agent (see Grafana Cloud). Use --loki to enable it and --loki-endpoint to specify the interface and the port.

Testing

First, install the nextest test runner.

cargo install cargo-nextest --locked
# To run base tests
cargo nextest run # use `make test-release` for longer compilation but faster execution

# To run all tests and all features enabled
make test-all

Chain synchronization checks are run after every merge to main. This code is maintained in a separate repository - Forest IaC.

Linters

The project uses exhaustively a set of linters to keep the codebase clean and secure in an automated fashion. While the CI will have them installed, if you want to run them yourself before submitting a PR (recommended), you should install a few of them.

# You can install those linters also with other package managers or by manually grabbing the binaries from the projects' repositories.

# Rust code linter
rustup component add clippy

# Rust code formatter
rustup component add rustfmt

# TOML linter
cargo install taplo-cli --locked

# Scanning dependencies for security vulnerabilities
cargo install cargo-audit

# Spellcheck
cargo install cargo-spellcheck

After everything is installed, you can run make lint-all.

Joining the testnet

Select the builtin calibnet configuration with the --chain option. The --auto-download-snapshot will ensure that a snapshot is downloaded if needed without any prompts.

./target/release/forest --chain calibnet --auto-download-snapshot

Interacting with Forest via CLI

When the Forest daemon is started, an admin token will be displayed (alternatively, use --save-token <token> flag to save it on disk). You will need this for commands that require a higher level of authorization (like a password). Forest, as mentioned above, uses multiaddresses for networking. This is no different in the CLI. To set the host and the port to use, if not using the default port or using a remote host, set the FULLNODE_API_INFO environment variable. This is also where you can set a token for authentication.

FULLNODE_API_INFO="<token goes here>:/ip4/<host>/tcp/<port>/http

Note that if a token is not present in the FULLNODE_API_INFO env variable, the colon is removed.

Forest developers will prepend this variable to CLI commands over using export on Linux or its equivalent on Windows. This will look like the following:

FULLNODE_API_INFO="..." forest-cli auth api-info -p admin

The admin token can also be set using --token flag.

forest-cli --token <ADMIN_TOKEN>

Forest executable organization

The binaries in the Forest repository are organized into the following categories:

Binary Role Command example
forest Forest daemon, used to connect to the Filecoin network forest --chain calibnet --encrypt-keystore false
forest-cli Human-friendly wrappers around the Filecoin JSON-RPC API forest-cli info show
forest-tool Handle tasks not involving the Forest daemon forest-tool snapshot fetch

Detaching Forest process

You can detach Forest process via the --detach flag so that it runs in the background:

./target/release/forest --detach

The command will block until the detached Forest process has started its RPC server, allowing you to chain some RPC command immediately after.

Forest snapshot links

Documentation

Contributing

ChainSafe Security Policy

Reporting a Security Bug

We take all security issues seriously, if you believe you have found a security issue within a ChainSafe project please notify us immediately. If an issue is confirmed, we will take all necessary precautions to ensure a statement and patch release is made in a timely manner.

Please email a description of the flaw and any related information (e.g. reproduction steps, version) to security at chainsafe dot io.

License

Forest is dual licensed under MIT + Apache 2.0.

More Repositories

1

lodestar

๐ŸŒŸ TypeScript Implementation of Ethereum Consensus
TypeScript
1,012
star
2

web3.unity

๐Ÿ•น Unity SDK for building games that interact with blockchains.
C#
817
star
3

dappeteer

[DEPRECATED]๐ŸŒ๐Ÿผโ€E2E testing for dApps using Puppeteer + MetaMask
TypeScript
486
star
4

ChainBridge

๐ŸŒ‰ Modular Multi-Directional Blockchain Bridge to interact with Multiple Networks; Ethereum, Ethereum Classic, Substrate, based chains. Stay tuned for ChainBridge Hub!
Go
463
star
5

gossamer

๐Ÿ•ธ๏ธ Go Implementation of the Polkadot Host
Go
392
star
6

mina-rs

Rust implementation of the Mina protocol, targeting Wasm and ARM architectures.
Rust
159
star
7

js-libp2p-gossipsub

TypeScript implementation of Gossipsub
TypeScript
127
star
8

chainbridge-solidity

โš™๏ธ Solidity contracts for Sygma (ChainBridge)
JavaScript
119
star
9

filsnap

MetaMask snap for interacting with Filecoin dapps.
HTML
107
star
10

bls

๐Ÿ’ป Javascript Implementation of Boneh-Lynn-Shacham Signatures
TypeScript
92
star
11

chainbridge-core

๐ŸŒ Sygma core library (ChainBridge)
Go
91
star
12

go-schnorrkel

๐Ÿต Schnorr Signatures over Ristretto255 in pure Go
Go
80
star
13

metamask-snap-polkadot

Metamask plugin for interacting with Polkadot dapps and other Substrate based chains.
TypeScript
77
star
14

chainbridge-substrate

Rust
55
star
15

Spectre

ZK coprocessor for verifying Beacon chain headers via Altair lightclient protocol
Rust
55
star
16

nodewatch-api

A devp2p crawler targeted at Eth2 nodes
Go
52
star
17

ui-monorepo

ChainSafe Files & Storage UI Monorepo
TypeScript
52
star
18

WeiPay

WeiPay is an open source cryptocurrency wallet available for both iOS and Android mobile devices. WeiPay will support Ethereum out of the box with added support for ERC-20 & ERC-223 tokens.
JavaScript
46
star
19

ChainGuardian

Eth2.0 desktop validator client
TypeScript
44
star
20

ssz

Typescript implementation of Simple Serialize (SSZ)
TypeScript
40
star
21

js-libp2p-noise

Noise libp2p handshake for js-libp2p
TypeScript
37
star
22

chainbridge-deploy

Deploy tooling for ChainBridge
JavaScript
35
star
23

Zipline-lightclient

Hackathon for EthBogota - An Eth2 light client using Cannon verifyable computation
C
30
star
24

discv5

A Typescript implementation of the Discv5 protocol
TypeScript
28
star
25

nodewatch-ui

TypeScript
27
star
26

chainbridge-ui

TypeScript
26
star
27

Multix

Use a Multisig to do anything, on Polkadot
TypeScript
24
star
28

denode

a mechanism for incentivizing full nodes
24
star
29

filecoindot

Filecoin to substrate bridge
Rust
24
star
30

chainbridge-substrate-chain

Simple Substrate chain for testing purposes
Rust
22
star
31

PINT

A Polkadot ecosystem index for investors. A self sustaining auction treasury for parachains.
Rust
21
star
32

eth-local

The purpose of eth-local is to offer a standardized way to store your keystore files on your local machine. While also allowing you to use them in browser.
JavaScript
21
star
33

chaindb

go key-value store using badgerDB
Go
20
star
34

web3js-example-react-app

TypeScript
20
star
35

as-sha256

AssemblyScript implementation of SHA256
WebAssembly
19
star
36

rust-libp2p-nym

implementation of a libp2p transport using the Nym mixnet
Rust
19
star
37

bls-keygen

Key management for BLS curves written in TypeScript and browser compatible
TypeScript
17
star
38

chainlink-cosmos

Chainlink on Cosmos: Cosmos SDK module for Chainlink data feeds
Go
17
star
39

bls-keystore

Implementation of bls keystore - EIP 2335
TypeScript
16
star
40

blst-ts

Typescript wrapper for https://github.com/supranational/blst native bindings, a highly performant BLS12-381 signature library
C++
16
star
41

bls-js

BLS signature implementation
TypeScript
15
star
42

das-prototype

Research prototypes of Data Availability Sampling for Ethereum (WIP)
Rust
14
star
43

truffle-plugin-abigen

Truffle plugin to post-process contracts for go-ethereum's abigen
Solidity
14
star
44

Anemone

A testing tool that broadcasts batches of transactions and tests opcodes
TypeScript
12
star
45

web3-context

A React context implementation of Onboard.js & general utilities
TypeScript
12
star
46

chainbridge-core-example

Go
11
star
47

ethermint-deploy

JavaScript
11
star
48

audits

This is public repository that holds ChainSafe audit reports
11
star
49

persistent-merkle-tree

TypeScript
11
star
50

ssz-js

Simple Serialize in TypeScript
TypeScript
9
star
51

chainbridge-utils

Go
9
star
52

dapp-boilerplate

A shared boilerplate for Dapp development
TypeScript
9
star
53

forest-iac

Infrastructure as Code to support the Forest Filecoin project
HCL
9
star
54

go-signature-adaptor

A pure Go implementation of ECDSA signature adaptors
Go
9
star
55

dotcon-0.5

Decentralized Networking with Libp2p
Go
8
star
56

lodestar-quickstart

Scripts to quick start Lodestar and execution clients pre and post-merge Ethereum.
Shell
8
star
57

api3-rust

Rewrite API3 Solidity contracts in Rust (for Solana, Near, Oasis)
Rust
8
star
58

W-OTS

Winternitz OTS+ implementation
Rust
7
star
59

hobbits-ts

A TypeScript implementation of the Hobbits Ethereum Wire Protocol
TypeScript
7
star
60

simpleserialize.com

TypeScript
7
star
61

hardhat-plugin-multichain-deploy

Solidity
7
star
62

go-cumulus

Go implementation of cumulus. for creating parachains with gossamer
Makefile
6
star
63

ChainSafe-Demo-WebGLProject-Files

Project Files For The ChainSafe Demo
C#
6
star
64

lazy-minting-server

Sample implementation of a lazy minting server
TypeScript
6
star
65

game-web3wallet

JavaScript
6
star
66

bls-hd-key

BLS key derivation and hd key utilities
TypeScript
6
star
67

ethersjs-genaddress

a simple script to generate an eth address utilizing ethers.js
JavaScript
6
star
68

eth-drive

eth-drive is the first disk utility tool designed for ethereum addresses
HTML
6
star
69

mina-snap

Metamask snap for interacting with mina procotol
HTML
6
star
70

eth2-light-client-demo

TypeScript
5
star
71

fil-secondary-retrieval-markets

Client and Provider implementations to enable secondary retrieval markets on Filecoin
Go
5
star
72

engineering-handbook

ChainSafe Engineering Handbook
JavaScript
5
star
73

serde-bin-prot

A Rust crate that adds serde support for the bin_prot serialization format
Rust
5
star
74

game-web3gl

JavaScript
5
star
75

ens-aztec-privacy

[BETA] Sending private transactions to ENS domains using Aztec and custom ENS Resolver contract.
Solidity
5
star
76

files-cli

A cli tool to download and decrypt any file uploaded using ChainSafe Files
TypeScript
5
star
77

chainbridge-docs

HTML
5
star
78

js-libp2p-yamux

Typescript implementation of Yamux
TypeScript
5
star
79

TypeScript-Cli-Generator

A TypeScript CLI Template
TypeScript
5
star
80

enr-app

TypeScript
4
star
81

beacon-state-upload

TypeScript
4
star
82

AGP-Report

Report for the Aragon Chain
4
star
83

rust-bls-derivation

Rust
4
star
84

sha256-rust-wasm

A wrapper around rust implementation of sha256
Rust
4
star
85

EthIndia2019

JavaScript
4
star
86

marketplace-landing

This is the marketplace landing page, currently a waitlist.
TypeScript
4
star
87

Zipline-Casper

A prototype implementation of the Zipline block root oracle using Casper finality
Solidity
4
star
88

aleo-snap

JavaScript
4
star
89

subgraph-arweave-example

Example subgraph for Arweave
TypeScript
4
star
90

near-snap

TypeScript
4
star
91

persistent-ts

TypeScript
3
star
92

ECOHacks

JavaScript
3
star
93

web3.js-plugin-chainlink

TypeScript
3
star
94

discv5-cli

Discv5 CLI
TypeScript
3
star
95

chainbridge-celo

Go
3
star
96

chainbridge-celo-solidity

JavaScript
3
star
97

metamask-eth2

Metamask snap plugin for eth2
HTML
3
star
98

chainbridge-substrate-events

Event definitions for GSRPC from the ChainBridge substrate pallet
Go
3
star
99

sha256-benchmarks

Benchmarks suite for various sha256 implementations
JavaScript
3
star
100

EthereumRPCSharp

Another .Net implementation of the Ethereum RPC
C#
3
star