GithubHelp home page GithubHelp logo

aakoshh / forest Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chainsafe/forest

0.0 0.0 0.0 14.83 MB

🌲 Rust Filecoin Node Implementation

License: Apache License 2.0

Shell 0.72% Rust 98.94% Makefile 0.24% Dockerfile 0.10%

forest's Introduction

GitHub Workflow Status Codecov GitHub release (latest by date) License Apache 2.0 License MIT Twitter Discord

Forest is an implementation of Filecoin written in Rust. The implementation will take a modular approach to building a full Filecoin node in Rust from the Filecoin Protocol Specification, specifically the virtual machine, blockchain, and node system.

Our crates:

component description/crates
forest the command-line interface and daemon (1 crate/workspace)
node the networking stack and storage (7 crates)
blockchain the chain structure and synchronization (8 crates)
vm state transition and actors, messages, addresses (9 crates)
key_management Filecoin account management (1 crate)
crypto cryptographic functions, signatures, and verification (1 crate)
encoding serialization library for encoding and decoding (1 crate)
ipld the IPLD model for content-addressable data (9 crates)
types the forest types (2 crates)
utils the forest toolbox (12 crates)

Run with Docker

No need to install Rust toolchain or other dependencies, you will need only Docker.

❯ docker run --init -it ghcr.io/chainsafe/forest:latest --help

Follow other instructions for proper forest usage. You may need to mount a volume to import a snapshot, e.g.

❯ docker run --init -it -v $HOME/Downloads:/downloads ghcr.io/chainsafe/forest:latest --import-snapshot /downloads/minimal_finality_stateroots_latest.car

Use dockerized Forest with host database:

❯ docker run --init -it -v $HOME/.forest:/root/.forest  --rm ghcr.io/chainsafe/forest:latest --target-peer-count 50 --encrypt-keystore false

Dependencies

  • Rust rustc >= 1.58.1
  • Rust WASM target wasm32-unknown-unknown
rustup install nightly
rustup target add wasm32-unknown-unknown
  • OS Base-Devel/Build-Essential
  • Clang compiler
  • OpenCL bindings
# Ubuntu
sudo apt install build-essential clang ocl-icd-opencl-dev libssl-dev

# Archlinux
sudo pacman -S base-devel clang ocl-icd openssl

# Fedora (36)
sudo dnf install -y clang-devel ocl-icd-devel cmake

Installation

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

# Install binary to $HOME/.cargo/bin and run node
make install
forest

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

git checkout $TAG
cargo build --release --bin forest --features release

Config

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"

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

Testing

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

# To pull serialization vectors submodule and run serialization tests
make test-vectors

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

Joining the testnet

Select the builtin calibnet configuration with the --chain option:

# Run and import past the state migrations to latest network version
./target/release/forest --chain calibnet --import-snapshot snapshot.car

Importing the snapshot only needs to happen during the first run. Following this, to restart the daemon run:

./target/release/forest --chain calibnet

Interacting with Forest via CLI

When the Forest daemon is started, an admin token will be displayed. 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 equivalant on Windows. This will look like the following:

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

Documentation

Work in progress.

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.

forest's People

Contributors

aakoshh avatar ansermino avatar austinabell avatar clearloop avatar connormullett avatar creativcoder avatar cryptoquick avatar detailyang avatar dignifiedquire avatar dutterbutter avatar ec2 avatar elmattic avatar flodesi avatar gregthegreek avatar huitseeker avatar jdjaustin avatar kirk-baird avatar laudiacay avatar lemmih avatar lesnyrumcajs avatar leviathanbeak avatar noot avatar q9f avatar rajarupansampanthan avatar snaumov avatar staticallytypedanxiety avatar timvermeulen avatar tyshko5 avatar vmx avatar willeslau avatar

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.